[Scummvm-cvs-logs] CVS: scummvm/gui dialog.cpp,1.5,1.6 dialog.h,1.2,1.3
Max Horn
fingolfin at users.sourceforge.net
Sun Jul 7 15:45:04 CEST 2002
- Previous message: [Scummvm-cvs-logs] CVS: scummvm newgui.cpp,1.4,1.5 newgui.h,1.4,1.5 guimaps.h,1.5,1.6
- Next message: [Scummvm-cvs-logs] CVS: scummvm/gui dialog.cpp,1.6,1.7 dialog.h,1.3,1.4 widget.cpp,1.5,1.6 widget.h,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/gui
In directory usw-pr-cvs1:/tmp/cvs-serv10919/gui
Modified Files:
dialog.cpp dialog.h
Log Message:
added options dialog; added NewGui TODO list;
Index: dialog.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/dialog.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- dialog.cpp 7 Jul 2002 21:46:53 -0000 1.5
+++ dialog.cpp 7 Jul 2002 22:44:30 -0000 1.6
@@ -56,6 +56,15 @@
}
+void Dialog::handleCommand(uint32 cmd)
+{
+ switch (cmd) {
+ case kCloseCmd:
+ close();
+ break;
+ }
+}
+
/*
* Determine the widget at location (x,y) if any. Assumes the coordinates are
* in the local coordinate system, i.e. relative to the top left of the dialog.
@@ -80,7 +89,7 @@
void Dialog::addResText(int x, int y, int w, int h, int resID)
{
// Get the string
- const char *str = _gui->queryString(resID);
+ const char *str = _gui->queryResString(resID);
if (!str)
str = "Dummy!";
new StaticTextWidget(this, x, y, w, h, str);
@@ -92,17 +101,9 @@
// TODO - handle hotkey
}
-void Dialog::addButton(int x, int y, int w, int h, char hotkey, int resID, uint32 cmd)
-{
- // Get the string
- const char *label = _gui->queryString(resID);
- if (!label)
- label = "Dummy!";
- addButton(x, y, w, h, hotkey, label, cmd);
-}
-
#pragma mark -
+
enum {
kSaveCmd = 'SAVE',
kLoadCmd = 'LOAD',
@@ -118,11 +119,11 @@
// addResText(10, 7, 240, 16, 2);
// addResText(10, 7, 240, 16, 3);
- addButton(200, 20, 54, 16, 'S', 4, kSaveCmd); // Save
- addButton(200, 40, 54, 16, 'L', 5, kLoadCmd); // Load
- addButton(200, 60, 54, 16, 'P', 6, kPlayCmd); // Play
- addButton(200, 80, 54, 16, 'O', 17, kOptionsCmd); // Options
- addButton(200, 100, 54, 16, 'Q', 8, kQuitCmd); // Quit
+ addButton(200, 20, 54, 16, 'S', RES_STRING(4), kSaveCmd); // Save
+ addButton(200, 40, 54, 16, 'L', RES_STRING(5), kLoadCmd); // Load
+ addButton(200, 60, 54, 16, 'P', RES_STRING(6), kPlayCmd); // Play
+ addButton(200, 80, 54, 16, 'O', CUSTOM_STRING(17), kOptionsCmd); // Options
+ addButton(200, 100, 54, 16, 'Q', RES_STRING(8), kQuitCmd); // Quit
}
void SaveLoadDialog::handleCommand(uint32 cmd)
@@ -131,17 +132,55 @@
case kSaveCmd:
break;
case kLoadCmd:
- // FIXME HACK - just to demo the nesting ability
- _gui->pauseDialog();
break;
case kPlayCmd:
close();
break;
case kOptionsCmd:
+ _gui->optionsDialog();
break;
case kQuitCmd:
exit(1);
break;
+ default:
+ Dialog::handleCommand(cmd);
+ }
+}
+
+
+#pragma mark -
+
+enum {
+ kSoundCmd = 'SOUN',
+ kKeysCmd = 'KEYS',
+ kAboutCmd = 'ABOU',
+ kMiscCmd = 'OPTN'
+};
+
+OptionsDialog::OptionsDialog(NewGui *gui)
+ : Dialog (gui, 50, 80, 210, 60)
+{
+ addButton( 10, 10, 40, 15, 'S', CUSTOM_STRING(5), kSoundCmd); // Sound
+ addButton( 80, 10, 40, 15, 'K', CUSTOM_STRING(6), kKeysCmd); // Keys
+ addButton(150, 10, 40, 15, 'A', CUSTOM_STRING(7), kAboutCmd); // About
+ addButton( 10, 35, 40, 15, 'M', CUSTOM_STRING(18), kMiscCmd); // Misc
+ addButton(150, 35, 40, 15, 'C', CUSTOM_STRING(23), kCloseCmd); // Close dialog - FIXME
+}
+
+void OptionsDialog::handleCommand(uint32 cmd)
+{
+ switch (cmd) {
+ case kSoundCmd:
+ break;
+ case kKeysCmd:
+ break;
+ case kAboutCmd:
+ _gui->aboutDialog();
+ break;
+ case kMiscCmd:
+ break;
+ default:
+ Dialog::handleCommand(cmd);
}
}
Index: dialog.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/dialog.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- dialog.h 6 Jul 2002 12:57:51 -0000 1.2
+++ dialog.h 7 Jul 2002 22:44:30 -0000 1.3
@@ -27,6 +27,14 @@
class Widget;
class NewGui;
+#define RES_STRING(id) _gui->queryResString(id)
+#define CUSTOM_STRING(id) _gui->queryCustomString(id)
+
+// Some "common" commands sent to handleCommand()
+enum {
+ kCloseCmd = 'clos'
+};
+
class Dialog {
friend class Widget;
friend class StaticTextWidget;
@@ -48,8 +56,7 @@
virtual void handleKey(char key, int modifiers) // modifiers = alt/shift/ctrl etc.
{ if (key == 27) close(); }
virtual void handleMouseMoved(int x, int y, int button);
- virtual void handleCommand(uint32 cmd)
- {}
+ virtual void handleCommand(uint32 cmd);
protected:
Widget* findWidget(int x, int y); // Find the widget at pos x,y if any
@@ -57,12 +64,18 @@
void addResText(int x, int y, int w, int h, int resID);
void addButton(int x, int y, int w, int h, char hotkey, const char *label, uint32 cmd);
- void addButton(int x, int y, int w, int h, char hotkey, int resID, uint32 cmd);
};
class SaveLoadDialog : public Dialog {
public:
SaveLoadDialog(NewGui *gui);
+
+ virtual void handleCommand(uint32 cmd);
+};
+
+class OptionsDialog : public Dialog {
+public:
+ OptionsDialog(NewGui *gui);
virtual void handleCommand(uint32 cmd);
};
- Previous message: [Scummvm-cvs-logs] CVS: scummvm newgui.cpp,1.4,1.5 newgui.h,1.4,1.5 guimaps.h,1.5,1.6
- Next message: [Scummvm-cvs-logs] CVS: scummvm/gui dialog.cpp,1.6,1.7 dialog.h,1.3,1.4 widget.cpp,1.5,1.6 widget.h,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list