mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-21 20:18:17 +08:00
2nd attempt to fix JIRA SPE-26 (Feature types on MAC)
This commit is contained in:
parent
a569de44b6
commit
26409cbade
@ -491,6 +491,8 @@ void create_combochecklist(wxComboCtrl* comboCtrl, std::string text, std::string
|
|||||||
popup->SetStringValue(text);
|
popup->SetStringValue(text);
|
||||||
popup->Bind(wxEVT_CHECKLISTBOX, [popup](wxCommandEvent& evt) { popup->OnCheckListBox(evt); });
|
popup->Bind(wxEVT_CHECKLISTBOX, [popup](wxCommandEvent& evt) { popup->OnCheckListBox(evt); });
|
||||||
popup->Bind(wxEVT_LISTBOX, [popup](wxCommandEvent& evt) { popup->OnListBoxSelection(evt); });
|
popup->Bind(wxEVT_LISTBOX, [popup](wxCommandEvent& evt) { popup->OnListBoxSelection(evt); });
|
||||||
|
popup->Bind(wxEVT_KEY_DOWN, [popup](wxKeyEvent& evt) { popup->OnKeyEvent(evt); });
|
||||||
|
popup->Bind(wxEVT_KEY_UP, [popup](wxKeyEvent& evt) { popup->OnKeyEvent(evt); });
|
||||||
|
|
||||||
std::vector<std::string> items_str;
|
std::vector<std::string> items_str;
|
||||||
boost::split(items_str, items, boost::is_any_of("|"), boost::token_compress_off);
|
boost::split(items_str, items, boost::is_any_of("|"), boost::token_compress_off);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "wxExtensions.hpp"
|
#include "wxExtensions.hpp"
|
||||||
|
|
||||||
const unsigned int wxCheckListBoxComboPopup::Height = 210;
|
const unsigned int wxCheckListBoxComboPopup::DefaultWidth = 200;
|
||||||
|
const unsigned int wxCheckListBoxComboPopup::DefaultHeight = 200;
|
||||||
|
|
||||||
bool wxCheckListBoxComboPopup::Create(wxWindow* parent)
|
bool wxCheckListBoxComboPopup::Create(wxWindow* parent)
|
||||||
{
|
{
|
||||||
@ -25,16 +26,32 @@ wxString wxCheckListBoxComboPopup::GetStringValue() const
|
|||||||
wxSize wxCheckListBoxComboPopup::GetAdjustedSize(int minWidth, int prefHeight, int maxHeight)
|
wxSize wxCheckListBoxComboPopup::GetAdjustedSize(int minWidth, int prefHeight, int maxHeight)
|
||||||
{
|
{
|
||||||
// matches owner wxComboCtrl's width
|
// matches owner wxComboCtrl's width
|
||||||
|
// and sets height dinamically in dependence of contained items count
|
||||||
|
|
||||||
wxComboCtrl* cmb = GetComboCtrl();
|
wxComboCtrl* cmb = GetComboCtrl();
|
||||||
if (cmb != nullptr)
|
if (cmb != nullptr)
|
||||||
{
|
{
|
||||||
wxSize size = GetComboCtrl()->GetSize();
|
wxSize size = GetComboCtrl()->GetSize();
|
||||||
size.SetHeight(Height);
|
|
||||||
|
unsigned int count = GetCount();
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
wxRect first_rect;
|
||||||
|
GetItemRect(0, first_rect);
|
||||||
|
size.SetHeight((1 + count) * first_rect.GetHeight());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
size.SetHeight(DefaultHeight);
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return wxSize(200, Height);
|
return wxSize(DefaultWidth, DefaultHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxCheckListBoxComboPopup::OnKeyEvent(wxKeyEvent& evt)
|
||||||
|
{
|
||||||
|
// do nothing, but prevents navigation in the list using arrows keys (which is not working properly)
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCheckListBoxComboPopup::OnCheckListBox(wxCommandEvent& evt)
|
void wxCheckListBoxComboPopup::OnCheckListBox(wxCommandEvent& evt)
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
class wxCheckListBoxComboPopup : public wxCheckListBox, public wxComboPopup
|
class wxCheckListBoxComboPopup : public wxCheckListBox, public wxComboPopup
|
||||||
{
|
{
|
||||||
static const unsigned int Height;
|
static const unsigned int DefaultWidth;
|
||||||
|
static const unsigned int DefaultHeight;
|
||||||
|
|
||||||
wxString m_text;
|
wxString m_text;
|
||||||
|
|
||||||
@ -17,6 +18,8 @@ public:
|
|||||||
virtual wxString GetStringValue() const;
|
virtual wxString GetStringValue() const;
|
||||||
virtual wxSize GetAdjustedSize(int minWidth, int prefHeight, int maxHeight);
|
virtual wxSize GetAdjustedSize(int minWidth, int prefHeight, int maxHeight);
|
||||||
|
|
||||||
|
virtual void OnKeyEvent(wxKeyEvent& evt);
|
||||||
|
|
||||||
void OnCheckListBox(wxCommandEvent& evt);
|
void OnCheckListBox(wxCommandEvent& evt);
|
||||||
void OnListBoxSelection(wxCommandEvent& evt);
|
void OnListBoxSelection(wxCommandEvent& evt);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user