Make grid cell editors with extra button consistent with normal text cell editors.

This commit is contained in:
Alex Shvartzkop 2024-04-11 00:47:27 +03:00
parent cae631d7b7
commit 5d22c1adee
1 changed files with 12 additions and 12 deletions

View File

@ -63,14 +63,6 @@ void GRID_CELL_TEXT_BUTTON::SetSize( const wxRect& aRect )
#if defined( __WXMAC__ ) #if defined( __WXMAC__ )
rect.Inflate( 2 ); // ignore FOCUS_RING rect.Inflate( 2 ); // ignore FOCUS_RING
#elif defined( __WXGTK__ )
rect.Inflate( -3 ); // The -3 is a very sad hack here. Some GTK themes overrun the
// default -1, preventing display. Unfortunately, we don't appear to
// have a good method of finding the current margin needed.
// Some GTK resize events seem to update the cell size but not all and
// not consistently.
#else
rect.Inflate( -1 );
#endif #endif
Combo()->SetSize( rect, wxSIZE_ALLOW_MINUS_ONE ); Combo()->SetSize( rect, wxSIZE_ALLOW_MINUS_ONE );
@ -232,6 +224,8 @@ void GRID_CELL_SYMBOL_ID_EDITOR::Create( wxWindow* aParent, wxWindowID aId,
{ {
m_control = new TEXT_BUTTON_SYMBOL_CHOOSER( aParent, m_dlg, m_preselect ); m_control = new TEXT_BUTTON_SYMBOL_CHOOSER( aParent, m_dlg, m_preselect );
Combo()->SetMargins( 0, 0 );
wxGridCellEditor::Create( aParent, aId, aEventHandler ); wxGridCellEditor::Create( aParent, aId, aEventHandler );
} }
@ -242,7 +236,7 @@ public:
TEXT_BUTTON_FP_CHOOSER( wxWindow* aParent, DIALOG_SHIM* aParentDlg, TEXT_BUTTON_FP_CHOOSER( wxWindow* aParent, DIALOG_SHIM* aParentDlg,
const wxString& aSymbolNetlist, const wxString& aPreselect ) : const wxString& aSymbolNetlist, const wxString& aPreselect ) :
wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
wxTE_PROCESS_ENTER ), wxTE_PROCESS_ENTER | wxBORDER_NONE ),
m_dlg( aParentDlg ), m_dlg( aParentDlg ),
m_preselect( aPreselect ), m_preselect( aPreselect ),
m_symbolNetlist( aSymbolNetlist.ToStdString() ) m_symbolNetlist( aSymbolNetlist.ToStdString() )
@ -299,6 +293,8 @@ void GRID_CELL_FPID_EDITOR::Create( wxWindow* aParent, wxWindowID aId,
{ {
m_control = new TEXT_BUTTON_FP_CHOOSER( aParent, m_dlg, m_symbolNetlist, m_preselect ); m_control = new TEXT_BUTTON_FP_CHOOSER( aParent, m_dlg, m_symbolNetlist, m_preselect );
Combo()->SetMargins( 0, 0 );
#if wxUSE_VALIDATORS #if wxUSE_VALIDATORS
// validate text in textctrl, if validator is set // validate text in textctrl, if validator is set
if ( m_validator ) if ( m_validator )
@ -316,7 +312,7 @@ class TEXT_BUTTON_URL : public wxComboCtrl
public: public:
TEXT_BUTTON_URL( wxWindow* aParent, DIALOG_SHIM* aParentDlg, SEARCH_STACK* aSearchStack ) : TEXT_BUTTON_URL( wxWindow* aParent, DIALOG_SHIM* aParentDlg, SEARCH_STACK* aSearchStack ) :
wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
wxTE_PROCESS_ENTER ), wxTE_PROCESS_ENTER | wxBORDER_NONE ),
m_dlg( aParentDlg ), m_dlg( aParentDlg ),
m_searchStack( aSearchStack ) m_searchStack( aSearchStack )
{ {
@ -350,6 +346,8 @@ void GRID_CELL_URL_EDITOR::Create( wxWindow* aParent, wxWindowID aId,
{ {
m_control = new TEXT_BUTTON_URL( aParent, m_dlg, m_searchStack ); m_control = new TEXT_BUTTON_URL( aParent, m_dlg, m_searchStack );
Combo()->SetMargins( 0, 0 );
#if wxUSE_VALIDATORS #if wxUSE_VALIDATORS
// validate text in textctrl, if validator is set // validate text in textctrl, if validator is set
if ( m_validator ) if ( m_validator )
@ -370,7 +368,7 @@ public:
bool aNormalize = false, bool aNormalize = false,
const wxString& aNormalizeBasePath = wxEmptyString ) : const wxString& aNormalizeBasePath = wxEmptyString ) :
wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
wxTE_PROCESS_ENTER ), wxTE_PROCESS_ENTER | wxBORDER_NONE ),
m_dlg( aParentDlg ), m_dlg( aParentDlg ),
m_grid( aGrid ), m_grid( aGrid ),
m_currentDir( aCurrentDir ), m_currentDir( aCurrentDir ),
@ -390,7 +388,7 @@ public:
bool aNormalize = false, bool aNormalize = false,
const wxString& aNormalizeBasePath = wxEmptyString ) : const wxString& aNormalizeBasePath = wxEmptyString ) :
wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
wxTE_PROCESS_ENTER ), wxTE_PROCESS_ENTER | wxBORDER_NONE ),
m_dlg( aParentDlg ), m_dlg( aParentDlg ),
m_grid( aGrid ), m_grid( aGrid ),
m_currentDir( aCurrentDir ), m_currentDir( aCurrentDir ),
@ -506,6 +504,8 @@ void GRID_CELL_PATH_EDITOR::Create( wxWindow* aParent, wxWindowID aId,
m_control = new TEXT_BUTTON_FILE_BROWSER( aParent, m_dlg, m_grid, m_currentDir, m_fileFilter, m_control = new TEXT_BUTTON_FILE_BROWSER( aParent, m_dlg, m_grid, m_currentDir, m_fileFilter,
m_normalize, m_normalizeBasePath ); m_normalize, m_normalizeBasePath );
Combo()->SetMargins( 0, 0 );
#if wxUSE_VALIDATORS #if wxUSE_VALIDATORS
// validate text in textctrl, if validator is set // validate text in textctrl, if validator is set
if ( m_validator ) if ( m_validator )