Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
wxCheckListBoxComboPopup Class Reference

#include <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

Member Function Documentation

◆ Create()

bool wxCheckListBoxComboPopup::Create ( wxWindow *  parent)
virtual
177{
178 return wxCheckListBox::Create(parent, wxID_HIGHEST + 1, wxPoint(0, 0));
179}

◆ GetAdjustedSize()

wxSize wxCheckListBoxComboPopup::GetAdjustedSize ( int  minWidth,
int  prefHeight,
int  maxHeight 
)
virtual
197{
198 // set width dinamically in dependence of items text
199 // and set height dinamically in dependence of items count
200
201 wxComboCtrl* cmb = GetComboCtrl();
202 if (cmb != nullptr) {
203 wxSize size = GetComboCtrl()->GetSize();
204
205 unsigned int count = GetCount();
206 if (count > 0) {
207 int max_width = size.x;
208 for (unsigned int i = 0; i < count; ++i) {
209 max_width = std::max(max_width, 60 + GetTextExtent(GetString(i)).x);
210 }
211 size.SetWidth(max_width);
212 size.SetHeight(count * cmb->GetCharHeight());
213 }
214 else
215 size.SetHeight(DefaultHeight);
216
217 return size;
218 }
219 else
220 return wxSize(DefaultWidth, DefaultHeight);
221}
static const unsigned int DefaultHeight
Definition wxExtensions.hpp:74
static const unsigned int DefaultWidth
Definition wxExtensions.hpp:73
constexpr auto size(const C &c) -> decltype(c.size())
Definition span.hpp:183
IGL_INLINE void count(const Eigen::SparseMatrix< XType > &X, const int dim, Eigen::SparseVector< SType > &S)
Definition count.cpp:12

References DefaultHeight, and DefaultWidth.

◆ GetControl()

wxWindow * wxCheckListBoxComboPopup::GetControl ( )
virtual
182{
183 return this;
184}

◆ GetStringValue()

wxString wxCheckListBoxComboPopup::GetStringValue ( ) const
virtual
192{
193 return m_text;
194}
wxString m_text
Definition wxExtensions.hpp:76

References m_text.

◆ OnCheckListBox()

void wxCheckListBoxComboPopup::OnCheckListBox ( wxCommandEvent &  evt)
256{
257 // forwards the checklistbox event to the owner wxComboCtrl
258
260 {
261 wxComboCtrl* cmb = GetComboCtrl();
262 if (cmb != nullptr) {
263 wxCommandEvent event(wxEVT_CHECKLISTBOX, cmb->GetId());
264 event.SetEventObject(cmb);
265 cmb->ProcessWindowEvent(event);
266 }
267 }
268
269 evt.Skip();
270
271 #ifndef _WIN32 // events are sent differently on OSX+Linux vs Win (more description in header file)
273 // this happens if the event was resent by OnListBoxSelection - next call to OnListBoxSelection is due to user clicking the text, so the function should
274 // explicitly change the state on the checkbox
276 else
277 // if the user clicked the checkbox square, this event was sent before OnListBoxSelection was called, so we don't want it to resend it
279 #endif
280}

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
224{
225 // filters out all the keys which are not working properly
226 switch (evt.GetKeyCode())
227 {
228 case WXK_LEFT:
229 case WXK_UP:
230 case WXK_RIGHT:
231 case WXK_DOWN:
232 case WXK_PAGEUP:
233 case WXK_PAGEDOWN:
234 case WXK_END:
235 case WXK_HOME:
236 case WXK_NUMPAD_LEFT:
237 case WXK_NUMPAD_UP:
238 case WXK_NUMPAD_RIGHT:
239 case WXK_NUMPAD_DOWN:
240 case WXK_NUMPAD_PAGEUP:
241 case WXK_NUMPAD_PAGEDOWN:
242 case WXK_NUMPAD_END:
243 case WXK_NUMPAD_HOME:
244 {
245 break;
246 }
247 default:
248 {
249 evt.Skip();
250 break;
251 }
252 }
253}

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

+ Here is the caller graph for this function:

◆ OnListBoxSelection()

void wxCheckListBoxComboPopup::OnListBoxSelection ( wxCommandEvent &  evt)
283{
284 // transforms list box item selection event into checklistbox item toggle event
285
286 int selId = GetSelection();
287 if (selId != wxNOT_FOUND)
288 {
289 #ifndef _WIN32
291 #endif
292 Check((unsigned int)selId, !IsChecked((unsigned int)selId));
293
294 m_check_box_events_status = OnCheckListBoxFunction::FreeToProceed; // so the checkbox reacts to square-click the next time
295
296 SetSelection(wxNOT_FOUND);
297 wxCommandEvent event(wxEVT_CHECKLISTBOX, GetId());
298 event.SetInt(selId);
299 event.SetEventObject(this);
300 ProcessEvent(event);
301 }
302}

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
187{
188 m_text = value;
189}

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: