WIP: New simple top bar : Improve/delete redundant mode sizers

+ UI-fixes for OSX
This commit is contained in:
YuSanka 2023-07-31 16:43:51 +02:00 committed by David Kocik
parent ada1fc37ff
commit cecfe485ab
7 changed files with 89 additions and 173 deletions

View File

@ -2483,7 +2483,6 @@ void GUI_App::update_mode()
plater()->canvas3D()->update_gizmos_on_off_state(); plater()->canvas3D()->update_gizmos_on_off_state();
} }
//void GUI_App::add_config_menu(wxMenuBar *menu)
wxMenu* GUI_App::get_config_menu() wxMenu* GUI_App::get_config_menu()
{ {
auto local_menu = new wxMenu(); auto local_menu = new wxMenu();
@ -2519,22 +2518,7 @@ wxMenu* GUI_App::get_config_menu()
"\tCtrl+P", "\tCtrl+P",
#endif #endif
_L("Application preferences")); _L("Application preferences"));
/*
wxMenu* mode_menu = nullptr;
if (is_editor()) {
local_menu->AppendSeparator();
mode_menu = new wxMenu();
mode_menu->AppendRadioItem(config_id_base + ConfigMenuModeSimple, _L("Simple"), _L("Simple View Mode"));
// mode_menu->AppendRadioItem(config_id_base + ConfigMenuModeAdvanced, _L("Advanced"), _L("Advanced View Mode"));
mode_menu->AppendRadioItem(config_id_base + ConfigMenuModeAdvanced, _CTX("Advanced", "Mode"), _L("Advanced View Mode"));
mode_menu->AppendRadioItem(config_id_base + ConfigMenuModeExpert, _L("Expert"), _L("Expert View Mode"));
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { if (get_mode() == comSimple) evt.Check(true); }, config_id_base + ConfigMenuModeSimple);
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { if (get_mode() == comAdvanced) evt.Check(true); }, config_id_base + ConfigMenuModeAdvanced);
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { if (get_mode() == comExpert) evt.Check(true); }, config_id_base + ConfigMenuModeExpert);
local_menu->AppendSubMenu(mode_menu, _L("Mode"), wxString::Format(_L("%s View Mode"), SLIC3R_APP_NAME));
}
*/
local_menu->AppendSeparator(); local_menu->AppendSeparator();
local_menu->Append(config_id_base + ConfigMenuLanguage, _L("&Language")); local_menu->Append(config_id_base + ConfigMenuLanguage, _L("&Language"));
if (is_editor()) { if (is_editor()) {
@ -2680,21 +2664,7 @@ wxMenu* GUI_App::get_config_menu()
} }
}); });
#if 1
return local_menu; return local_menu;
#else
using std::placeholders::_1;
if (mode_menu != nullptr) {
auto modfn = [this](int mode, wxCommandEvent&) { if (get_mode() != mode) save_mode(mode); };
mode_menu->Bind(wxEVT_MENU, std::bind(modfn, comSimple, _1), config_id_base + ConfigMenuModeSimple);
mode_menu->Bind(wxEVT_MENU, std::bind(modfn, comAdvanced, _1), config_id_base + ConfigMenuModeAdvanced);
mode_menu->Bind(wxEVT_MENU, std::bind(modfn, comExpert, _1), config_id_base + ConfigMenuModeExpert);
}
menu->Append(local_menu, _L("&Configuration"));
#endif
} }
void GUI_App::update_config_menu() void GUI_App::update_config_menu()
{ {

View File

@ -298,7 +298,6 @@ public:
bool save_mode(const /*ConfigOptionMode*/int mode) ; bool save_mode(const /*ConfigOptionMode*/int mode) ;
void update_mode(); void update_mode();
// void add_config_menu(wxMenuBar *menu);
wxMenu* get_config_menu(); wxMenu* get_config_menu();
void update_config_menu(); void update_config_menu();
bool has_unsaved_preset_changes() const; bool has_unsaved_preset_changes() const;

View File

@ -1463,6 +1463,8 @@ void MenuFactory::sys_color_changed()
void MenuFactory::sys_color_changed(wxMenuBar* menubar) void MenuFactory::sys_color_changed(wxMenuBar* menubar)
{ {
if (!menubar)
return;
for (size_t id = 0; id < menubar->GetMenuCount(); id++) { for (size_t id = 0; id < menubar->GetMenuCount(); id++) {
wxMenu* menu = menubar->GetMenu(id); wxMenu* menu = menubar->GetMenu(id);
sys_color_changed_menu(menu); sys_color_changed_menu(menu);

View File

@ -703,7 +703,7 @@ void MainFrame::init_tabpanel()
} }
else else
#endif #endif
m_tabpanel = new TopBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME, true); m_tabpanel = new TopBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME);
m_tabpanel->SetFont(Slic3r::GUI::wxGetApp().normal_font()); m_tabpanel->SetFont(Slic3r::GUI::wxGetApp().normal_font());
m_tabpanel->Hide(); m_tabpanel->Hide();
@ -1539,7 +1539,7 @@ void MainFrame::init_menubar_as_editor()
// Help menu // Help menu
auto helpMenu = generate_help_menu(); auto helpMenu = generate_help_menu();
#if 1 #ifndef __APPLE__
// append menus for Menu button from TopBar // append menus for Menu button from TopBar
TopBar* top_bar = dynamic_cast<TopBar*>(m_tabpanel); TopBar* top_bar = dynamic_cast<TopBar*>(m_tabpanel);
@ -1571,27 +1571,13 @@ void MainFrame::init_menubar_as_editor()
m_menubar->Append(windowMenu, _L("&Window")); m_menubar->Append(windowMenu, _L("&Window"));
if (viewMenu) m_menubar->Append(viewMenu, _L("&View")); if (viewMenu) m_menubar->Append(viewMenu, _L("&View"));
// Add additional menus from C++ // Add additional menus from C++
wxGetApp().add_config_menu(m_menubar); m_menubar->Append(wxGetApp().get_config_menu(), _L("&Configuration"));
m_menubar->Append(helpMenu, _L("&Help")); m_menubar->Append(helpMenu, _L("&Help"));
#ifdef _MSW_DARK_MODE
if (wxGetApp().tabs_as_menu()) {
// Add separator
m_menubar->Append(new wxMenu(), " ");
add_tabs_as_menu(m_menubar, this, this);
}
#endif
SetMenuBar(m_menubar); SetMenuBar(m_menubar);
#endif
#ifdef _MSW_DARK_MODE
if (wxGetApp().tabs_as_menu())
m_menubar->EnableTop(6, false);
#endif
#ifdef __APPLE__
init_macos_application_menu(m_menubar, this); init_macos_application_menu(m_menubar, this);
#endif // __APPLE__ #endif // __APPLE__
if (plater()->printer_technology() == ptSLA) if (plater()->printer_technology() == ptSLA)

View File

@ -237,12 +237,6 @@ void Tab::create_preset_tab()
m_modified_label_clr = wxGetApp().get_label_clr_modified(); m_modified_label_clr = wxGetApp().get_label_clr_modified();
m_default_text_clr = wxGetApp().get_label_clr_default(); m_default_text_clr = wxGetApp().get_label_clr_default();
#ifdef _MSW_DARK_MODE
// Sizer with buttons for mode changing
if (wxGetApp().tabs_as_menu())
#endif
m_mode_sizer = new ModeSizer(panel, int (0.5*em_unit(this)));
const float scale_factor = em_unit(this)*0.1;// GetContentScaleFactor(); const float scale_factor = em_unit(this)*0.1;// GetContentScaleFactor();
m_top_hsizer = new wxBoxSizer(wxHORIZONTAL); m_top_hsizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(m_top_hsizer, 0, wxEXPAND | wxBOTTOM, 3); sizer->Add(m_top_hsizer, 0, wxEXPAND | wxBOTTOM, 3);

View File

@ -13,7 +13,11 @@ wxDEFINE_EVENT(wxCUSTOMEVT_TOPBAR_SEL_CHANGED, wxCommandEvent);
using namespace Slic3r::GUI; using namespace Slic3r::GUI;
#ifdef __APPLE__
#define down_arrow L"\u25BC";
#else
#define down_arrow L"\u23f7"; #define down_arrow L"\u23f7";
#endif
TopBarItemsCtrl::Button::Button(wxWindow* parent, const wxString& label, const std::string& icon_name, const int px_cnt) TopBarItemsCtrl::Button::Button(wxWindow* parent, const wxString& label, const std::string& icon_name, const int px_cnt)
@ -25,22 +29,31 @@ TopBarItemsCtrl::Button::Button(wxWindow* parent, const wxString& label, const s
this->SetMinSize(size); this->SetMinSize(size);
else else
this->SetMinSize(wxSize(-1, size.y)); this->SetMinSize(wxSize(-1, size.y));
}
const wxColour& selected_btn_bg = wxGetApp().get_label_clr_default(); void TopBarItemsCtrl::Button::set_selected(bool selected)
const wxColour& default_btn_bg = wxGetApp().get_window_default_clr(); {
m_is_selected = selected;
this->Bind(wxEVT_SET_FOCUS, [this, selected_btn_bg, default_btn_bg](wxFocusEvent& event) { if (m_is_selected) {
this->SetBackgroundColour(selected_btn_bg); #ifdef __APPLE__
this->SetForegroundColour(default_btn_bg); this->SetBackgroundColour(wxGetApp().get_highlight_default_clr());
event.Skip(); #else
}); this->SetBackgroundColour(wxGetApp().get_label_clr_default());
this->Bind(wxEVT_KILL_FOCUS, [this, selected_btn_bg, default_btn_bg](wxFocusEvent& event) { this->SetForegroundColour(wxGetApp().get_window_default_clr());
if (!m_is_selected) { #endif
this->SetBackgroundColour(default_btn_bg); }
this->SetForegroundColour(selected_btn_bg); else {
} #ifdef _WIN32
event.Skip(); this->SetBackgroundColour(wxGetApp().get_window_default_clr());
}); #else
this->SetBackgroundColour(wxTransparentColor);
#endif
#ifndef __APPLE__
this->SetForegroundColour(wxGetApp().get_label_clr_default());
#endif
}
} }
TopBarItemsCtrl::ButtonWithPopup::ButtonWithPopup(wxWindow* parent, const wxString& label, const std::string& icon_name) TopBarItemsCtrl::ButtonWithPopup::ButtonWithPopup(wxWindow* parent, const wxString& label, const std::string& icon_name)
@ -61,77 +74,76 @@ static wxString get_workspace_name(Slic3r::ConfigOptionMode mode)
mode == Slic3r::ConfigOptionMode::comAdvanced ? _L("Regular workspace") : _L("Josef Prusa's workspace"); mode == Slic3r::ConfigOptionMode::comAdvanced ? _L("Regular workspace") : _L("Josef Prusa's workspace");
} }
TopBarItemsCtrl::TopBarItemsCtrl(wxWindow *parent, bool add_mode_buttons/* = false*/) : void TopBarItemsCtrl::ApplyWorkspacesMenu()
{
wxMenuItemList& items = m_workspaces_menu.GetMenuItems();
if (!items.IsEmpty()) {
for (int id = int(m_workspaces_menu.GetMenuItemCount()) - 1; id >= 0; id--)
m_workspaces_menu.Destroy(items[id]);
}
for (const Slic3r::ConfigOptionMode& mode : { Slic3r::ConfigOptionMode::comSimple,
Slic3r::ConfigOptionMode::comAdvanced,
Slic3r::ConfigOptionMode::comExpert }) {
const wxString label = get_workspace_name(mode);
append_menu_item(&m_workspaces_menu, wxID_ANY, label, label,
[this, mode](wxCommandEvent&) {
if (wxGetApp().get_mode() != mode)
wxGetApp().save_mode(mode);
}, get_bmp_bundle("mode", 16, -1, wxGetApp().get_mode_btn_color(mode)), nullptr, []() { return true; }, this);
if (mode < Slic3r::ConfigOptionMode::comExpert)
m_workspaces_menu.AppendSeparator();
}
}
TopBarItemsCtrl::TopBarItemsCtrl(wxWindow *parent) :
wxControl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE | wxTAB_TRAVERSAL) wxControl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE | wxTAB_TRAVERSAL)
{ {
#ifdef __WINDOWS__ #ifdef __WINDOWS__
SetDoubleBuffered(true); SetDoubleBuffered(true);
#endif //__WINDOWS__ #endif //__WINDOWS__
int em = em_unit(this);// Slic3r::GUI::wxGetApp().em_unit(); int em = em_unit(this);
m_btn_margin = std::lround(0.9 * em); m_btn_margin = std::lround(0.9 * em);
m_line_margin = std::lround(0.1 * em); m_line_margin = std::lround(0.1 * em);
m_sizer = new wxBoxSizer(wxHORIZONTAL); m_sizer = new wxBoxSizer(wxHORIZONTAL);
this->SetSizer(m_sizer); this->SetSizer(m_sizer);
#ifdef __APPLE__
auto logo = new wxStaticBitmap(this, wxID_ANY, *get_bmp_bundle(wxGetApp().logo_name(), 24));
m_sizer->Add(logo, 1, wxALIGN_CENTER_VERTICAL | wxALL, m_btn_margin);
#else
m_menu_btn = new ButtonWithPopup(this, _L("Menu"), wxGetApp().logo_name()); m_menu_btn = new ButtonWithPopup(this, _L("Menu"), wxGetApp().logo_name());
m_sizer->Add(m_menu_btn, 1, wxALIGN_CENTER_VERTICAL | wxALL, m_btn_margin); m_sizer->Add(m_menu_btn, 1, wxALIGN_CENTER_VERTICAL | wxALL, m_btn_margin);
m_menu_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event) {
m_menu_btn->set_selected(true);
wxPoint pos = m_menu_btn->GetPosition();
wxGetApp().plater()->PopupMenu(&m_main_menu, pos);
});
m_main_menu.Bind(wxEVT_MENU_CLOSE, [this](wxMenuEvent&) { m_menu_btn->set_selected(false); });
#endif
m_buttons_sizer = new wxFlexGridSizer(1, m_btn_margin, m_btn_margin); m_buttons_sizer = new wxFlexGridSizer(1, m_btn_margin, m_btn_margin);
m_sizer->Add(m_buttons_sizer, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 2 * m_btn_margin); m_sizer->Add(m_buttons_sizer, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 2 * m_btn_margin);
if (add_mode_buttons) { // create modes menu
m_mode_sizer = new ModeSizer(this, m_btn_margin); ApplyWorkspacesMenu();
m_sizer->AddStretchSpacer(20);
m_sizer->Add(m_mode_sizer, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, m_btn_margin);
m_mode_sizer->ShowItems(false);
}
m_workspace_btn = new ButtonWithPopup(this, _L("Workspace"), "mode_simple"); m_workspace_btn = new ButtonWithPopup(this, _L("Workspace"), "mode_simple");
m_sizer->AddStretchSpacer(20); m_sizer->AddStretchSpacer(20);
m_sizer->Add(m_workspace_btn, 1, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxRIGHT, 2 * m_btn_margin); m_sizer->Add(m_workspace_btn, 1, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxRIGHT, 2 * m_btn_margin);
// create modes menu
{
for (const Slic3r::ConfigOptionMode& mode : { Slic3r::ConfigOptionMode::comSimple, Slic3r::ConfigOptionMode::comAdvanced, Slic3r::ConfigOptionMode::comExpert } ) {
const wxString label = get_workspace_name(mode);
append_menu_item(&m_workspace_modes, wxID_ANY, label, label,
[this, mode](wxCommandEvent&) {
if (wxGetApp().get_mode() != mode)
wxGetApp().save_mode(mode);
}, get_bmp_bundle("mode", 16, -1, wxGetApp().get_mode_btn_color(mode)), nullptr, []() { return true; }, this);
if (mode < Slic3r::ConfigOptionMode::comExpert)
m_workspace_modes.AppendSeparator();
}
}
this->Bind(wxEVT_PAINT, &TopBarItemsCtrl::OnPaint, this);
m_menu_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event) {
wxPoint pos = m_menu_btn->GetPosition();
wxGetApp().plater()->PopupMenu(&m_menu, pos);
});
m_menu.Bind(wxEVT_MENU_CLOSE, [this](wxMenuEvent&) {
if (m_menu_btn->HasFocus()) {
wxPostEvent(m_menu_btn->GetEventHandler(), wxFocusEvent(wxEVT_KILL_FOCUS));
}
});
m_workspace_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event) { m_workspace_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event) {
m_workspace_btn->set_selected(true);
wxPoint pos = m_workspace_btn->GetPosition(); wxPoint pos = m_workspace_btn->GetPosition();
wxGetApp().plater()->PopupMenu(&m_workspace_modes, pos); wxGetApp().plater()->PopupMenu(&m_workspaces_menu, pos);
}); });
m_workspaces_menu.Bind(wxEVT_MENU_CLOSE, [this](wxMenuEvent&) { m_workspace_btn->set_selected(false); });
m_workspace_modes.Bind(wxEVT_MENU_CLOSE, [this](wxMenuEvent&) { this->Bind(wxEVT_PAINT, &TopBarItemsCtrl::OnPaint, this);
if (m_workspace_btn->HasFocus()) {
wxPostEvent(m_workspace_btn->GetEventHandler(), wxFocusEvent(wxEVT_KILL_FOCUS));
}
});
} }
void TopBarItemsCtrl::OnPaint(wxPaintEvent&) void TopBarItemsCtrl::OnPaint(wxPaintEvent&)
@ -143,41 +155,8 @@ void TopBarItemsCtrl::OnPaint(wxPaintEvent&)
if (m_selection < 0 || m_selection >= (int)m_pageButtons.size()) if (m_selection < 0 || m_selection >= (int)m_pageButtons.size())
return; return;
const wxColour& selected_btn_bg = wxGetApp().get_label_clr_default();
const wxColour& default_btn_bg = wxGetApp().get_window_default_clr();
const wxColour& btn_marker_color = wxGetApp().get_highlight_default_clr(); const wxColour& btn_marker_color = wxGetApp().get_highlight_default_clr();
// highlight selected notebook button
for (int idx = 0; idx < int(m_pageButtons.size()); idx++) {
wxButton* btn = m_pageButtons[idx];
btn->SetBackgroundColour(idx == m_selection ? selected_btn_bg : default_btn_bg);
btn->SetForegroundColour(idx == m_selection ? default_btn_bg : selected_btn_bg);
}
// highlight selected mode button
//bool mode_is_focused = m_workspace_btn->HasFocus();
//m_workspace_btn->SetBackgroundColour(mode_is_focused ? selected_btn_bg : default_btn_bg);
//m_workspace_btn->SetForegroundColour(mode_is_focused ? default_btn_bg : selected_btn_bg);
//if (m_mode_sizer) {
// const std::vector<ModeButton*>& mode_btns = m_mode_sizer->get_btns();
// for (int idx = 0; idx < int(mode_btns.size()); idx++) {
// ModeButton* btn = mode_btns[idx];
// btn->SetBackgroundColour(btn->is_selected() ? selected_btn_bg : default_btn_bg);
// //wxPoint pos = btn->GetPosition();
// //wxSize size = btn->GetSize();
// //const wxColour& clr = btn->is_selected() ? btn_marker_color : default_btn_bg;
// //dc.SetPen(clr);
// //dc.SetBrush(clr);
// //dc.DrawRectangle(pos.x, pos.y + size.y, size.x, sz.y - size.y);
// }
//}
// Draw orange bottom line // Draw orange bottom line
dc.SetPen(btn_marker_color); dc.SetPen(btn_marker_color);
@ -188,8 +167,6 @@ void TopBarItemsCtrl::OnPaint(wxPaintEvent&)
void TopBarItemsCtrl::UpdateMode() void TopBarItemsCtrl::UpdateMode()
{ {
auto mode = wxGetApp().get_mode(); auto mode = wxGetApp().get_mode();
m_mode_sizer->SetMode(mode);
auto m_bmp = *get_bmp_bundle("mode", 16, -1, wxGetApp().get_mode_btn_color(mode)); auto m_bmp = *get_bmp_bundle("mode", 16, -1, wxGetApp().get_mode_btn_color(mode));
@ -220,14 +197,13 @@ void TopBarItemsCtrl::OnColorsChanged()
for (ScalableButton* btn : m_pageButtons) for (ScalableButton* btn : m_pageButtons)
btn->sys_color_changed(); btn->sys_color_changed();
m_mode_sizer->sys_color_changed();
m_sizer->Layout(); m_sizer->Layout();
} }
void TopBarItemsCtrl::UpdateModeMarkers() void TopBarItemsCtrl::UpdateModeMarkers()
{ {
m_mode_sizer->update_mode_markers(); UpdateMode();
ApplyWorkspacesMenu();
} }
void TopBarItemsCtrl::UpdateSelection() void TopBarItemsCtrl::UpdateSelection()
@ -293,16 +269,10 @@ wxString TopBarItemsCtrl::GetPageText(size_t n) const
void TopBarItemsCtrl::AppendMenuItem(wxMenu* menu, const wxString& title) void TopBarItemsCtrl::AppendMenuItem(wxMenu* menu, const wxString& title)
{ {
append_submenu(&m_menu, menu, wxID_ANY, title, "cog"); append_submenu(&m_main_menu, menu, wxID_ANY, title, "cog");
} }
void TopBarItemsCtrl::AppendMenuSeparaorItem() void TopBarItemsCtrl::AppendMenuSeparaorItem()
{ {
m_menu.AppendSeparator(); m_main_menu.AppendSeparator();
}
void TopBarItemsCtrl::ShowMenu()
{
wxPoint pos = m_menu_btn->GetPosition();
wxGetApp().plater()->PopupMenu(&m_menu, pos);
} }

View File

@ -26,7 +26,7 @@ class TopBarItemsCtrl : public wxControl
~Button() {} ~Button() {}
void set_selected(bool selected) { m_is_selected = selected; } void set_selected(bool selected);
}; };
class ButtonWithPopup : public Button class ButtonWithPopup : public Button
@ -42,11 +42,11 @@ class TopBarItemsCtrl : public wxControl
void SetLabel(const wxString& label) override; void SetLabel(const wxString& label) override;
}; };
MenuWithSeparators m_menu; wxMenu m_main_menu;
MenuWithSeparators m_workspace_modes; wxMenu m_workspaces_menu;
public: public:
TopBarItemsCtrl(wxWindow* parent, bool add_mode_buttons = false); TopBarItemsCtrl(wxWindow* parent);
~TopBarItemsCtrl() {} ~TopBarItemsCtrl() {}
void OnPaint(wxPaintEvent&); void OnPaint(wxPaintEvent&);
@ -63,9 +63,7 @@ public:
void AppendMenuItem(wxMenu* menu, const wxString& title); void AppendMenuItem(wxMenu* menu, const wxString& title);
void AppendMenuSeparaorItem(); void AppendMenuSeparaorItem();
void ShowMenu(); void ApplyWorkspacesMenu();
void AddModeItem();
void ShowModes();
private: private:
wxWindow* m_parent; wxWindow* m_parent;
@ -77,7 +75,6 @@ private:
int m_selection {-1}; int m_selection {-1};
int m_btn_margin; int m_btn_margin;
int m_line_margin; int m_line_margin;
ModeSizer* m_mode_sizer {nullptr};
}; };
class TopBar : public wxBookCtrlBase class TopBar : public wxBookCtrlBase
@ -87,24 +84,22 @@ public:
wxWindowID winid = wxID_ANY, wxWindowID winid = wxID_ANY,
const wxPoint & pos = wxDefaultPosition, const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize, const wxSize & size = wxDefaultSize,
long style = 0, long style = 0)
bool add_mode_buttons = false)
{ {
Init(); Init();
Create(parent, winid, pos, size, style, add_mode_buttons); Create(parent, winid, pos, size, style);
} }
bool Create(wxWindow * parent, bool Create(wxWindow * parent,
wxWindowID winid = wxID_ANY, wxWindowID winid = wxID_ANY,
const wxPoint & pos = wxDefaultPosition, const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize, const wxSize & size = wxDefaultSize,
long style = 0, long style = 0)
bool add_mode_buttons = false)
{ {
if (!wxBookCtrlBase::Create(parent, winid, pos, size, style | wxBK_TOP)) if (!wxBookCtrlBase::Create(parent, winid, pos, size, style | wxBK_TOP))
return false; return false;
m_bookctrl = new TopBarItemsCtrl(this, add_mode_buttons); m_bookctrl = new TopBarItemsCtrl(this);
wxSizer* mainSizer = new wxBoxSizer(IsVertical() ? wxVERTICAL : wxHORIZONTAL); wxSizer* mainSizer = new wxBoxSizer(IsVertical() ? wxVERTICAL : wxHORIZONTAL);