diff options
Diffstat (limited to 'gui/TabWidget.cpp')
-rw-r--r-- | gui/TabWidget.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gui/TabWidget.cpp b/gui/TabWidget.cpp index 934179a441..40d3a69d2f 100644 --- a/gui/TabWidget.cpp +++ b/gui/TabWidget.cpp @@ -26,7 +26,7 @@ enum { kTabHeight = 15, - + kTabLeftOffset = 4, kTabSpacing = 2, kTabPadding = 3 @@ -34,11 +34,11 @@ enum { TabWidget::TabWidget(GuiObject *boss, int x, int y, int w, int h) : Widget(boss, x, y, w, h) { - + _flags = WIDGET_ENABLED; _type = kTabWidget; _activeTab = -1; - + _tabWidth = 40; } @@ -61,7 +61,7 @@ int TabWidget::addTab(const String &title) { newTab.firstWidget = NULL; _tabs.push_back(newTab); - + int numTabs = _tabs.size(); // Determine the new tab width @@ -71,10 +71,10 @@ int TabWidget::addTab(const String &title) { int maxWidth = (_w - kTabLeftOffset) / numTabs - kTabLeftOffset; if (_tabWidth > maxWidth) _tabWidth = maxWidth; - + // Activate the new tab setActiveTab(numTabs - 1); - + return _activeTab; } @@ -102,7 +102,7 @@ void TabWidget::handleMouseDown(int x, int y, int button, int clickCount) { if (tabID >= _tabs.size()) tabID = -1; } - + // If a tab was clicked, switch to that pane if (tabID >= 0) { setActiveTab(tabID); @@ -120,7 +120,7 @@ void TabWidget::drawWidget(bool hilite) { NewGui *gui = &g_gui; // Draw horizontal line - gui->hLine(_x+1, _y + kTabHeight - 2, _x + _w - 2, gui->_shadowcolor); + gui->hLine(_x + 1, _y + kTabHeight - 2, _x + _w - 2, gui->_shadowcolor); // Iterate over all tabs and draw them int i, x = _x + kTabLeftOffset; @@ -128,7 +128,7 @@ void TabWidget::drawWidget(bool hilite) { NewGuiColor color = (i == _activeTab) ? gui->_color : gui->_shadowcolor; int yOffset = (i == _activeTab) ? 0 : 2; gui->box(x, _y + yOffset, _tabWidth, kTabHeight - yOffset, color, color); - gui->drawString(_tabs[i].title, x + kTabPadding, _y + yOffset/2 + 4, _tabWidth - 2 * kTabPadding, gui->_textcolor, kTextAlignCenter); + gui->drawString(_tabs[i].title, x + kTabPadding, _y + yOffset / 2 + 4, _tabWidth - 2 * kTabPadding, gui->_textcolor, kTextAlignCenter); x += _tabWidth + kTabSpacing; } |