summaryrefslogtreecommitdiff
path: root/src/gui/widgets/checkbox.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-03-30 00:07:54 +0300
committerAndrei Karas <akaras@inbox.ru>2014-03-30 00:07:54 +0300
commita93d1e06f928f6e4e1c7f3c58ddb7ae3676c1c63 (patch)
tree2d85d112997176e9ab765e638b0e7f2e16677b83 /src/gui/widgets/checkbox.cpp
parent5c83a96b8ad85ad0562542b9720a0df6c5fb550c (diff)
parent8983700f6c8cc6496626ed3af235e1ec31fe5501 (diff)
downloadplus-a93d1e06f928f6e4e1c7f3c58ddb7ae3676c1c63.tar.gz
plus-a93d1e06f928f6e4e1c7f3c58ddb7ae3676c1c63.tar.bz2
plus-a93d1e06f928f6e4e1c7f3c58ddb7ae3676c1c63.tar.xz
plus-a93d1e06f928f6e4e1c7f3c58ddb7ae3676c1c63.zip
Merge branch 'master' into stable
Diffstat (limited to 'src/gui/widgets/checkbox.cpp')
-rw-r--r--src/gui/widgets/checkbox.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp
index f01495bcf..06dcecab0 100644
--- a/src/gui/widgets/checkbox.cpp
+++ b/src/gui/widgets/checkbox.cpp
@@ -98,6 +98,7 @@ CheckBox::CheckBox(const Widget2 *const widget,
mDrawBox(true)
{
setCaption(caption);
+ mAllowLogic = false;
setFocusable(true);
addMouseListener(this);
@@ -106,9 +107,9 @@ CheckBox::CheckBox(const Widget2 *const widget,
mForegroundColor2 = getThemeColor(Theme::CHECKBOX_OUTLINE);
if (instances == 0)
{
- if (Theme::instance())
+ if (theme)
{
- mSkin = Theme::instance()->load("checkbox.xml", "");
+ mSkin = theme->load("checkbox.xml", "");
updateAlpha();
}
}
@@ -142,8 +143,8 @@ CheckBox::~CheckBox()
if (instances == 0)
{
- if (Theme::instance())
- Theme::instance()->unload(mSkin);
+ if (theme)
+ theme->unload(mSkin);
}
}
@@ -162,7 +163,7 @@ void CheckBox::draw(Graphics *const graphics)
void CheckBox::updateAlpha()
{
const float alpha = std::max(client->getGuiAlpha(),
- Theme::instance()->getMinimumOpacity());
+ theme->getMinimumOpacity());
if (mAlpha != alpha)
{
@@ -234,14 +235,14 @@ void CheckBox::mouseExited(MouseEvent& event A_UNUSED)
mHasMouse = false;
}
-void CheckBox::keyPressed(KeyEvent& keyEvent)
+void CheckBox::keyPressed(KeyEvent& event)
{
- const int action = keyEvent.getActionId();
+ const int action = event.getActionId();
if (action == Input::KEY_GUI_SELECT)
{
toggleSelected();
- keyEvent.consume();
+ event.consume();
}
}
@@ -252,15 +253,18 @@ void CheckBox::adjustSize()
+ getFont()->getWidth(mCaption) + mPadding);
}
-void CheckBox::mouseClicked(MouseEvent& mouseEvent)
+void CheckBox::mouseClicked(MouseEvent& event)
{
- if (mouseEvent.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseEvent::LEFT)
+ {
toggleSelected();
+ event.consume();
+ }
}
-void CheckBox::mouseDragged(MouseEvent& mouseEvent)
+void CheckBox::mouseDragged(MouseEvent& event)
{
- mouseEvent.consume();
+ event.consume();
}
void CheckBox::toggleSelected()