diff options
author | B Stack <bgstack15@gmail.com> | 2019-11-20 08:36:44 -0500 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2019-11-20 08:36:44 -0500 |
commit | ed50041589974d31296cb30dc1897f7fba6336c2 (patch) | |
tree | e2c5c7b1f98e64011b1ee8ca4e9bb9157510dfe7 /wx+/toggle_button.h | |
parent | Merge branch '10.17' into 'master' (diff) | |
download | FreeFileSync-ed50041589974d31296cb30dc1897f7fba6336c2.tar.gz FreeFileSync-ed50041589974d31296cb30dc1897f7fba6336c2.tar.bz2 FreeFileSync-ed50041589974d31296cb30dc1897f7fba6336c2.zip |
add upstream 10.18
Diffstat (limited to 'wx+/toggle_button.h')
-rw-r--r-- | wx+/toggle_button.h | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/wx+/toggle_button.h b/wx+/toggle_button.h index f61c3857..98ca32b3 100644 --- a/wx+/toggle_button.h +++ b/wx+/toggle_button.h @@ -28,8 +28,8 @@ public: SetLayoutDirection(wxLayout_LeftToRight); //avoid mirroring RTL languages like Hebrew or Arabic } - void init(const wxBitmap& activeBmp, - const wxBitmap& inactiveBmp); + void init(const wxBitmap& bmpActive, + const wxBitmap& bmpInactive); void setActive(bool value); bool isActive() const { return active_; } @@ -37,8 +37,8 @@ public: private: bool active_ = false; - wxBitmap activeBmp_; - wxBitmap inactiveBmp_; + wxBitmap bmpActive_; + wxBitmap bmpInactive_; }; @@ -49,21 +49,24 @@ private: //######################## implementation ######################## inline -void ToggleButton::init(const wxBitmap& activeBmp, - const wxBitmap& inactiveBmp) +void ToggleButton::init(const wxBitmap& bmpActive, + const wxBitmap& bmpInactive) { - activeBmp_ = activeBmp; - inactiveBmp_ = inactiveBmp; + bmpActive_ = bmpActive; + bmpInactive_ = bmpInactive; - setActive(active_); + setImage(*this, active_ ? bmpActive_ : bmpInactive_); } inline void ToggleButton::setActive(bool value) { - active_ = value; - setImage(*this, active_ ? activeBmp_ : inactiveBmp_); + if (active_ != value) + { + active_ = value; + setImage(*this, active_ ? bmpActive_ : bmpInactive_); + } } } |