mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-08 10:37:40 +00:00
ENH: ComboBox second drop list & align center
Change-Id: I468468a1a86bb8e89468070b0323aace6279fd09 Jira: STUDIO-8857 (cherry picked from commit 120ac092e38993a91132b6b3d87777ef8e728f0e)
This commit is contained in:
@@ -15,12 +15,27 @@ wxDECLARE_EVENT(EVT_DISMISS, wxCommandEvent);
|
||||
|
||||
class DropDown : public PopupWindow
|
||||
{
|
||||
std::vector<wxString> & texts;
|
||||
std::vector<wxString> & tips;
|
||||
std::vector<wxBitmap> & icons;
|
||||
bool need_sync = false;
|
||||
int selection = -1;
|
||||
int hover_item = -1;
|
||||
public:
|
||||
struct Item
|
||||
{
|
||||
wxString text;
|
||||
wxBitmap icon;
|
||||
void * data{nullptr};
|
||||
wxString group{};
|
||||
wxString alias{};
|
||||
wxString tip{};
|
||||
};
|
||||
|
||||
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;
|
||||
@@ -45,19 +60,12 @@ class DropDown : public PopupWindow
|
||||
wxPoint dragStart;
|
||||
|
||||
public:
|
||||
DropDown(std::vector<wxString> &texts,
|
||||
std::vector<wxString> &tips,
|
||||
std::vector<wxBitmap> &icons);
|
||||
|
||||
DropDown(wxWindow * parent,
|
||||
std::vector<wxString> &texts,
|
||||
std::vector<wxString> &tips,
|
||||
std::vector<wxBitmap> &icons,
|
||||
long style = 0);
|
||||
|
||||
void Create(wxWindow * parent,
|
||||
long style = 0);
|
||||
|
||||
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);
|
||||
|
||||
@@ -82,13 +90,15 @@ public:
|
||||
void SetUseContentWidth(bool use, bool limit_max_content_width = false);
|
||||
|
||||
void SetAlignIcon(bool align);
|
||||
|
||||
|
||||
public:
|
||||
void Rescale();
|
||||
|
||||
bool HasDismissLongTime();
|
||||
|
||||
|
||||
protected:
|
||||
void Dismiss() override;
|
||||
|
||||
void OnDismiss() override;
|
||||
|
||||
private:
|
||||
@@ -97,6 +107,10 @@ private:
|
||||
|
||||
void render(wxDC& dc);
|
||||
|
||||
int hoverIndex();
|
||||
|
||||
int selectedItem();
|
||||
|
||||
friend class ComboBox;
|
||||
void messureSize();
|
||||
void autoPosition();
|
||||
|
||||
Reference in New Issue
Block a user