mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-12 10:21:17 +00:00
* Ignore Clipper, libpng, mcut and Boost.Polygon Internals in clang-tidy Each only works through a wrapper or umbrella header: libslic3r/clipper.hpp or clipper_z.hpp configure Clipper before including it, png.h pulls in libpng's config headers, and Boost.Polygon's headers only compile through polygon.hpp or voronoi.hpp. * Ignore minilzo's Config Headers in clang-tidy lzoconf.h and lzodefs.h are internal to minilzo.h, which is what the code includes. * Add Missing Includes Across the Remaining Sources and Tests Covers src/slic3r/Utils, src/slic3r/plugin, src/slic3r/Config, src/libvgcode, src/dev-utils, src/OrcaSlicer.cpp and tests/, the directories left after src/slic3r/GUI and src/libslic3r. Generated with clang-tidy misc-include-cleaner. libvgcode's own headers are included by relative path as in the rest of that library, and Catch2 and pybind11 with angle brackets as elsewhere in the repo. * Make the GUI and Test Headers Compile on Their Own Each now includes, or forward-declares, what it uses instead of relying on what its includers happened to include first. Headers that only compile on one platform, or that nothing built includes, are left alone. * Keep Windows and nanosvg Setup Ahead of the Added Includes OrcaSlicer.cpp and several tests set _WIN32_WINNT, WIN32_LEAN_AND_MEAN or NOMINMAX before including Windows.h, and the profile validator defines NANOSVG_IMPLEMENTATION before any libslic3r header. The added includes had landed above those blocks, which broke the Windows build. * Add the GUI Includes the First Pass Missed Covers headers that only became editable once they compiled on their own, and wx symbols whose suggested header changed as the clang-tidy ignore list grew after the src/slic3r/GUI pass. * Keep the Added Test Includes Below the NOMINMAX Guard test_marchingsquares.cpp and test_texture_displacement.cpp had includes inside #ifndef NOMINMAX, which the tests inherit as defined on Windows from libslic3r, so those were skipped there. .clang-tidy also ignores the MSVC STL and UCRT internals, Boost.Multiprecision's fwd.hpp and CPython's Windows include directory, as in #16068.
136 lines
4.4 KiB
C++
136 lines
4.4 KiB
C++
#ifndef slic3r_GUI_ComboBox_hpp_
|
|
#define slic3r_GUI_ComboBox_hpp_
|
|
|
|
#include "TextInput.hpp"
|
|
#include "DropDown.hpp"
|
|
#include <wx/containr.h>
|
|
#include <wx/ctrlsub.h>
|
|
#include <vector>
|
|
#include <wx/string.h>
|
|
#include <wx/textctrl.h>
|
|
#include <wx/gdicmn.h>
|
|
#include <cstddef>
|
|
#include <wx/arrstr.h>
|
|
#include <wx/clntdata.h>
|
|
#include <wx/event.h>
|
|
|
|
#define CB_NO_DROP_ICON DD_NO_CHECK_ICON
|
|
#define CB_NO_TEXT DD_NO_TEXT
|
|
|
|
class ComboBox : public wxWindowWithItems<TextInput, wxItemContainer>
|
|
{
|
|
typedef DropDown::Item Item;
|
|
std::vector<Item> items;
|
|
|
|
DropDown drop;
|
|
bool drop_down = false;
|
|
bool text_off = false;
|
|
bool is_replace_text_to_image = false;
|
|
bool m_keep_drop_arrow = false; // When true, item icon goes to icon_1, keeping drop_down arrow
|
|
wxString replace_text;
|
|
wxString image_for_text;
|
|
|
|
public:
|
|
ComboBox(wxWindow * parent,
|
|
wxWindowID id,
|
|
const wxString &value = wxEmptyString,
|
|
const wxPoint & pos = wxDefaultPosition,
|
|
const wxSize & size = wxDefaultSize,
|
|
int n = 0,
|
|
const wxString choices[] = NULL,
|
|
long style = 0);
|
|
|
|
DropDown & GetDropDown() { return drop; }
|
|
|
|
// When true, item icon is shown as icon_1 (secondary), preserving drop_down arrow.
|
|
// Note: item bitmaps are set via raw wxBitmap (not ScalableBitmap), so they won't
|
|
// auto-rescale on DPI change. Caller should recreate items after DPI change.
|
|
void SetKeepDropArrow(bool keep) { m_keep_drop_arrow = keep; }
|
|
|
|
virtual bool SetFont(wxFont const & font) override;
|
|
|
|
public:
|
|
int Append(const wxString &item, const wxBitmap &bitmap = wxNullBitmap, int item_style = 0);
|
|
int Append(const wxString &item, const wxBitmap &bitmap, void *clientData, int item_style = 0);
|
|
int Append(const wxString &item, const wxBitmap &bitmap, const wxString &group, void *clientData = nullptr, int item_style = 0);
|
|
int Append(const wxString& item,
|
|
const wxBitmap& bitmap,
|
|
const wxString& group_key,
|
|
const wxString& group_label,
|
|
void* clientData = nullptr,
|
|
int item_style = 0);
|
|
|
|
int SetItems(const std::vector<DropDown::Item>& the_items);
|
|
|
|
void set_replace_text(wxString text, wxString image_name);
|
|
unsigned int GetCount() const override;
|
|
|
|
int GetSelection() const override;
|
|
|
|
void SetSelection(int n) override;
|
|
|
|
void SelectAndNotify(int n);
|
|
|
|
virtual void Rescale() override;
|
|
|
|
wxString GetValue() const;
|
|
void SetValue(const wxString &value);
|
|
|
|
void SetLabel(const wxString &label) override;
|
|
wxString GetLabel() const override;
|
|
|
|
int GetFlag(unsigned int n);
|
|
void SetFlag(unsigned int n, int value);
|
|
|
|
void SetTextLabel(const wxString &label);
|
|
wxString GetTextLabel() const;
|
|
|
|
wxString GetString(unsigned int n) const override;
|
|
void SetString(unsigned int n, wxString const &value) override;
|
|
|
|
wxString GetItemTooltip(unsigned int n) const;
|
|
void SetItemTooltip(unsigned int n, wxString const &value);
|
|
|
|
wxString GetItemAlias(unsigned int n) const;
|
|
void SetItemAlias(unsigned int n, wxString const &value);
|
|
|
|
wxBitmap GetItemBitmap(unsigned int n);
|
|
void SetItemBitmap(unsigned int n, wxBitmap const &bitmap);
|
|
bool is_drop_down(){return drop_down;}
|
|
void DeleteOneItem(unsigned int pos) { DoDeleteOneItem(pos); }
|
|
|
|
void ForceDropdownOpen();
|
|
|
|
protected:
|
|
virtual int DoInsertItems(const wxArrayStringsAdapter &items,
|
|
unsigned int pos,
|
|
void ** clientData,
|
|
wxClientDataType type) override;
|
|
virtual void DoClear() override;
|
|
|
|
void DoDeleteOneItem(unsigned int pos) override;
|
|
|
|
void *DoGetItemClientData(unsigned int n) const override;
|
|
void DoSetItemClientData(unsigned int n, void *data) override;
|
|
|
|
void OnEdit() override;
|
|
|
|
void sendComboBoxEvent();
|
|
|
|
#ifdef __WIN32__
|
|
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) override;
|
|
#endif
|
|
|
|
private:
|
|
|
|
// some useful events
|
|
void mouseDown(wxMouseEvent &event);
|
|
void mouseWheelMoved(wxMouseEvent &event);
|
|
void keyDown(wxKeyEvent &event);
|
|
void onMove(wxMoveEvent &event);
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
};
|
|
|
|
#endif // !slic3r_GUI_ComboBox_hpp_
|