summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-06-16 20:39:05 +0300
committerAndrei Karas <akaras@inbox.ru>2013-06-16 20:39:05 +0300
commitc106b4914a09fae969f8cb1205b9286dd2beb0e7 (patch)
tree58e34b4ace90c922a3ba061dde59146b4e4b0ed0 /src/gui
parent11f10affa92d3868a4a91d45fe4915d36e1400a9 (diff)
downloadmanaverse-c106b4914a09fae969f8cb1205b9286dd2beb0e7.tar.gz
manaverse-c106b4914a09fae969f8cb1205b9286dd2beb0e7.tar.bz2
manaverse-c106b4914a09fae969f8cb1205b9286dd2beb0e7.tar.xz
manaverse-c106b4914a09fae969f8cb1205b9286dd2beb0e7.zip
Improve tab.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/tab.cpp20
-rw-r--r--src/gui/widgets/tab.h8
2 files changed, 13 insertions, 15 deletions
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*>(graphics)->calcWindow(mVertexes, 0, 0,
- getWidth(), getHeight(), rect);
+ mDimension.width, mDimension.height, rect);
}
static_cast<Graphics*>(graphics)->drawTile(mVertexes);
}
else
{
- static_cast<Graphics*>(graphics)->
- drawImageRect(0, 0, getWidth(), getHeight(), skin->getBorder());
+ static_cast<Graphics*>(graphics)->drawImageRect(
+ 0, 0, mDimension.width, mDimension.height, skin->getBorder());
}
-// static_cast<Graphics*>(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