aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2005-04-17 11:47:44 +0000
committerMax Horn2005-04-17 11:47:44 +0000
commita9f700b0a31c8bf2de7c2adf78a0e2b36f4edfbc (patch)
tree5fe80e0c3338c34295e5e916c655697bb19038dd
parentf4a5d245b58648e3d8fe163ea9ef46cd63407f85 (diff)
downloadscummvm-rg350-a9f700b0a31c8bf2de7c2adf78a0e2b36f4edfbc.tar.gz
scummvm-rg350-a9f700b0a31c8bf2de7c2adf78a0e2b36f4edfbc.tar.bz2
scummvm-rg350-a9f700b0a31c8bf2de7c2adf78a0e2b36f4edfbc.zip
Allow usage of ScrollBarWidget with a non-standard width
svn-id: r17650
-rw-r--r--gui/ListWidget.cpp4
-rw-r--r--gui/ScrollBarWidget.cpp6
-rw-r--r--gui/ScrollBarWidget.h2
-rw-r--r--gui/console.cpp8
4 files changed, 10 insertions, 10 deletions
diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp
index f6b3526184..a6cf672f6d 100644
--- a/gui/ListWidget.cpp
+++ b/gui/ListWidget.cpp
@@ -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 @@ ListWidget::ListWidget(GuiObject *boss, int x, int y, int w, int h)
_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;
diff --git a/gui/ScrollBarWidget.cpp b/gui/ScrollBarWidget.cpp
index edcee76ff8..50c66cb63d 100644
--- a/gui/ScrollBarWidget.cpp
+++ b/gui/ScrollBarWidget.cpp
@@ -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 @@ void ScrollBarWidget::drawWidget(bool hilite) {
// 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);
diff --git a/gui/ScrollBarWidget.h b/gui/ScrollBarWidget.h
index 3bf6d1d009..dd132096c5 100644
--- a/gui/ScrollBarWidget.h
+++ b/gui/ScrollBarWidget.h
@@ -26,7 +26,7 @@
namespace GUI {
enum {
- kScrollBarWidth = 9
+ kDefaultScrollBarWidth = 9
};
diff --git a/gui/console.cpp b/gui/console.cpp
index 9e5abe6b2e..badbce2cee 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -74,7 +74,7 @@ ConsoleDialog::ConsoleDialog(float widthPercent, float heightPercent)
_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 @@ ConsoleDialog::ConsoleDialog(float widthPercent, float heightPercent)
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;
}