33#include <wx/version.h>
62 void SetColAttr( wxGridCellAttr* aAttr,
int aCol )
override
68 wxGridCellAttr*
GetAttr(
int aRow,
int aCol, wxGridCellAttr::wxAttrKind aKind )
override
85 DeleteRows( 0, GetNumberRows() );
89 wxGridCellAttr* enhanceAttr( wxGridCellAttr* aInputAttr,
int aRow,
int aCol,
90 wxGridCellAttr::wxAttrKind aKind );
101 WX_GRID( wxWindow *parent, wxWindowID
id,
const wxPoint& pos = wxDefaultPosition,
102 const wxSize& size = wxDefaultSize,
long style = wxWANTS_CHARS,
103 const wxString&
name = wxGridNameStr );
146 void SetTable( wxGridTableBase*
table,
bool aTakeOwnership =
false );
163 void OnAddRow(
const std::function<std::pair<int, int>()>& aAdder );
169 void OnDeleteRows(
const std::function<
void(
int row )>& aDeleter );
171 void OnDeleteRows(
const std::function<
bool(
int row )>& aFilter,
172 const std::function<
void(
int row )>& aDeleter );
177 void SwapRows(
int aRowA,
int aRowB );
178 void OnMoveRowUp(
const std::function<
void(
int row )>& aMover );
179 void OnMoveRowDown(
const std::function<
void(
int row )>& aMover );
180 void OnMoveRowUp(
const std::function<
bool(
int row )>& aFilter,
181 const std::function<
void(
int row )>& aMover );
182 void OnMoveRowDown(
const std::function<
bool(
int row )>& aFilter,
183 const std::function<
void(
int row )>& aMover );
202 void SetAutoEvalColUnits(
int col,
EDA_UNITS aUnit );
212 int GetUnitValue(
int aRow,
int aCol );
221 std::optional<int> GetOptionalUnitValue(
int aRow,
int aCol );
226 void SetUnitValue(
int aRow,
int aCol,
int aValue );
231 void SetOptionalUnitValue(
int aRow,
int aCol, std::optional<int> aValue );
242 int GetVisibleWidth(
int aCol,
bool aHeader =
true,
bool aContents =
true,
bool aKeep =
false );
248 void EnsureColLabelsVisible();
268 if( GetNumberRows() > 0 )
269 DeleteRows( 0, GetNumberRows(), aUpdateLabels );
275 static void CellEditorSetMargins( wxTextEntryBase* aEntry );
280 static void CellEditorTransformSizeRect( wxRect& aRect );
299 return wxGrid::DoGetBestSize();
306 void SetupColumnAutosizer(
int aFlexibleCol );
317 void DrawColLabel( wxDC& dc,
int col )
override;
322 void DrawRowLabel( wxDC& dc,
int row )
override;
327 void DrawCornerLabel( wxDC& dc )
override;
329 void onGridColMove( wxGridEvent& aEvent );
330 void onGridCellSelect( wxGridEvent& aEvent );
331 void onCellEditorShown( wxGridEvent& aEvent );
332 void onCellEditorHidden( wxGridEvent& aEvent );
334 void onDPIChanged(wxDPIChangedEvent& event);
347 std::pair<EDA_UNITS, EDA_DATA_TYPE> getColumnUnits(
int aCol )
const;
350 void recomputeGridWidths();
352 void onSizeEvent( wxSizeEvent& aEvent );
358 std::unique_ptr<NUMERIC_EVALUATOR>
m_eval;
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 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
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.
enum KICOMMON_API GROUP_TYPE
GROUP_COLLAPSED_DURING_SORT