diff options
author | B Stack <bgstack15@gmail.com> | 2020-07-22 11:37:03 -0400 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2020-07-22 11:37:03 -0400 |
commit | c95b3937fef3e2c63768f1b3b1dc2c898f23d91d (patch) | |
tree | 10260e25ae905564f7978b83fc4e316670f987c6 /wx+/toggle_button.h | |
parent | Merge branch '10.25' into 'master' (diff) | |
download | FreeFileSync-c95b3937fef3e2c63768f1b3b1dc2c898f23d91d.tar.gz FreeFileSync-c95b3937fef3e2c63768f1b3b1dc2c898f23d91d.tar.bz2 FreeFileSync-c95b3937fef3e2c63768f1b3b1dc2c898f23d91d.zip |
add upstream 11.0
Diffstat (limited to 'wx+/toggle_button.h')
-rw-r--r-- | wx+/toggle_button.h | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/wx+/toggle_button.h b/wx+/toggle_button.h index 98ca32b3..0a359c5c 100644 --- a/wx+/toggle_button.h +++ b/wx+/toggle_button.h @@ -16,6 +16,7 @@ namespace zen class ToggleButton : public wxBitmapButton { public: + //wxBitmapButton constructor ToggleButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, @@ -23,13 +24,25 @@ public: const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr) : wxBitmapButton(parent, id, bitmap, pos, size, style, validator, name) + const wxString& name = wxButtonNameStr) : + wxBitmapButton(parent, id, bitmap, pos, size, style, validator, name) {} + + //wxButton constructor + ToggleButton(wxWindow* parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr) : + wxBitmapButton(parent, id, wxNullBitmap, pos, size, style, validator, name) { - SetLayoutDirection(wxLayout_LeftToRight); //avoid mirroring RTL languages like Hebrew or Arabic + SetLabel(label); } - void init(const wxBitmap& bmpActive, - const wxBitmap& bmpInactive); + void init(const wxImage& imgActive, + const wxImage& imgInactive); void setActive(bool value); bool isActive() const { return active_; } @@ -37,8 +50,8 @@ public: private: bool active_ = false; - wxBitmap bmpActive_; - wxBitmap bmpInactive_; + wxImage imgActive_; + wxImage imgInactive_; }; @@ -49,13 +62,13 @@ private: //######################## implementation ######################## inline -void ToggleButton::init(const wxBitmap& bmpActive, - const wxBitmap& bmpInactive) +void ToggleButton::init(const wxImage& imgActive, + const wxImage& imgInactive) { - bmpActive_ = bmpActive; - bmpInactive_ = bmpInactive; + imgActive_ = imgActive; + imgInactive_ = imgInactive; - setImage(*this, active_ ? bmpActive_ : bmpInactive_); + setImage(*this, active_ ? imgActive_ : imgInactive_); } @@ -65,7 +78,7 @@ void ToggleButton::setActive(bool value) if (active_ != value) { active_ = value; - setImage(*this, active_ ? bmpActive_ : bmpInactive_); + setImage(*this, active_ ? imgActive_ : imgInactive_); } } } |