![]() |
KiCad PCB EDA Suite
|
#include <wx_grid.h>
Public Member Functions | |
WX_GRID (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxWANTS_CHARS, const wxString &name=wxGridNameStr) | |
~WX_GRID () override | |
void | SetColLabelSize (int aHeight) |
Hide wxGrid's SetColLabelSize() method with one which makes sure the size is tall enough for the system GUI font. More... | |
wxString | GetShownColumns () |
Get a tokenized string containing the shown column indexes. More... | |
void | ShowHideColumns (const wxString &shownColumns) |
Show/hide the grid columns based on a tokenized string of shown column indexes. More... | |
void | SetTable (wxGridTableBase *table, bool aTakeOwnership=false) |
Hide wxGrid's SetTable() method with one which doesn't mess up the grid column widths when setting the table. More... | |
void | DestroyTable (wxGridTableBase *aTable) |
Work-around for a bug in wxGrid which crashes when deleting the table if the cell edit control was not closed. More... | |
bool | CommitPendingChanges (bool aQuietMode=false) |
Close any open cell edit controls. More... | |
int | GetVisibleWidth (int aCol, bool aHeader=true, bool aContents=false, bool aKeep=true) |
Calculates the specified column based on the actual size of the text on screen. More... | |
void | EnsureColLabelsVisible () |
Ensure the height of the row displaying the column labels is enough, even if labels are multiline texts. More... | |
void | ShowEditorOnMouseUp () |
WxWidgets has a bunch of bugs in its handling of wxGrid mouse events which close cell editors right after opening them. More... | |
Protected Member Functions | |
void | DrawColLabel (wxDC &dc, int col) override |
void | onGridColMove (wxGridEvent &aEvent) |
Protected Attributes | |
bool | m_weOwnTable |
WX_GRID::WX_GRID | ( | wxWindow * | parent, |
wxWindowID | id, | ||
const wxPoint & | pos = wxDefaultPosition , |
||
const wxSize & | size = wxDefaultSize , |
||
long | style = wxWANTS_CHARS , |
||
const wxString & | name = wxGridNameStr |
||
) |
Definition at line 35 of file wx_grid.cpp.
|
override |
Definition at line 42 of file wx_grid.cpp.
References DestroyTable(), and m_weOwnTable.
bool WX_GRID::CommitPendingChanges | ( | bool | aQuietMode = false | ) |
Close any open cell edit controls.
aQuietMode | if true don't send events (ie: for row/col delete operations) |
Definition at line 182 of file wx_grid.cpp.
Referenced by PANEL_FP_LIB_TABLE::appendRowHandler(), PANEL_SYM_LIB_TABLE::appendRowHandler(), PANEL_FP_LIB_TABLE::browseLibrariesHandler(), PANEL_SYM_LIB_TABLE::deleteRowHandler(), PANEL_FP_LIB_TABLE::deleteRowHandler(), DestroyTable(), PANEL_SETUP_NETCLASSES::doApplyFilters(), PANEL_SETUP_NETCLASSES::doAssignments(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::doValidate(), PANEL_SETUP_TEXT_AND_GRAPHICS::ImportSettingsFrom(), PANEL_SETUP_TRACKS_AND_VIAS::ImportSettingsFrom(), PANEL_SYM_LIB_TABLE::moveDownHandler(), PANEL_FP_LIB_TABLE::moveDownHandler(), PANEL_SYM_LIB_TABLE::moveUpHandler(), PANEL_FP_LIB_TABLE::moveUpHandler(), DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel(), DIALOG_FOOTPRINT_PROPERTIES::OnAdd3DModel(), DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DRow(), DIALOG_FOOTPRINT_PROPERTIES::OnAdd3DRow(), DIALOG_PIN_PROPERTIES::OnAddAlternate(), PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::OnAddButtonClick(), DIALOG_CONFIGURE_PATHS::OnAddEnvVar(), DIALOG_SHEET_PROPERTIES::OnAddField(), DIALOG_SYMBOL_PROPERTIES::OnAddField(), DIALOG_LIB_SYMBOL_PROPERTIES::OnAddField(), DIALOG_FOOTPRINT_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), PANEL_SETUP_NETCLASSES::OnAddNetclassClick(), DIALOG_LIB_EDIT_PIN_TABLE::OnAddRow(), DIALOG_CONFIGURE_PATHS::OnAddSearchPath(), PANEL_FP_EDITOR_DEFAULTS::OnAddTextItem(), PANEL_TEXT_VARIABLES::OnAddTextVar(), DIALOG_FP_PLUGIN_OPTIONS::onAppendOption(), DIALOG_FP_PLUGIN_OPTIONS::onAppendRow(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::OnButtonAdd(), TEXT_BUTTON_FILE_BROWSER::OnButtonClick(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::OnButtonDelete(), DIALOG_LIB_EDIT_PIN_TABLE::OnClose(), DIALOG_FIELDS_EDITOR_GLOBAL::OnClose(), PANEL_SYM_LIB_TABLE::onConvertLegacyLibraries(), DIALOG_PIN_PROPERTIES::OnDeleteAlternate(), PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::OnDeleteButtonClick(), DIALOG_SHEET_PROPERTIES::OnDeleteField(), DIALOG_SYMBOL_PROPERTIES::OnDeleteField(), DIALOG_LIB_SYMBOL_PROPERTIES::OnDeleteField(), DIALOG_FOOTPRINT_FP_EDITOR::OnDeleteField(), DIALOG_FOOTPRINT_PROPERTIES::OnDeleteField(), DIALOG_LIB_EDIT_PIN_TABLE::OnDeleteRow(), DIALOG_FP_PLUGIN_OPTIONS::onDeleteRow(), DIALOG_CONFIGURE_PATHS::OnDeleteSearchPath(), PANEL_FP_EDITOR_DEFAULTS::OnDeleteTextItem(), onGridColMove(), GRID_TRICKS::onGridLabelLeftClick(), DIALOG_SHEET_PROPERTIES::OnMoveDown(), DIALOG_SYMBOL_PROPERTIES::OnMoveDown(), DIALOG_LIB_SYMBOL_PROPERTIES::OnMoveDown(), DIALOG_SHEET_PROPERTIES::OnMoveUp(), DIALOG_SYMBOL_PROPERTIES::OnMoveUp(), DIALOG_LIB_SYMBOL_PROPERTIES::OnMoveUp(), DIALOG_LIB_EDIT_PIN_TABLE::OnRebuildRows(), DIALOG_FOOTPRINT_FP_EDITOR::OnRemove3DModel(), DIALOG_FOOTPRINT_PROPERTIES::OnRemove3DModel(), DIALOG_CONFIGURE_PATHS::OnRemoveEnvVar(), PANEL_SETUP_NETCLASSES::OnRemoveNetclassClick(), PANEL_TEXT_VARIABLES::OnRemoveTextVar(), DIALOG_CONFIGURE_PATHS::OnSearchPathMoveDown(), DIALOG_CONFIGURE_PATHS::OnSearchPathMoveUp(), PANEL_SETUP_NETCLASSES::rebuildNetclassDropdowns(), PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::TransferDataFromGrid(), PANEL_TEXT_VARIABLES::TransferDataFromWindow(), DIALOG_FIELDS_EDITOR_GLOBAL::TransferDataFromWindow(), PANEL_FP_LIB_TABLE::TransferDataFromWindow(), DIALOG_CONFIGURE_PATHS::TransferDataFromWindow(), DIALOG_SWAP_LAYERS::TransferDataFromWindow(), DIALOG_LIB_EDIT_PIN_TABLE::TransferDataFromWindow(), PANEL_SYM_LIB_TABLE::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), PANEL_SETUP_TRACKS_AND_VIAS::TransferDataFromWindow(), DIALOG_PIN_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_FP_PLUGIN_OPTIONS::TransferDataFromWindow(), PANEL_SETUP_TEXT_AND_GRAPHICS::Validate(), DIALOG_SHEET_PROPERTIES::Validate(), DIALOG_SYMBOL_PROPERTIES::Validate(), DIALOG_FOOTPRINT_FP_EDITOR::Validate(), PANEL_SETUP_TRACKS_AND_VIAS::Validate(), DIALOG_LIB_SYMBOL_PROPERTIES::Validate(), PANEL_SETUP_NETCLASSES::Validate(), DIALOG_FOOTPRINT_PROPERTIES::Validate(), PANEL_FP_EDITOR_DEFAULTS::validateData(), and DIALOG_EDIT_COMPONENTS_LIBID::validateLibIds().
void WX_GRID::DestroyTable | ( | wxGridTableBase * | aTable | ) |
Work-around for a bug in wxGrid which crashes when deleting the table if the cell edit control was not closed.
Definition at line 97 of file wx_grid.cpp.
References CommitPendingChanges(), NULL, and onGridColMove().
Referenced by DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FOOTPRINT_PROPERTIES::~DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_LIB_EDIT_PIN_TABLE::~DIALOG_LIB_EDIT_PIN_TABLE(), DIALOG_LIB_SYMBOL_PROPERTIES::~DIALOG_LIB_SYMBOL_PROPERTIES(), DIALOG_PIN_PROPERTIES::~DIALOG_PIN_PROPERTIES(), DIALOG_SHEET_PROPERTIES::~DIALOG_SHEET_PROPERTIES(), DIALOG_SWAP_LAYERS::~DIALOG_SWAP_LAYERS(), DIALOG_SYMBOL_PROPERTIES::~DIALOG_SYMBOL_PROPERTIES(), and ~WX_GRID().
|
overrideprotected |
Definition at line 149 of file wx_grid.cpp.
void WX_GRID::EnsureColLabelsVisible | ( | ) |
Ensure the height of the row displaying the column labels is enough, even if labels are multiline texts.
Definition at line 283 of file wx_grid.cpp.
References SetColLabelSize().
Referenced by GetVisibleWidth(), and PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES().
wxString WX_GRID::GetShownColumns | ( | ) |
Get a tokenized string containing the shown column indexes.
Tokens are separated by spaces.
Definition at line 110 of file wx_grid.cpp.
Referenced by DIALOG_LIB_EDIT_PIN_TABLE::OnUpdateUI(), DIALOG_SHEET_PROPERTIES::OnUpdateUI(), DIALOG_SYMBOL_PROPERTIES::OnUpdateUI(), DIALOG_LIB_SYMBOL_PROPERTIES::OnUpdateUI(), DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FOOTPRINT_PROPERTIES::~DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_LIB_EDIT_PIN_TABLE::~DIALOG_LIB_EDIT_PIN_TABLE(), DIALOG_LIB_SYMBOL_PROPERTIES::~DIALOG_LIB_SYMBOL_PROPERTIES(), DIALOG_SHEET_PROPERTIES::~DIALOG_SHEET_PROPERTIES(), and DIALOG_SYMBOL_PROPERTIES::~DIALOG_SYMBOL_PROPERTIES().
int WX_GRID::GetVisibleWidth | ( | int | aCol, |
bool | aHeader = true , |
||
bool | aContents = false , |
||
bool | aKeep = true |
||
) |
Calculates the specified column based on the actual size of the text on screen.
Will return the maximum value of all calculated widths.
aCol | - Integer value of the column to resize. Specify -1 for the row labels. |
aHeader | - Include the header in the width calculation |
aContents | - Include the full contents of the column |
aKeep | - Use the current size as a minimum value |
Definition at line 238 of file wx_grid.cpp.
References EnsureColLabelsVisible().
Referenced by DIALOG_FOOTPRINT_FP_EDITOR::adjustGridColumns(), DIALOG_FOOTPRINT_PROPERTIES::adjustGridColumns(), PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES(), PANEL_PCBNEW_ACTION_PLUGINS::TransferDataToWindow(), PANEL_FP_EDITOR_DEFAULTS::TransferDataToWindow(), PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataToWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), and DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow().
|
protected |
Definition at line 231 of file wx_grid.cpp.
References CommitPendingChanges().
Referenced by DestroyTable(), and SetTable().
void WX_GRID::SetColLabelSize | ( | int | aHeight | ) |
Hide wxGrid's SetColLabelSize() method with one which makes sure the size is tall enough for the system GUI font.
height |
Definition at line 49 of file wx_grid.cpp.
References MIN_GRIDCELL_MARGIN.
Referenced by APPEARANCE_CONTROLS::APPEARANCE_CONTROLS(), APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE(), DIALOG_CONFIGURE_PATHS_BASE::DIALOG_CONFIGURE_PATHS_BASE(), DIALOG_EDIT_COMPONENTS_LIBID_BASE::DIALOG_EDIT_COMPONENTS_LIBID_BASE(), DIALOG_FIELDS_EDITOR_GLOBAL_BASE::DIALOG_FIELDS_EDITOR_GLOBAL_BASE(), DIALOG_FOOTPRINT_FP_EDITOR_BASE::DIALOG_FOOTPRINT_FP_EDITOR_BASE(), DIALOG_FOOTPRINT_PROPERTIES_BASE::DIALOG_FOOTPRINT_PROPERTIES_BASE(), DIALOG_FP_PLUGIN_OPTIONS_BASE::DIALOG_FP_PLUGIN_OPTIONS_BASE(), DIALOG_LIB_EDIT_PIN_TABLE_BASE::DIALOG_LIB_EDIT_PIN_TABLE_BASE(), DIALOG_LIB_SYMBOL_PROPERTIES_BASE::DIALOG_LIB_SYMBOL_PROPERTIES_BASE(), DIALOG_PAD_PRIMITIVE_POLY_PROPS_BASE::DIALOG_PAD_PRIMITIVE_POLY_PROPS_BASE(), DIALOG_PIN_PROPERTIES_BASE::DIALOG_PIN_PROPERTIES_BASE(), DIALOG_SHEET_PROPERTIES_BASE::DIALOG_SHEET_PROPERTIES_BASE(), DIALOG_SWAP_LAYERS_BASE::DIALOG_SWAP_LAYERS_BASE(), DIALOG_SYMBOL_PROPERTIES_BASE::DIALOG_SYMBOL_PROPERTIES_BASE(), EnsureColLabelsVisible(), FOOTPRINT_WIZARD_FRAME::initParameterGrid(), PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE::PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE(), PANEL_FP_EDITOR_DEFAULTS_BASE::PANEL_FP_EDITOR_DEFAULTS_BASE(), PANEL_FP_LIB_TABLE_BASE::PANEL_FP_LIB_TABLE_BASE(), PANEL_PCBNEW_ACTION_PLUGINS_BASE::PANEL_PCBNEW_ACTION_PLUGINS_BASE(), PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE(), PANEL_SETUP_TEXT_AND_GRAPHICS_BASE::PANEL_SETUP_TEXT_AND_GRAPHICS_BASE(), PANEL_SETUP_TRACKS_AND_VIAS_BASE::PANEL_SETUP_TRACKS_AND_VIAS_BASE(), PANEL_SYM_LIB_TABLE_BASE::PANEL_SYM_LIB_TABLE_BASE(), and PANEL_TEXT_VARIABLES_BASE::PANEL_TEXT_VARIABLES_BASE().
void WX_GRID::SetTable | ( | wxGridTableBase * | table, |
bool | aTakeOwnership = false |
||
) |
Hide wxGrid's SetTable() method with one which doesn't mess up the grid column widths when setting the table.
Definition at line 65 of file wx_grid.cpp.
References m_weOwnTable, MIN_GRIDCELL_MARGIN, NULL, and onGridColMove().
Referenced by APPEARANCE_CONTROLS::APPEARANCE_CONTROLS(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE(), DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES(), PANEL_FP_EDITOR_DEFAULTS::PANEL_FP_EDITOR_DEFAULTS(), PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE(), and PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE().
|
inline |
WxWidgets has a bunch of bugs in its handling of wxGrid mouse events which close cell editors right after opening them.
Helpfully, it already has a bunch of work-arounds in place (such as the SetInSetFocus() hack), including one to make slow clicks work. We re-purpose this hack to work-around the bugs when we want to open an editor.
Definition at line 99 of file wx_grid.h.
Referenced by GRID_TRICKS::showEditor().
void WX_GRID::ShowHideColumns | ( | const wxString & | shownColumns | ) |
Show/hide the grid columns based on a tokenized string of shown column indexes.
Definition at line 129 of file wx_grid.cpp.
Referenced by DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE(), DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES(), DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES(), and DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES().
|
protected |
Definition at line 106 of file wx_grid.h.
Referenced by SetTable(), and ~WX_GRID().