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 179 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 182 of file grid_text_button_helpers.cpp.

183  :
184  wxComboCtrl( aParent ),
185  m_dlg( aParentDlg ),
186  m_preselect( aPreselect )
187  {
188  SetButtonBitmaps( KiBitmap( BITMAPS::small_library ) );
189 
190  // win32 fix, avoids drawing the "native dropdown caret"
191  Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
192  }
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

References KiBitmap(), and small_library.

Member Function Documentation

◆ DoSetPopupControl()

void TEXT_BUTTON_SYMBOL_CHOOSER::DoSetPopupControl ( wxComboPopup *  popup)
inlineoverrideprotected

Definition at line 195 of file grid_text_button_helpers.cpp.

196  {
197  m_popup = nullptr;
198  }

◆ escapeLibId()

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

Definition at line 200 of file grid_text_button_helpers.cpp.

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

References CTX_LIBID, and EscapeString().

Referenced by OnButtonClick().

◆ OnButtonClick()

void TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick ( )
inlineoverrideprotected

Definition at line 207 of file grid_text_button_helpers.cpp.

208  {
209  // pick a symbol using the symbol picker.
210  wxString rawValue = GetValue();
211 
212  if( rawValue.IsEmpty() )
213  rawValue = m_preselect;
214 
215  wxString symbolId = escapeLibId( rawValue );
217 
218  if( frame->ShowModal( &symbolId, m_dlg ) )
219  SetValue( UnescapeString( symbolId ) );
220 
221  frame->Destroy();
222  }
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...
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:64
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:393
wxString escapeLibId(const wxString &aRawValue)
wxString UnescapeString(const wxString &aSource)
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.

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 224 of file grid_text_button_helpers.cpp.

Referenced by OnButtonClick().

◆ m_preselect

wxString TEXT_BUTTON_SYMBOL_CHOOSER::m_preselect
protected

Definition at line 225 of file grid_text_button_helpers.cpp.

Referenced by OnButtonClick().


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