33#include <wx/version.h>
62 void SetColAttr( wxGridCellAttr* aAttr,
int aCol )
override
68 wxGridCellAttr*
GetAttr(
int aRow,
int aCol, wxGridCellAttr::wxAttrKind aKind )
override
96 DeleteRows( 0, GetNumberRows() );
100 wxGridCellAttr* enhanceAttr( wxGridCellAttr* aInputAttr,
int aRow,
int aCol,
101 wxGridCellAttr::wxAttrKind aKind );
112 WX_GRID( wxWindow *parent, wxWindowID
id,
const wxPoint& pos = wxDefaultPosition,
113 const wxSize& size = wxDefaultSize,
long style = wxWANTS_CHARS,
114 const wxString&
name = wxGridNameStr );
157 void SetTable( wxGridTableBase*
table,
bool aTakeOwnership =
false );
174 void OnAddRow(
const std::function<std::pair<int, int>()>& aAdder );
180 void OnDeleteRows(
const std::function<
void(
int row )>& aDeleter );
182 void OnDeleteRows(
const std::function<
bool(
int row )>& aFilter,
183 const std::function<
void(
int row )>& aDeleter );
188 void SwapRows(
int aRowA,
int aRowB );
189 void OnMoveRowUp(
const std::function<
void(
int row )>& aMover );
190 void OnMoveRowDown(
const std::function<
void(
int row )>& aMover );
191 void OnMoveRowUp(
const std::function<
bool(
int row )>& aFilter,
192 const std::function<
void(
int row )>& aMover );
193 void OnMoveRowDown(
const std::function<
bool(
int row )>& aFilter,
194 const std::function<
void(
int row )>& aMover );
213 void SetAutoEvalColUnits(
int col,
EDA_UNITS aUnit );
223 int GetUnitValue(
int aRow,
int aCol );
232 std::optional<int> GetOptionalUnitValue(
int aRow,
int aCol );
237 void SetUnitValue(
int aRow,
int aCol,
int aValue );
242 void SetOptionalUnitValue(
int aRow,
int aCol, std::optional<int> aValue );
253 int GetVisibleWidth(
int aCol,
bool aHeader =
true,
bool aContents =
true,
bool aKeep =
false );
259 void EnsureColLabelsVisible();
279 if( GetNumberRows() > 0 )
280 DeleteRows( 0, GetNumberRows(), aUpdateLabels );
286 static void CellEditorSetMargins( wxTextEntryBase* aEntry );
291 static void CellEditorTransformSizeRect( wxRect& aRect );
310 return wxGrid::DoGetBestSize();
317 void SetupColumnAutosizer(
int aFlexibleCol );
323 void RecomputeGridWidths();
330 void DrawColLabel( wxDC& dc,
int col )
override;
335 void DrawRowLabel( wxDC& dc,
int row )
override;
340 void DrawCornerLabel( wxDC& dc )
override;
342 void onGridColMove( wxGridEvent& aEvent );
343 void onGridCellSelect( wxGridEvent& aEvent );
344 void onCellEditorShown( wxGridEvent& aEvent );
345 void onCellEditorHidden( wxGridEvent& aEvent );
347 void onDPIChanged(wxDPIChangedEvent& event);
360 std::pair<EDA_UNITS, EDA_DATA_TYPE> getColumnUnits(
int aCol )
const;
363 void onSizeEvent( wxSizeEvent& aEvent );
369 std::unique_ptr<NUMERIC_EVALUATOR>
m_eval;
383 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