diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2015-07-01 03:46:03 +0200 | 
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2015-07-01 03:46:03 +0200 | 
| commit | 9adea4aefa6cda838d82a612853359de664374ef (patch) | |
| tree | fc1f5b5e741c63be2afc7a717820bcebe2c0eeef /shutdown | |
| parent | fc2da0e76f5b004c570eaf73a99b846f533941f0 (diff) | |
SessionButton: set button opacity to 75% when pressed
Fixes LP: #1301655 (bzr r3983.7.3)
Diffstat (limited to 'shutdown')
| -rw-r--r-- | shutdown/SessionButton.cpp | 7 | ||||
| -rw-r--r-- | shutdown/SessionButton.h | 1 | 
2 files changed, 8 insertions, 0 deletions
| diff --git a/shutdown/SessionButton.cpp b/shutdown/SessionButton.cpp index 06a8afa04..2e0eac9f9 100644 --- a/shutdown/SessionButton.cpp +++ b/shutdown/SessionButton.cpp @@ -40,6 +40,7 @@ Button::Button(Action action, NUX_FILE_LINE_DECL)  : nux::View(NUX_FILE_LINE_PARAM)  , scale(1.0)  , highlighted(false) + , pressed(false)  , action([this] { return action_; })  , label([this] { return label_view_->GetText(); })  , action_(action) @@ -107,6 +108,8 @@ Button::Button(Action action, NUX_FILE_LINE_DECL)  mouse_enter.connect([this] (int, int, unsigned long, unsigned long) { highlighted = true; });  mouse_leave.connect([this] (int, int, unsigned long, unsigned long) { highlighted = false; });  mouse_click.connect([this] (int, int, unsigned long, unsigned long) { activated.emit(); }); + mouse_down.connect([this] (int, int, unsigned long, unsigned long) { pressed = true; }); + mouse_up.connect([this] (int, int, unsigned long, unsigned long) { pressed = false; });  begin_key_focus.connect([this] { highlighted = true; });  end_key_focus.connect([this] { highlighted = false; }); @@ -116,6 +119,10 @@ Button::Button(Action action, NUX_FILE_LINE_DECL)  image_view_->SetTexture(value ? highlight_tex_ : normal_tex_);  label_view_->SetTextColor(value ? nux::color::White : nux::color::Transparent);  }); + + pressed.changed.connect([this] (bool value) { + image_view_->SetOpacity(value ? 0.75 : 1.0); + });  }  void Button::UpdateTextures(std::string const& texture_prefix) diff --git a/shutdown/SessionButton.h b/shutdown/SessionButton.h index a25a65cdc..493113e8a 100644 --- a/shutdown/SessionButton.h +++ b/shutdown/SessionButton.h @@ -52,6 +52,7 @@ public:  nux::Property<double> scale;  nux::Property<bool> highlighted; + nux::Property<bool> pressed;  nux::ROProperty<Action> action;  nux::ROProperty<std::string> label; | 
