OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
wxCheckListBoxComboPopup Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/wxExtensions.hpp>

Inheritance diagram for wxCheckListBoxComboPopup:
Collaboration diagram for wxCheckListBoxComboPopup:

Public Member Functions

virtual bool Create (wxWindow *parent)
virtual wxWindow * GetControl ()
virtual void SetStringValue (const wxString &value)
virtual wxString GetStringValue () const
virtual wxSize GetAdjustedSize (int minWidth, int prefHeight, int maxHeight)
virtual void OnKeyEvent (wxKeyEvent &evt)
void OnCheckListBox (wxCommandEvent &evt)
void OnListBoxSelection (wxCommandEvent &evt)

Private Types

enum class  OnCheckListBoxFunction { FreeToProceed , RefuseToProceed , WasRefusedLastTime }

Private Attributes

wxString m_text
enum wxCheckListBoxComboPopup::OnCheckListBoxFunction m_check_box_events_status = OnCheckListBoxFunction::FreeToProceed

Static Private Attributes

static const unsigned int DefaultWidth = 200
static const unsigned int DefaultHeight = 200

Detailed Description

Member Enumeration Documentation

◆ OnCheckListBoxFunction

Enumerator
FreeToProceed 
RefuseToProceed 
WasRefusedLastTime 
118 {
119 FreeToProceed,
120 RefuseToProceed,
121 WasRefusedLastTime
122 } m_check_box_events_status = OnCheckListBoxFunction::FreeToProceed;

Member Function Documentation

◆ Create()

bool wxCheckListBoxComboPopup::Create ( wxWindow * parent)
virtual
213{
214 return wxCheckListBox::Create(parent, wxID_HIGHEST + 1, wxPoint(0, 0));
215}

◆ GetAdjustedSize()

wxSize wxCheckListBoxComboPopup::GetAdjustedSize ( int minWidth,
int prefHeight,
int maxHeight )
virtual
233{
234 // set width dinamically in dependence of items text
235 // and set height dinamically in dependence of items count
236
237 wxComboCtrl* cmb = GetComboCtrl();
238 if (cmb != nullptr) {
239 wxSize size = GetComboCtrl()->GetSize();
240
241 unsigned int count = GetCount();
242 if (count > 0) {
243 int max_width = size.x;
244 for (unsigned int i = 0; i < count; ++i) {
245 max_width = std::max(max_width, 60 + GetTextExtent(GetString(i)).x);
246 }
247 size.SetWidth(max_width);
248 size.SetHeight(count * cmb->GetCharHeight());
249 }
250 else
251 size.SetHeight(DefaultHeight);
252
253 return size;
254 }
255 else
256 return wxSize(DefaultWidth, DefaultHeight);
257}
static unsigned int count
Definition AuxiliaryDataViewModel.cpp:246
static const unsigned int DefaultHeight
Definition wxExtensions.hpp:106
static const unsigned int DefaultWidth
Definition wxExtensions.hpp:105

References count, DefaultHeight, and DefaultWidth.

◆ GetControl()

wxWindow * wxCheckListBoxComboPopup::GetControl ( )
virtual
218{
219 return this;
220}

◆ GetStringValue()

wxString wxCheckListBoxComboPopup::GetStringValue ( ) const
virtual
228{
229 return m_text;
230}
wxString m_text
Definition wxExtensions.hpp:108

References m_text.

◆ OnCheckListBox()

void wxCheckListBoxComboPopup::OnCheckListBox ( wxCommandEvent & evt)
292{
293 // forwards the checklistbox event to the owner wxComboCtrl
294
296 {
297 wxComboCtrl* cmb = GetComboCtrl();
298 if (cmb != nullptr) {
299 wxCommandEvent event(wxEVT_CHECKLISTBOX, cmb->GetId());
300 event.SetEventObject(cmb);
301 cmb->ProcessWindowEvent(event);
302 }
303 }
304
305 evt.Skip();
306
307 #ifndef _WIN32 // events are sent differently on OSX+Linux vs Win (more description in header file)
309 // this happens if the event was resent by OnListBoxSelection - next call to OnListBoxSelection is due to user clicking the text, so the function should
310 // explicitly change the state on the checkbox
312 else
313 // if the user clicked the checkbox square, this event was sent before OnListBoxSelection was called, so we don't want it to resend it
315 #endif
316}
enum wxCheckListBoxComboPopup::OnCheckListBoxFunction m_check_box_events_status
@ WasRefusedLastTime
Definition wxExtensions.hpp:121
@ RefuseToProceed
Definition wxExtensions.hpp:120
@ FreeToProceed
Definition wxExtensions.hpp:119

References FreeToProceed, m_check_box_events_status, RefuseToProceed, and WasRefusedLastTime.

Referenced by Slic3r::GUI::create_combochecklist().

Here is the caller graph for this function:

◆ OnKeyEvent()

void wxCheckListBoxComboPopup::OnKeyEvent ( wxKeyEvent & evt)
virtual
260{
261 // filters out all the keys which are not working properly
262 switch (evt.GetKeyCode())
263 {
264 case WXK_LEFT:
265 case WXK_UP:
266 case WXK_RIGHT:
267 case WXK_DOWN:
268 case WXK_PAGEUP:
269 case WXK_PAGEDOWN:
270 case WXK_END:
271 case WXK_HOME:
272 case WXK_NUMPAD_LEFT:
273 case WXK_NUMPAD_UP:
274 case WXK_NUMPAD_RIGHT:
275 case WXK_NUMPAD_DOWN:
276 case WXK_NUMPAD_PAGEUP:
277 case WXK_NUMPAD_PAGEDOWN:
278 case WXK_NUMPAD_END:
279 case WXK_NUMPAD_HOME:
280 {
281 break;
282 }
283 default:
284 {
285 evt.Skip();
286 break;
287 }
288 }
289}

Referenced by Slic3r::GUI::create_combochecklist().

Here is the caller graph for this function:

◆ OnListBoxSelection()

void wxCheckListBoxComboPopup::OnListBoxSelection ( wxCommandEvent & evt)
319{
320 // transforms list box item selection event into checklistbox item toggle event
321
322 int selId = GetSelection();
323 if (selId != wxNOT_FOUND)
324 {
325 #ifndef _WIN32
327 #endif
328 Check((unsigned int)selId, !IsChecked((unsigned int)selId));
329
330 m_check_box_events_status = OnCheckListBoxFunction::FreeToProceed; // so the checkbox reacts to square-click the next time
331
332 SetSelection(wxNOT_FOUND);
333 wxCommandEvent event(wxEVT_CHECKLISTBOX, GetId());
334 event.SetInt(selId);
335 event.SetEventObject(this);
336 ProcessEvent(event);
337 }
338}

References FreeToProceed, m_check_box_events_status, and RefuseToProceed.

Referenced by Slic3r::GUI::create_combochecklist().

Here is the caller graph for this function:

◆ SetStringValue()

void wxCheckListBoxComboPopup::SetStringValue ( const wxString & value)
virtual
223{
224 m_text = value;
225}

References m_text.

Referenced by Slic3r::GUI::create_combochecklist().

Here is the caller graph for this function:

Member Data Documentation

◆ DefaultHeight

const unsigned int wxCheckListBoxComboPopup::DefaultHeight = 200
staticprivate

Referenced by GetAdjustedSize().

◆ DefaultWidth

const unsigned int wxCheckListBoxComboPopup::DefaultWidth = 200
staticprivate

Referenced by GetAdjustedSize().

◆ m_check_box_events_status

enum wxCheckListBoxComboPopup::OnCheckListBoxFunction wxCheckListBoxComboPopup::m_check_box_events_status = OnCheckListBoxFunction::FreeToProceed
private

◆ m_text

wxString wxCheckListBoxComboPopup::m_text
private

Referenced by GetStringValue(), and SetStringValue().


The documentation for this class was generated from the following files: