diff options
| -rw-r--r-- | hud/HudAbstractView.h | 1 | ||||
| -rw-r--r-- | hud/HudController.cpp | 2 | ||||
| -rw-r--r-- | hud/HudView.cpp | 29 | ||||
| -rw-r--r-- | hud/HudView.h | 3 |
4 files changed, 18 insertions, 17 deletions
diff --git a/hud/HudAbstractView.h b/hud/HudAbstractView.h index 56f20e2be..a1c9ca0ba 100644 --- a/hud/HudAbstractView.h +++ b/hud/HudAbstractView.h @@ -43,7 +43,6 @@ public: virtual void AboutToShow() = 0; virtual void AboutToHide() = 0; - virtual void Relayout() = 0; virtual void ResetToDefault() = 0; virtual void SearchFinished() = 0; virtual void SetIcon(std::string const& icon_name, unsigned int tile_size, unsigned int size, unsigned int padding) = 0; diff --git a/hud/HudController.cpp b/hud/HudController.cpp index c6f5d5ddc..71895a679 100644 --- a/hud/HudController.cpp +++ b/hud/HudController.cpp @@ -252,7 +252,7 @@ void Controller::Relayout(bool check_monitor) } nux::Geometry const& geo = GetIdealWindowGeometry(); - view_->Relayout(); + view_->QueueDraw(); window_->SetGeometry(geo); panel::Style &panel_style = panel::Style::Instance(); view_->SetMonitorOffset(launcher_width, panel_style.panel_height); diff --git a/hud/HudView.cpp b/hud/HudView.cpp index 09a6ad413..e32190218 100644 --- a/hud/HudView.cpp +++ b/hud/HudView.cpp @@ -121,7 +121,7 @@ View::View() mouse_down.connect(sigc::mem_fun(this, &View::OnMouseButtonDown)); - Relayout(); + QueueDraw(); } View::~View() @@ -192,22 +192,12 @@ void View::ResetToDefault() SetQueries(Hud::Queries()); current_height_ = content_layout_->GetBaseHeight();; + UpdateLayoutGeometry(); + search_bar_->search_string = ""; search_bar_->search_hint = _("Type your command"); } -void View::Relayout() -{ - nux::Geometry const& geo = GetGeometry(); - content_geo_ = GetBestFitGeometry(geo); - LOG_DEBUG(logger) << "content_geo: " << content_geo_.width << "x" << content_geo_.height; - - layout_->SetMinimumWidth(content_geo_.width); - layout_->SetMaximumSize(content_geo_.width, content_geo_.height); - - QueueDraw(); -} - nux::View* View::default_focus() const { return search_bar_->text_entry(); @@ -328,7 +318,8 @@ void View::ShowEmbeddedIcon(bool show) RemoveChild(icon_.GetPointer()); } - Relayout(); + UpdateLayoutGeometry(); + QueueDraw(); } // Gives us the width and height of the contents that will give us the best "fit", @@ -409,6 +400,7 @@ void View::SetupViews() } }); + UpdateLayoutGeometry(); layout_->AddLayout(content_layout_.GetPointer(), 1, nux::MINOR_POSITION_START); } @@ -417,6 +409,15 @@ void View::SetupViews() SetLayout(super_layout); } +void View::UpdateLayoutGeometry() +{ + nux::Geometry const& geo = GetGeometry(); + content_geo_ = GetBestFitGeometry(geo); + + layout_->SetMinimumWidth(content_geo_.width); + layout_->SetMaximumSize(content_geo_.width, content_geo_.height); +} + void View::OnSearchChanged(std::string const& search_string) { LOG_DEBUG(logger) << "got search change"; diff --git a/hud/HudView.h b/hud/HudView.h index 8161187fa..9cb88ce61 100644 --- a/hud/HudView.h +++ b/hud/HudView.h @@ -49,7 +49,6 @@ public: void ResetToDefault(); - void Relayout(); nux::View* default_focus() const; std::list<HudButton::Ptr> const& buttons() const; @@ -83,7 +82,9 @@ private: bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character); void OnSearchbarActivated(); bool AcceptKeyNavFocus(); + nux::Geometry GetBestFitGeometry(nux::Geometry const& for_geo); + void UpdateLayoutGeometry(); void ProcessGrowShrink(); |
