mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 05:26:02 +08:00
WIP: New simple top bar : Improve/delete redundant mode sizers
+ UI-fixes for OSX
This commit is contained in:
parent
ada1fc37ff
commit
cecfe485ab
@ -2483,7 +2483,6 @@ void GUI_App::update_mode()
|
||||
plater()->canvas3D()->update_gizmos_on_off_state();
|
||||
}
|
||||
|
||||
//void GUI_App::add_config_menu(wxMenuBar *menu)
|
||||
wxMenu* GUI_App::get_config_menu()
|
||||
{
|
||||
auto local_menu = new wxMenu();
|
||||
@ -2519,22 +2518,7 @@ wxMenu* GUI_App::get_config_menu()
|
||||
"\tCtrl+P",
|
||||
#endif
|
||||
_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->Append(config_id_base + ConfigMenuLanguage, _L("&Language"));
|
||||
if (is_editor()) {
|
||||
@ -2680,21 +2664,7 @@ wxMenu* GUI_App::get_config_menu()
|
||||
}
|
||||
});
|
||||
|
||||
#if 1
|
||||
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()
|
||||
{
|
||||
|
@ -298,7 +298,6 @@ public:
|
||||
bool save_mode(const /*ConfigOptionMode*/int mode) ;
|
||||
void update_mode();
|
||||
|
||||
// void add_config_menu(wxMenuBar *menu);
|
||||
wxMenu* get_config_menu();
|
||||
void update_config_menu();
|
||||
bool has_unsaved_preset_changes() const;
|
||||
|
@ -1463,6 +1463,8 @@ void MenuFactory::sys_color_changed()
|
||||
|
||||
void MenuFactory::sys_color_changed(wxMenuBar* menubar)
|
||||
{
|
||||
if (!menubar)
|
||||
return;
|
||||
for (size_t id = 0; id < menubar->GetMenuCount(); id++) {
|
||||
wxMenu* menu = menubar->GetMenu(id);
|
||||
sys_color_changed_menu(menu);
|
||||
|
@ -703,7 +703,7 @@ void MainFrame::init_tabpanel()
|
||||
}
|
||||
else
|
||||
#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->Hide();
|
||||
@ -1539,7 +1539,7 @@ void MainFrame::init_menubar_as_editor()
|
||||
// Help menu
|
||||
auto helpMenu = generate_help_menu();
|
||||
|
||||
#if 1
|
||||
#ifndef __APPLE__
|
||||
// append menus for Menu button from TopBar
|
||||
|
||||
TopBar* top_bar = dynamic_cast<TopBar*>(m_tabpanel);
|
||||
@ -1571,27 +1571,13 @@ void MainFrame::init_menubar_as_editor()
|
||||
m_menubar->Append(windowMenu, _L("&Window"));
|
||||
if (viewMenu) m_menubar->Append(viewMenu, _L("&View"));
|
||||
// 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"));
|
||||
|
||||
#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);
|
||||
|
||||
#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);
|
||||
|
||||
#endif // __APPLE__
|
||||
|
||||
if (plater()->printer_technology() == ptSLA)
|
||||
|
@ -237,12 +237,6 @@ void Tab::create_preset_tab()
|
||||
m_modified_label_clr = wxGetApp().get_label_clr_modified();
|
||||
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();
|
||||
m_top_hsizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add(m_top_hsizer, 0, wxEXPAND | wxBOTTOM, 3);
|
||||
|
@ -13,7 +13,11 @@ wxDEFINE_EVENT(wxCUSTOMEVT_TOPBAR_SEL_CHANGED, wxCommandEvent);
|
||||
|
||||
using namespace Slic3r::GUI;
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define down_arrow L"\u25BC";
|
||||
#else
|
||||
#define down_arrow L"\u23f7";
|
||||
#endif
|
||||
|
||||
|
||||
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);
|
||||
else
|
||||
this->SetMinSize(wxSize(-1, size.y));
|
||||
}
|
||||
|
||||
const wxColour& selected_btn_bg = wxGetApp().get_label_clr_default();
|
||||
const wxColour& default_btn_bg = wxGetApp().get_window_default_clr();
|
||||
void TopBarItemsCtrl::Button::set_selected(bool selected)
|
||||
{
|
||||
m_is_selected = selected;
|
||||
|
||||
this->Bind(wxEVT_SET_FOCUS, [this, selected_btn_bg, default_btn_bg](wxFocusEvent& event) {
|
||||
this->SetBackgroundColour(selected_btn_bg);
|
||||
this->SetForegroundColour(default_btn_bg);
|
||||
event.Skip();
|
||||
});
|
||||
this->Bind(wxEVT_KILL_FOCUS, [this, selected_btn_bg, default_btn_bg](wxFocusEvent& event) {
|
||||
if (!m_is_selected) {
|
||||
this->SetBackgroundColour(default_btn_bg);
|
||||
this->SetForegroundColour(selected_btn_bg);
|
||||
if (m_is_selected) {
|
||||
#ifdef __APPLE__
|
||||
this->SetBackgroundColour(wxGetApp().get_highlight_default_clr());
|
||||
#else
|
||||
this->SetBackgroundColour(wxGetApp().get_label_clr_default());
|
||||
this->SetForegroundColour(wxGetApp().get_window_default_clr());
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#ifdef _WIN32
|
||||
this->SetBackgroundColour(wxGetApp().get_window_default_clr());
|
||||
#else
|
||||
this->SetBackgroundColour(wxTransparentColor);
|
||||
#endif
|
||||
|
||||
#ifndef __APPLE__
|
||||
this->SetForegroundColour(wxGetApp().get_label_clr_default());
|
||||
#endif
|
||||
}
|
||||
event.Skip();
|
||||
});
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
TopBarItemsCtrl::TopBarItemsCtrl(wxWindow *parent, bool add_mode_buttons/* = false*/) :
|
||||
wxControl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE | wxTAB_TRAVERSAL)
|
||||
void TopBarItemsCtrl::ApplyWorkspacesMenu()
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
SetDoubleBuffered(true);
|
||||
#endif //__WINDOWS__
|
||||
|
||||
int em = em_unit(this);// Slic3r::GUI::wxGetApp().em_unit();
|
||||
m_btn_margin = std::lround(0.9 * em);
|
||||
m_line_margin = std::lround(0.1 * em);
|
||||
|
||||
m_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
this->SetSizer(m_sizer);
|
||||
|
||||
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_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);
|
||||
|
||||
if (add_mode_buttons) {
|
||||
m_mode_sizer = new ModeSizer(this, m_btn_margin);
|
||||
m_sizer->AddStretchSpacer(20);
|
||||
m_sizer->Add(m_mode_sizer, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, m_btn_margin);
|
||||
|
||||
m_mode_sizer->ShowItems(false);
|
||||
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]);
|
||||
}
|
||||
|
||||
m_workspace_btn = new ButtonWithPopup(this, _L("Workspace"), "mode_simple");
|
||||
m_sizer->AddStretchSpacer(20);
|
||||
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 } ) {
|
||||
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,
|
||||
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_workspace_modes.AppendSeparator();
|
||||
}
|
||||
m_workspaces_menu.AppendSeparator();
|
||||
}
|
||||
}
|
||||
|
||||
TopBarItemsCtrl::TopBarItemsCtrl(wxWindow *parent) :
|
||||
wxControl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE | wxTAB_TRAVERSAL)
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
SetDoubleBuffered(true);
|
||||
#endif //__WINDOWS__
|
||||
|
||||
this->Bind(wxEVT_PAINT, &TopBarItemsCtrl::OnPaint, this);
|
||||
int em = em_unit(this);
|
||||
m_btn_margin = std::lround(0.9 * em);
|
||||
m_line_margin = std::lround(0.1 * em);
|
||||
|
||||
m_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
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_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_menu, pos);
|
||||
wxGetApp().plater()->PopupMenu(&m_main_menu, pos);
|
||||
});
|
||||
m_main_menu.Bind(wxEVT_MENU_CLOSE, [this](wxMenuEvent&) { m_menu_btn->set_selected(false); });
|
||||
#endif
|
||||
|
||||
m_menu.Bind(wxEVT_MENU_CLOSE, [this](wxMenuEvent&) {
|
||||
if (m_menu_btn->HasFocus()) {
|
||||
wxPostEvent(m_menu_btn->GetEventHandler(), wxFocusEvent(wxEVT_KILL_FOCUS));
|
||||
}
|
||||
});
|
||||
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);
|
||||
|
||||
// create modes menu
|
||||
ApplyWorkspacesMenu();
|
||||
|
||||
m_workspace_btn = new ButtonWithPopup(this, _L("Workspace"), "mode_simple");
|
||||
m_sizer->AddStretchSpacer(20);
|
||||
m_sizer->Add(m_workspace_btn, 1, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxRIGHT, 2 * m_btn_margin);
|
||||
|
||||
m_workspace_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event) {
|
||||
m_workspace_btn->set_selected(true);
|
||||
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&) {
|
||||
if (m_workspace_btn->HasFocus()) {
|
||||
wxPostEvent(m_workspace_btn->GetEventHandler(), wxFocusEvent(wxEVT_KILL_FOCUS));
|
||||
}
|
||||
});
|
||||
this->Bind(wxEVT_PAINT, &TopBarItemsCtrl::OnPaint, this);
|
||||
}
|
||||
|
||||
void TopBarItemsCtrl::OnPaint(wxPaintEvent&)
|
||||
@ -143,41 +155,8 @@ void TopBarItemsCtrl::OnPaint(wxPaintEvent&)
|
||||
if (m_selection < 0 || m_selection >= (int)m_pageButtons.size())
|
||||
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();
|
||||
|
||||
// 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
|
||||
|
||||
dc.SetPen(btn_marker_color);
|
||||
@ -188,8 +167,6 @@ void TopBarItemsCtrl::OnPaint(wxPaintEvent&)
|
||||
void TopBarItemsCtrl::UpdateMode()
|
||||
{
|
||||
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));
|
||||
|
||||
@ -220,14 +197,13 @@ void TopBarItemsCtrl::OnColorsChanged()
|
||||
for (ScalableButton* btn : m_pageButtons)
|
||||
btn->sys_color_changed();
|
||||
|
||||
m_mode_sizer->sys_color_changed();
|
||||
|
||||
m_sizer->Layout();
|
||||
}
|
||||
|
||||
void TopBarItemsCtrl::UpdateModeMarkers()
|
||||
{
|
||||
m_mode_sizer->update_mode_markers();
|
||||
UpdateMode();
|
||||
ApplyWorkspacesMenu();
|
||||
}
|
||||
|
||||
void TopBarItemsCtrl::UpdateSelection()
|
||||
@ -293,16 +269,10 @@ wxString TopBarItemsCtrl::GetPageText(size_t n) const
|
||||
|
||||
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()
|
||||
{
|
||||
m_menu.AppendSeparator();
|
||||
}
|
||||
|
||||
void TopBarItemsCtrl::ShowMenu()
|
||||
{
|
||||
wxPoint pos = m_menu_btn->GetPosition();
|
||||
wxGetApp().plater()->PopupMenu(&m_menu, pos);
|
||||
m_main_menu.AppendSeparator();
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ class TopBarItemsCtrl : public wxControl
|
||||
|
||||
~Button() {}
|
||||
|
||||
void set_selected(bool selected) { m_is_selected = selected; }
|
||||
void set_selected(bool selected);
|
||||
};
|
||||
|
||||
class ButtonWithPopup : public Button
|
||||
@ -42,11 +42,11 @@ class TopBarItemsCtrl : public wxControl
|
||||
void SetLabel(const wxString& label) override;
|
||||
};
|
||||
|
||||
MenuWithSeparators m_menu;
|
||||
MenuWithSeparators m_workspace_modes;
|
||||
wxMenu m_main_menu;
|
||||
wxMenu m_workspaces_menu;
|
||||
|
||||
public:
|
||||
TopBarItemsCtrl(wxWindow* parent, bool add_mode_buttons = false);
|
||||
TopBarItemsCtrl(wxWindow* parent);
|
||||
~TopBarItemsCtrl() {}
|
||||
|
||||
void OnPaint(wxPaintEvent&);
|
||||
@ -63,9 +63,7 @@ public:
|
||||
|
||||
void AppendMenuItem(wxMenu* menu, const wxString& title);
|
||||
void AppendMenuSeparaorItem();
|
||||
void ShowMenu();
|
||||
void AddModeItem();
|
||||
void ShowModes();
|
||||
void ApplyWorkspacesMenu();
|
||||
|
||||
private:
|
||||
wxWindow* m_parent;
|
||||
@ -77,7 +75,6 @@ private:
|
||||
int m_selection {-1};
|
||||
int m_btn_margin;
|
||||
int m_line_margin;
|
||||
ModeSizer* m_mode_sizer {nullptr};
|
||||
};
|
||||
|
||||
class TopBar : public wxBookCtrlBase
|
||||
@ -87,24 +84,22 @@ public:
|
||||
wxWindowID winid = wxID_ANY,
|
||||
const wxPoint & pos = wxDefaultPosition,
|
||||
const wxSize & size = wxDefaultSize,
|
||||
long style = 0,
|
||||
bool add_mode_buttons = false)
|
||||
long style = 0)
|
||||
{
|
||||
Init();
|
||||
Create(parent, winid, pos, size, style, add_mode_buttons);
|
||||
Create(parent, winid, pos, size, style);
|
||||
}
|
||||
|
||||
bool Create(wxWindow * parent,
|
||||
wxWindowID winid = wxID_ANY,
|
||||
const wxPoint & pos = wxDefaultPosition,
|
||||
const wxSize & size = wxDefaultSize,
|
||||
long style = 0,
|
||||
bool add_mode_buttons = false)
|
||||
long style = 0)
|
||||
{
|
||||
if (!wxBookCtrlBase::Create(parent, winid, pos, size, style | wxBK_TOP))
|
||||
return false;
|
||||
|
||||
m_bookctrl = new TopBarItemsCtrl(this, add_mode_buttons);
|
||||
m_bookctrl = new TopBarItemsCtrl(this);
|
||||
|
||||
wxSizer* mainSizer = new wxBoxSizer(IsVertical() ? wxVERTICAL : wxHORIZONTAL);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user