26 #include <wx/filedlg.h> 27 #include <wx/dirdlg.h> 53 return Combo()->GetValue();
62 #if defined( __WXMAC__ ) 66 Combo()->SetSize( rect, wxSIZE_ALLOW_MINUS_ONE );
80 wxTextEntry* textEntry = static_cast<wxTextEntry*>(
Combo() );
86 ch =
event.GetUnicodeKey();
91 #endif // wxUSE_UNICODE 93 ch =
event.GetKeyCode();
94 isPrintable = ch >= WXK_SPACE && ch < WXK_START;
101 textEntry->Remove( 0, 1 );
107 const long pos = textEntry->GetLastPosition();
108 textEntry->Remove( pos - 1, pos );
114 textEntry->WriteText( static_cast<wxChar>( ch ) );
122 auto evtHandler = static_cast< wxGridCellEditorEvtHandler* >( m_control->GetEventHandler() );
125 evtHandler->SetInSetFocus(
true );
127 m_value = aGrid->GetTable()->GetValue( aRow, aCol );
136 const wxString value =
Combo()->GetValue();
152 aGrid->GetTable()->SetValue( aRow, aCol,
m_value );
163 void GRID_CELL_TEXT_BUTTON::SetValidator(
const wxValidator& validator )
165 m_validator.reset( static_cast< wxValidator* >( validator.Clone() ) );
174 const wxString& aPreselect ) :
175 wxComboCtrl( aParent ),
191 wxString compid = GetValue();
193 if( compid.IsEmpty() )
210 wxEvtHandler* aEventHandler )
214 wxGridCellEditor::Create( aParent, aId, aEventHandler );
222 const wxString& aPreselect ) :
223 wxComboCtrl( aParent ),
239 wxString fpid = GetValue();
258 wxEvtHandler* aEventHandler )
266 Combo()->SetValidator( *m_validator );
270 wxGridCellEditor::Create( aParent, aId, aEventHandler );
278 wxComboCtrl( aParent ),
292 wxString filename = GetValue();
294 if( !filename.IsEmpty() && filename != wxT(
"~" ) )
303 wxEvtHandler* aEventHandler )
311 Combo()->SetValidator( *m_validator );
315 wxGridCellEditor::Create( aParent, aId, aEventHandler );
323 wxString* aCurrentDir, wxString* aExt =
nullptr,
324 bool aNormalize =
false,
325 wxString aNormalizeBasePath = wxEmptyString ) :
326 wxComboCtrl( aParent ),
345 wxString path = GetValue();
354 wxFileName fn( path );
355 wxFileDialog dlg(
nullptr,
_(
"Select a File" ), fn.GetPath(), fn.GetFullName(), *
m_ext,
356 wxFD_FILE_MUST_EXIST | wxFD_OPEN );
358 if( dlg.ShowModal() == wxID_OK )
360 wxString filePath = dlg.GetPath();
361 wxString lastPath = dlg.GetDirectory();
362 wxString relPath = wxEmptyString;
368 lastPath =
NormalizePath( dlg.GetDirectory(), &
Pgm().GetLocalEnvVariables(),
372 if( relPath.IsEmpty() )
385 wxDirDialog dlg(
nullptr,
_(
"Select Path" ), path,
386 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
388 if( dlg.ShowModal() == wxID_OK )
390 wxString filePath = dlg.GetPath();
391 wxString relPath = wxEmptyString;
399 if( relPath.IsEmpty() )
422 wxEvtHandler* aEventHandler )
424 if(
m_ext.IsEmpty() )
435 Combo()->SetValidator( *m_validator );
439 wxGridCellEditor::Create( aParent, aId, aEventHandler );
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 GetAssociatedDocument(wxWindow *aParent, const wxString &aDocName, PROJECT *aProject)
Open a document (file) with the suitable browser.
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
TEXT_BUTTON_FILE_BROWSER(wxWindow *aParent, DIALOG_SHIM *aParentDlg, WX_GRID *aGrid, wxString *aCurrentDir, wxString *aExt=nullptr, bool aNormalize=false, wxString aNormalizeBasePath=wxEmptyString)
void StartingKey(wxKeyEvent &event) override
const BITMAP_OPAQUE small_folder_xpm[1]
This file is part of the common library.
wxString m_normalizeBasePath
void Create(wxWindow *aParent, wxWindowID aId, wxEvtHandler *aEventHandler) override
void Create(wxWindow *aParent, wxWindowID aId, wxEvtHandler *aEventHandler) override
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
TEXT_BUTTON_URL(wxWindow *aParent, DIALOG_SHIM *aParentDlg)
void DoSetPopupControl(wxComboPopup *popup) override
const wxString ExpandEnvVarSubstitutions(const wxString &aString, PROJECT *aProject)
Replace any environment variable & text variable references with their values.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
void SetSize(const wxRect &aRect) override
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
void BeginEdit(int aRow, int aCol, wxGrid *aGrid) override
TEXT_BUTTON_FP_CHOOSER(wxWindow *aParent, DIALOG_SHIM *aParentDlg, const wxString &aPreselect)
TEXT_BUTTON_SYMBOL_CHOOSER(wxWindow *aParent, DIALOG_SHIM *aParentDlg, const wxString &aPreselect)
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
wxString m_normalizeBasePath
wxComboCtrl * Combo() const
void OnButtonClick() override
void DoSetPopupControl(wxComboPopup *popup) override
void OnButtonClick() override
const BITMAP_OPAQUE small_library_xpm[1]
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
void DoSetPopupControl(wxComboPopup *popup) override
const BITMAP_OPAQUE www_xpm[1]
wxString GetValue() const override
void OnButtonClick() override
void OnButtonClick() override
void ApplyEdit(int aRow, int aCol, wxGrid *aGrid) override
void DoSetPopupControl(wxComboPopup *popup) override
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
void Create(wxWindow *aParent, wxWindowID aId, wxEvtHandler *aEventHandler) override
bool EndEdit(int, int, const wxGrid *, const wxString &, wxString *aNewVal) override
wxString NormalizePath(const wxFileName &aFilePath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath)
Normalize a file path to an environmental variable, if possible.