21#include <wx/tokenzr.h>
23#include <wx/settings.h>
25#include <wx/textentry.h>
45 wxGridCellAttr::wxAttrKind aKind )
47 wxGridCellAttr* attr = aInputAttr;
49 if( wxGridCellAttrProvider* provider = GetAttrProvider() )
51 wxGridCellAttr* providerAttr = provider->GetAttr( aRow, aCol, aKind );
55 attr =
new wxGridCellAttr;
56 attr->SetKind( wxGridCellAttr::Merged );
60 attr->MergeWith( aInputAttr );
64 attr->MergeWith( providerAttr );
65 providerAttr->DecRef();
73#define MIN_GRIDCELL_MARGIN FromDIP( 2 )
79 aEntry->SetMargins( 0, 0 );
85#if defined( __WXMSW__ ) || defined( __WXGTK__ )
92 const std::vector<int>& aRowHeights,
int aMaxRows )
97 int rowsHeight = aHeaderHeight;
98 int count = std::min( aMaxRows, (
int) aRowHeights.size() );
100 for(
int row = 0; row < count; ++row )
101 rowsHeight += aRowHeights[row];
103 return std::min( aMinHeight, rowsHeight );
111 std::vector<int> rowHeights;
112 rowHeights.reserve( GetNumberRows() );
114 int allRowsHeight = GetColLabelSize();
116 for(
int row = 0; row < GetNumberRows(); ++row )
118 rowHeights.push_back( GetRowSize( row ) );
119 allRowsHeight += rowHeights.back();
125 rowHeights, aMinRows ) ) );
127 aDialog->SetMinSize( wxDefaultSize );
128 aDialog->InvalidateBestSize();
129 aDialog->SetMinSize( aDialog->GetBestSize() );
132 int grow = allRowsHeight - GetSize().y;
135 aDialog->SetSize( aDialog->GetSize().x, aDialog->GetSize().y + grow );
141 KIGFX::COLOR4D bg = wxSystemSettings::GetColour( wxSYS_COLOUR_FRAMEBK );
142 KIGFX::COLOR4D fg = wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER );
153 wxDCBrushChanger SetBrush( dc, *wxTRANSPARENT_BRUSH );
156 rect.SetTop( rect.GetTop() + 1 );
157 rect.SetLeft( rect.GetLeft() + 1 );
158 rect.SetBottom( rect.GetBottom() - 1 );
159 rect.SetRight( rect.GetRight() - 1 );
160 dc.DrawRectangle( rect );
170 wxDCBrushChanger SetBrush( dc, *wxTRANSPARENT_BRUSH );
173 rect.SetTop( rect.GetTop() + 1 );
174 rect.SetLeft( rect.GetLeft() );
175 rect.SetBottom( rect.GetBottom() - 1 );
176 rect.SetRight( rect.GetRight() - 1 );
177 dc.DrawRectangle( rect );
187 wxDCBrushChanger SetBrush( dc, *wxTRANSPARENT_BRUSH );
190 rect.SetTop( rect.GetTop() + 1 );
191 rect.SetLeft( rect.GetLeft() + 1 );
192 rect.SetBottom( rect.GetBottom() - 1 );
193 rect.SetRight( rect.GetRight() );
194 dc.DrawRectangle( rect );
207 wxGridCellAttrProvider(),
221 wxGridCellAttr*
GetAttr(
int row,
int col, wxGridCellAttr::wxAttrKind kind )
const override
223 wxGridCellAttrPtr cellAttr( wxGridCellAttrProvider::GetAttr( row, col, kind ) );
228 return cellAttr.release();
236 if( !cellAttr->HasBackgroundColour() )
238 cellAttr = cellAttr->Clone();
239 cellAttr->SetBackgroundColour(
m_attrEven->GetBackgroundColour() );
243 return cellAttr.release();
251WX_GRID::WX_GRID( wxWindow *parent, wxWindowID
id,
const wxPoint& pos,
const wxSize& size,
long style,
252 const wxString&
name ) :
253 wxGrid( parent, id, pos, size, style,
name ),
257 SetDefaultRowSize( GetDefaultRowSize() + FromDIP( 4 ) );
259 SetDefaultCellOverflow(
false );
294 std::vector<int> hiddenCols;
296 for(
int col = 0; col < GetNumberCols(); ++col )
298 if( !IsColShown( col ) )
299 hiddenCols.push_back( col );
304 if( !hiddenCols.empty() )
309 for(
int col : hiddenCols )
322 wxGrid::SetColLabelSize( wxGRID_AUTOSIZE );
329 if( aHeight == 0 || aHeight == wxGRID_AUTOSIZE )
331 wxGrid::SetColLabelSize( aHeight );
338 wxGrid::SetColLabelSize( std::max( aHeight, minHeight ) );
352 int numberCols = GetNumberCols();
353 int* formBuilderColWidths =
new int[numberCols];
355 for(
int i = 0; i < numberCols; ++i )
356 formBuilderColWidths[ i ] = GetColSize( i );
358 wxGrid::SetTable( aTable );
362 numberCols = std::min( numberCols, GetNumberCols() );
364 for(
int i = 0; i < numberCols; ++i )
369 SetColSize( i, std::max( formBuilderColWidths[ i ], headingWidth ) );
372 delete[] formBuilderColWidths;
380 Connect( wxEVT_IDLE, wxIdleEventHandler( WX_GRID::onIdleRefreshHighlight ),
nullptr,
this );
389 wxGridTableBase*
table = wxGrid::GetTable();
391 wxCHECK_MSG(
table, ,
"Tried to enable alternate row colors without a table assigned to the grid" );
395 wxColor color = wxGrid::GetDefaultCellBackgroundColour();
400 table->SetAttrProvider(
nullptr );
410 int row = aEvent.GetRow();
411 int col = aEvent.GetCol();
413 if( row >= 0 && row < GetNumberRows() && col >= 0 && col < GetNumberCols() )
415 if( GetSelectionMode() == wxGrid::wxGridSelectCells )
417 SelectBlock( row, col, row, col,
false );
419 else if( GetSelectionMode() == wxGrid::wxGridSelectRows
420 || GetSelectionMode() == wxGrid::wxGridSelectRowsOrColumns )
422 SelectBlock( row, 0, row, GetNumberCols() - 1,
false );
424 else if( GetSelectionMode() == wxGrid::wxGridSelectColumns )
426 SelectBlock( 0, col, GetNumberRows() - 1, col,
false );
436void WX_GRID::onIdleRefreshHighlight( wxIdleEvent& aEvent )
446 if( !IsShownOnScreen() )
449 Disconnect( wxEVT_IDLE, wxIdleEventHandler( WX_GRID::onIdleRefreshHighlight ),
nullptr,
this );
459 MakeCellVisible( aEvent.GetRow(), aEvent.GetCol() );
463 int row = aEvent.GetRow();
464 int col = aEvent.GetCol();
466 const std::pair<wxString, wxString>& beforeAfter =
m_evalBeforeAfter[ { row, col } ];
468 if( GetCellValue( row, col ) == beforeAfter.second )
469 SetCellValue( row, col, beforeAfter.first );
476 const int col = aEvent.GetCol();
483 EDA_UNITS cellUnits = cellUnitsData.first;
486 m_eval->SetDefaultUnits( cellUnits );
488 const int row = aEvent.GetRow();
491 bool isNullable =
false;
492 wxGridCellEditor* cellEditor = GetCellEditor( row, col );
498 isNullable = nullable->IsNullable();
500 cellEditor->DecRef();
504 [
this, row, col, isNullable, unitsProvider, cellDataType]()
508 if( row >= GetNumberRows() || col >= GetNumberCols() )
511 wxString stringValue = GetCellValue( row, col );
512 bool processedOk =
true;
515 processedOk =
m_eval->Process( stringValue );
523 std::optional<int> val;
543 if( stringValue != evalValue )
545 SetCellValue( row, col, evalValue );
566 Disconnect( wxEVT_IDLE, wxIdleEventHandler( WX_GRID::onIdleRefreshHighlight ),
nullptr,
this );
569 wxGrid::SetTable(
nullptr );
576 wxString shownColumns;
578 for(
int i = 0; i < GetNumberCols(); ++i )
580 if( IsColShown( i ) )
582 if( shownColumns.Length() )
583 shownColumns << wxT(
" " );
595 std::bitset<64> shownColumns;
597 for(
int ii = 0; ii < GetNumberCols(); ++ii )
598 shownColumns[ii] = IsColShown( ii );
606 for(
int i = 0; i < GetNumberCols(); ++i )
609 wxStringTokenizer shownTokens( shownColumns,
" \t\r\n", wxTOKEN_STRTOK );
611 while( shownTokens.HasMoreTokens() )
614 shownTokens.GetNextToken().ToLong( &colNumber );
616 if( colNumber >= 0 && colNumber < GetNumberCols() )
617 ShowCol( (
int) colNumber );
624 if( m_nativeColumnLabels )
625 wxGrid::DrawCornerLabel( dc );
627 wxRect rect( wxSize( m_rowLabelWidth, m_colLabelHeight ) );
633 wxDCBrushChanger setBrush( dc, m_colLabelWin->GetBackgroundColour() );
634 wxDCPenChanger setPen( dc, m_colLabelWin->GetBackgroundColour() );
635 dc.DrawRectangle( rect.Inflate( 1 ) );
644 if( m_nativeColumnLabels )
645 wxGrid::DrawColLabel( dc, col );
647 if( GetColWidth( col ) <= 0 || m_colLabelHeight <= 0 )
650 wxRect rect( GetColLeft( col ), 0, GetColWidth( col ), m_colLabelHeight );
656 wxDCBrushChanger setBrush( dc, m_colLabelWin->GetBackgroundColour() );
657 wxDCPenChanger setPen( dc, m_colLabelWin->GetBackgroundColour() );
658 dc.DrawRectangle( rect.Inflate( 1 ) );
664 dc.SetFont( GetLabelFont() );
667 GetColLabelAlignment( &hAlign, &vAlign );
668 const int orient = GetColLabelTextOrientation();
671 hAlign = wxALIGN_LEFT;
673 if( hAlign == wxALIGN_LEFT )
676 rend.DrawLabel( *
this, dc, GetColLabelValue( col ), rect, hAlign, vAlign, orient );
682 if( GetRowHeight( row ) <= 0 || m_rowLabelWidth <= 0 )
685 wxRect rect( 0, GetRowTop( row ), m_rowLabelWidth, GetRowHeight( row ) );
691 wxDCBrushChanger setBrush( dc, m_colLabelWin->GetBackgroundColour() );
692 wxDCPenChanger setPen( dc, m_colLabelWin->GetBackgroundColour() );
693 dc.DrawRectangle( rect.Inflate( 1 ) );
708 dc.DrawBitmap( bitmap, rect.GetLeft() + ( rect.GetWidth() - bitmap.GetLogicalWidth() ) / 2,
709 rect.GetTop() + ( rect.GetHeight() - bitmap.GetLogicalHeight() ) / 2,
true );
711 else if( state == ROW_STATE::EXPANDED_CHILD )
714 wxDCPenChanger setPen( dc, wxPen( GetLabelTextColour(), FromDIP( 1 ) ) );
715 wxPoint
center( rect.GetLeft() + rect.GetWidth() / 2, rect.GetTop() + rect.GetHeight() / 2 );
716 bool moreChildren = row + 1 < GetNumberRows()
717 &&
table->GetRowState( row + 1 ) == ROW_STATE::EXPANDED_CHILD;
719 dc.DrawLine(
center.x, rect.GetTop(),
center.x, moreChildren ? rect.GetBottom() + 1 :
center.y );
727 dc.SetFont( GetLabelFont() );
730 GetRowLabelAlignment(&hAlign, &vAlign);
732 if( hAlign == wxALIGN_LEFT )
735 rend.DrawLabel( *
this, dc, GetRowLabelValue( row ), rect, hAlign, vAlign, wxHORIZONTAL );
741 if( !IsCellEditControlEnabled() )
744 HideCellEditControl();
747 m_cellEditCtrlEnabled =
false;
749 int row = m_currentCellCoords.GetRow();
750 int col = m_currentCellCoords.GetCol();
752 wxString oldval = GetCellValue( row, col );
755 wxGridCellAttr* attr = GetCellAttr( row, col );
756 wxGridCellEditor*
editor = attr->GetEditor(
this, row, col );
758 editor->EndEdit( row, col,
this, oldval, &newval );
769 if( !IsCellEditControlEnabled() )
772 if( !aQuietMode && SendEvent( wxEVT_GRID_EDITOR_HIDDEN ) == -1 )
775 HideCellEditControl();
778 m_cellEditCtrlEnabled =
false;
780 int row = m_currentCellCoords.GetRow();
781 int col = m_currentCellCoords.GetCol();
783 wxString oldval = GetCellValue( row, col );
786 wxGridCellAttr* attr = GetCellAttr( row, col );
787 wxGridCellEditor*
editor = attr->GetEditor(
this, row, col );
789 bool changed =
editor->EndEdit( row, col,
this, oldval, &newval );
796 if( !aQuietMode && SendEvent( wxEVT_GRID_CELL_CHANGING, newval ) == -1 )
799 editor->ApplyEdit( row, col,
this );
804 if( !aQuietMode && SendEvent( wxEVT_GRID_CELL_CHANGED, oldval ) == -1 )
807 SetCellValue( row, col, oldval );
824 auto [row, editCol] = aAdder();
828 MakeCellVisible( row, std::max( editCol, 0 ) );
829 SetGridCursor( row, std::max( editCol, 0 ) );
833 EnableCellEditControl(
true );
834 ShowCellEditControl();
851 const std::function<
void(
int row )>& aDeleter )
853 wxArrayInt selectedRows = GetSelectedRows();
855 auto addSelectedRow = [&](
int row )
857 for(
size_t i = 0; i < selectedRows.size(); ++i )
859 if( selectedRows[i] == row )
863 selectedRows.push_back( row );
866 wxGridCellCoordsArray topLeft = GetSelectionBlockTopLeft();
867 wxGridCellCoordsArray botRight = GetSelectionBlockBottomRight();
869 for(
size_t i = 0; i < std::min( topLeft.Count(), botRight.Count() ); ++i )
871 for(
int row = topLeft[i].GetRow(); row <= botRight[i].GetRow(); ++row )
872 addSelectedRow( row );
875 wxGridCellCoordsArray cells = GetSelectedCells();
877 for(
size_t i = 0; i < cells.Count(); ++i )
878 addSelectedRow( cells[i].GetRow() );
880 if( selectedRows.empty() && GetGridCursorRow() >= 0 )
881 selectedRows.push_back( GetGridCursorRow() );
883 if( selectedRows.empty() )
886 for(
int row : selectedRows )
888 if( !aFilter( row ) )
897 [](
int* first,
int* second )
899 return *second - *first;
902 int nextSelRow = selectedRows.back() - 1;
904 if( nextSelRow >= 0 )
906 GoToCell( nextSelRow, GetGridCursorCol() );
907 SetGridCursor( nextSelRow, GetGridCursorCol() );
910 for(
int row : selectedRows )
917 for(
int col = 0; col < GetNumberCols(); ++col )
919 wxString temp = GetCellValue( aRowA, col );
920 SetCellValue( aRowA, col, GetCellValue( aRowB, col ) );
921 SetCellValue( aRowB, col, temp );
938 const std::function<
void(
int row )>& aMover )
943 int i = GetGridCursorRow();
945 if( i > 0 && aFilter( i ) )
949 SetGridCursor( i - 1, GetGridCursorCol() );
950 MakeCellVisible( GetGridCursorRow(), GetGridCursorCol() );
971 const std::function<
void(
int row )>& aMover )
976 int i = GetGridCursorRow();
978 if( i + 1 < GetNumberRows() && aFilter( i ) )
982 SetGridCursor( i + 1, GetGridCursorCol() );
983 MakeCellVisible( GetGridCursorRow(), GetGridCursorCol() );
1016 wxString stringValue = GetCellValue( aRow, aCol );
1022 m_eval->SetDefaultUnits( cellUnits );
1024 if(
m_eval->Process( stringValue ) )
1025 stringValue =
m_eval->Result();
1034 wxString stringValue = GetCellValue( aRow, aCol );
1040 m_eval->SetDefaultUnits( cellUnits );
1043 stringValue =
m_eval->Result();
1059 SetCellValue( aRow, aCol,
getUnitsProvider( aCol )->StringFromValue( aValue,
true, cellDataType ) );
1072 SetCellValue( aRow, aCol,
getUnitsProvider( aCol )->StringFromOptionalValue( aValue,
true, cellDataType ) );
1090 size = GetRowLabelSize();
1092 for(
int row = 0; aContents && row < GetNumberRows(); row++ )
1093 size = std::max( size,
int( GetTextExtent( GetRowLabelValue( row ) + wxS(
"M" ) ).x ) );
1098 size = GetColSize( aCol );
1106 size = std::max( size,
int( GetTextExtent( GetColLabelValue( aCol ) + wxS(
"M" ) ).x ) );
1109 for(
int row = 0; aContents && row < GetNumberRows(); row++ )
1112 if( GetTable()->CanGetValueAs( row, aCol, wxGRID_VALUE_STRING ) )
1113 size = std::max( size, GetTextExtent( GetCellValue( row, aCol ) + wxS(
"M" ) ).x );
1115 size = std::max( size, GetTextExtent(
"MM" ).x );
1125 int line_height = int( GetTextExtent(
"Mj" ).y ) + 3;
1126 int row_height = GetColLabelSize();
1127 int initial_row_height = row_height;
1132 for(
int col = 0; col < GetNumberCols(); col++ )
1134 int nl_count = GetColLabelValue( col ).Freq(
'\n' );
1139 if( row_height < line_height * ( nl_count+1 ) )
1140 row_height += line_height * nl_count;
1146 if( initial_row_height != row_height )
1163 const int colCount = GetNumberCols();
1165 for(
int ii = 0; ii < GetNumberCols(); ++ii )
1170 wxASSERT_MSG(
m_flexibleCol < colCount,
"Flexible column index does not exist in grid" );
1172 Bind( wxEVT_UPDATE_UI,
1173 [
this]( wxUpdateUIEvent& aEvent )
1180 [
this]( wxSizeEvent& aEvent )
1187 Bind( wxEVT_GRID_CELL_CHANGED,
1188 [
this]( wxGridEvent& aEvent )
1200 const int width = GetSize().GetX() - wxSystemSettings::GetMetric( wxSYS_VSCROLL_X );
1202 std::optional<int> flexibleMinWidth;
1206 if( GetColSize( colIndex ) != 0 )
1208 AutoSizeColumn( colIndex );
1209 int colSize = GetColSize( colIndex );
1212 wxGridCellEditor*
editor = GetCellEditor( 0, colIndex );
1214 if(
dynamic_cast<wxGridCellChoiceEditor*
>(
editor )
1224 int minWidthScaled = FromDIP( minWidth );
1225 SetColSize( colIndex, std::max( minWidthScaled, colSize ) );
1228 flexibleMinWidth = minWidthScaled;
1233 int nonFlexibleWidth = 0;
1235 for(
int i = 0; i < GetNumberCols(); ++i )
1238 nonFlexibleWidth += GetColSize( i );
1242 SetColSize(
m_flexibleCol, std::max( flexibleMinWidth.value_or( 0 ), width - nonFlexibleWidth ) );
1253 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)