mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-20 15:32:33 +00:00
build: clear 295 -Woverloaded-virtual warnings in GUI widgets Turns three hidden base virtuals into real overrides, clearing 295 of the 553 -Woverloaded-virtual warnings and taking a full clang-cl build from 1,264 to 969. Part of #15374. Search.hpp: SearchDialog::Popup and SearchObjectDialog::Popup took a wxPoint that neither body ever read, hiding the virtual wxPopupTransientWindow::Popup(wxWindow*). Both bodies clear the input, call the base, set focus and refill the list, and SearchObjectDialog also guards re-entry, so hiding meant none of that ran when the window was popped through a base pointer. They now override and forward focus. LabeledStaticBox::SetFont and ScrolledWindow::SetBackgroundColour hid their base virtuals the same way, so the label metrics recompute and the child colour propagation only ran for callers holding the concrete type. Both now override. Marking a member override makes clang flag every other unmarked override in the same class, so seven sibling declarations needed the keyword too. Left unmarked they were worth 481 warnings, which would have made this a net loss. MSWDismissUnfocusedPopup is declared only inside #ifdef __WXMSW__ in wx/popupwin.h, so off Windows there is no base virtual to override and the keyword would not compile. Both the declarations and the definitions are guarded, which is how wxWidgets itself declares MSWWindowProc in wx/nativewin.h and how this repo already handles it in BBLTopbar, MainFrame, Button, ComboBox and TabCtrl. ScrolledWindow's constructor left m_userPanel and m_scroll_win uninitialised unless the style requested a vertical scrollbar, while SetBackgroundColour dereferences both. No caller hits that today since every instantiation passes wxVSCROLL, but the override widens who can reach them, so they are now initialised alongside their siblings. Co-authored-by: Rodrigo Faselli <162915171+RF47@users.noreply.github.com>
77 lines
2.0 KiB
C++
77 lines
2.0 KiB
C++
#ifndef slic3r_GUI_LabeledStaticBox_hpp_
|
|
#define slic3r_GUI_LabeledStaticBox_hpp_
|
|
|
|
#include <wx/window.h>
|
|
#include <wx/dc.h>
|
|
#include <wx/dcgraph.h>
|
|
#include <wx/dcclient.h>
|
|
#include <wx/dcbuffer.h>
|
|
#include <wx/settings.h>
|
|
#include <wx/statbox.h>
|
|
#include <wx/pen.h>
|
|
|
|
#include "libslic3r/Utils.hpp"
|
|
|
|
#include "slic3r/GUI/wxExtensions.hpp"
|
|
#include "slic3r/GUI/Widgets/StateHandler.hpp"
|
|
|
|
class LabeledStaticBox : public wxStaticBox
|
|
{
|
|
public:
|
|
LabeledStaticBox();
|
|
|
|
LabeledStaticBox(
|
|
wxWindow* parent,
|
|
const wxString& label = wxEmptyString,
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
const wxSize& size = wxDefaultSize,
|
|
long style = 0
|
|
);
|
|
|
|
bool Create(
|
|
wxWindow* parent,
|
|
const wxString& label = wxEmptyString,
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
const wxSize& size = wxDefaultSize,
|
|
long style = 0
|
|
);
|
|
|
|
void SetCornerRadius(int radius);
|
|
|
|
void SetBorderWidth(int width);
|
|
|
|
void SetBorderColor(StateColor const &color);
|
|
|
|
bool SetFont(const wxFont &set_font) override;
|
|
|
|
bool Enable(bool enable) override;
|
|
|
|
// Only meant to be used by inspector, not public API
|
|
int GetCornerRadius() const { return m_radius; }
|
|
int GetBorderWidth() const { return m_border_width; }
|
|
StateColor GetBorderColor() const { return border_color; }
|
|
float GetScale() const { return m_scale; }
|
|
|
|
private:
|
|
void PickDC(wxDC& dc);
|
|
|
|
protected:
|
|
StateHandler state_handler;
|
|
StateColor text_color;
|
|
StateColor border_color;
|
|
StateColor background_color;
|
|
int m_border_width;
|
|
int m_radius;
|
|
wxFont m_font;
|
|
wxString m_label;
|
|
int m_label_height;
|
|
int m_label_width;
|
|
float m_scale;
|
|
wxPoint m_pos;
|
|
|
|
virtual void DrawBorderAndLabel(wxDC& dc);
|
|
void GetBordersForSizer(int *borderTop, int *borderOther) const override;
|
|
|
|
};
|
|
|
|
#endif // !slic3r_GUI_LabeledStaticBox_hpp_
|