29#include <wx/version.h>
66 void SetColAttr( wxGridCellAttr* aAttr,
int aCol )
override
72 wxGridCellAttr*
GetAttr(
int aRow,
int aCol, wxGridCellAttr::wxAttrKind aKind )
override
100 DeleteRows( 0, GetNumberRows() );
104 wxGridCellAttr* enhanceAttr( wxGridCellAttr* aInputAttr,
int aRow,
int aCol,
105 wxGridCellAttr::wxAttrKind aKind );
116 WX_GRID( wxWindow *parent, wxWindowID
id,
const wxPoint& pos = wxDefaultPosition,
117 const wxSize& size = wxDefaultSize,
long style = wxWANTS_CHARS,
118 const wxString&
name = wxGridNameStr );
156 wxString GetShownColumnsAsString();
157 std::bitset<64> GetShownColumns();
162 void ShowHideColumns(
const wxString& shownColumns );
168 void SetTable( wxGridTableBase*
table,
bool aTakeOwnership =
false );
174 void DestroyTable( wxGridTableBase* aTable );
182 bool CommitPendingChanges(
bool aQuietMode =
false );
183 bool CancelPendingChanges();
185 void OnAddRow(
const std::function<std::pair<int, int>()>& aAdder );
191 void OnDeleteRows(
const std::function<
void(
int row )>& aDeleter );
193 void OnDeleteRows(
const std::function<
bool(
int row )>& aFilter,
194 const std::function<
void(
int row )>& aDeleter );
199 void SwapRows(
int aRowA,
int aRowB );
200 void OnMoveRowUp(
const std::function<
void(
int row )>& aMover );
201 void OnMoveRowDown(
const std::function<
void(
int row )>& aMover );
202 void OnMoveRowUp(
const std::function<
bool(
int row )>& aFilter,
203 const std::function<
void(
int row )>& aMover );
204 void OnMoveRowDown(
const std::function<
bool(
int row )>& aFilter,
205 const std::function<
void(
int row )>& aMover );
224 void SetAutoEvalColUnits(
int col,
EDA_UNITS aUnit );
234 int GetUnitValue(
int aRow,
int aCol );
243 std::optional<int> GetOptionalUnitValue(
int aRow,
int aCol );
248 void SetUnitValue(
int aRow,
int aCol,
int aValue );
253 void SetOptionalUnitValue(
int aRow,
int aCol, std::optional<int> aValue );
264 int GetVisibleWidth(
int aCol,
bool aHeader =
true,
bool aContents =
true,
bool aKeep =
false );
270 void EnsureColLabelsVisible();
290 if( GetNumberRows() > 0 )
291 DeleteRows( 0, GetNumberRows(), aUpdateLabels );
297 static void CellEditorSetMargins( wxTextEntryBase* aEntry );
302 static void CellEditorTransformSizeRect( wxRect& aRect );
324 void SetMinVisibleRows( wxWindow* aDialog,
int aMinRows );
335 static int CapHeightToVisibleRows(
int aMinHeight,
int aHeaderHeight,
336 const std::vector<int>& aRowHeights,
int aMaxRows );
343 return wxGrid::DoGetBestSize();
350 void SetupColumnAutosizer(
int aFlexibleCol );
356 void RecomputeGridWidths();
363 void DrawColLabel( wxDC& dc,
int col )
override;
368 void DrawRowLabel( wxDC& dc,
int row )
override;
373 void DrawCornerLabel( wxDC& dc )
override;
375 void onGridColMove( wxGridEvent& aEvent );
376 void onGridCellSelect( wxGridEvent& aEvent );
377 void onCellEditorShown( wxGridEvent& aEvent );
378 void onCellEditorHidden( wxGridEvent& aEvent );
382 void onIdleRefreshHighlight( wxIdleEvent& aEvent );
385 void onDPIChanged(wxDPIChangedEvent& event);
398 std::pair<EDA_UNITS, EDA_DATA_TYPE> getColumnUnits(
int aCol )
const;
401 void onSizeEvent( wxSizeEvent& aEvent );
408 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 void RestoreUndoState(const wxString &aState)
virtual ROW_STATE GetRowState(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...
std::map< int, UNITS_PROVIDER * > m_unitsProviders
std::optional< wxSize > m_minSizeOverride
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...
void SetColLabelSize(int aHeight)
Hide wxGrid's SetColLabelSize() method with one which makes sure the size is tall enough for the syst...
WX_GRID(wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxWANTS_CHARS, const wxString &name=wxGridNameStr)
void SetGridWidthsDirty()
void EnableCursorRowColumnHighlight(bool aEnable=true)
Enable repainting for grids whose table uses the cursor row and column when rendering cells.
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()
bool m_cursorRowColumnHighlight
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 ShowEditorOnMouseUp()
WxWidgets has a bunch of bugs in its handling of wxGrid mouse events which close cell editors right a...
bool IsCursorRowColumnHighlightEnabled() const
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
std::unique_ptr< NUMERIC_EVALUATOR > m_eval
wxSize DoGetBestSize() const override
EDA_DATA_TYPE
The type of unit.
enum KICOMMON_API ROW_STATE
Used primarily by the fields tables to collapse multiple grouped symbols, etc.