diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2014-07-10 14:21:03 +0200 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2014-07-10 14:21:03 +0200 |
| commit | 048c2781c541ca0907856d2d13f17b4dc456a71c (patch) | |
| tree | 810d0e0abc93a1133160e94d0cfd9dab801a54d8 /unity-shared | |
| parent | c38ffff5e20f346f2841879f5a35d2ba9a309cdb (diff) | |
RatingsButton: make sure we always pull the virtual function to get/set ratings
(bzr r3830.5.15)
Diffstat (limited to 'unity-shared')
| -rw-r--r-- | unity-shared/RatingsButton.cpp | 7 | ||||
| -rw-r--r-- | unity-shared/RatingsButton.h | 1 |
2 files changed, 4 insertions, 4 deletions
diff --git a/unity-shared/RatingsButton.cpp b/unity-shared/RatingsButton.cpp index eae9c517c..480f2e54f 100644 --- a/unity-shared/RatingsButton.cpp +++ b/unity-shared/RatingsButton.cpp @@ -59,6 +59,7 @@ RatingsButton::RatingsButton(int star_size, int star_gap, NUX_FILE_LINE_DECL) QueueDraw(); }); + key_nav_focus_activate.connect([this](nux::Area*) { SetRating(static_cast<float>(focused_star_+1)/NUM_STARS); }); key_down.connect(sigc::mem_fun(this, &RatingsButton::OnKeyDown)); @@ -77,7 +78,7 @@ void RatingsButton::SetEditable(bool editable) void RatingsButton::SetRating(float rating) { - rating_ = rating; + rating_ = rating; QueueDraw(); } @@ -88,7 +89,7 @@ float RatingsButton::GetRating() const void RatingsButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { - int rating = static_cast<int>(rating_ * NUM_STARS); + int rating = static_cast<int>(GetRating() * NUM_STARS); // FIXME: 9/26/2011 // We should probably support an API for saying whether the ratings // should or shouldn't support half stars...but our only consumer at @@ -284,7 +285,7 @@ void RatingsButton::AddProperties(debug::IntrospectionData& introspection) { introspection .add(GetAbsoluteGeometry()) - .add("rating", rating_) + .add("rating", GetRating()) .add("focused-star", focused_star_) .add("editable", editable_); } diff --git a/unity-shared/RatingsButton.h b/unity-shared/RatingsButton.h index a0cf138d4..6efcb08d7 100644 --- a/unity-shared/RatingsButton.h +++ b/unity-shared/RatingsButton.h @@ -64,7 +64,6 @@ private: void RecvMouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags); void UpdateRatingToMouse(int x); - protected: RawPixel star_size_; RawPixel star_gap_; |
