diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2014-07-10 14:00:57 +0200 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2014-07-10 14:00:57 +0200 |
| commit | c38ffff5e20f346f2841879f5a35d2ba9a309cdb (patch) | |
| tree | e09ee92d26226cd19452bcb467bd99cc2e6cd971 /dash | |
| parent | 4de6736c3dacd415d0fa016f50d99ca0350ef803 (diff) | |
RatingsButton: correctly scale the ratings button
(bzr r3830.5.14)
Diffstat (limited to 'dash')
| -rw-r--r-- | dash/previews/PreviewRatingsWidget.cpp | 27 | ||||
| -rw-r--r-- | dash/previews/PreviewRatingsWidget.h | 1 |
2 files changed, 8 insertions, 20 deletions
diff --git a/dash/previews/PreviewRatingsWidget.cpp b/dash/previews/PreviewRatingsWidget.cpp index d4ac893ff..13fee6e1e 100644 --- a/dash/previews/PreviewRatingsWidget.cpp +++ b/dash/previews/PreviewRatingsWidget.cpp @@ -29,6 +29,7 @@ #include "unity-shared/RatingsButton.h" #include "unity-shared/StaticCairoText.h" #include "unity-shared/PreviewStyle.h" +#include "unity-shared/DashStyle.h" #include "PreviewRatingsWidget.h" namespace unity @@ -41,8 +42,8 @@ namespace previews namespace { const RawPixel CHILDREN_SPACE = 3_em; - const RawPixel RATINGS_SIZE = 18_em; - const RawPixel RATINGS_GAP = 2_em; + const int RATINGS_SIZE = 18; + const int RATINGS_GAP = 2; } NUX_IMPLEMENT_OBJECT_TYPE(PreviewRatingsWidget); @@ -58,9 +59,10 @@ PreviewRatingsWidget::PreviewRatingsWidget(NUX_FILE_LINE_DECL) auto on_mouse_down = [this](int x, int y, unsigned long button_flags, unsigned long key_flags) { this->preview_container_.OnMouseDown(x, y, button_flags, key_flags); }; - ratings_ = new RatingsButton(RATINGS_SIZE.CP(scale), RATINGS_GAP.CP(scale)); + ratings_ = new RatingsButton(RATINGS_SIZE, RATINGS_GAP); ratings_->SetEditable(false); ratings_->mouse_click.connect(on_mouse_down); + ratings_->scale = scale(); layout_->AddView(ratings_); reviews_ = new StaticCairoText("", NUX_TRACKER_LOCATION); @@ -77,10 +79,6 @@ PreviewRatingsWidget::PreviewRatingsWidget(NUX_FILE_LINE_DECL) scale.changed.connect(sigc::mem_fun(this, &PreviewRatingsWidget::UpdateScale)); } -PreviewRatingsWidget::~PreviewRatingsWidget() -{ -} - void PreviewRatingsWidget::SetRating(float rating) { ratings_->SetRating(rating); @@ -128,19 +126,10 @@ void PreviewRatingsWidget::AddProperties(debug::IntrospectionData& introspection void PreviewRatingsWidget::UpdateScale(double scale) { - if (reviews_) - reviews_->SetScale(scale); - - if (ratings_) - { - ratings_->star_size_ = RATINGS_SIZE.CP(scale); - ratings_->star_gap_ = RATINGS_GAP.CP(scale); - } - + reviews_->SetScale(scale); + ratings_->scale = scale; preview_container_.scale = scale; - - if (layout_) - layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale)); + layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale)); QueueRelayout(); QueueDraw(); diff --git a/dash/previews/PreviewRatingsWidget.h b/dash/previews/PreviewRatingsWidget.h index 6b3784ff7..f55f2f69c 100644 --- a/dash/previews/PreviewRatingsWidget.h +++ b/dash/previews/PreviewRatingsWidget.h @@ -45,7 +45,6 @@ class PreviewRatingsWidget : public debug::Introspectable, public nux::View NUX_DECLARE_OBJECT_TYPE(PreviewRatingsWidget, nux::View); public: PreviewRatingsWidget(NUX_FILE_LINE_PROTO); - virtual ~PreviewRatingsWidget(); void SetRating(float rating); float GetRating() const; |
