Allow usage of ScrollBarWidget with a non-standard width
svn-id: r17650
This commit is contained in:
parent
f4a5d245b5
commit
a9f700b0a3
4 changed files with 10 additions and 10 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
namespace GUI {
|
||||
|
||||
enum {
|
||||
kScrollBarWidth = 9
|
||||
kDefaultScrollBarWidth = 9
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue