aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorKostas Nakos2006-06-10 11:23:00 +0000
committerKostas Nakos2006-06-10 11:23:00 +0000
commit3b4416bb37ff366de0794ad476f4c98a7c3da11b (patch)
treeeb98541e3d62605e3ede5ac65bda74fa90ed692e /backends
parentfd672ef2e1d202821ca75feadef28d8cb9eab17f (diff)
downloadscummvm-rg350-3b4416bb37ff366de0794ad476f4c98a7c3da11b.tar.gz
scummvm-rg350-3b4416bb37ff366de0794ad476f4c98a7c3da11b.tar.bz2
scummvm-rg350-3b4416bb37ff366de0794ad476f4c98a7c3da11b.zip
added multiple state support
svn-id: r23006
Diffstat (limited to 'backends')
-rw-r--r--backends/wince/CEgui/ItemSwitch.cpp53
-rw-r--r--backends/wince/CEgui/ItemSwitch.h4
2 files changed, 44 insertions, 13 deletions
diff --git a/backends/wince/CEgui/ItemSwitch.cpp b/backends/wince/CEgui/ItemSwitch.cpp
index 1d329c9991..7498463871 100644
--- a/backends/wince/CEgui/ItemSwitch.cpp
+++ b/backends/wince/CEgui/ItemSwitch.cpp
@@ -25,9 +25,7 @@
namespace CEGUI {
- ItemSwitch::ItemSwitch(WORD referenceTrue, WORD referenceFalse, bool *item) :
- PanelItem(referenceTrue) {
- _item = item;
+ void ItemSwitch::init(WORD referenceTrue, WORD referenceFalse) {
_backgroundTrue = _background;
_backgroundFalse = new SDL_ImageResource();
if (!_backgroundFalse->load(referenceFalse)) {
@@ -36,10 +34,25 @@ namespace CEGUI {
_background = NULL;
_backgroundFalse = NULL;
}
+ }
+
+ ItemSwitch::ItemSwitch(WORD referenceTrue, WORD referenceFalse, bool *item) :
+ PanelItem(referenceTrue) {
+ init(referenceTrue, referenceFalse);
+ _item = item;
+ _itemmax = -1;
if (!*_item)
_background = _backgroundFalse;
}
+ ItemSwitch::ItemSwitch(WORD referenceTrue, WORD referenceFalse, int *item, int max) :
+ PanelItem(referenceTrue) {
+ init(referenceTrue, referenceFalse);
+ _itemmultiple = item;
+ _itemmax = max;
+ if (!*item)
+ _background = _backgroundFalse;
+ }
ItemSwitch::~ItemSwitch() {
if (_backgroundFalse)
@@ -49,18 +62,32 @@ namespace CEGUI {
bool ItemSwitch::action(int x, int y, bool pushed) {
if (checkInside(x, y) && _visible && pushed) {
- *_item = !*_item;
- if (*_item)
- _background = _backgroundTrue;
- else
- _background = _backgroundFalse;
+ if (_itemmax <= 0) {
+ *_item = !*_item;
+ if (*_item)
+ _background = _backgroundTrue;
+ else
+ _background = _backgroundFalse;
- if (_panel)
- _panel->forceRedraw();
+ if (_panel)
+ _panel->forceRedraw();
- return true;
- }
- else
+ return true;
+ } else {
+ *_itemmultiple = *_itemmultiple + 1;
+ if (*_itemmultiple > _itemmax)
+ *_itemmultiple = 0;
+ if (*_itemmultiple)
+ _background = _backgroundTrue;
+ else
+ _background = _backgroundFalse;
+
+ if (_panel)
+ _panel->forceRedraw();
+
+ return true;
+ }
+ } else
return false;
}
}
diff --git a/backends/wince/CEgui/ItemSwitch.h b/backends/wince/CEgui/ItemSwitch.h
index 33480544fe..60a96c4894 100644
--- a/backends/wince/CEgui/ItemSwitch.h
+++ b/backends/wince/CEgui/ItemSwitch.h
@@ -37,10 +37,14 @@ namespace CEGUI {
class ItemSwitch : public PanelItem {
public:
ItemSwitch(WORD referenceTrue, WORD referenceFalse, bool *item);
+ ItemSwitch(WORD referenceTrue, WORD referenceFalse, int *item, int max);
virtual ~ItemSwitch();
virtual bool action(int x, int y, bool pushed);
private:
+ void init(WORD referenceTrue, WORD referenceFalse);
bool *_item;
+ static bool _itemdummy;
+ int *_itemmultiple, _itemmax;
SDL_ImageResource *_backgroundTrue;
SDL_ImageResource *_backgroundFalse;
};