[Scummvm-cvs-logs] CVS: scummvm/gui PopUpWidget.h,1.10,1.11 PopUpWidget.cpp,1.29,1.30
Max Horn
fingolfin at users.sourceforge.net
Sat Mar 13 04:43:03 CET 2004
Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6592/gui
Modified Files:
PopUpWidget.h PopUpWidget.cpp
Log Message:
useful helper method (will be used for improved options dialog)
Index: PopUpWidget.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/PopUpWidget.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- PopUpWidget.h 6 Jan 2004 12:45:28 -0000 1.10
+++ PopUpWidget.h 13 Mar 2004 12:33:31 -0000 1.11
@@ -62,7 +62,12 @@
void appendEntry(const String &entry, uint32 tag = (uint32)-1);
void clearEntries();
+ /** Select the entry at the given index. */
void setSelected(int item);
+
+ /** Select the first entry matching the given tag. */
+ void setSelectedTag(uint32 tag);
+
int getSelected() const { return _selectedItem; }
uint32 getSelectedTag() const { return (_selectedItem >= 0) ? _entries[_selectedItem].tag : (uint32)-1; }
const String& getSelectedString() const { return (_selectedItem >= 0) ? _entries[_selectedItem].name : String::emptyString; }
Index: PopUpWidget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/PopUpWidget.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- PopUpWidget.cpp 5 Feb 2004 00:19:54 -0000 1.29
+++ PopUpWidget.cpp 13 Mar 2004 12:33:31 -0000 1.30
@@ -315,6 +315,16 @@
}
}
+void PopUpWidget::setSelectedTag(uint32 tag) {
+ uint item;
+ for (item = 0; item < _entries.size(); ++item) {
+ if (_entries[item].tag == tag) {
+ setSelected(item);
+ return;
+ }
+ }
+}
+
void PopUpWidget::drawWidget(bool hilite) {
NewGui *gui = &g_gui;
int x = _x + _labelWidth;
More information about the Scummvm-git-logs
mailing list