[Scummvm-cvs-logs] SF.net SVN: scummvm:[41267] scummvm/trunk/gui
sev at users.sourceforge.net
sev at users.sourceforge.net
Sat Jun 6 19:53:25 CEST 2009
Revision: 41267
http://scummvm.svn.sourceforge.net/scummvm/?rev=41267&view=rev
Author: sev
Date: 2009-06-06 17:53:25 +0000 (Sat, 06 Jun 2009)
Log Message:
-----------
Add to launcher not yet functional search widget.
Make EditableWidget CommandSender
Modified Paths:
--------------
scummvm/trunk/gui/EditTextWidget.cpp
scummvm/trunk/gui/EditTextWidget.h
scummvm/trunk/gui/ListWidget.cpp
scummvm/trunk/gui/ListWidget.h
scummvm/trunk/gui/ThemeEngine.h
scummvm/trunk/gui/editable.cpp
scummvm/trunk/gui/editable.h
scummvm/trunk/gui/launcher.cpp
scummvm/trunk/gui/launcher.h
scummvm/trunk/gui/themes/scummmodern/scummmodern_gfx.stx
scummvm/trunk/gui/themes/scummmodern/scummmodern_layout.stx
scummvm/trunk/gui/themes/scummmodern.zip
Modified: scummvm/trunk/gui/EditTextWidget.cpp
===================================================================
--- scummvm/trunk/gui/EditTextWidget.cpp 2009-06-06 17:52:44 UTC (rev 41266)
+++ scummvm/trunk/gui/EditTextWidget.cpp 2009-06-06 17:53:25 UTC (rev 41267)
@@ -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;
Modified: scummvm/trunk/gui/EditTextWidget.h
===================================================================
--- scummvm/trunk/gui/EditTextWidget.h 2009-06-06 17:52:44 UTC (rev 41266)
+++ scummvm/trunk/gui/EditTextWidget.h 2009-06-06 17:53:25 UTC (rev 41267)
@@ -41,8 +41,8 @@
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);
Modified: scummvm/trunk/gui/ListWidget.cpp
===================================================================
--- scummvm/trunk/gui/ListWidget.cpp 2009-06-06 17:52:44 UTC (rev 41266)
+++ scummvm/trunk/gui/ListWidget.cpp 2009-06-06 17:53:25 UTC (rev 41267)
@@ -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, 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;
Modified: scummvm/trunk/gui/ListWidget.h
===================================================================
--- scummvm/trunk/gui/ListWidget.h 2009-06-06 17:52:44 UTC (rev 41266)
+++ scummvm/trunk/gui/ListWidget.h 2009-06-06 17:53:25 UTC (rev 41267)
@@ -47,7 +47,7 @@
};
/* ListWidget */
-class ListWidget : public EditableWidget, public CommandSender {
+class ListWidget : public EditableWidget {
public:
typedef Common::String String;
typedef Common::StringList StringList;
Modified: scummvm/trunk/gui/ThemeEngine.h
===================================================================
--- scummvm/trunk/gui/ThemeEngine.h 2009-06-06 17:52:44 UTC (rev 41266)
+++ scummvm/trunk/gui/ThemeEngine.h 2009-06-06 17:53:25 UTC (rev 41267)
@@ -184,8 +184,9 @@
//! 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 @@
}
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;
+ }
}
/**
Modified: scummvm/trunk/gui/editable.cpp
===================================================================
--- scummvm/trunk/gui/editable.cpp 2009-06-06 17:52:44 UTC (rev 41266)
+++ scummvm/trunk/gui/editable.cpp 2009-06-06 17:53:25 UTC (rev 41267)
@@ -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 @@
_caretPos--;
_editString.deleteChar(_caretPos);
dirty = true;
+
+ sendCommand(_cmd, 0);
}
forcecaret = true;
break;
@@ -116,6 +118,8 @@
if (_caretPos < (int)_editString.size()) {
_editString.deleteChar(_caretPos);
dirty = true;
+
+ sendCommand(_cmd, 0);
}
forcecaret = true;
break;
@@ -146,6 +150,8 @@
_caretPos++;
dirty = true;
forcecaret = true;
+
+ sendCommand(_cmd, 0);
} else {
handled = false;
}
Modified: scummvm/trunk/gui/editable.h
===================================================================
--- scummvm/trunk/gui/editable.h 2009-06-06 17:52:44 UTC (rev 41266)
+++ scummvm/trunk/gui/editable.h 2009-06-06 17:53:25 UTC (rev 41267)
@@ -36,12 +36,14 @@
* 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 @@
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();
Modified: scummvm/trunk/gui/launcher.cpp
===================================================================
--- scummvm/trunk/gui/launcher.cpp 2009-06-06 17:52:44 UTC (rev 41266)
+++ scummvm/trunk/gui/launcher.cpp 2009-06-06 17:53:25 UTC (rev 41267)
@@ -64,6 +64,7 @@
kRemoveGameCmd = 'REMG',
kLoadGameCmd = 'LOAD',
kQuitCmd = 'QUIT',
+ kSearchCmd = 'SRCH',
kCmdGlobalGraphicsOverride = 'OGFX',
@@ -508,6 +509,10 @@
_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 @@
setResult(-1);
close();
break;
+ case kSearchCmd:
+ break;
default:
Dialog::handleCommand(sender, cmd, data);
}
Modified: scummvm/trunk/gui/launcher.h
===================================================================
--- scummvm/trunk/gui/launcher.h 2009-06-06 17:52:44 UTC (rev 41266)
+++ scummvm/trunk/gui/launcher.h 2009-06-06 17:53:25 UTC (rev 41267)
@@ -34,6 +34,7 @@
class ListWidget;
class GraphicsWidget;
class SaveLoadChooser;
+class EditTextWidget;
Common::String addGameToConf(const GameDescriptor &result);
@@ -50,6 +51,7 @@
virtual void handleKeyUp(Common::KeyState state);
protected:
+ EditTextWidget *_searchWidget;
ListWidget *_list;
ButtonWidget *_addButton;
Widget *_startButton;
@@ -58,11 +60,14 @@
Widget *_removeButton;
#ifndef DISABLE_FANCY_THEMES
GraphicsWidget *_logo;
+ GraphicsWidget *_searchPic;
#endif
StringList _domains;
BrowserDialog *_browser;
SaveLoadChooser *_loadDialog;
+ String _search;
+
virtual void reflowLayout();
void updateListing();
Modified: scummvm/trunk/gui/themes/scummmodern/scummmodern_gfx.stx
===================================================================
--- scummvm/trunk/gui/themes/scummmodern/scummmodern_gfx.stx 2009-06-06 17:52:44 UTC (rev 41266)
+++ scummvm/trunk/gui/themes/scummmodern/scummmodern_gfx.stx 2009-06-06 17:53:25 UTC (rev 41267)
@@ -99,6 +99,7 @@
<bitmap filename = 'checkbox.bmp'/>
<bitmap filename = 'checkbox_empty.bmp'/>
<bitmap filename = 'logo_small.bmp'/>
+ <bitmap filename = 'search.bmp'/>
</bitmaps>
<fonts>
Modified: scummvm/trunk/gui/themes/scummmodern/scummmodern_layout.stx
===================================================================
--- scummvm/trunk/gui/themes/scummmodern/scummmodern_layout.stx 2009-06-06 17:52:44 UTC (rev 41266)
+++ scummvm/trunk/gui/themes/scummmodern/scummmodern_layout.stx 2009-06-06 17:53:25 UTC (rev 41267)
@@ -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'>
Modified: scummvm/trunk/gui/themes/scummmodern.zip
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list