From 12461c3ca0e0c971f4cdf2ba255c37568208dc94 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 26 May 2006 01:16:21 +0000 Subject: Do not create scrollbar copy on each resolution switch svn-id: r22645 --- gui/console.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'gui') diff --git a/gui/console.cpp b/gui/console.cpp index 419ea59c14..28e21d9628 100644 --- a/gui/console.cpp +++ b/gui/console.cpp @@ -56,6 +56,11 @@ ConsoleDialog::ConsoleDialog(float widthPercent, float heightPercent) // Reset the line buffer memset(_buffer, ' ', kBufferSize); + + // Dummy + _scrollBar = new ScrollBarWidget(this, 0, 0, 5, 10); + _scrollBar->setTarget(this); + init(); _currentPos = 0; @@ -101,14 +106,14 @@ void ConsoleDialog::init() { _h = (uint16)((_heightPercent * screenH - 2) / kConsoleLineHeight); _h = _h * kConsoleLineHeight + 2; - // Add scrollbar + // Set scrollbar dimensions int scrollBarWidth; if (g_gui.getWidgetSize() == kBigWidgetSize) scrollBarWidth = kBigScrollBarWidth; else scrollBarWidth = kNormalScrollBarWidth; - _scrollBar = new ScrollBarWidget(this, _w - scrollBarWidth - 1, 0, scrollBarWidth, _h); - _scrollBar->setTarget(this); + _scrollBar->setPos(_w - scrollBarWidth - 1, 0); + _scrollBar->setSize(scrollBarWidth, _h); _drawingHints = THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND; -- cgit v1.2.3