aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorEugene Sandulenko2009-06-06 17:53:25 +0000
committerEugene Sandulenko2009-06-06 17:53:25 +0000
commitdcc90445f6ea424bd4576f04afbc790fc43a5c76 (patch)
tree5c13a7e7ffb75d8c57e7108749902a5bbcc1d9d7 /gui
parentb0db1b5ed0634dee707d234cfda23201c648cf98 (diff)
downloadscummvm-rg350-dcc90445f6ea424bd4576f04afbc790fc43a5c76.tar.gz
scummvm-rg350-dcc90445f6ea424bd4576f04afbc790fc43a5c76.tar.bz2
scummvm-rg350-dcc90445f6ea424bd4576f04afbc790fc43a5c76.zip
Add to launcher not yet functional search widget.
Make EditableWidget CommandSender svn-id: r41267
Diffstat (limited to 'gui')
-rw-r--r--gui/EditTextWidget.cpp8
-rw-r--r--gui/EditTextWidget.h4
-rw-r--r--gui/ListWidget.cpp4
-rw-r--r--gui/ListWidget.h2
-rw-r--r--gui/ThemeEngine.h17
-rw-r--r--gui/editable.cpp14
-rw-r--r--gui/editable.h8
-rw-r--r--gui/launcher.cpp7
-rw-r--r--gui/launcher.h5
-rw-r--r--gui/themes/scummmodern.zipbin154633 -> 155905 bytes
-rw-r--r--gui/themes/scummmodern/scummmodern_gfx.stx1
-rw-r--r--gui/themes/scummmodern/scummmodern_layout.stx11
12 files changed, 59 insertions, 22 deletions
diff --git a/gui/EditTextWidget.cpp b/gui/EditTextWidget.cpp
index c977ecc3d0..ac3967589a 100644
--- a/gui/EditTextWidget.cpp
+++ b/gui/EditTextWidget.cpp
@@ -30,16 +30,16 @@
namespace GUI {
-EditTextWidget::EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text)
- : EditableWidget(boss, x, y - 1, w, h + 2) {
+EditTextWidget::EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, uint32 cmd)
+ : EditableWidget(boss, x, y - 1, w, h + 2, cmd) {
setFlags(WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE);
_type = kEditTextWidget;
setEditString(text);
}
-EditTextWidget::EditTextWidget(GuiObject *boss, const String &name, const String &text)
- : EditableWidget(boss, name) {
+EditTextWidget::EditTextWidget(GuiObject *boss, const String &name, const String &text, uint32 cmd)
+ : EditableWidget(boss, name, cmd) {
setFlags(WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE);
_type = kEditTextWidget;
diff --git a/gui/EditTextWidget.h b/gui/EditTextWidget.h
index 661ba28e1b..5a5823cfb1 100644
--- a/gui/EditTextWidget.h
+++ b/gui/EditTextWidget.h
@@ -41,8 +41,8 @@ protected:
int _rightPadding;
public:
- EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text);
- EditTextWidget(GuiObject *boss, const String &name, const String &text);
+ EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, uint32 cmd = 0);
+ EditTextWidget(GuiObject *boss, const String &name, const String &text, uint32 cmd = 0);
void setEditString(const String &str);
diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp
index f534c14d1e..8e5ef99f06 100644
--- a/gui/ListWidget.cpp
+++ b/gui/ListWidget.cpp
@@ -34,7 +34,7 @@
namespace GUI {
ListWidget::ListWidget(GuiObject *boss, const String &name)
- : EditableWidget(boss, name), CommandSender(boss) {
+ : EditableWidget(boss, name) {
_scrollBar = NULL;
_textWidth = NULL;
@@ -63,7 +63,7 @@ ListWidget::ListWidget(GuiObject *boss, const String &name)
}
ListWidget::ListWidget(GuiObject *boss, int x, int y, int w, int h)
- : EditableWidget(boss, x, y, w, h), CommandSender(boss) {
+ : EditableWidget(boss, x, y, w, h) {
_scrollBar = NULL;
_textWidth = NULL;
diff --git a/gui/ListWidget.h b/gui/ListWidget.h
index 5b73f42a1c..7478da930d 100644
--- a/gui/ListWidget.h
+++ b/gui/ListWidget.h
@@ -47,7 +47,7 @@ enum {
};
/* ListWidget */
-class ListWidget : public EditableWidget, public CommandSender {
+class ListWidget : public EditableWidget {
public:
typedef Common::String String;
typedef Common::StringList StringList;
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index dd32ff6f2f..bee3737fd1 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -184,8 +184,9 @@ public:
//! Special image ids for images used in the GUI
enum kThemeImages {
- kImageLogo = 0, //!< ScummVM Logo used in the launcher
- kImageLogoSmall //!< ScummVM logo used in the GMM
+ kImageLogo = 0, //!< ScummVM logo used in the launcher
+ kImageLogoSmall, //!< ScummVM logo used in the GMM
+ kImageSearch //!< Search tool image used in the launcher
};
/**
@@ -422,12 +423,16 @@ public:
}
const Graphics::Surface *getImageSurface(const kThemeImages n) const {
- if (n == kImageLogo)
+ switch (n) {
+ case kImageLogo:
return _bitmaps.contains("logo.bmp") ? _bitmaps["logo.bmp"] : 0;
- else if (n == kImageLogoSmall)
+ case kImageLogoSmall:
return _bitmaps.contains("logo_small.bmp") ? _bitmaps["logo_small.bmp"] : 0;
-
- return 0;
+ case kImageSearch:
+ return _bitmaps.contains("search.bmp") ? _bitmaps["search.bmp"] : 0;
+ default:
+ return 0;
+ }
}
/**
diff --git a/gui/editable.cpp b/gui/editable.cpp
index 38dcb1ecf5..232873ffe3 100644
--- a/gui/editable.cpp
+++ b/gui/editable.cpp
@@ -28,13 +28,13 @@
namespace GUI {
-EditableWidget::EditableWidget(GuiObject *boss, int x, int y, int w, int h)
- : Widget(boss, x, y, w, h) {
+EditableWidget::EditableWidget(GuiObject *boss, int x, int y, int w, int h, uint32 cmd)
+ : Widget(boss, x, y, w, h), CommandSender(boss), _cmd(cmd) {
init();
}
-EditableWidget::EditableWidget(GuiObject *boss, const String &name)
- : Widget(boss, name) {
+EditableWidget::EditableWidget(GuiObject *boss, const String &name, uint32 cmd)
+ : Widget(boss, name), CommandSender(boss), _cmd(cmd) {
init();
}
@@ -109,6 +109,8 @@ bool EditableWidget::handleKeyDown(Common::KeyState state) {
_caretPos--;
_editString.deleteChar(_caretPos);
dirty = true;
+
+ sendCommand(_cmd, 0);
}
forcecaret = true;
break;
@@ -116,6 +118,8 @@ bool EditableWidget::handleKeyDown(Common::KeyState state) {
if (_caretPos < (int)_editString.size()) {
_editString.deleteChar(_caretPos);
dirty = true;
+
+ sendCommand(_cmd, 0);
}
forcecaret = true;
break;
@@ -146,6 +150,8 @@ bool EditableWidget::handleKeyDown(Common::KeyState state) {
_caretPos++;
dirty = true;
forcecaret = true;
+
+ sendCommand(_cmd, 0);
} else {
handled = false;
}
diff --git a/gui/editable.h b/gui/editable.h
index f01a4a5da2..363ba7b9f6 100644
--- a/gui/editable.h
+++ b/gui/editable.h
@@ -36,12 +36,14 @@ namespace GUI {
* Base class for widgets which need to edit text, like ListWidget and
* EditTextWidget.
*/
-class EditableWidget : public Widget {
+class EditableWidget : public Widget, public CommandSender {
public:
typedef Common::String String;
protected:
String _editString;
+ uint32 _cmd;
+
bool _caretVisible;
uint32 _caretTime;
int _caretPos;
@@ -53,8 +55,8 @@ protected:
ThemeEngine::FontStyle _font;
public:
- EditableWidget(GuiObject *boss, int x, int y, int w, int h);
- EditableWidget(GuiObject *boss, const String &name);
+ EditableWidget(GuiObject *boss, int x, int y, int w, int h, uint32 cmd = 0);
+ EditableWidget(GuiObject *boss, const String &name, uint32 cmd = 0);
virtual ~EditableWidget();
void init();
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 6982550cbd..f9c0775444 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -64,6 +64,7 @@ enum {
kRemoveGameCmd = 'REMG',
kLoadGameCmd = 'LOAD',
kQuitCmd = 'QUIT',
+ kSearchCmd = 'SRCH',
kCmdGlobalGraphicsOverride = 'OGFX',
@@ -508,6 +509,10 @@ LauncherDialog::LauncherDialog()
_removeButton =
new ButtonWidget(this, "Launcher.RemoveGameButton", "Remove Game", kRemoveGameCmd, 'R');
+ // Search box
+ _searchPic = new GraphicsWidget(this, "Launcher.SearchPic");
+ _searchPic->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageSearch));
+ _searchWidget = new EditTextWidget(this, "Launcher.Search", _search, kSearchCmd);
// Add list with game titles
_list = new ListWidget(this, "Launcher.GameList");
@@ -907,6 +912,8 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
setResult(-1);
close();
break;
+ case kSearchCmd:
+ break;
default:
Dialog::handleCommand(sender, cmd, data);
}
diff --git a/gui/launcher.h b/gui/launcher.h
index b9a76c80ca..0f4bdd8ed7 100644
--- a/gui/launcher.h
+++ b/gui/launcher.h
@@ -34,6 +34,7 @@ class BrowserDialog;
class ListWidget;
class GraphicsWidget;
class SaveLoadChooser;
+class EditTextWidget;
Common::String addGameToConf(const GameDescriptor &result);
@@ -50,6 +51,7 @@ public:
virtual void handleKeyUp(Common::KeyState state);
protected:
+ EditTextWidget *_searchWidget;
ListWidget *_list;
ButtonWidget *_addButton;
Widget *_startButton;
@@ -58,11 +60,14 @@ protected:
Widget *_removeButton;
#ifndef DISABLE_FANCY_THEMES
GraphicsWidget *_logo;
+ GraphicsWidget *_searchPic;
#endif
StringList _domains;
BrowserDialog *_browser;
SaveLoadChooser *_loadDialog;
+ String _search;
+
virtual void reflowLayout();
void updateListing();
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index 1870d5c224..360afa5996 100644
--- a/gui/themes/scummmodern.zip
+++ b/gui/themes/scummmodern.zip
Binary files differ
diff --git a/gui/themes/scummmodern/scummmodern_gfx.stx b/gui/themes/scummmodern/scummmodern_gfx.stx
index 09fdc7fc48..b0bba89bfe 100644
--- a/gui/themes/scummmodern/scummmodern_gfx.stx
+++ b/gui/themes/scummmodern/scummmodern_gfx.stx
@@ -99,6 +99,7 @@
<bitmap filename = 'checkbox.bmp'/>
<bitmap filename = 'checkbox_empty.bmp'/>
<bitmap filename = 'logo_small.bmp'/>
+ <bitmap filename = 'search.bmp'/>
</bitmaps>
<fonts>
diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx
index 3b948f0885..d90d6cd8da 100644
--- a/gui/themes/scummmodern/scummmodern_layout.stx
+++ b/gui/themes/scummmodern/scummmodern_layout.stx
@@ -104,6 +104,17 @@
width = '283'
height = '80'
/>
+ <layout type = 'horizontal' spacing = '5' padding = '10, 0, 0, 0'>
+ <widget name = 'SearchPic'
+ width = '16'
+ height = '17'
+ />
+ <widget name = 'Search'
+ width = '150'
+ height = 'Globals.Line.Height'
+ />
+ <space />
+ </layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0'>
<widget name = 'GameList'/>
<layout type = 'vertical' padding = '10, 0, 0, 0'>