void MyFrame::OnRemoveAll( wxCommandEvent& WXUNUSED(event) ) { for( int i = 0; i != MAX_LAYOUTS; ++i ) { RemoveLayout( i ); } Refresh(); }
void PreviewInfoHintWidget::SetupViews() { RemoveLayout(); auto& style = previews::Style::Instance(); 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); }; layout_ = new nux::HLayout(); layout_->SetSpaceBetweenChildren(LAYOUT_SPACING.CP(scale)); auto *hint_vlayout = new nux::VLayout(); hint_vlayout->SetSpaceBetweenChildren(HINTS_SPACING.CP(scale)); layout_->AddLayout(hint_vlayout); info_names_layout_ = hint_vlayout; hint_vlayout = new nux::VLayout(); hint_vlayout->SetSpaceBetweenChildren(HINTS_SPACING.CP(scale)); layout_->AddLayout(hint_vlayout); info_values_layout_ = hint_vlayout; for (dash::Preview::InfoHintPtr const& info_hint : preview_model_->GetInfoHints()) { // The "%s" is used in the dash preview to display the "<hint>: <value>" infos auto const& name = glib::String(g_strdup_printf (_("%s:"), info_hint->display_name.c_str())).Str(); auto* info_name = new StaticCairoText(name == ":" ? "" : name, true, NUX_TRACKER_LOCATION); info_name->SetFont(style.info_hint_bold_font()); info_name->SetLines(-1); info_name->SetScale(scale); info_name->SetTextAlignment(StaticCairoText::NUX_ALIGN_RIGHT); info_name->SetMinimumWidth(style.GetInfoHintNameMinimumWidth().CP(scale)); info_name->SetMaximumWidth(style.GetInfoHintNameMaximumWidth().CP(scale)); info_name->mouse_click.connect(on_mouse_down); info_names_layout_->AddView(info_name, 1, nux::MINOR_POSITION_RIGHT); auto* info_value = new StaticCairoText(StringFromVariant(info_hint->value), true, NUX_TRACKER_LOCATION); info_value->SetFont(style.info_hint_font()); info_value->SetLines(-1); info_value->SetScale(scale); info_value->mouse_click.connect(on_mouse_down); info_values_layout_->AddView(info_value, 1, nux::MINOR_POSITION_LEFT); } mouse_click.connect(on_mouse_down); SetLayout(layout_); }
void MyFrame::OnRemove( wxCommandEvent& WXUNUSED(event) ) { RemoveLayout( mActiveLayoutNo ); Refresh(); }