[Scummvm-cvs-logs] CVS: scummvm/gui ListWidget.cpp,1.3,1.4 ListWidget.h,1.3,1.4 dialog.cpp,1.16,1.17 dialog.h,1.8,1.9 widget.h,1.11,1.12

James Brown ender at users.sourceforge.net
Sat Jul 13 02:20:03 CEST 2002


Update of /cvsroot/scummvm/scummvm/gui
In directory usw-pr-cvs1:/tmp/cvs-serv12627/gui

Modified Files:
	ListWidget.cpp ListWidget.h dialog.cpp dialog.h widget.h 
Log Message:
Let ListWidget have an 'active' item



Index: ListWidget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/ListWidget.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ListWidget.cpp	12 Jul 2002 23:00:35 -0000	1.3
+++ ListWidget.cpp	13 Jul 2002 09:19:23 -0000	1.4
@@ -48,7 +48,7 @@
 	_numberingMode = kListNumberingOne;
 	_entriesPerPage = (_h - 4) / LINE_HEIGHT;
 	_currentPos = 3;
-	
+	_selectedItem = -1;
 	_scrollBar = new ScrollBarWidget(boss, _x + _w, _y, kScrollBarWidth, _h);
 	_scrollBar->setTarget(this);
 	
@@ -86,6 +86,8 @@
 void ListWidget::handleClick(int x, int y, int button)
 {
 	if (_flags & WIDGET_ENABLED) {
+		_selectedItem = (y / LINE_HEIGHT) + _currentPos;
+		draw();
 	}
 }
 
@@ -121,6 +123,9 @@
 		} else
 			buffer = "";
 		buffer += _list[pos];
-		gui->drawString(buffer, _x+5, _y+2 + LINE_HEIGHT * i, _w - 10, gui->_textcolor);
+		if (_selectedItem == pos)
+			gui->drawString(buffer, _x+5, _y+2 + LINE_HEIGHT * i, _w - 10, gui->_textcolorhi);
+		else
+			gui->drawString(buffer, _x+5, _y+2 + LINE_HEIGHT * i, _w - 10, gui->_textcolor);
 	}
 }

Index: ListWidget.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/ListWidget.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ListWidget.h	12 Jul 2002 16:24:11 -0000	1.3
+++ ListWidget.h	13 Jul 2002 09:19:23 -0000	1.4
@@ -40,6 +40,7 @@
 	int				_numberingMode;
 	int				_currentPos;
 	int				_entriesPerPage;
+	int				_selectedItem;
 	ScrollBarWidget	*_scrollBar;
 public:
 	ListWidget(Dialog *boss, int x, int y, int w, int h);
@@ -47,7 +48,7 @@
 	
 	void setList(const StringList& list)	{ _list = list; }
 	const StringList& getList()	const		{ return _list; }
-	
+	const int getSelected()	 {return _selectedItem;}
 	void setNumberingMode(int numberingMode)	{ _numberingMode = numberingMode; }
 	
 	virtual void handleClick(int x, int y, int button);

Index: dialog.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/dialog.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- dialog.cpp	12 Jul 2002 16:24:11 -0000	1.16
+++ dialog.cpp	13 Jul 2002 09:19:23 -0000	1.17
@@ -205,7 +205,7 @@
 	new SliderWidget(this, 110, 20, 80, 16, "Volume", 0);
 	
 	// FIXME - test
-	new ListWidget(this, 10, 40, 180, 74);
+	_savegameList = new ListWidget(this, 10, 40, 180, 74);
 }
 
 void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data)
@@ -214,6 +214,7 @@
 	case kSaveCmd:
 		break;
 	case kLoadCmd:
+		//printf("Saving game in slot %d\n", _savegameList->getSelected());
 		break;
 	case kPlayCmd:
 		close();

Index: dialog.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/dialog.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- dialog.h	12 Jul 2002 16:24:11 -0000	1.8
+++ dialog.h	13 Jul 2002 09:19:23 -0000	1.9
@@ -77,6 +77,8 @@
 	SaveLoadDialog(NewGui *gui);
 
 	virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
+protected:
+	Widget* _savegameList;
 };
 
 

Index: widget.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/widget.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- widget.h	12 Jul 2002 16:24:11 -0000	1.11
+++ widget.h	13 Jul 2002 09:19:23 -0000	1.12
@@ -23,7 +23,6 @@
 
 #include "scummsys.h"
 
-
 class Dialog;
 
 enum {





More information about the Scummvm-git-logs mailing list