29#include <wx/version.h>
58 void SetColAttr( wxGridCellAttr* aAttr,
int aCol )
override
64 wxGridCellAttr*
GetAttr(
int aRow,
int aCol, wxGridCellAttr::wxAttrKind aKind )
override
92 DeleteRows( 0, GetNumberRows() );
96 wxGridCellAttr* enhanceAttr( wxGridCellAttr* aInputAttr,
int aRow,
int aCol,
97 wxGridCellAttr::wxAttrKind aKind );
108 WX_GRID( wxWindow *parent, wxWindowID
id,
const wxPoint& pos = wxDefaultPosition,
109 const wxSize& size = wxDefaultSize,
long style = wxWANTS_CHARS,
110 const wxString&
name = wxGridNameStr );
153 void SetTable( wxGridTableBase*
table,
bool aTakeOwnership =
false );
170 void OnAddRow(
const std::function<std::pair<int, int>()>& aAdder );
176 void OnDeleteRows(
const std::function<
void(
int row )>& aDeleter );
178 void OnDeleteRows(
const std::function<
bool(
int row )>& aFilter,
179 const std::function<
void(
int row )>& aDeleter );
184 void SwapRows(
int aRowA,
int aRowB );
185 void OnMoveRowUp(
const std::function<
void(
int row )>& aMover );
186 void OnMoveRowDown(
const std::function<
void(
int row )>& aMover );
187 void OnMoveRowUp(
const std::function<
bool(
int row )>& aFilter,
188 const std::function<
void(
int row )>& aMover );
189 void OnMoveRowDown(
const std::function<
bool(
int row )>& aFilter,
190 const std::function<
void(
int row )>& aMover );
209 void SetAutoEvalColUnits(
int col,
EDA_UNITS aUnit );
219 int GetUnitValue(
int aRow,
int aCol );
228 std::optional<int> GetOptionalUnitValue(
int aRow,
int aCol );
233 void SetUnitValue(
int aRow,
int aCol,
int aValue );
238 void SetOptionalUnitValue(
int aRow,
int aCol, std::optional<int> aValue );
249 int GetVisibleWidth(
int aCol,
bool aHeader =
true,
bool aContents =
true,
bool aKeep =
false );
255 void EnsureColLabelsVisible();
275 if( GetNumberRows() > 0 )
276 DeleteRows( 0, GetNumberRows(), aUpdateLabels );
282 static void CellEditorSetMargins( wxTextEntryBase* aEntry );
287 static void CellEditorTransformSizeRect( wxRect& aRect );
306 return wxGrid::DoGetBestSize();
313 void SetupColumnAutosizer(
int aFlexibleCol );
319 void RecomputeGridWidths();
326 void DrawColLabel( wxDC& dc,
int col )
override;
331 void DrawRowLabel( wxDC& dc,
int row )
override;
336 void DrawCornerLabel( wxDC& dc )
override;
338 void onGridColMove( wxGridEvent& aEvent );
339 void onGridCellSelect( wxGridEvent& aEvent );
340 void onCellEditorShown( wxGridEvent& aEvent );
341 void onCellEditorHidden( wxGridEvent& aEvent );
343 void onDPIChanged(wxDPIChangedEvent& event);
356 std::pair<EDA_UNITS, EDA_DATA_TYPE> getColumnUnits(
int aCol )
const;
359 void onSizeEvent( wxSizeEvent& aEvent );
365 std::unique_ptr<NUMERIC_EVALUATOR>
m_eval;
379 bool m_firstSelectionRefreshDone =
false;
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Icon provider for the "standard" row indicators, for example in layer selection lists.
~WX_GRID_TABLE_BASE() override
virtual void RestoreUndoState(const wxString &aState)
virtual GROUP_TYPE GetGroupType(int aRow) const
virtual bool IsExpanderColumn(int aCol) const
wxGridCellAttr * enhanceAttr(wxGridCellAttr *aInputAttr, int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind)
std::map< int, wxGridCellAttr * > m_colAttrs
wxGridCellAttr * GetAttr(int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind) override
void SetColAttr(wxGridCellAttr *aAttr, int aCol) override
virtual wxString SerializeUndoState() const
virtual bool HasUndoStateSerialization() const
Optional identity-based serialization for the host dialog's Ctrl+Z/Ctrl+Y.
std::map< int, int > m_autosizedCols
void SetLabelFont(const wxFont &aFont)
Hide wxGrid's SetLabelFont() because for some reason on MSW it's a one-shot and subsequent calls to i...
void ShowHideColumns(const wxString &shownColumns)
Show/hide the grid columns based on a tokenized string of shown column indexes.
void OnMoveRowUp(const std::function< void(int row)> &aMover)
std::map< int, UNITS_PROVIDER * > m_unitsProviders
std::optional< wxSize > m_minSizeOverride
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 th...
void DestroyTable(wxGridTableBase *aTable)
Work-around for a bug in wxGrid which crashes when deleting the table if the cell edit control was no...
std::unordered_map< int, std::pair< EDA_UNITS, EDA_DATA_TYPE > > m_autoEvalColsUnits
void OverrideMinSize(double aXPct, double aYPct)
Grids that have column sizes automatically set to fill the available width don't want to shrink after...
bool CancelPendingChanges()
void SetColLabelSize(int aHeight)
Hide wxGrid's SetColLabelSize() method with one which makes sure the size is tall enough for the syst...
void SwapRows(int aRowA, int aRowB)
These aren't that tricky, but might as well share code.
WX_GRID(wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxWANTS_CHARS, const wxString &name=wxGridNameStr)
void SetGridWidthsDirty()
std::vector< int > m_autoEvalCols
UNITS_PROVIDER * getUnitsProvider(int aCol) const
std::map< std::pair< int, int >, std::pair< wxString, wxString > > m_evalBeforeAfter
void CancelShowEditorOnMouseUp()
void ClearRows(bool aUpdateLabels=true)
wxWidgets recently added an ASSERT which fires if the position is greater than or equal to the number...
ROW_ICON_PROVIDER * m_rowIconProvider
void OnMoveRowDown(const std::function< void(int row)> &aMover)
void ShowEditorOnMouseUp()
WxWidgets has a bunch of bugs in its handling of wxGrid mouse events which close cell editors right a...
void OnDeleteRows(const std::function< void(int row)> &aDeleter)
Handles a row deletion event.
wxString GetShownColumnsAsString()
Get a tokenized string containing the shown column indexes.
void OnAddRow(const std::function< std::pair< int, int >()> &aAdder)
std::bitset< 64 > GetShownColumns()
void SetAutoEvalCols(const std::vector< int > &aCols)
void EnableAlternateRowColors(bool aEnable=true)
Enable alternate row highlighting, where every odd row has a different background color than the even...
ROW_ICON_PROVIDER * GetRowIconProvider() const
void SetUnitsProvider(UNITS_PROVIDER *aProvider, int aCol=0)
Set a EUNITS_PROVIDER to enable use of unit- and eval-based Getters.
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
std::unique_ptr< NUMERIC_EVALUATOR > m_eval
wxSize DoGetBestSize() const override
EDA_DATA_TYPE
The type of unit.
std::vector< std::vector< std::string > > table
enum KICOMMON_API GROUP_TYPE
GROUP_COLLAPSED_DURING_SORT