mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-15 11:51:33 +00:00
* Remove Unused Project Includes and Forward-Declare Where a Type Is Only Referenced Generated with include-what-you-use and applied conservatively. Only OrcaSlicer's own headers, the ones under src/ and tests/, are removed or forward-declared; standard-library and third-party includes are left alone. An include is removed only when both the Release and the Debug configuration leave it unused, never from inside a conditional block, and never from a file with platform-specific blocks, which only gain includes. Files whose only use of a header sits behind a feature or debug macro (libvgcode's OpenGL ES and marker code, the ARACHNE/TESTS_EXPORT_SVGS debug output) keep their includes. clonable_ptr.hpp gains #pragma once; it had no include guard and was only safe while Config.hpp was its sole includer. * Remove Unused Project Includes From Files With Platform-Specific Code A Linux include-what-you-use run cannot see the code inside _WIN32, __APPLE__ or __linux__ blocks, so its verdict is only taken where nothing the removed header declares, directly or through what it includes, is named inside those blocks. Removals also have to hold in both the Release and Debug configuration and never touch a line inside a conditional block. * Restore the libslic3r Precompiled Header and Direct Includes Lost in the Platform Pass The platform-file pass treated pchheader.hpp as an ordinary header and emptied it, and left GUI_Preview.hpp and 14 other files relying on headers they no longer reached directly. * Restore MainFrame.hpp in ParamsDialog.cpp for the Windows-Only Reparent Call * Include Headers That Files Reached Through Ones the Cleanup Removed * Drop Includes Duplicated by the Cleanup or by Main's Own Additions * Leave PreciseSeam.cpp as Main Has It After the Precise Seam Rework
157 lines
3.9 KiB
C++
157 lines
3.9 KiB
C++
#ifndef slic3r_GUI_DropDown_hpp_
|
|
#define slic3r_GUI_DropDown_hpp_
|
|
|
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
|
#include <wx/event.h>
|
|
#include <vector>
|
|
#include <cstddef>
|
|
#include <wx/gdicmn.h>
|
|
#include "slic3r/GUI/Widgets/StateColor.hpp"
|
|
#include <boost/date_time/posix_time/ptime.hpp>
|
|
#include <wx/dc.h>
|
|
#include <wx/stattext.h>
|
|
#include <wx/string.h>
|
|
#include "../wxExtensions.hpp"
|
|
#include "StateHandler.hpp"
|
|
#include "PopupWindow.hpp"
|
|
|
|
class wxDC;
|
|
class wxWindow;
|
|
|
|
#define DD_NO_CHECK_ICON 0x0001
|
|
#define DD_NO_TEXT 0x0002
|
|
#define DD_STYLE_MASK 0x0003
|
|
|
|
#define DD_ITEM_STYLE_SPLIT_ITEM 0x0001 // ----text----, text with horizontal line arounds
|
|
#define DD_ITEM_STYLE_DISABLED 0x0002 // ----text----, text with horizontal line arounds
|
|
#define DD_ITEM_STYLE_DIMMED 0x0004 // gray text, but still selectable
|
|
|
|
wxDECLARE_EVENT(EVT_DISMISS, wxCommandEvent);
|
|
|
|
class DropDown : public PopupWindow
|
|
{
|
|
public:
|
|
struct Item
|
|
{
|
|
wxString text;
|
|
wxString text_static_tips;// display static tips for TextInput.eg.PrinterInfoBox
|
|
wxBitmap icon;
|
|
wxBitmap icon_textctrl;// display icon for TextInput.eg.PrinterInfoBox
|
|
void * data{nullptr};
|
|
wxString group_key{};
|
|
wxString group_label{};
|
|
wxString alias{};
|
|
wxString tip{};
|
|
int flag{0};
|
|
int style{ 0 };// the style of item
|
|
};
|
|
|
|
private:
|
|
std::vector<Item> &items;
|
|
size_t count = 0;
|
|
wxString group;
|
|
bool need_sync = false;
|
|
int selection = -1;
|
|
int hover_item = -1;
|
|
|
|
DropDown * subDropDown { nullptr };
|
|
DropDown * mainDropDown { nullptr };
|
|
|
|
double radius = 0;
|
|
bool use_content_width = false;
|
|
bool limit_max_content_width = false;
|
|
bool align_icon = false;
|
|
bool text_off = false;
|
|
|
|
wxSize textSize;
|
|
wxSize iconSize;
|
|
wxSize rowSize;
|
|
|
|
StateHandler state_handler;
|
|
StateColor text_color;
|
|
StateColor border_color;
|
|
StateColor selector_border_color;
|
|
StateColor selector_background_color;
|
|
ScalableBitmap check_bitmap;
|
|
ScalableBitmap arrow_bitmap;
|
|
|
|
bool pressedDown = false;
|
|
boost::posix_time::ptime dismissTime;
|
|
wxPoint offset; // x not used
|
|
wxPoint dragStart;
|
|
|
|
public:
|
|
DropDown(std::vector<Item> &items);
|
|
|
|
DropDown(wxWindow *parent, std::vector<Item> &items, long style = 0);
|
|
|
|
void Create(wxWindow * parent, long style = 0);
|
|
|
|
public:
|
|
void Invalidate(bool clear = false);
|
|
|
|
int GetSelection() const { return selection; }
|
|
|
|
void SetSelection(int n);
|
|
|
|
wxString GetValue() const;
|
|
void SetValue(const wxString &value);
|
|
|
|
public:
|
|
void SetCornerRadius(double radius);
|
|
|
|
void SetBorderColor(StateColor const & color);
|
|
|
|
void SetSelectorBorderColor(StateColor const & color);
|
|
|
|
void SetTextColor(StateColor const &color);
|
|
|
|
void SetSelectorBackgroundColor(StateColor const &color);
|
|
|
|
void SetUseContentWidth(bool use, bool limit_max_content_width = false);
|
|
|
|
void SetAlignIcon(bool align);
|
|
|
|
public:
|
|
void Rescale();
|
|
|
|
bool HasDismissLongTime();
|
|
|
|
void Popup(wxWindow *focus = nullptr) override;
|
|
|
|
protected:
|
|
void Dismiss() override;
|
|
|
|
void OnDismiss() override;
|
|
|
|
bool ShouldDismissOnTopWindowDeactivate() override;
|
|
|
|
private:
|
|
void paintEvent(wxPaintEvent& evt);
|
|
void paintNow();
|
|
|
|
void render(wxDC& dc);
|
|
|
|
int hoverIndex();
|
|
|
|
int selectedItem();
|
|
|
|
friend class ComboBox;
|
|
void messureSize();
|
|
void autoPosition();
|
|
|
|
// some useful events
|
|
void mouseDown(wxMouseEvent& event);
|
|
void mouseReleased(wxMouseEvent &event);
|
|
void mouseCaptureLost(wxMouseCaptureLostEvent &event);
|
|
void mouseMove(wxMouseEvent &event);
|
|
void mouseWheelMoved(wxMouseEvent &event);
|
|
|
|
void sendDropDownEvent();
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
};
|
|
|
|
#endif // !slic3r_GUI_DropDown_hpp_
|