KiCad PCB EDA Suite
TEXT_BUTTON_SYMBOL_CHOOSER Class Reference
Inheritance diagram for TEXT_BUTTON_SYMBOL_CHOOSER:

Public Member Functions

 TEXT_BUTTON_SYMBOL_CHOOSER (wxWindow *aParent, DIALOG_SHIM *aParentDlg, const wxString &aPreselect)
 

Protected Member Functions

void DoSetPopupControl (wxComboPopup *popup) override
 
wxString escapeLibId (const wxString &aRawValue)
 
void OnButtonClick () override
 

Protected Attributes

DIALOG_SHIMm_dlg
 
wxString m_preselect
 

Detailed Description

Definition at line 180 of file grid_text_button_helpers.cpp.

Constructor & Destructor Documentation

◆ TEXT_BUTTON_SYMBOL_CHOOSER()

TEXT_BUTTON_SYMBOL_CHOOSER::TEXT_BUTTON_SYMBOL_CHOOSER ( wxWindow *  aParent,
DIALOG_SHIM aParentDlg,
const wxString &  aPreselect 
)
inline

Definition at line 183 of file grid_text_button_helpers.cpp.

184 :
185 wxComboCtrl( aParent ),
186 m_dlg( aParentDlg ),
187 m_preselect( aPreselect )
188 {
189 SetButtonBitmaps( KiBitmap( BITMAPS::small_library ) );
190
191 // win32 fix, avoids drawing the "native dropdown caret"
192 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
193 }
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:105
@ small_library

References KiBitmap(), and small_library.

Member Function Documentation

◆ DoSetPopupControl()

void TEXT_BUTTON_SYMBOL_CHOOSER::DoSetPopupControl ( wxComboPopup *  popup)
inlineoverrideprotected

Definition at line 196 of file grid_text_button_helpers.cpp.

197 {
198 m_popup = nullptr;
199 }

◆ escapeLibId()

wxString TEXT_BUTTON_SYMBOL_CHOOSER::escapeLibId ( const wxString &  aRawValue)
inlineprotected

Definition at line 201 of file grid_text_button_helpers.cpp.

202 {
203 wxString itemName;
204 wxString libName = aRawValue.BeforeFirst( ':', &itemName );
205 return EscapeString( libName, CTX_LIBID ) + ':' + EscapeString( itemName, CTX_LIBID );
206 }
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
@ CTX_LIBID
Definition: string_utils.h:55

References CTX_LIBID, and EscapeString().

Referenced by OnButtonClick().

◆ OnButtonClick()

void TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick ( )
inlineoverrideprotected

Definition at line 208 of file grid_text_button_helpers.cpp.

209 {
210 // pick a symbol using the symbol picker.
211 wxString rawValue = GetValue();
212
213 if( rawValue.IsEmpty() )
214 rawValue = m_preselect;
215
216 wxString symbolId = escapeLibId( rawValue );
218
219 if( frame->ShowModal( &symbolId, m_dlg ) )
220 SetValue( UnescapeString( symbolId ) );
221
222 frame->Destroy();
223 }
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:66
virtual bool ShowModal(wxString *aResult=nullptr, wxWindow *aResultantFocusWindow=nullptr)
Show this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until t...
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:394
wxString escapeLibId(const wxString &aRawValue)
@ FRAME_SCH_VIEWER_MODAL
Definition: frame_type.h:37
wxString UnescapeString(const wxString &aSource)

References KIWAY_PLAYER::Destroy(), escapeLibId(), FRAME_SCH_VIEWER_MODAL, KIWAY_HOLDER::Kiway(), m_dlg, m_preselect, KIWAY::Player(), KIWAY_PLAYER::ShowModal(), and UnescapeString().

Member Data Documentation

◆ m_dlg

DIALOG_SHIM* TEXT_BUTTON_SYMBOL_CHOOSER::m_dlg
protected

Definition at line 225 of file grid_text_button_helpers.cpp.

Referenced by OnButtonClick().

◆ m_preselect

wxString TEXT_BUTTON_SYMBOL_CHOOSER::m_preselect
protected

Definition at line 226 of file grid_text_button_helpers.cpp.

Referenced by OnButtonClick().


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