Resizing panel to 1 px

This commit is contained in:
YuSanka 2018-06-28 17:52:20 +02:00
parent 0171f49ad0
commit 896d898124
2 changed files with 21 additions and 19 deletions

View File

@ -40,7 +40,7 @@ void Tab::create_preset_tab(PresetBundle *preset_bundle)
m_preset_bundle = preset_bundle; m_preset_bundle = preset_bundle;
// Vertical sizer to hold the choice menu and the rest of the page. // Vertical sizer to hold the choice menu and the rest of the page.
#ifdef __WXOSX__ //#ifdef __WXOSX__
auto *main_sizer = new wxBoxSizer(wxVERTICAL); auto *main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->SetSizeHints(this); main_sizer->SetSizeHints(this);
this->SetSizer(main_sizer); this->SetSizer(main_sizer);
@ -54,12 +54,12 @@ void Tab::create_preset_tab(PresetBundle *preset_bundle)
m_tmp_panel->Layout(); m_tmp_panel->Layout();
main_sizer->Add(m_tmp_panel, 1, wxEXPAND | wxALL, 0); main_sizer->Add(m_tmp_panel, 1, wxEXPAND | wxALL, 0);
#else // #else
Tab *panel = this; // Tab *panel = this;
auto *sizer = new wxBoxSizer(wxVERTICAL); // auto *sizer = new wxBoxSizer(wxVERTICAL);
sizer->SetSizeHints(panel); // sizer->SetSizeHints(panel);
panel->SetSizer(sizer); // panel->SetSizer(sizer);
#endif //__WXOSX__ // #endif //__WXOSX__
// preset chooser // preset chooser
m_presets_choice = new wxBitmapComboBox(panel, wxID_ANY, "", wxDefaultPosition, wxSize(270, -1), 0, 0,wxCB_READONLY); m_presets_choice = new wxBitmapComboBox(panel, wxID_ANY, "", wxDefaultPosition, wxSize(270, -1), 0, 0,wxCB_READONLY);
@ -295,11 +295,11 @@ PageShp Tab::add_options_page(const wxString& title, const std::string& icon, bo
} }
} }
// Initialize the page. // Initialize the page.
#ifdef __WXOSX__ //#ifdef __WXOSX__
auto panel = m_tmp_panel; auto panel = m_tmp_panel;
#else // #else
auto panel = this; // auto panel = this;
#endif // #endif
PageShp page(new Page(panel, title, icon_idx)); PageShp page(new Page(panel, title, icon_idx));
page->SetScrollbars(1, 1, 1, 1); page->SetScrollbars(1, 1, 1, 1);
page->Hide(); page->Hide();
@ -313,12 +313,13 @@ PageShp Tab::add_options_page(const wxString& title, const std::string& icon, bo
void Tab::OnActivate() void Tab::OnActivate()
{ {
#ifdef __WXOSX__ // #ifdef __WXOSX__
wxWindowUpdateLocker noUpdates(this); wxWindowUpdateLocker noUpdates(this);
auto sizer = GetSizer(); auto size = GetSizer()->GetSize();
m_tmp_panel->GetSizer()->SetMinSize(sizer->GetSize()); m_tmp_panel->GetSizer()->SetMinSize(size.x + m_size_move, size.y);
/*m_tmp_panel->*/Fit(); Fit();
m_size_move *= -1;
// Page* page = nullptr; // Page* page = nullptr;
// auto selection = m_treectrl->GetItemText(m_treectrl->GetSelection()); // auto selection = m_treectrl->GetItemText(m_treectrl->GetSelection());
@ -332,7 +333,7 @@ void Tab::OnActivate()
// page->Fit(); // page->Fit();
// m_hsizer->Layout(); // m_hsizer->Layout();
// Refresh(); // Refresh();
#endif // __WXOSX__ // #endif // __WXOSX__
} }
void Tab::update_labels_colour() void Tab::update_labels_colour()

View File

@ -102,6 +102,10 @@ using PageShp = std::shared_ptr<Page>;
class Tab: public wxPanel class Tab: public wxPanel
{ {
wxNotebook* m_parent; wxNotebook* m_parent;
//#ifdef __WXOSX__
wxPanel* m_tmp_panel;
int m_size_move = -1;
//#endif // __WXOSX__
protected: protected:
std::string m_name; std::string m_name;
const wxString m_title; const wxString m_title;
@ -118,9 +122,6 @@ protected:
wxButton* m_undo_btn; wxButton* m_undo_btn;
wxButton* m_undo_to_sys_btn; wxButton* m_undo_to_sys_btn;
wxButton* m_question_btn; wxButton* m_question_btn;
#ifdef __WXOSX__
wxPanel* m_tmp_panel;
#endif // __WXOSX__
wxComboCtrl* m_cc_presets_choice; wxComboCtrl* m_cc_presets_choice;
wxDataViewTreeCtrl* m_presetctrl; wxDataViewTreeCtrl* m_presetctrl;
wxImageList* m_preset_icons; wxImageList* m_preset_icons;