summaryrefslogtreecommitdiff
path: root/wx+/toggle_button.h
diff options
context:
space:
mode:
Diffstat (limited to 'wx+/toggle_button.h')
-rw-r--r--wx+/toggle_button.h34
1 files changed, 9 insertions, 25 deletions
diff --git a/wx+/toggle_button.h b/wx+/toggle_button.h
index 666f291d..548def1d 100644
--- a/wx+/toggle_button.h
+++ b/wx+/toggle_button.h
@@ -28,8 +28,7 @@ public:
void init(const wxBitmap& activeBmp,
const wxBitmap& inactiveBmp,
- const wxString& activeTooltip,
- const wxString& inactiveTooltip = wxString());
+ const wxString& tooltip);
void setActive(bool value);
bool isActive() const { return active; }
@@ -38,11 +37,8 @@ public:
private:
bool active;
- wxBitmap m_activeBmp;
- wxString m_activeTooltip;
-
- wxBitmap m_inactiveBmp;
- wxString m_inactiveTooltip;
+ wxBitmap activeBmp_;
+ wxBitmap inactiveBmp_;
};
@@ -61,15 +57,13 @@ private:
inline
void ToggleButton::init(const wxBitmap& activeBmp,
const wxBitmap& inactiveBmp,
- const wxString& activeTooltip,
- const wxString& inactiveTooltip)
+ const wxString& tooltip)
{
- m_activeBmp = activeBmp;
- m_activeTooltip = activeTooltip;
- m_inactiveBmp = inactiveBmp;
- m_inactiveTooltip = inactiveTooltip.empty() ? activeTooltip : inactiveTooltip;
+ SetToolTip(tooltip);
+
+ activeBmp_ = activeBmp;
+ inactiveBmp_ = inactiveBmp;
- //load resources
setActive(active);
}
@@ -78,17 +72,7 @@ inline
void ToggleButton::setActive(bool value)
{
active = value;
-
- if (active)
- {
- SetBitmapLabel(m_activeBmp);
- SetToolTip(m_activeTooltip);
- }
- else
- {
- SetBitmapLabel(m_inactiveBmp);
- SetToolTip(m_inactiveTooltip);
- }
+ SetBitmapLabel(active ? activeBmp_ : inactiveBmp_);
}
#endif // TOGGLEBUTTON_H_INCLUDED
bgstack15