21#include <wx/tokenzr.h>
23#include <wx/settings.h>
25#include <wx/textentry.h>
44 wxGridCellAttr::wxAttrKind aKind )
46 wxGridCellAttr* attr = aInputAttr;
48 if( wxGridCellAttrProvider* provider = GetAttrProvider() )
50 wxGridCellAttr* providerAttr = provider->GetAttr( aRow, aCol, aKind );
54 attr =
new wxGridCellAttr;
55 attr->SetKind( wxGridCellAttr::Merged );
59 attr->MergeWith( aInputAttr );
63 attr->MergeWith( providerAttr );
64 providerAttr->DecRef();
72#define MIN_GRIDCELL_MARGIN FromDIP( 2 )
78 aEntry->SetMargins( 0, 0 );
84#if defined( __WXMSW__ ) || defined( __WXGTK__ )
91 const std::vector<int>& aRowHeights,
int aMaxRows )
96 int rowsHeight = aHeaderHeight;
97 int count = std::min( aMaxRows, (
int) aRowHeights.size() );
99 for(
int row = 0; row < count; ++row )
100 rowsHeight += aRowHeights[row];
102 return std::min( aMinHeight, rowsHeight );
110 std::vector<int> rowHeights;
111 rowHeights.reserve( GetNumberRows() );
113 int allRowsHeight = GetColLabelSize();
115 for(
int row = 0; row < GetNumberRows(); ++row )
117 rowHeights.push_back( GetRowSize( row ) );
118 allRowsHeight += rowHeights.back();
124 rowHeights, aMinRows ) ) );
126 aDialog->SetMinSize( wxDefaultSize );
127 aDialog->InvalidateBestSize();
128 aDialog->SetMinSize( aDialog->GetBestSize() );
131 int grow = allRowsHeight - GetSize().y;
134 aDialog->SetSize( aDialog->GetSize().x, aDialog->GetSize().y + grow );
140 KIGFX::COLOR4D bg = wxSystemSettings::GetColour( wxSYS_COLOUR_FRAMEBK );
141 KIGFX::COLOR4D fg = wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER );
152 wxDCBrushChanger SetBrush( dc, *wxTRANSPARENT_BRUSH );
155 rect.SetTop( rect.GetTop() + 1 );
156 rect.SetLeft( rect.GetLeft() + 1 );
157 rect.SetBottom( rect.GetBottom() - 1 );
158 rect.SetRight( rect.GetRight() - 1 );
159 dc.DrawRectangle( rect );
169 wxDCBrushChanger SetBrush( dc, *wxTRANSPARENT_BRUSH );
172 rect.SetTop( rect.GetTop() + 1 );
173 rect.SetLeft( rect.GetLeft() );
174 rect.SetBottom( rect.GetBottom() - 1 );
175 rect.SetRight( rect.GetRight() - 1 );
176 dc.DrawRectangle( rect );
186 wxDCBrushChanger SetBrush( dc, *wxTRANSPARENT_BRUSH );
189 rect.SetTop( rect.GetTop() + 1 );
190 rect.SetLeft( rect.GetLeft() + 1 );
191 rect.SetBottom( rect.GetBottom() - 1 );
192 rect.SetRight( rect.GetRight() );
193 dc.DrawRectangle( rect );
206 wxGridCellAttrProvider(),
220 wxGridCellAttr*
GetAttr(
int row,
int col, wxGridCellAttr::wxAttrKind kind )
const override
222 wxGridCellAttrPtr cellAttr( wxGridCellAttrProvider::GetAttr( row, col, kind ) );
227 return cellAttr.release();
235 if( !cellAttr->HasBackgroundColour() )
237 cellAttr = cellAttr->Clone();
238 cellAttr->SetBackgroundColour(
m_attrEven->GetBackgroundColour() );
242 return cellAttr.release();
250WX_GRID::WX_GRID( wxWindow *parent, wxWindowID
id,
const wxPoint& pos,
const wxSize& size,
long style,
251 const wxString&
name ) :
252 wxGrid( parent, id, pos, size, style,
name ),
256 SetDefaultRowSize( GetDefaultRowSize() + FromDIP( 4 ) );
258 SetDefaultCellOverflow(
false );
293 std::vector<int> hiddenCols;
295 for(
int col = 0; col < GetNumberCols(); ++col )
297 if( !IsColShown( col ) )
298 hiddenCols.push_back( col );
303 if( !hiddenCols.empty() )
308 for(
int col : hiddenCols )
321 wxGrid::SetColLabelSize( wxGRID_AUTOSIZE );
328 if( aHeight == 0 || aHeight == wxGRID_AUTOSIZE )
330 wxGrid::SetColLabelSize( aHeight );
337 wxGrid::SetColLabelSize( std::max( aHeight, minHeight ) );
351 int numberCols = GetNumberCols();
352 int* formBuilderColWidths =
new int[numberCols];
354 for(
int i = 0; i < numberCols; ++i )
355 formBuilderColWidths[ i ] = GetColSize( i );
357 wxGrid::SetTable( aTable );
361 numberCols = std::min( numberCols, GetNumberCols() );
363 for(
int i = 0; i < numberCols; ++i )
368 SetColSize( i, std::max( formBuilderColWidths[ i ], headingWidth ) );
371 delete[] formBuilderColWidths;
379 Connect( wxEVT_IDLE, wxIdleEventHandler( WX_GRID::onIdleRefreshHighlight ),
nullptr,
this );
388 wxGridTableBase*
table = wxGrid::GetTable();
390 wxCHECK_MSG(
table, ,
"Tried to enable alternate row colors without a table assigned to the grid" );
394 wxColor color = wxGrid::GetDefaultCellBackgroundColour();
399 table->SetAttrProvider(
nullptr );
409 int row = aEvent.GetRow();
410 int col = aEvent.GetCol();
412 if( row >= 0 && row < GetNumberRows() && col >= 0 && col < GetNumberCols() )
414 if( GetSelectionMode() == wxGrid::wxGridSelectCells )
416 SelectBlock( row, col, row, col,
false );
418 else if( GetSelectionMode() == wxGrid::wxGridSelectRows
419 || GetSelectionMode() == wxGrid::wxGridSelectRowsOrColumns )
421 SelectBlock( row, 0, row, GetNumberCols() - 1,
false );
423 else if( GetSelectionMode() == wxGrid::wxGridSelectColumns )
425 SelectBlock( 0, col, GetNumberRows() - 1, col,
false );
435void WX_GRID::onIdleRefreshHighlight( wxIdleEvent& aEvent )
445 if( !IsShownOnScreen() )
448 Disconnect( wxEVT_IDLE, wxIdleEventHandler( WX_GRID::onIdleRefreshHighlight ),
nullptr,
this );
458 MakeCellVisible( aEvent.GetRow(), aEvent.GetCol() );
462 int row = aEvent.GetRow();
463 int col = aEvent.GetCol();
465 const std::pair<wxString, wxString>& beforeAfter =
m_evalBeforeAfter[ { row, col } ];
467 if( GetCellValue( row, col ) == beforeAfter.second )
468 SetCellValue( row, col, beforeAfter.first );
475 const int col = aEvent.GetCol();
482 EDA_UNITS cellUnits = cellUnitsData.first;
485 m_eval->SetDefaultUnits( cellUnits );
487 const int row = aEvent.GetRow();
490 bool isNullable =
false;
491 wxGridCellEditor* cellEditor = GetCellEditor( row, col );
497 isNullable = nullable->IsNullable();
499 cellEditor->DecRef();
503 [
this, row, col, isNullable, unitsProvider, cellDataType]()
507 if( row >= GetNumberRows() || col >= GetNumberCols() )
510 wxString stringValue = GetCellValue( row, col );
511 bool processedOk =
true;
514 processedOk =
m_eval->Process( stringValue );
522 std::optional<int> val;
542 if( stringValue != evalValue )
544 SetCellValue( row, col, evalValue );
565 Disconnect( wxEVT_IDLE, wxIdleEventHandler( WX_GRID::onIdleRefreshHighlight ),
nullptr,
this );
568 wxGrid::SetTable(
nullptr );
575 wxString shownColumns;
577 for(
int i = 0; i < GetNumberCols(); ++i )
579 if( IsColShown( i ) )
581 if( shownColumns.Length() )
582 shownColumns << wxT(
" " );
594 std::bitset<64> shownColumns;
596 for(
int ii = 0; ii < GetNumberCols(); ++ii )
597 shownColumns[ii] = IsColShown( ii );
605 for(
int i = 0; i < GetNumberCols(); ++i )
608 wxStringTokenizer shownTokens( shownColumns,
" \t\r\n", wxTOKEN_STRTOK );
610 while( shownTokens.HasMoreTokens() )
613 shownTokens.GetNextToken().ToLong( &colNumber );
615 if( colNumber >= 0 && colNumber < GetNumberCols() )
616 ShowCol( (
int) colNumber );
623 if( m_nativeColumnLabels )
624 wxGrid::DrawCornerLabel( dc );
626 wxRect rect( wxSize( m_rowLabelWidth, m_colLabelHeight ) );
632 wxDCBrushChanger setBrush( dc, m_colLabelWin->GetBackgroundColour() );
633 wxDCPenChanger setPen( dc, m_colLabelWin->GetBackgroundColour() );
634 dc.DrawRectangle( rect.Inflate( 1 ) );
643 if( m_nativeColumnLabels )
644 wxGrid::DrawColLabel( dc, col );
646 if( GetColWidth( col ) <= 0 || m_colLabelHeight <= 0 )
649 wxRect rect( GetColLeft( col ), 0, GetColWidth( col ), m_colLabelHeight );
655 wxDCBrushChanger setBrush( dc, m_colLabelWin->GetBackgroundColour() );
656 wxDCPenChanger setPen( dc, m_colLabelWin->GetBackgroundColour() );
657 dc.DrawRectangle( rect.Inflate( 1 ) );
663 dc.SetFont( GetLabelFont() );
666 GetColLabelAlignment( &hAlign, &vAlign );
667 const int orient = GetColLabelTextOrientation();
670 hAlign = wxALIGN_LEFT;
672 if( hAlign == wxALIGN_LEFT )
675 rend.DrawLabel( *
this, dc, GetColLabelValue( col ), rect, hAlign, vAlign, orient );
681 if( GetRowHeight( row ) <= 0 || m_rowLabelWidth <= 0 )
684 wxRect rect( 0, GetRowTop( row ), m_rowLabelWidth, GetRowHeight( row ) );
690 wxDCBrushChanger setBrush( dc, m_colLabelWin->GetBackgroundColour() );
691 wxDCPenChanger setPen( dc, m_colLabelWin->GetBackgroundColour() );
692 dc.DrawRectangle( rect.Inflate( 1 ) );
707 dc.DrawBitmap( bitmap, rect.GetLeft() + ( rect.GetWidth() - bitmap.GetLogicalWidth() ) / 2,
708 rect.GetTop() + ( rect.GetHeight() - bitmap.GetLogicalHeight() ) / 2,
true );
710 else if( state == ROW_STATE::EXPANDED_CHILD )
713 wxDCPenChanger setPen( dc, wxPen( GetLabelTextColour(), FromDIP( 1 ) ) );
714 wxPoint
center( rect.GetLeft() + rect.GetWidth() / 2, rect.GetTop() + rect.GetHeight() / 2 );
715 bool moreChildren = row + 1 < GetNumberRows()
716 &&
table->GetRowState( row + 1 ) == ROW_STATE::EXPANDED_CHILD;
718 dc.DrawLine(
center.x, rect.GetTop(),
center.x, moreChildren ? rect.GetBottom() + 1 :
center.y );
726 dc.SetFont( GetLabelFont() );
729 GetRowLabelAlignment(&hAlign, &vAlign);
731 if( hAlign == wxALIGN_LEFT )
734 rend.DrawLabel( *
this, dc, GetRowLabelValue( row ), rect, hAlign, vAlign, wxHORIZONTAL );
740 if( !IsCellEditControlEnabled() )
743 HideCellEditControl();
746 m_cellEditCtrlEnabled =
false;
748 int row = m_currentCellCoords.GetRow();
749 int col = m_currentCellCoords.GetCol();
751 wxString oldval = GetCellValue( row, col );
754 wxGridCellAttr* attr = GetCellAttr( row, col );
755 wxGridCellEditor*
editor = attr->GetEditor(
this, row, col );
757 editor->EndEdit( row, col,
this, oldval, &newval );
768 if( !IsCellEditControlEnabled() )
771 if( !aQuietMode && SendEvent( wxEVT_GRID_EDITOR_HIDDEN ) == -1 )
774 HideCellEditControl();
777 m_cellEditCtrlEnabled =
false;
779 int row = m_currentCellCoords.GetRow();
780 int col = m_currentCellCoords.GetCol();
782 wxString oldval = GetCellValue( row, col );
785 wxGridCellAttr* attr = GetCellAttr( row, col );
786 wxGridCellEditor*
editor = attr->GetEditor(
this, row, col );
788 bool changed =
editor->EndEdit( row, col,
this, oldval, &newval );
795 if( !aQuietMode && SendEvent( wxEVT_GRID_CELL_CHANGING, newval ) == -1 )
798 editor->ApplyEdit( row, col,
this );
803 if( !aQuietMode && SendEvent( wxEVT_GRID_CELL_CHANGED, oldval ) == -1 )
806 SetCellValue( row, col, oldval );
823 auto [row, editCol] = aAdder();
827 MakeCellVisible( row, std::max( editCol, 0 ) );
828 SetGridCursor( row, std::max( editCol, 0 ) );
832 EnableCellEditControl(
true );
833 ShowCellEditControl();
850 const std::function<
void(
int row )>& aDeleter )
852 wxArrayInt selectedRows = GetSelectedRows();
854 auto addSelectedRow = [&](
int row )
856 for(
size_t i = 0; i < selectedRows.size(); ++i )
858 if( selectedRows[i] == row )
862 selectedRows.push_back( row );
865 wxGridCellCoordsArray topLeft = GetSelectionBlockTopLeft();
866 wxGridCellCoordsArray botRight = GetSelectionBlockBottomRight();
868 for(
size_t i = 0; i < std::min( topLeft.Count(), botRight.Count() ); ++i )
870 for(
int row = topLeft[i].GetRow(); row <= botRight[i].GetRow(); ++row )
871 addSelectedRow( row );
874 wxGridCellCoordsArray cells = GetSelectedCells();
876 for(
size_t i = 0; i < cells.Count(); ++i )
877 addSelectedRow( cells[i].GetRow() );
879 if( selectedRows.empty() && GetGridCursorRow() >= 0 )
880 selectedRows.push_back( GetGridCursorRow() );
882 if( selectedRows.empty() )
885 for(
int row : selectedRows )
887 if( !aFilter( row ) )
896 [](
int* first,
int* second )
898 return *second - *first;
901 int nextSelRow = selectedRows.back() - 1;
903 if( nextSelRow >= 0 )
905 GoToCell( nextSelRow, GetGridCursorCol() );
906 SetGridCursor( nextSelRow, GetGridCursorCol() );
909 for(
int row : selectedRows )
916 for(
int col = 0; col < GetNumberCols(); ++col )
918 wxString temp = GetCellValue( aRowA, col );
919 SetCellValue( aRowA, col, GetCellValue( aRowB, col ) );
920 SetCellValue( aRowB, col, temp );
937 const std::function<
void(
int row )>& aMover )
942 int i = GetGridCursorRow();
944 if( i > 0 && aFilter( i ) )
948 SetGridCursor( i - 1, GetGridCursorCol() );
949 MakeCellVisible( GetGridCursorRow(), GetGridCursorCol() );
970 const std::function<
void(
int row )>& aMover )
975 int i = GetGridCursorRow();
977 if( i + 1 < GetNumberRows() && aFilter( i ) )
981 SetGridCursor( i + 1, GetGridCursorCol() );
982 MakeCellVisible( GetGridCursorRow(), GetGridCursorCol() );
1015 wxString stringValue = GetCellValue( aRow, aCol );
1021 m_eval->SetDefaultUnits( cellUnits );
1023 if(
m_eval->Process( stringValue ) )
1024 stringValue =
m_eval->Result();
1033 wxString stringValue = GetCellValue( aRow, aCol );
1039 m_eval->SetDefaultUnits( cellUnits );
1042 stringValue =
m_eval->Result();
1058 SetCellValue( aRow, aCol,
getUnitsProvider( aCol )->StringFromValue( aValue,
true, cellDataType ) );
1071 SetCellValue( aRow, aCol,
getUnitsProvider( aCol )->StringFromOptionalValue( aValue,
true, cellDataType ) );
1089 size = GetRowLabelSize();
1091 for(
int row = 0; aContents && row < GetNumberRows(); row++ )
1092 size = std::max( size,
int( GetTextExtent( GetRowLabelValue( row ) + wxS(
"M" ) ).x ) );
1097 size = GetColSize( aCol );
1105 size = std::max( size,
int( GetTextExtent( GetColLabelValue( aCol ) + wxS(
"M" ) ).x ) );
1108 for(
int row = 0; aContents && row < GetNumberRows(); row++ )
1111 if( GetTable()->CanGetValueAs( row, aCol, wxGRID_VALUE_STRING ) )
1112 size = std::max( size, GetTextExtent( GetCellValue( row, aCol ) + wxS(
"M" ) ).x );
1114 size = std::max( size, GetTextExtent(
"MM" ).x );
1124 int line_height = int( GetTextExtent(
"Mj" ).y ) + 3;
1125 int row_height = GetColLabelSize();
1126 int initial_row_height = row_height;
1131 for(
int col = 0; col < GetNumberCols(); col++ )
1133 int nl_count = GetColLabelValue( col ).Freq(
'\n' );
1138 if( row_height < line_height * ( nl_count+1 ) )
1139 row_height += line_height * nl_count;
1145 if( initial_row_height != row_height )
1162 const int colCount = GetNumberCols();
1164 for(
int ii = 0; ii < GetNumberCols(); ++ii )
1169 wxASSERT_MSG(
m_flexibleCol < colCount,
"Flexible column index does not exist in grid" );
1171 Bind( wxEVT_UPDATE_UI,
1172 [
this]( wxUpdateUIEvent& aEvent )
1179 [
this]( wxSizeEvent& aEvent )
1186 Bind( wxEVT_GRID_CELL_CHANGED,
1187 [
this]( wxGridEvent& aEvent )
1199 const int width = GetSize().GetX() - wxSystemSettings::GetMetric( wxSYS_VSCROLL_X );
1201 std::optional<int> flexibleMinWidth;
1205 if( GetColSize( colIndex ) != 0 )
1207 AutoSizeColumn( colIndex );
1208 const int colSize = GetColSize( colIndex );
1210 int minWidthScaled = FromDIP( minWidth );
1211 SetColSize( colIndex, std::max( minWidthScaled, colSize ) );
1214 flexibleMinWidth = minWidthScaled;
1219 int nonFlexibleWidth = 0;
1221 for(
int i = 0; i < GetNumberCols(); ++i )
1224 nonFlexibleWidth += GetColSize( i );
1228 SetColSize(
m_flexibleCol, std::max( flexibleMinWidth.value_or( 0 ), width - nonFlexibleWidth ) );
1239 const int width = aEvent.GetSize().GetX();
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
A color representation with 4 components: red, green, blue, alpha.
wxColour ToColour() const
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
Icon provider for the "standard" row indicators, for example in layer selection lists.
@ CLOSED
Tree control closed.
static const wxString NullUiString
The string that is used in the UI to represent a null value.
std::optional< int > OptionalValueFromString(const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aTextValue in aUnits to internal units used by the frame.
wxString StringFromOptionalValue(std::optional< int > aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts an optional aValue in internal units into a united string.
EDA_UNITS GetUserUnits() const
static EDA_DATA_TYPE GetTypeFromUnits(const EDA_UNITS aUnits)
Gets the inferred type from the given units.
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aValue in internal units into a united string.
int ValueFromString(const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aTextValue in aUnits to internal units used by the frame.
Attribute provider that provides attributes (or modifies the existing attribute) to alternate a row c...
WX_GRID_ALT_ROW_COLOR_PROVIDER(const wxColor &aBaseColor)
wxGridCellAttr * GetAttr(int row, int col, wxGridCellAttr::wxAttrKind kind) const override
wxGridCellAttrPtr m_attrEven
void UpdateColors(const wxColor &aBaseColor)
void DrawBorder(const wxGrid &grid, wxDC &dc, wxRect &rect) const override
wxGridCellAttr * enhanceAttr(wxGridCellAttr *aInputAttr, int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind)
int GetVisibleWidth(int aCol, bool aHeader=true, bool aContents=true, bool aKeep=false)
Calculate the specified column based on the actual size of the text on screen.
void onGridCellSelect(wxGridEvent &aEvent)
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 onDPIChanged(wxDPIChangedEvent &event)
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
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 SetAutoEvalColUnits(int col, EDA_UNITS aUnit, EDA_DATA_TYPE aUnitType)
Set the unit and unit data type to use for a given column.
bool CancelPendingChanges()
void SetColLabelSize(int aHeight)
Hide wxGrid's SetColLabelSize() method with one which makes sure the size is tall enough for the syst...
static int CapHeightToVisibleRows(int aMinHeight, int aHeaderHeight, const std::vector< int > &aRowHeights, int aMaxRows)
Height of aMaxRows data rows plus the column-label header, never more than aMinHeight.
void SwapRows(int aRowA, int aRowB)
These aren't that tricky, but might as well share code.
std::pair< EDA_UNITS, EDA_DATA_TYPE > getColumnUnits(int aCol) const
Returns the units and data type associated with a given column.
void SetUnitValue(int aRow, int aCol, int aValue)
Set a unitized cell's value.
WX_GRID(wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxWANTS_CHARS, const wxString &name=wxGridNameStr)
int GetUnitValue(int aRow, int aCol)
Apply standard KiCad unit and eval services to a numeric cell.
std::vector< int > m_autoEvalCols
UNITS_PROVIDER * getUnitsProvider(int aCol) const
std::map< std::pair< int, int >, std::pair< wxString, wxString > > m_evalBeforeAfter
void SetMinVisibleRows(wxWindow *aDialog, int aMinRows)
Floor this grid at aMinRows visible rows and grow aDialog so it opens tall enough to show every curre...
void DrawCornerLabel(wxDC &dc) override
A re-implementation of wxGrid::DrawCornerLabel which draws flat borders.
bool m_cursorRowColumnHighlight
ROW_ICON_PROVIDER * m_rowIconProvider
void onCellEditorHidden(wxGridEvent &aEvent)
void SetupColumnAutosizer(int aFlexibleCol)
Set autosize behaviour using wxFormBuilder column widths as minimums, with a single specified growabl...
void RecomputeGridWidths()
void OnMoveRowDown(const std::function< void(int row)> &aMover)
void onGridColMove(wxGridEvent &aEvent)
void SetOptionalUnitValue(int aRow, int aCol, std::optional< int > aValue)
Set a unitized cell's optional value.
void onSizeEvent(wxSizeEvent &aEvent)
void onCellEditorShown(wxGridEvent &aEvent)
void EnsureColLabelsVisible()
Ensure the height of the row displaying the column labels is enough, even if labels are multiline tex...
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)
void DrawRowLabel(wxDC &dc, int row) override
A re-implementation of wxGrid::DrawRowLabel which draws flat borders.
std::bitset< 64 > GetShownColumns()
static void CellEditorSetMargins(wxTextEntryBase *aEntry)
A helper function to set OS-specific margins for text-based cell editors.
std::optional< int > GetOptionalUnitValue(int aRow, int aCol)
Apply standard KiCad unit and eval services to a numeric cell.
void EnableAlternateRowColors(bool aEnable=true)
Enable alternate row highlighting, where every odd row has a different background color than the even...
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
void DrawColLabel(wxDC &dc, int col) override
A re-implementation of wxGrid::DrawColLabel which left-aligns the first column and draws flat borders...
static void CellEditorTransformSizeRect(wxRect &aRect)
A helper function to tweak sizes of text-based cell editors depending on OS.
EDA_DATA_TYPE
The type of unit.
KICOMMON_API wxFont GetControlFont(wxWindow *aWindow)
const int c_IndicatorSizeDIP
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
PGM_BASE & Pgm()
The global program "get" accessor.
Functions to provide common constants and other functions to assist in making a consistent UI.
wxColour getBorderColour()
#define MIN_GRIDCELL_MARGIN
bool IsRowCollapsed(ROW_STATE aState)
enum KICOMMON_API ROW_STATE
Used primarily by the fields tables to collapse multiple grouped symbols, etc.
bool IsRowExpanded(ROW_STATE aState)