added namespace GUI

svn-id: r11255
This commit is contained in:
Max Horn 2003-11-10 23:40:48 +00:00
parent 5c2a3da7f2
commit 22c22d1e81
37 changed files with 166 additions and 44 deletions

View File

@ -183,7 +183,7 @@ static void launcherDialog(GameDetector &detector, OSystem *system) {
system->set_palette(dummy_palette, 0, 16);
LauncherDialog dlg(detector);
GUI::LauncherDialog dlg(detector);
dlg.runModal();
}

View File

@ -41,7 +41,7 @@ Debugger<T>::Debugger() {
_isAttached = false;
_errStr = NULL;
_firstTime = true;
_debuggerDialog = new ConsoleDialog(1.0, 0.67F);
_debuggerDialog = new GUI::ConsoleDialog(1.0, 0.67F);
_debuggerDialog->setInputCallback(debuggerInputCallback, this);
_debuggerDialog->setCompletionCallback(debuggerCompletionCallback, this);
}
@ -339,7 +339,7 @@ void Debugger<T>::DCmd_Register(const char *cmdname, DebugProc pointer) {
// Console handler
#if USE_CONSOLE
template <class T>
bool Debugger<T>::debuggerInputCallback(ConsoleDialog *console, const char *input, void *refCon) {
bool Debugger<T>::debuggerInputCallback(GUI::ConsoleDialog *console, const char *input, void *refCon) {
Debugger *debugger = (Debugger *)refCon;
return debugger->RunCommand(input);
@ -347,7 +347,7 @@ bool Debugger<T>::debuggerInputCallback(ConsoleDialog *console, const char *inpu
template <class T>
bool Debugger<T>::debuggerCompletionCallback(ConsoleDialog *console, const char *input, char*& completion, void *refCon) {
bool Debugger<T>::debuggerCompletionCallback(GUI::ConsoleDialog *console, const char *input, char*& completion, void *refCon) {
Debugger *debugger = (Debugger *)refCon;
return debugger->TabComplete(input, completion);

View File

@ -21,7 +21,9 @@
#ifndef COMMON_DEBUGGER_H
#define COMMON_DEBUGGER_H
class ConsoleDialog;
namespace GUI {
class ConsoleDialog;
};
namespace Common {
@ -71,7 +73,7 @@ private:
bool _isAttached;
char *_errStr;
bool _firstTime;
ConsoleDialog *_debuggerDialog;
GUI::ConsoleDialog *_debuggerDialog;
protected:
void detach();
@ -87,8 +89,8 @@ protected:
void DCmd_Register(const char *cmdname, DebugProc pointer);
#if USE_CONSOLE
static bool debuggerInputCallback(ConsoleDialog *console, const char *input, void *refCon);
static bool debuggerCompletionCallback(ConsoleDialog *console, const char *input, char*& completion, void *refCon);
static bool debuggerInputCallback(GUI::ConsoleDialog *console, const char *input, void *refCon);
static bool debuggerCompletionCallback(GUI::ConsoleDialog *console, const char *input, char*& completion, void *refCon);
#endif
};

View File

@ -19,9 +19,12 @@
*/
#include "stdafx.h"
#include "EditTextWidget.h"
#include "dialog.h"
#include "newgui.h"
#include "gui/EditTextWidget.h"
#include "gui/dialog.h"
#include "gui/newgui.h"
namespace GUI {
EditTextWidget::EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text)
: StaticTextWidget(boss, x, y - 1, w, h + 2, text, kTextAlignLeft), _backupString(text) {
@ -214,3 +217,5 @@ bool EditTextWidget::adjustOffset() {
return false;
}
} // End of namespace GUI

View File

@ -21,10 +21,12 @@
#ifndef EDITTEXTWIDGET_H
#define EDITTEXTWIDGET_H
#include "widget.h"
#include "gui/widget.h"
#include "common/str.h"
#include "common/list.h"
namespace GUI {
/* EditTextWidget */
class EditTextWidget : public StaticTextWidget {
typedef Common::StringList StringList;
@ -53,4 +55,6 @@ protected:
bool adjustOffset();
};
} // End of namespace GUI
#endif

View File

@ -19,12 +19,14 @@
*/
#include "stdafx.h"
#include "ListWidget.h"
#include "ScrollBarWidget.h"
#include "dialog.h"
#include "newgui.h"
#include "gui/ListWidget.h"
#include "gui/ScrollBarWidget.h"
#include "gui/dialog.h"
#include "gui/newgui.h"
namespace GUI {
ListWidget::ListWidget(GuiObject *boss, int x, int y, int w, int h)
: Widget(boss, x, y, w - kScrollBarWidth, h), CommandSender(boss) {
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE;
@ -349,3 +351,5 @@ void ListWidget::abortEditMode() {
draw();
}
}
} // End of namespace GUI

View File

@ -21,10 +21,12 @@
#ifndef LISTWIDGET_H
#define LISTWIDGET_H
#include "widget.h"
#include "gui/widget.h"
#include "common/str.h"
#include "common/list.h"
namespace GUI {
class ScrollBarWidget;
enum NumberingMode {
@ -92,4 +94,6 @@ protected:
void scrollToCurrent();
};
} // End of namespace GUI
#endif

View File

@ -19,11 +19,13 @@
*/
#include "stdafx.h"
#include "PopUpWidget.h"
#include "dialog.h"
#include "newgui.h"
#include "gui/PopUpWidget.h"
#include "gui/dialog.h"
#include "gui/newgui.h"
#include "base/engine.h"
namespace GUI {
#define UP_DOWN_BOX_HEIGHT 10
// Little up/down arrow
@ -337,3 +339,5 @@ void PopUpWidget::drawWidget(bool hilite) {
gui->drawString(_entries[_selectedItem].name, x+2, _y+3, w-6, !isEnabled() ? gui->_color : gui->_textcolor, align);
}
}
} // End of namespace GUI

View File

@ -21,10 +21,12 @@
#ifndef POPUPWIDGET_H
#define POPUPWIDGET_H
#include "widget.h"
#include "gui/widget.h"
#include "common/str.h"
#include "common/list.h"
namespace GUI {
enum {
kPopUpItemSelectedCmd = 'POPs'
};
@ -69,4 +71,6 @@ protected:
void drawWidget(bool hilite);
};
} // End of namespace GUI
#endif

View File

@ -20,10 +20,12 @@
#include "stdafx.h"
#include "ScrollBarWidget.h"
#include "dialog.h"
#include "newgui.h"
#include "gui/dialog.h"
#include "gui/newgui.h"
namespace GUI {
/*
* TODO:
* - Auto-repeat: if user clicks & holds on one of the arrows, then after a
@ -245,3 +247,5 @@ void ScrollBarWidget::drawWidget(bool hilite) {
gui->hLine(_x + 2, y + 2, _x + _w-3, color);
}
}
} // End of namespace GUI

View File

@ -21,7 +21,9 @@
#ifndef SCROLLBARWIDGET_H
#define SCROLLBARWIDGET_H
#include "widget.h"
#include "gui/widget.h"
namespace GUI {
enum {
kScrollBarWidth = 9
@ -77,5 +79,6 @@ protected:
void checkBounds(int old_pos);
};
} // End of namespace GUI
#endif

View File

@ -24,6 +24,8 @@
#include "gui/dialog.h"
#include "gui/newgui.h"
namespace GUI {
enum {
kTabHeight = 15,
@ -148,3 +150,5 @@ Widget *TabWidget::findWidget(int x, int y) {
return Widget::findWidgetInChain(_firstWidget, x, y - kTabHeight);
}
}
} // End of namespace GUI

View File

@ -25,6 +25,8 @@
#include "common/str.h"
#include "common/list.h"
namespace GUI {
class TabWidget : public Widget {
typedef Common::String String;
struct Tab {
@ -66,4 +68,6 @@ protected:
virtual Widget *findWidget(int x, int y);
};
} // End of namespace GUI
#endif

View File

@ -24,6 +24,8 @@
#include "gui/newgui.h"
#include "gui/widget.h"
namespace GUI {
AboutDialog::AboutDialog()
: Dialog(10, 20, 300, 144) {
addButton((_w - kButtonWidth) / 2, 120, "OK", kCloseCmd, '\r'); // Close dialog - FIXME
@ -48,3 +50,4 @@ AboutDialog::AboutDialog()
new StaticTextWidget(this, 10, 105, _w - 20, kLineHeight, "Broken Sword Games (C) Revolution", kTextAlignCenter);
}
} // End of namespace GUI

View File

@ -23,9 +23,13 @@
#include "dialog.h"
namespace GUI {
class AboutDialog : public Dialog {
public:
AboutDialog();
};
} // End of namespace GUI
#endif

View File

@ -25,6 +25,8 @@
#include "backends/fs/fs.h"
namespace GUI {
/* We want to use this as a general directory selector at some point... possible uses
* - to select the data dir for a game
* - to select the place where save games are stored
@ -155,3 +157,4 @@ void BrowserDialog::updateListing() {
draw();
}
} // End of namespace GUI

View File

@ -25,12 +25,14 @@
#include "common/str.h"
#include "common/list.h"
class ListWidget;
class StaticTextWidget;
class FilesystemNode;
class FSList;
namespace GUI {
class ListWidget;
class StaticTextWidget;
class BrowserDialog : public Dialog {
typedef Common::String String;
typedef Common::StringList StringList;
@ -54,4 +56,6 @@ protected:
void updateListing();
};
} // End of namespace GUI
#endif

View File

@ -19,9 +19,11 @@
*/
#include "stdafx.h"
#include "chooser.h"
#include "newgui.h"
#include "ListWidget.h"
#include "gui/chooser.h"
#include "gui/newgui.h"
#include "gui/ListWidget.h"
namespace GUI {
enum {
kChooseCmd = 'Chos'
@ -61,3 +63,5 @@ void ChooserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
Dialog::handleCommand(sender, cmd, data);
}
}
} // End of namespace GUI

View File

@ -25,6 +25,8 @@
#include "common/list.h"
#include "gui/dialog.h"
namespace GUI {
class ButtonWidget;
class ListWidget;
@ -45,4 +47,6 @@ public:
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
};
} // End of namespace GUI
#endif

View File

@ -20,11 +20,13 @@
#include "stdafx.h"
#include "gui/console.h"
#include "ScrollBarWidget.h"
#include "gui/ScrollBarWidget.h"
#include "base/engine.h"
namespace GUI {
#define PROMPT ") "
/* TODO:
@ -528,3 +530,5 @@ void ConsoleDialog::scrollToCurrent() {
updateScrollBar();
}
}
} // End of namespace GUI

View File

@ -26,6 +26,8 @@
#include <stdarg.h>
namespace GUI {
enum {
kBufferSize = 32768,
kLineBufferSize = 256,
@ -123,4 +125,6 @@ protected:
void historyScroll(int direction);
};
} // End of namespace GUI
#endif

View File

@ -25,6 +25,8 @@
#include "dialog.h"
#include "widget.h"
namespace GUI {
/*
* TODO list
* - add some sense of the window being "active" (i.e. in front) or not. If it
@ -269,3 +271,5 @@ Widget *Dialog::findWidget(int x, int y) {
ButtonWidget *Dialog::addButton(int x, int y, const Common::String &label, uint32 cmd, char hotkey) {
return new ButtonWidget(this, x, y, kButtonWidth, 16, label, cmd, hotkey);
}
} // End of namespace GUI

View File

@ -26,6 +26,8 @@
#include "gui/object.h"
namespace GUI {
class NewGui;
class ButtonWidget;
@ -81,4 +83,6 @@ protected:
int getResult() const { return _result; }
};
} // End of namespace GUI
#endif

View File

@ -46,6 +46,8 @@
using Common::ConfigManager;
namespace GUI {
enum {
kStartCmd = 'STRT',
kAboutCmd = 'ABOU',
@ -511,7 +513,7 @@ void LauncherDialog::editGame(int item) {
}
void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
int item = _list->getSelected();
int item = _list->getSelected();
switch (cmd) {
case kAddGameCmd:
@ -569,3 +571,5 @@ void LauncherDialog::updateButtons() {
_removeButton->draw();
}
}
} // End of namespace GUI

View File

@ -25,8 +25,11 @@
#include "common/str.h"
#include "common/list.h"
class BrowserDialog;
class GameDetector;
namespace GUI {
class BrowserDialog;
class ListWidget;
class LauncherDialog : public Dialog {
@ -55,4 +58,6 @@ protected:
void editGame(int item);
};
} // End of namespace GUI
#endif

View File

@ -25,6 +25,8 @@
#include "gui/newgui.h"
#include "gui/widget.h"
namespace GUI {
enum {
kOkCmd = 'OK ',
kCancelCmd = 'CNCL'
@ -162,3 +164,5 @@ void TimedMessageDialog::handleTickle() {
if (g_system->get_msecs() > _timer)
close();
}
} // End of namespace GUI

View File

@ -28,6 +28,8 @@ namespace Common {
class StringList;
}
namespace GUI {
/**
* Simple message dialog ("alert box"): presents a text message in a dialog with up to two buttons.
*/
@ -56,5 +58,6 @@ protected:
uint32 _timer;
};
} // End of namespace GUI
#endif

View File

@ -27,6 +27,8 @@
# include "palm.h"
#endif
namespace GUI {
/*
* TODO list
* - get a nicer font which contains diacrits (ŠšŸ§Žˆ etc.)
@ -574,6 +576,8 @@ void NewGui::animateCursor() {
}
}
} // End of namespace GUI
#ifdef __PALM_OS__
#include "scumm_globals.h"

View File

@ -26,6 +26,8 @@
#include "common/str.h"
#include "common/system.h" // For events
namespace GUI {
class Dialog;
#define hLine(x, y, x2, color) line(x, y, x2, y, color);
@ -147,4 +149,6 @@ public:
void addDirtyRect(int x, int y, int w, int h);
};
} // End of namespace GUI
#endif

View File

@ -21,6 +21,8 @@
#ifndef GUI_OBJECT_H
#define GUI_OBJECT_H
namespace GUI {
class CommandReceiver;
class CommandSender;
@ -75,5 +77,6 @@ protected:
virtual void releaseFocus() = 0;
};
} // End of namespace GUI
#endif

View File

@ -36,6 +36,8 @@
#include <unistd.h>
#endif
namespace GUI {
// TODO - allow changing options for:
// - the save path (use _browser!)
// - music & graphics driver (but see also the comments on EditGameDialog
@ -411,3 +413,5 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
OptionsDialog::handleCommand(sender, cmd, data);
}
}
} // End of namespace GUI

View File

@ -25,9 +25,12 @@
#include "common/str.h"
#include "common/list.h"
class GameDetector;
namespace GUI {
class BrowserDialog;
class CheckboxWidget;
class GameDetector;
class PopUpWidget;
class SliderWidget;
class StaticTextWidget;
@ -105,4 +108,6 @@ protected:
StaticTextWidget *_savePath;
};
} // End of namespace GUI
#endif

View File

@ -25,6 +25,8 @@
#include "gui/newgui.h"
namespace GUI {
Widget::Widget(GuiObject *boss, int x, int y, int w, int h)
: GuiObject(x, y, w, h), _type(0), _boss(boss),
_id(0), _flags(0), _hasFocus(false) {
@ -260,3 +262,5 @@ int SliderWidget::valueToPos(int value) {
int SliderWidget::posToValue(int pos) {
return (pos) * (_valueMax - _valueMin) / (_w - _labelWidth - 4) + _valueMin;
}
} // End of namespace GUI

View File

@ -25,6 +25,8 @@
#include "common/str.h"
#include "gui/object.h"
namespace GUI {
class Dialog;
enum {
@ -206,5 +208,6 @@ protected:
int posToValue(int pos);
};
} // End of namespace GUI
#endif

View File

@ -136,12 +136,6 @@ static ResString string_map_table_v5[] = {
#pragma mark -
void ScummDialog::addResText(int x, int y, int w, int h, int resID) {
// Get the string
new StaticTextWidget(this, x, y, w, h, queryResString(resID), kTextAlignCenter);
}
const Common::String ScummDialog::queryResString(int stringno) {
byte *result;

View File

@ -30,7 +30,11 @@
#include "scumm/help.h"
#endif
class ListWidget;
namespace GUI {
class ListWidget;
}
using namespace GUI; // FIXME: Bad style to use a using directive in a header
namespace Scumm {
@ -46,8 +50,6 @@ protected:
ScummEngine *_scumm;
void addResText(int x, int y, int w, int h, int resID);
// Query a string from the resources
const String queryResString(int stringno);
};

View File

@ -32,7 +32,10 @@
#include "scumm/gfx.h"
#include "scumm/script.h"
class Dialog;
namespace GUI {
class Dialog;
}
using GUI::Dialog;
class GameDetector;
namespace Scumm {