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 );
158 rect.SetBottom(
rect.GetBottom() - 1 );
159 rect.SetRight(
rect.GetRight() - 1 );
170 wxDCBrushChanger SetBrush(
dc, *wxTRANSPARENT_BRUSH );
175 rect.SetBottom(
rect.GetBottom() - 1 );
176 rect.SetRight(
rect.GetRight() - 1 );
187 wxDCBrushChanger SetBrush(
dc, *wxTRANSPARENT_BRUSH );
192 rect.SetBottom(
rect.GetBottom() - 1 );
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 );
302#ifdef wxHAS_DPI_INDEPENDENT_PIXELS
303 const wxGridSizesInfo savedColSizes = GetColSizes();
304 const wxGridSizesInfo savedRowSizes = GetRowSizes();
309#ifdef wxHAS_DPI_INDEPENDENT_PIXELS
311 [
this, savedColSizes, savedRowSizes]()
315 for(
const auto& [col, size] : savedColSizes.m_customSizes )
317 if( size > 0 &&
static_cast<int>( col ) < GetNumberCols() )
318 SetColSize( col, size );
321 for(
const auto& [row, size] : savedRowSizes.m_customSizes )
323 if( size > 0 &&
static_cast<int>( row ) < GetNumberRows() )
324 SetRowSize( row, size );
331 if( !hiddenCols.empty() )
336 for(
int col : hiddenCols )
349 wxGrid::SetColLabelSize( wxGRID_AUTOSIZE );
356 if( aHeight == 0 || aHeight == wxGRID_AUTOSIZE )
358 wxGrid::SetColLabelSize( aHeight );
365 wxGrid::SetColLabelSize( std::max( aHeight, minHeight ) );
379 int numberCols = GetNumberCols();
380 int* formBuilderColWidths =
new int[numberCols];
382 for(
int i = 0; i < numberCols; ++i )
383 formBuilderColWidths[ i ] = GetColSize( i );
385 wxGrid::SetTable( aTable );
389 numberCols = std::min( numberCols, GetNumberCols() );
391 for(
int i = 0; i < numberCols; ++i )
396 SetColSize( i, std::max( formBuilderColWidths[ i ], headingWidth ) );
399 delete[] formBuilderColWidths;
407 Connect( wxEVT_IDLE, wxIdleEventHandler( WX_GRID::onIdleRefreshHighlight ),
nullptr,
this );
416 wxGridTableBase*
table = wxGrid::GetTable();
418 wxCHECK_MSG(
table, ,
"Tried to enable alternate row colors without a table assigned to the grid" );
422 wxColor color = wxGrid::GetDefaultCellBackgroundColour();
427 table->SetAttrProvider(
nullptr );
443 int row = aEvent.GetRow();
444 int col = aEvent.GetCol();
446 if( row >= 0 && row < GetNumberRows() && col >= 0 && col < GetNumberCols() )
448 if( GetSelectionMode() == wxGrid::wxGridSelectCells )
450 SelectBlock( row, col, row, col,
false );
452 else if( GetSelectionMode() == wxGrid::wxGridSelectRows
453 || GetSelectionMode() == wxGrid::wxGridSelectRowsOrColumns )
455 SelectBlock( row, 0, row, GetNumberCols() - 1,
false );
457 else if( GetSelectionMode() == wxGrid::wxGridSelectColumns )
459 SelectBlock( 0, col, GetNumberRows() - 1, col,
false );
469void WX_GRID::onIdleRefreshHighlight( wxIdleEvent& aEvent )
479 if( !IsShownOnScreen() )
482 Disconnect( wxEVT_IDLE, wxIdleEventHandler( WX_GRID::onIdleRefreshHighlight ),
nullptr,
this );
492 MakeCellVisible( aEvent.GetRow(), aEvent.GetCol() );
496 int row = aEvent.GetRow();
497 int col = aEvent.GetCol();
499 const std::pair<wxString, wxString>& beforeAfter =
m_evalBeforeAfter[ { row, col } ];
501 if( GetCellValue( row, col ) == beforeAfter.second )
502 SetCellValue( row, col, beforeAfter.first );
516 const int col = aCol;
523 EDA_UNITS cellUnits = cellUnitsData.first;
526 m_eval->SetDefaultUnits( cellUnits );
528 const int row = aRow;
531 bool isNullable =
false;
532 wxGridCellEditor* cellEditor = GetCellEditor( row, col );
538 isNullable = nullable->IsNullable();
540 cellEditor->DecRef();
544 [
this, row, col, isNullable, unitsProvider, cellDataType]()
548 if( row >= GetNumberRows() || col >= GetNumberCols() )
551 wxString stringValue = GetCellValue( row, col );
552 bool processedOk =
true;
555 processedOk =
m_eval->Process( stringValue );
563 std::optional<int> val;
583 if( stringValue != evalValue )
585 SetCellValue( row, col, evalValue );
604 Disconnect( wxEVT_IDLE, wxIdleEventHandler( WX_GRID::onIdleRefreshHighlight ),
nullptr,
this );
607 wxGrid::SetTable(
nullptr );
614 wxString shownColumns;
616 for(
int i = 0; i < GetNumberCols(); ++i )
618 if( IsColShown( i ) )
620 if( shownColumns.Length() )
621 shownColumns << wxT(
" " );
633 std::bitset<64> shownColumns;
635 for(
int ii = 0; ii < GetNumberCols(); ++ii )
636 shownColumns[ii] = IsColShown( ii );
644 for(
int i = 0; i < GetNumberCols(); ++i )
647 wxStringTokenizer shownTokens( shownColumns,
" \t\r\n", wxTOKEN_STRTOK );
649 while( shownTokens.HasMoreTokens() )
652 shownTokens.GetNextToken().ToLong( &colNumber );
654 if( colNumber >= 0 && colNumber < GetNumberCols() )
655 ShowCol( (
int) colNumber );
662 if( m_nativeColumnLabels )
663 wxGrid::DrawCornerLabel(
dc );
665 wxRect
rect( wxSize( m_rowLabelWidth, m_colLabelHeight ) );
671 wxDCBrushChanger setBrush(
dc, m_colLabelWin->GetBackgroundColour() );
672 wxDCPenChanger setPen(
dc, m_colLabelWin->GetBackgroundColour() );
673 dc.DrawRectangle(
rect.Inflate( 1 ) );
682 if( m_nativeColumnLabels )
683 wxGrid::DrawColLabel(
dc, col );
685 if( GetColWidth( col ) <= 0 || m_colLabelHeight <= 0 )
688 wxRect
rect( GetColLeft( col ), 0, GetColWidth( col ), m_colLabelHeight );
694 wxDCBrushChanger setBrush(
dc, m_colLabelWin->GetBackgroundColour() );
695 wxDCPenChanger setPen(
dc, m_colLabelWin->GetBackgroundColour() );
696 dc.DrawRectangle(
rect.Inflate( 1 ) );
702 dc.SetFont( GetLabelFont() );
705 GetColLabelAlignment( &hAlign, &vAlign );
706 const int orient = GetColLabelTextOrientation();
709 hAlign = wxALIGN_LEFT;
711 if( hAlign == wxALIGN_LEFT )
714 rend.DrawLabel( *
this,
dc, GetColLabelValue( col ),
rect, hAlign, vAlign, orient );
720 if( GetRowHeight( row ) <= 0 || m_rowLabelWidth <= 0 )
723 wxRect
rect( 0, GetRowTop( row ), m_rowLabelWidth, GetRowHeight( row ) );
729 wxDCBrushChanger setBrush(
dc, m_colLabelWin->GetBackgroundColour() );
730 wxDCPenChanger setPen(
dc, m_colLabelWin->GetBackgroundColour() );
731 dc.DrawRectangle(
rect.Inflate( 1 ) );
746 dc.DrawBitmap( bitmap,
rect.GetLeft() + (
rect.GetWidth() - bitmap.GetLogicalWidth() ) / 2,
747 rect.GetTop() + (
rect.GetHeight() - bitmap.GetLogicalHeight() ) / 2,
true );
749 else if( state == ROW_STATE::EXPANDED_CHILD )
752 wxDCPenChanger setPen(
dc, wxPen( GetLabelTextColour(), FromDIP( 1 ) ) );
754 bool moreChildren = row + 1 < GetNumberRows()
755 &&
table->GetRowState( row + 1 ) == ROW_STATE::EXPANDED_CHILD;
765 dc.SetFont( GetLabelFont() );
768 GetRowLabelAlignment(&hAlign, &vAlign);
770 if( hAlign == wxALIGN_LEFT )
773 rend.DrawLabel( *
this,
dc, GetRowLabelValue( row ),
rect, hAlign, vAlign, wxHORIZONTAL );
779 if( !IsCellEditControlEnabled() )
782 HideCellEditControl();
785 m_cellEditCtrlEnabled =
false;
787 int row = m_currentCellCoords.GetRow();
788 int col = m_currentCellCoords.GetCol();
790 wxString oldval = GetCellValue( row, col );
793 wxGridCellAttr* attr = GetCellAttr( row, col );
794 wxGridCellEditor*
editor = attr->GetEditor(
this, row, col );
796 editor->EndEdit( row, col,
this, oldval, &newval );
807 if( !IsCellEditControlEnabled() )
810 if( !aQuietMode && SendEvent( wxEVT_GRID_EDITOR_HIDDEN ) == -1 )
813 HideCellEditControl();
816 m_cellEditCtrlEnabled =
false;
818 int row = m_currentCellCoords.GetRow();
819 int col = m_currentCellCoords.GetCol();
821 wxString oldval = GetCellValue( row, col );
824 wxGridCellAttr* attr = GetCellAttr( row, col );
825 wxGridCellEditor*
editor = attr->GetEditor(
this, row, col );
827 bool changed =
editor->EndEdit( row, col,
this, oldval, &newval );
834 if( !aQuietMode && SendEvent( wxEVT_GRID_CELL_CHANGING, newval ) == -1 )
837 editor->ApplyEdit( row, col,
this );
842 if( !aQuietMode && SendEvent( wxEVT_GRID_CELL_CHANGED, oldval ) == -1 )
845 SetCellValue( row, col, oldval );
862 auto [row, editCol] = aAdder();
866 MakeCellVisible( row, std::max( editCol, 0 ) );
867 SetGridCursor( row, std::max( editCol, 0 ) );
871 EnableCellEditControl(
true );
872 ShowCellEditControl();
889 const std::function<
void(
int row )>& aDeleter )
893 if( selectedRows.empty() )
896 for(
int row : selectedRows )
898 if( !aFilter( row ) )
906 std::sort( selectedRows.rbegin(), selectedRows.rend() );
908 int nextSelRow = selectedRows.back() - 1;
910 if( nextSelRow >= 0 )
912 GoToCell( nextSelRow, GetGridCursorCol() );
913 SetGridCursor( nextSelRow, GetGridCursorCol() );
916 for(
int row : selectedRows )
923 std::vector<bool> selected( GetNumberRows(),
false );
925 for(
const wxGridBlockCoords& block : GetSelectedBlocks() )
927 for(
int row = block.GetTopRow(); row <= block.GetBottomRow(); ++row )
928 selected[row] =
true;
931 std::vector<int>
rows;
933 for(
int row = 0; row < GetNumberRows(); ++row )
936 rows.push_back( row );
939 if(
rows.empty() && GetGridCursorRow() >= 0 )
940 rows.push_back( GetGridCursorRow() );
948 for(
int col = 0; col < GetNumberCols(); ++col )
950 wxString temp = GetCellValue( aRowA, col );
951 SetCellValue( aRowA, col, GetCellValue( aRowB, col ) );
952 SetCellValue( aRowB, col, temp );
969 const std::function<
void(
int row )>& aMover )
974 int i = GetGridCursorRow();
976 if( i > 0 && aFilter( i ) )
980 SetGridCursor( i - 1, GetGridCursorCol() );
981 MakeCellVisible( GetGridCursorRow(), GetGridCursorCol() );
1002 const std::function<
void(
int row )>& aMover )
1007 int i = GetGridCursorRow();
1009 if( i + 1 < GetNumberRows() && aFilter( i ) )
1013 SetGridCursor( i + 1, GetGridCursorCol() );
1014 MakeCellVisible( GetGridCursorRow(), GetGridCursorCol() );
1047 wxString stringValue = GetCellValue( aRow, aCol );
1053 m_eval->SetDefaultUnits( cellUnits );
1055 if(
m_eval->Process( stringValue ) )
1056 stringValue =
m_eval->Result();
1065 wxString stringValue = GetCellValue( aRow, aCol );
1071 m_eval->SetDefaultUnits( cellUnits );
1074 stringValue =
m_eval->Result();
1090 SetCellValue( aRow, aCol,
getUnitsProvider( aCol )->StringFromValue( aValue,
true, cellDataType ) );
1103 SetCellValue( aRow, aCol,
getUnitsProvider( aCol )->StringFromOptionalValue( aValue,
true, cellDataType ) );
1121 size = GetRowLabelSize();
1123 for(
int row = 0; aContents && row < GetNumberRows(); row++ )
1124 size = std::max( size,
int( GetTextExtent( GetRowLabelValue( row ) + wxS(
"M" ) ).x ) );
1129 size = GetColSize( aCol );
1137 size = std::max( size,
int( GetTextExtent( GetColLabelValue( aCol ) + wxS(
"M" ) ).x ) );
1140 for(
int row = 0; aContents && row < GetNumberRows(); row++ )
1143 if( GetTable()->CanGetValueAs( row, aCol, wxGRID_VALUE_STRING ) )
1144 size = std::max( size, GetTextExtent( GetCellValue( row, aCol ) + wxS(
"M" ) ).x );
1146 size = std::max( size, GetTextExtent(
"MM" ).x );
1156 int line_height = int( GetTextExtent(
"Mj" ).y ) + 3;
1157 int row_height = GetColLabelSize();
1158 int initial_row_height = row_height;
1163 for(
int col = 0; col < GetNumberCols(); col++ )
1165 int nl_count = GetColLabelValue( col ).Freq(
'\n' );
1170 if( row_height < line_height * ( nl_count+1 ) )
1171 row_height += line_height * nl_count;
1177 if( initial_row_height != row_height )
1194 const int colCount = GetNumberCols();
1196 for(
int ii = 0; ii < GetNumberCols(); ++ii )
1201 wxASSERT_MSG(
m_flexibleCol < colCount,
"Flexible column index does not exist in grid" );
1203 Bind( wxEVT_UPDATE_UI,
1204 [
this]( wxUpdateUIEvent& aEvent )
1211 [
this]( wxSizeEvent& aEvent )
1218 Bind( wxEVT_GRID_CELL_CHANGED,
1219 [
this]( wxGridEvent& aEvent )
1231 const int width = GetSize().GetX() - wxSystemSettings::GetMetric( wxSYS_VSCROLL_X );
1233 std::optional<int> flexibleMinWidth;
1237 if( GetColSize( colIndex ) != 0 )
1239 AutoSizeColumn( colIndex );
1240 int colSize = GetColSize( colIndex );
1243 if( GetNumberRows() > 0 )
1245 if( wxGridCellEditor*
editor = GetCellEditor( 0, colIndex ) )
1247 if(
dynamic_cast<wxGridCellChoiceEditor*
>(
editor )
1258 int minWidthScaled = FromDIP( minWidth );
1259 SetColSize( colIndex, std::max( minWidthScaled, colSize ) );
1262 flexibleMinWidth = minWidthScaled;
1267 int nonFlexibleWidth = 0;
1269 for(
int i = 0; i < GetNumberCols(); ++i )
1272 nonFlexibleWidth += GetColSize( i );
1276 SetColSize(
m_flexibleCol, std::max( flexibleMinWidth.value_or( 0 ), width - nonFlexibleWidth ) );
1287 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 EvaluateCell(int aRow, int aCol)
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
std::vector< int > GetSelectedRowIndices() const
bool m_useNativeSelection
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.
DATABASE_CONNECTION dc(odbcBackend(cs))
std::vector< DATABASE_CONNECTION::ROW > rows
Functions to provide common constants and other functions to assist in making a consistent UI.
static PIECE rect(double aLeft, double aTop, double aRight, double aBottom, bool aMixed=false)
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)