[Scummvm-cvs-logs] CVS: scummvm/gui ListWidget.cpp,1.46,1.47 ScrollBarWidget.cpp,1.20,1.21 ScrollBarWidget.h,1.8,1.9 console.cpp,1.58,1.59

Max Horn fingolfin at users.sourceforge.net
Sun Apr 17 04:48:29 CEST 2005


Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3061

Modified Files:
	ListWidget.cpp ScrollBarWidget.cpp ScrollBarWidget.h 
	console.cpp 
Log Message:
Allow usage of ScrollBarWidget with a non-standard width

Index: ListWidget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/ListWidget.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- ListWidget.cpp	9 Apr 2005 17:51:40 -0000	1.46
+++ ListWidget.cpp	17 Apr 2005 11:47:44 -0000	1.47
@@ -28,7 +28,7 @@
 namespace GUI {
 
 ListWidget::ListWidget(GuiObject *boss, int x, int y, int w, int h)
-	: EditableWidget(boss, x, y, w - kScrollBarWidth, h), CommandSender(boss) {
+	: EditableWidget(boss, x, y, w - kDefaultScrollBarWidth, h), CommandSender(boss) {
 	_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE;
 	_type = kListWidget;
 	_editMode = false;
@@ -36,7 +36,7 @@
 	_entriesPerPage = (_h - 2) / kLineHeight;
 	_currentPos = 0;
 	_selectedItem = -1;
-	_scrollBar = new ScrollBarWidget(boss, _x + _w, _y, kScrollBarWidth, _h);
+	_scrollBar = new ScrollBarWidget(boss, _x + _w, _y, kDefaultScrollBarWidth, _h);
 	_scrollBar->setTarget(this);
 	_currentKeyDown = 0;
 	

Index: ScrollBarWidget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/ScrollBarWidget.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- ScrollBarWidget.cpp	17 Apr 2005 11:26:13 -0000	1.20
+++ ScrollBarWidget.cpp	17 Apr 2005 11:47:44 -0000	1.21
@@ -26,7 +26,7 @@
 
 namespace GUI {
 
-#define UP_DOWN_BOX_HEIGHT	10
+#define UP_DOWN_BOX_HEIGHT	(_w+1)
 
 // Up arrow
 static uint32 up_arrow[8] = {
@@ -215,13 +215,13 @@
 
 	// Up arrow
 	gui->frameRect(_x, _y, _w, UP_DOWN_BOX_HEIGHT, gui->_color);
-	gui->drawBitmap(up_arrow, _x + 1, _y,
+	gui->drawBitmap(up_arrow, _x + 1 + (_w - 8) / 2, _y + (_w - 8) / 2,
 					isSinglePage ? gui->_color :
 					(hilite && _part == kUpArrowPart) ? gui->_textcolorhi : gui->_textcolor);
 
 	// Down arrow
 	gui->frameRect(_x, bottomY - UP_DOWN_BOX_HEIGHT, _w, UP_DOWN_BOX_HEIGHT, gui->_color);
-	gui->drawBitmap(down_arrow, _x + 1, bottomY - UP_DOWN_BOX_HEIGHT,
+	gui->drawBitmap(down_arrow, _x + 1 + (_w - 8) / 2, bottomY - UP_DOWN_BOX_HEIGHT + (_w - 8) / 2,
 					isSinglePage ? gui->_color :
 					(hilite && _part == kDownArrowPart) ? gui->_textcolorhi : gui->_textcolor);
 

Index: ScrollBarWidget.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/ScrollBarWidget.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ScrollBarWidget.h	1 Jan 2005 16:09:06 -0000	1.8
+++ ScrollBarWidget.h	17 Apr 2005 11:47:44 -0000	1.9
@@ -26,7 +26,7 @@
 namespace GUI {
 
 enum {
-	kScrollBarWidth		= 9
+	kDefaultScrollBarWidth		= 9
 };
 
 

Index: console.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/console.cpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- console.cpp	17 Apr 2005 11:20:58 -0000	1.58
+++ console.cpp	17 Apr 2005 11:47:44 -0000	1.59
@@ -74,7 +74,7 @@
 	_slideTime = 0;
 
 	// Add scrollbar
-	_scrollBar = new ScrollBarWidget(this, _w - kScrollBarWidth - 1, 0, kScrollBarWidth, _h);
+	_scrollBar = new ScrollBarWidget(this, _w - kDefaultScrollBarWidth - 1, 0, kDefaultScrollBarWidth, _h);
 	_scrollBar->setTarget(this);
 
 	// Init callback
@@ -98,13 +98,13 @@
 void ConsoleDialog::reflowLayout() {
 	// Calculate the real width/height (rounded to char/line multiples)
 	_w = (uint16)(_widthPercent * g_system->getOverlayWidth());
-//	_w = (_widthPercent * g_system->getOverlayWidth() - kScrollBarWidth - 2) / kConsoleCharWidth;
-//	_w = _w * kConsoleCharWidth + kScrollBarWidth + 2;
+//	_w = (_widthPercent * g_system->getOverlayWidth() - kDefaultScrollBarWidth - 2) / kConsoleCharWidth;
+//	_w = _w * kConsoleCharWidth + kDefaultScrollBarWidth + 2;
 	_h = (uint16)((_heightPercent * g_system->getOverlayHeight() - 2) / kConsoleLineHeight);
 	_h = _h * kConsoleLineHeight + 2;
 
 	// Calculate depending values
-	_lineWidth = (_w - kScrollBarWidth - 2) / kConsoleCharWidth;
+	_lineWidth = (_w - kDefaultScrollBarWidth - 2) / kConsoleCharWidth;
 	_linesPerPage = (_h - 2) / kConsoleLineHeight;
 }
 





More information about the Scummvm-git-logs mailing list