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 );
242 void EvaluateCell(
int aRow,
int aCol );
246 std::vector<int> GetSelectedRowIndices()
const;
256 void SetAutoEvalColUnits(
int col,
EDA_UNITS aUnit );
265 int GetUnitValue(
int aRow,
int aCol );
274 std::optional<int> GetOptionalUnitValue(
int aRow,
int aCol );
279 void SetUnitValue(
int aRow,
int aCol,
int aValue );
284 void SetOptionalUnitValue(
int aRow,
int aCol, std::optional<int> aValue );
295 int GetVisibleWidth(
int aCol,
bool aHeader =
true,
bool aContents =
true,
bool aKeep =
false );
301 void EnsureColLabelsVisible();
321 if( GetNumberRows() > 0 )
322 DeleteRows( 0, GetNumberRows(), aUpdateLabels );
328 static void CellEditorSetMargins( wxTextEntryBase* aEntry );
333 static void CellEditorTransformSizeRect( wxRect& aRect );
355 void SetMinVisibleRows( wxWindow* aDialog,
int aMinRows );
366 static int CapHeightToVisibleRows(
int aMinHeight,
int aHeaderHeight,
367 const std::vector<int>& aRowHeights,
int aMaxRows );
374 return wxGrid::DoGetBestSize();
381 void SetupColumnAutosizer(
int aFlexibleCol );
387 void RecomputeGridWidths();
394 void DrawColLabel( wxDC&
dc,
int col )
override;
399 void DrawRowLabel( wxDC&
dc,
int row )
override;
404 void DrawCornerLabel( wxDC&
dc )
override;
406 void onGridColMove( wxGridEvent& aEvent );
407 void onGridCellSelect( wxGridEvent& aEvent );
408 void onCellEditorShown( wxGridEvent& aEvent );
409 void onCellEditorHidden( wxGridEvent& aEvent );
413 void onIdleRefreshHighlight( wxIdleEvent& aEvent );
416 void onDPIChanged(wxDPIChangedEvent& event);
429 std::pair<EDA_UNITS, EDA_DATA_TYPE> getColumnUnits(
int aCol )
const;
432 void onSizeEvent( wxSizeEvent& aEvent );
440 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 SetUseNativeSelection(bool aUseNative)
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_useNativeSelection
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.
DATABASE_CONNECTION dc(odbcBackend(cs))
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)