From c106b4914a09fae969f8cb1205b9286dd2beb0e7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 16 Jun 2013 20:39:05 +0300 Subject: Improve tab. --- src/gui/widgets/tab.cpp | 20 ++++++++------------ src/gui/widgets/tab.h | 8 +++++--- 2 files changed, 13 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index c70d15850..813ae0ef8 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -61,7 +61,6 @@ Tab::Tab(const Widget2 *const widget) : gcn::MouseListener(), gcn::WidgetListener(), mLabel(new Label(this)), - mHasMouse(false), mTabbedArea(nullptr), mTabColor(&getThemeColor(Theme::TAB)), mTabOutlineColor(&getThemeColor(Theme::TAB_OUTLINE)), @@ -76,8 +75,9 @@ Tab::Tab(const Widget2 *const widget) : mPlayerFlashOutlineColor(&getThemeColor(Theme::TAB_PLAYER_FLASH_OUTLINE)), mFlash(0), mVertexes(new ImageCollection), + mMode(0), mRedraw(true), - mMode(0) + mHasMouse(false) { init(); } @@ -146,11 +146,11 @@ void Tab::updateAlpha() { for (int t = 0; t < TAB_COUNT; t++) { - Skin *skin = tabImg[t]; + Skin *const skin = tabImg[t]; if (skin) { const ImageRect &rect = skin->getBorder(); - Image *image = rect.grid[a]; + Image *const image = rect.grid[a]; if (image) image->setAlpha(mAlpha); } @@ -221,21 +221,17 @@ void Tab::draw(gcn::Graphics *graphics) mRedraw = false; mVertexes->clear(); static_cast(graphics)->calcWindow(mVertexes, 0, 0, - getWidth(), getHeight(), rect); + mDimension.width, mDimension.height, rect); } static_cast(graphics)->drawTile(mVertexes); } else { - static_cast(graphics)-> - drawImageRect(0, 0, getWidth(), getHeight(), skin->getBorder()); + static_cast(graphics)->drawImageRect( + 0, 0, mDimension.width, mDimension.height, skin->getBorder()); } -// static_cast(graphics)-> -// drawImageRect(0, 0, getWidth(), getHeight(), tabImg[mode]); - - // draw label drawChildren(graphics); BLOCK_END("Tab::draw") } @@ -280,7 +276,7 @@ void Tab::setTabbedArea(TabbedArea* tabbedArea) mTabbedArea = tabbedArea; } -TabbedArea* Tab::getTabbedArea() +TabbedArea* Tab::getTabbedArea() const { return mTabbedArea; } diff --git a/src/gui/widgets/tab.h b/src/gui/widgets/tab.h index 6cd2a3e2d..cbc50a2ef 100644 --- a/src/gui/widgets/tab.h +++ b/src/gui/widgets/tab.h @@ -135,7 +135,7 @@ class Tab : public gcn::BasicContainer, void setTabbedArea(TabbedArea* tabbedArea); - TabbedArea* getTabbedArea() A_WARN_UNUSED; + TabbedArea* getTabbedArea() const A_WARN_UNUSED; void setCaption(const std::string& caption); @@ -153,7 +153,6 @@ class Tab : public gcn::BasicContainer, Label* mLabel; - bool mHasMouse; TabbedArea* mTabbedArea; @@ -177,8 +176,11 @@ class Tab : public gcn::BasicContainer, const gcn::Color *mPlayerFlashOutlineColor; int mFlash; ImageCollection *mVertexes; - bool mRedraw; int mMode; + bool mRedraw; + + protected: + bool mHasMouse; }; #endif // GUI_WIDGETS_TAB_H -- cgit v1.2.3-60-g2f50