mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 06:08:35 +00:00
HUGO: Initial work on user input dialog
This commit is contained in:
parent
c813391455
commit
901b5e2097
@ -230,4 +230,24 @@ void TopMenu::handleMouseUp(int x, int y, int button, int clickCount) {
|
||||
Dialog::handleMouseUp(x, y, button, clickCount);
|
||||
}
|
||||
|
||||
EntryDialog::EntryDialog(const Common::String &title, const Common::String &buttonLabel, const Common::String &defaultValue) : GUI::Dialog(20, 20, 100, 50) {
|
||||
new GUI::StaticTextWidget(this, 0, 0, 10, 10, title, Graphics::kTextAlignCenter);
|
||||
|
||||
_text = new GUI::EditTextWidget(this, 0, 0, 50, 10, "");
|
||||
_text->setEditString(defaultValue);
|
||||
|
||||
new GUI::ButtonWidget(this, 20, 20, 30, 10, buttonLabel, 0, kCmdButton);
|
||||
}
|
||||
|
||||
void EntryDialog::handleCommand(GUI::CommandSender *sender, uint32 command, uint32 data) {
|
||||
switch (command) {
|
||||
case kCmdButton:
|
||||
close();
|
||||
break;
|
||||
default:
|
||||
Dialog::handleCommand(sender, command, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // End of namespace Hugo
|
||||
|
@ -27,6 +27,7 @@
|
||||
#define HUGO_TOPMENU_H
|
||||
|
||||
#include "gui/dialog.h"
|
||||
#include "gui/widgets/edittext.h"
|
||||
|
||||
namespace Hugo {
|
||||
|
||||
@ -54,6 +55,7 @@ enum {
|
||||
};
|
||||
|
||||
enum {
|
||||
// TopMenu commands
|
||||
kCmdWhat = 'WHAT',
|
||||
kCmdMusic = 'MUZK',
|
||||
kCmdSoundFX = 'SOUN',
|
||||
@ -62,7 +64,10 @@ enum {
|
||||
kCmdRecall = 'RECL',
|
||||
kCmdTurbo = 'TURB',
|
||||
kCmdLook = 'LOOK',
|
||||
kCmdInvent = 'INVT'
|
||||
kCmdInvent = 'INVT',
|
||||
|
||||
// EntryDialog commands
|
||||
kCmdButton = 'BTNP'
|
||||
};
|
||||
|
||||
class TopMenu : public GUI::Dialog {
|
||||
@ -95,6 +100,21 @@ protected:
|
||||
uint16 arraySize;
|
||||
};
|
||||
|
||||
class EntryDialog : public GUI::Dialog {
|
||||
EntryDialog(const Common::String &title, const Common::String &buttonLabel, const Common::String &defaultValue);
|
||||
~EntryDialog();
|
||||
|
||||
void reflowLayout();
|
||||
void handleCommand(GUI::CommandSender *sender, uint32 command, uint32 data);
|
||||
|
||||
const Common::String &getEditString() const { return _text->getEditString(); }
|
||||
|
||||
protected:
|
||||
void init();
|
||||
|
||||
GUI::EditTextWidget *_text;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // HUGO_TOPMENU_H
|
||||
|
Loading…
Reference in New Issue
Block a user