KiCad PCB EDA Suite
Loading...
Searching...
No Matches
WX_COMBOBOX Class Reference

Fix some issues with wxCombobox: More...

#include <wx_combobox.h>

Inheritance diagram for WX_COMBOBOX:

Public Member Functions

 WX_COMBOBOX (wxWindow *aParent, int aId=wxID_ANY, const wxString &aValue=wxEmptyString, const wxPoint &aPos=wxDefaultPosition, const wxSize &aSize=wxDefaultSize, int n=0, const wxString choices[]=nullptr, long style=0)
 
virtual ~WX_COMBOBOX ()
 
void Append (const wxString &aText, const wxString &aMenuText=wxEmptyString)
 
int GetCharHeight () const override
 

Protected Member Functions

virtual void DoSetPopupControl (wxComboPopup *aPopup) override
 
virtual void OnDrawItem (wxDC &aDC, const wxRect &aRect, int aItem, int aFlags) const override
 
virtual wxCoord OnMeasureItem (size_t aItem) const override
 
virtual wxCoord OnMeasureItemWidth (size_t aItem) const override
 
void TryVetoMouse (wxMouseEvent &aEvent)
 Veto a mouseover event if in the separator.
 
void TryVetoSelect (wxCommandEvent &aEvent, bool aInner)
 Veto a select event for the separator.
 
wxString GetMenuText (int aItem) const
 Safely get a string for an item, returning wxEmptyString if the item doesn't exist.
 
int GetSelectionEither (bool aInner) const
 Get selection from either the outer (combo box) or inner (popup) list.
 
void SetSelectionEither (bool aInner, int aSel)
 Safely set selection for either the outer (combo box) or inner (popup) list, doing nothing for invalid selections.
 

Private Attributes

std::map< int, wxString > m_menuText
 
int m_lastSelection
 

Detailed Description

Fix some issues with wxCombobox:

  • setting the value of a non-read-only combobox doesn't work on MSW
  • rollover highlighting in the dropdown doesn't work on OSX
  • separators don't work anywhere

Definition at line 32 of file wx_combobox.h.

Constructor & Destructor Documentation

◆ WX_COMBOBOX()

WX_COMBOBOX::WX_COMBOBOX ( wxWindow *  aParent,
int  aId = wxID_ANY,
const wxString &  aValue = wxEmptyString,
const wxPoint &  aPos = wxDefaultPosition,
const wxSize &  aSize = wxDefaultSize,
int  n = 0,
const wxString  choices[] = nullptr,
long  style = 0 
)

Definition at line 30 of file wx_combobox.cpp.

◆ ~WX_COMBOBOX()

WX_COMBOBOX::~WX_COMBOBOX ( )
virtual

Definition at line 38 of file wx_combobox.cpp.

Member Function Documentation

◆ Append()

void WX_COMBOBOX::Append ( const wxString &  aText,
const wxString &  aMenuText = wxEmptyString 
)

Definition at line 147 of file wx_combobox.cpp.

References m_menuText.

Referenced by DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES().

◆ DoSetPopupControl()

void WX_COMBOBOX::DoSetPopupControl ( wxComboPopup *  aPopup)
overrideprotectedvirtual

Definition at line 43 of file wx_combobox.cpp.

References TryVetoMouse(), and TryVetoSelect().

◆ GetCharHeight()

int WX_COMBOBOX::GetCharHeight ( ) const
override

Definition at line 93 of file wx_combobox.cpp.

◆ GetMenuText()

wxString WX_COMBOBOX::GetMenuText ( int  aItem) const
protected

Safely get a string for an item, returning wxEmptyString if the item doesn't exist.

Definition at line 156 of file wx_combobox.cpp.

References m_menuText.

Referenced by OnDrawItem(), OnMeasureItem(), OnMeasureItemWidth(), TryVetoMouse(), and TryVetoSelect().

◆ GetSelectionEither()

int WX_COMBOBOX::GetSelectionEither ( bool  aInner) const
protected

Get selection from either the outer (combo box) or inner (popup) list.

Definition at line 167 of file wx_combobox.cpp.

Referenced by TryVetoSelect().

◆ OnDrawItem()

void WX_COMBOBOX::OnDrawItem ( wxDC &  aDC,
const wxRect &  aRect,
int  aItem,
int  aFlags 
) const
overrideprotectedvirtual

Definition at line 61 of file wx_combobox.cpp.

References GetMenuText(), SEPARATOR, and text.

◆ OnMeasureItem()

wxCoord WX_COMBOBOX::OnMeasureItem ( size_t  aItem) const
overrideprotectedvirtual

Definition at line 99 of file wx_combobox.cpp.

References GetMenuText(), and SEPARATOR.

◆ OnMeasureItemWidth()

wxCoord WX_COMBOBOX::OnMeasureItemWidth ( size_t  aItem) const
overrideprotectedvirtual

Definition at line 108 of file wx_combobox.cpp.

References GetMenuText(), and SEPARATOR.

◆ SetSelectionEither()

void WX_COMBOBOX::SetSelectionEither ( bool  aInner,
int  aSel 
)
protected

Safely set selection for either the outer (combo box) or inner (popup) list, doing nothing for invalid selections.

Definition at line 176 of file wx_combobox.cpp.

Referenced by TryVetoSelect().

◆ TryVetoMouse()

void WX_COMBOBOX::TryVetoMouse ( wxMouseEvent &  aEvent)
protected

Veto a mouseover event if in the separator.

Definition at line 117 of file wx_combobox.cpp.

References GetMenuText(), and SEPARATOR.

Referenced by DoSetPopupControl().

◆ TryVetoSelect()

void WX_COMBOBOX::TryVetoSelect ( wxCommandEvent &  aEvent,
bool  aInner 
)
protected

Veto a select event for the separator.

Parameters
aEvent- the wxCommandEvent caller
aInner- true if event was called for the inner list (ie the popup)

Definition at line 126 of file wx_combobox.cpp.

References GetMenuText(), GetSelectionEither(), m_lastSelection, SEPARATOR, SetSelectionEither(), and text.

Referenced by DoSetPopupControl().

Member Data Documentation

◆ m_lastSelection

int WX_COMBOBOX::m_lastSelection
private

Definition at line 80 of file wx_combobox.h.

Referenced by TryVetoSelect().

◆ m_menuText

std::map<int, wxString> WX_COMBOBOX::m_menuText
private

Definition at line 79 of file wx_combobox.h.

Referenced by Append(), and GetMenuText().


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