summaryrefslogtreecommitdiff
path: root/src/gui/widgets/radiobutton.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-24 15:11:39 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-24 15:11:39 +0300
commit07cef0090ecb3f9b904afbaeaf7b2e2449f34794 (patch)
tree6847d35368baa2a279212ab1562e0e1d277c58df /src/gui/widgets/radiobutton.h
parent2027da5f18f3ffa4808c8d686990512a9d14c1be (diff)
downloadmanaverse-07cef0090ecb3f9b904afbaeaf7b2e2449f34794.tar.gz
manaverse-07cef0090ecb3f9b904afbaeaf7b2e2449f34794.tar.bz2
manaverse-07cef0090ecb3f9b904afbaeaf7b2e2449f34794.tar.xz
manaverse-07cef0090ecb3f9b904afbaeaf7b2e2449f34794.zip
Improve radiobutton draw speed.
Use local text image and improve a bit calculations in draw.
Diffstat (limited to 'src/gui/widgets/radiobutton.h')
-rw-r--r--src/gui/widgets/radiobutton.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/gui/widgets/radiobutton.h b/src/gui/widgets/radiobutton.h
index eebbae8bd..d33634546 100644
--- a/src/gui/widgets/radiobutton.h
+++ b/src/gui/widgets/radiobutton.h
@@ -68,6 +68,9 @@
#include "listeners/keylistener.h"
#include "listeners/mouselistener.h"
+#include "listeners/widgetlistener.h"
+
+#include "gui/fonts/textchunk.h"
#include "gui/widgets/widget.h"
@@ -80,7 +83,8 @@ class Skin;
*/
class RadioButton final : public Widget,
public MouseListener,
- public KeyListener
+ public KeyListener,
+ public WidgetListener
{
public:
@@ -161,8 +165,7 @@ class RadioButton final : public Widget,
* @param caption The caption of the radio button.
* @see getCaption, adjustSize
*/
- void setCaption(const std::string &caption)
- { mCaption = caption; }
+ void setCaption(const std::string &caption);
void mouseClicked(MouseEvent& event) override final;
@@ -187,6 +190,10 @@ class RadioButton final : public Widget,
const std::string &getGroup() const
{ return mGroup; }
+ void setParent(Widget *widget) override final;
+
+ void widgetHidden(const Event &event) override final;
+
private:
static int instances;
static Skin *mSkin;
@@ -207,6 +214,8 @@ class RadioButton final : public Widget,
*/
std::string mGroup;
+ TextChunk mTextChunk;
+
/**
* Typdef.
*/
@@ -226,7 +235,9 @@ class RadioButton final : public Widget,
int mImagePadding;
int mImageSize;
int mSpacing;
+ int mTextX;
bool mHasMouse;
+ bool mTextChanged;
};
#endif // GUI_WIDGETS_RADIOBUTTON_H