29#include <wx/version.h>
64 return aState == ROW_STATE::PARENT_COLLAPSED || aState == ROW_STATE::PARENT_COLLAPSED_DURING_SORT
65 || aState == ROW_STATE::PARENT_EXPANDED;
71 return aState == ROW_STATE::GROUP_COLLAPSED || aState == ROW_STATE::PARENT_COLLAPSED;
77 return aState == ROW_STATE::GROUP_EXPANDED || aState == ROW_STATE::PARENT_EXPANDED;
90 void SetColAttr( wxGridCellAttr* aAttr,
int aCol )
override
96 wxGridCellAttr*
GetAttr(
int aRow,
int aCol, wxGridCellAttr::wxAttrKind aKind )
override
124 if( GetNumberRows() )
125 DeleteRows( 0, GetNumberRows() );
129 wxGridCellAttr* enhanceAttr( wxGridCellAttr* aInputAttr,
int aRow,
int aCol,
130 wxGridCellAttr::wxAttrKind aKind );
141 WX_GRID( wxWindow *parent, wxWindowID
id,
const wxPoint& pos = wxDefaultPosition,
142 const wxSize& size = wxDefaultSize,
long style = wxWANTS_CHARS,
143 const wxString&
name = wxGridNameStr );
181 wxString GetShownColumnsAsString();
182 std::bitset<64> GetShownColumns();
187 void ShowHideColumns(
const wxString& shownColumns );
193 void SetTable( wxGridTableBase*
table,
bool aTakeOwnership =
false );
199 void DestroyTable( wxGridTableBase* aTable );
207 bool CommitPendingChanges(
bool aQuietMode =
false );
208 bool CancelPendingChanges();
210 void OnAddRow(
const std::function<std::pair<int, int>()>& aAdder );
216 void OnDeleteRows(
const std::function<
void(
int row )>& aDeleter );
218 void OnDeleteRows(
const std::function<
bool(
int row )>& aFilter,
219 const std::function<
void(
int row )>& aDeleter );
224 void SwapRows(
int aRowA,
int aRowB );
225 void OnMoveRowUp(
const std::function<
void(
int row )>& aMover );
226 void OnMoveRowDown(
const std::function<
void(
int row )>& aMover );
227 void OnMoveRowUp(
const std::function<
bool(
int row )>& aFilter,
228 const std::function<
void(
int row )>& aMover );
229 void OnMoveRowDown(
const std::function<
bool(
int row )>& aFilter,
230 const std::function<
void(
int row )>& aMover );
250 void SetAutoEvalColUnits(
int col,
EDA_UNITS aUnit );
259 int GetUnitValue(
int aRow,
int aCol );
268 std::optional<int> GetOptionalUnitValue(
int aRow,
int aCol );
273 void SetUnitValue(
int aRow,
int aCol,
int aValue );
278 void SetOptionalUnitValue(
int aRow,
int aCol, std::optional<int> aValue );
289 int GetVisibleWidth(
int aCol,
bool aHeader =
true,
bool aContents =
true,
bool aKeep =
false );
295 void EnsureColLabelsVisible();
315 if( GetNumberRows() > 0 )
316 DeleteRows( 0, GetNumberRows(), aUpdateLabels );
322 static void CellEditorSetMargins( wxTextEntryBase* aEntry );
327 static void CellEditorTransformSizeRect( wxRect& aRect );
349 void SetMinVisibleRows( wxWindow* aDialog,
int aMinRows );
360 static int CapHeightToVisibleRows(
int aMinHeight,
int aHeaderHeight,
361 const std::vector<int>& aRowHeights,
int aMaxRows );
368 return wxGrid::DoGetBestSize();
375 void SetupColumnAutosizer(
int aFlexibleCol );
381 void RecomputeGridWidths();
388 void DrawColLabel( wxDC& dc,
int col )
override;
393 void DrawRowLabel( wxDC& dc,
int row )
override;
398 void DrawCornerLabel( wxDC& dc )
override;
400 void onGridColMove( wxGridEvent& aEvent );
401 void onGridCellSelect( wxGridEvent& aEvent );
402 void onCellEditorShown( wxGridEvent& aEvent );
403 void onCellEditorHidden( wxGridEvent& aEvent );
407 void onIdleRefreshHighlight( wxIdleEvent& aEvent );
410 void onDPIChanged(wxDPIChangedEvent& event);
423 std::pair<EDA_UNITS, EDA_DATA_TYPE> getColumnUnits(
int aCol )
const;
426 void onSizeEvent( wxSizeEvent& aEvent );
433 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 HasRowLabelExpanders() const
Show grouping controls in the row headers instead of row numbers.
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.
bool IsRowCollapsed(ROW_STATE aState)
enum KICOMMON_API ROW_STATE
Used primarily by the fields tables to collapse multiple grouped symbols, etc.
bool IsParentRow(ROW_STATE aState)
GROUP_COLLAPSED_DURING_SORT
PARENT_COLLAPSED_DURING_SORT
bool IsRowExpanded(ROW_STATE aState)