Files
OrcaSlicer/src/slic3r/GUI/BBLTopbar.hpp
T
HanifKoh f02292f163 Stop Exporting Names Through Usings in GUI and Voronoi Headers (#16223)
Each of these headers put a using or namespace alias at global or
namespace scope, which every includer inherited:

- BBLTopbar.hpp: "using namespace Slic3r::GUI;" at global scope, reached
  through MainFrame.hpp. Seven source files used GUI names unqualified
  outside the namespace because of it, one of them as "::RadioBox".
- IMSlider.hpp and TickCode.hpp: "using namespace CustomGCode;" inside
  Slic3r.
- ProjectTask.hpp, Jobs/PrintJob.hpp and ConfigWizard_private.hpp:
  "namespace fs = boost::filesystem;". PresetBundle.cpp and GUI_App.cpp
  had no alias of their own.
- VoronoiUtils.hpp: "using VD = Slic3r::Geometry::VoronoiDiagram;" at
  global scope.

The headers now spell the names out. Source files that used them get
the qualifier, or a using of their own where there are many uses.
2026-10-07 14:22:45 +08:00

118 lines
3.1 KiB
C++

#pragma once
#include "wx/wxprec.h"
#include "wx/aui/auibar.h"
#include "SelectMachine.hpp"
#include <wx/control.h>
#include <wx/string.h>
#include <wx/gdicmn.h>
#include <wx/event.h>
#include "slic3r/GUI/DeviceCore/DevDefs.h"
class wxFrame;
class wxMenuEvent;
class wxMenuItem;
class wxMouseCaptureLostEvent;
class wxMouseEvent;
class wxWindow;
class CenteredTitle : public wxControl
{
public:
CenteredTitle(wxWindow* parent);
void SetTitle(const wxString& title);
wxSize DoGetBestSize() const override;
protected:
#ifdef __WXMSW__
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) override;
#endif
private:
wxString m_title;
};
class BBLTopbar : public wxAuiToolBar
{
public:
BBLTopbar(wxWindow* pwin, wxFrame* parent);
BBLTopbar(wxFrame* parent);
void Init(wxFrame *parent);
~BBLTopbar();
void UpdateToolbarWidth(int width);
void Rescale();
void OnIconize(wxAuiToolBarEvent& event);
void OnFullScreen(wxAuiToolBarEvent& event);
void OnCloseFrame(wxAuiToolBarEvent& event);
void OnFileToolItem(wxAuiToolBarEvent& evt);
void OnDropdownToolItem(wxAuiToolBarEvent& evt);
void OnCalibToolItem(wxAuiToolBarEvent &evt);
void OnMouseLeftDClock(wxMouseEvent& mouse);
void OnMouseLeftDown(wxMouseEvent& event);
void OnMouseLeftUp(wxMouseEvent& event);
void OnMouseMotion(wxMouseEvent& event);
void OnMouseCaptureLost(wxMouseCaptureLostEvent& event);
void OnMenuClose(wxMenuEvent& event);
void OnOpenProject(wxAuiToolBarEvent& event);
void OnSaveProject(wxAuiToolBarEvent& event);
void OnUndo(wxAuiToolBarEvent& event);
void OnRedo(wxAuiToolBarEvent& event);
void OnModelStoreClicked(wxAuiToolBarEvent& event);
wxAuiToolBarItem* FindToolByCurrentPosition();
void SetFileMenu(wxMenu* file_menu);
void AddDropDownSubMenu(wxMenu* sub_menu, const wxString& title);
void AddDropDownMenuItem(wxMenuItem* menu_item);
wxMenu *GetTopMenu();
wxMenu *GetCalibMenu();
void SetTitle(wxString title);
void SetMaximizedSize();
void SetWindowSize();
void EnableUndoRedoItems();
void DisableUndoRedoItems();
void EnableUndoRedo(bool undo, bool redo);
void SaveNormalRect();
void ShowCalibrationButton(bool show = true);
protected:
#ifdef __WXMSW__
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) override;
#endif
private:
wxFrame* m_frame;
wxAuiToolBarItem* m_file_menu_item;
wxAuiToolBarItem* m_dropdown_menu_item;
wxRect m_normalRect;
wxPoint m_delta;
wxPoint m_last_mouse_position{wxDefaultPosition};
wxMenu m_top_menu;
wxMenu* m_file_menu;
wxMenu m_calib_menu;
CenteredTitle* m_title_ctrl { nullptr };
wxString m_titleText;
wxAuiToolBarItem* m_undo_item;
wxAuiToolBarItem* m_redo_item;
wxAuiToolBarItem* m_calib_item;
wxAuiToolBarItem* maximize_btn;
wxBitmap maximize_bitmap;
wxBitmap window_bitmap;
int m_toolbar_h;
bool m_skip_popup_file_menu;
bool m_skip_popup_dropdown_menu;
bool m_skip_popup_calib_menu;
};