KiCad PCB EDA Suite
wx_grid.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 3
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#include <wx/tokenzr.h>
25#include <wx/dc.h>
26#include <wx/settings.h>
27
28#include <widgets/wx_grid.h>
29#include <widgets/ui_common.h>
30#include <algorithm>
31#include <core/kicad_algo.h>
32#include <gal/color4d.h>
33
34#define MIN_GRIDCELL_MARGIN 3
35
36
38{
39 KIGFX::COLOR4D bg = wxSystemSettings::GetColour( wxSYS_COLOUR_FRAMEBK );
40 KIGFX::COLOR4D fg = wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER );
41 KIGFX::COLOR4D border = fg.Mix( bg, 0.50 );
42 return border.ToColour();
43}
44
45
46class WX_GRID_CORNER_HEADER_RENDERER : public wxGridCornerHeaderRendererDefault
47{
48public:
49 void DrawBorder( const wxGrid& grid, wxDC& dc, wxRect& rect ) const override
50 {
51 wxDCBrushChanger SetBrush( dc, *wxTRANSPARENT_BRUSH );
52 wxDCPenChanger SetPen( dc, wxPen( getBorderColour(), 1 ) );
53
54 rect.SetTop( rect.GetTop() + 1 );
55 rect.SetLeft( rect.GetLeft() + 1 );
56 rect.SetBottom( rect.GetBottom() - 1 );
57 rect.SetRight( rect.GetRight() - 1 );
58 dc.DrawRectangle( rect );
59 }
60};
61
62
63class WX_GRID_COLUMN_HEADER_RENDERER : public wxGridColumnHeaderRendererDefault
64{
65public:
66 void DrawBorder( const wxGrid& grid, wxDC& dc, wxRect& rect ) const override
67 {
68 wxDCBrushChanger SetBrush( dc, *wxTRANSPARENT_BRUSH );
69 wxDCPenChanger SetPen( dc, wxPen( getBorderColour(), 1 ) );
70
71 rect.SetTop( rect.GetTop() + 1 );
72 rect.SetLeft( rect.GetLeft() );
73 rect.SetBottom( rect.GetBottom() - 1 );
74 rect.SetRight( rect.GetRight() - 1 );
75 dc.DrawRectangle( rect );
76 }
77};
78
79
80class WX_GRID_ROW_HEADER_RENDERER : public wxGridRowHeaderRendererDefault
81{
82public:
83 void DrawBorder( const wxGrid& grid, wxDC& dc, wxRect& rect ) const override
84 {
85 wxDCBrushChanger SetBrush( dc, *wxTRANSPARENT_BRUSH );
86 wxDCPenChanger SetPen( dc, wxPen( getBorderColour(), 1 ) );
87
88 rect.SetTop( rect.GetTop() + 1 );
89 rect.SetLeft( rect.GetLeft() + 1 );
90 rect.SetBottom( rect.GetBottom() - 1 );
91 rect.SetRight( rect.GetRight() );
92 dc.DrawRectangle( rect );
93 }
94};
95
96
97WX_GRID::WX_GRID( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
98 long style, const wxString& name ) :
99 wxGrid( parent, id, pos, size, style, name ),
100 m_weOwnTable( false )
101{
102 SetDefaultCellOverflow( false );
103
104 // Make sure the GUI font scales properly
105 SetDefaultCellFont( KIUI::GetControlFont( this ) );
107
108 if( GetColLabelSize() > 0 )
109 SetColLabelSize( GetColLabelSize() + 4 );
110
111#if wxCHECK_VERSION( 3, 1, 3 )
112 Connect( wxEVT_DPI_CHANGED, wxDPIChangedEventHandler( WX_GRID::onDPIChanged ), nullptr, this );
113#endif
114
115 Connect( wxEVT_GRID_EDITOR_SHOWN, wxGridEventHandler( WX_GRID::onCellEditorShown ), nullptr, this );
116 Connect( wxEVT_GRID_EDITOR_HIDDEN, wxGridEventHandler( WX_GRID::onCellEditorHidden ), nullptr, this );
117}
118
119
121{
122 if( m_weOwnTable )
123 DestroyTable( GetTable() );
124
125#if wxCHECK_VERSION( 3, 1, 3 )
126 Disconnect( wxEVT_DPI_CHANGED, wxDPIChangedEventHandler( WX_GRID::onDPIChanged ), nullptr, this );
127#endif
128
129}
130
131
132#if wxCHECK_VERSION( 3, 1, 3 )
133void WX_GRID::onDPIChanged(wxDPIChangedEvent& aEvt)
134{
137#ifndef __WXMAC__
138 aEvt.Skip();
139#endif
140}
141#endif
142
143
144void WX_GRID::SetColLabelSize( int aHeight )
145{
146 if( aHeight == 0 )
147 {
148 wxGrid::SetColLabelSize( 0 );
149 return;
150 }
151
152 // Correct wxFormBuilder height for large fonts
153 int minHeight = GetLabelFont().GetPixelSize().y + 2 * MIN_GRIDCELL_MARGIN;
154 wxGrid::SetColLabelSize( std::max( aHeight, minHeight ) );
155}
156
157
158void WX_GRID::SetLabelFont( const wxFont& aFont )
159{
160 wxGrid::SetLabelFont( KIUI::GetControlFont( this ) );
161}
162
163
164void WX_GRID::SetTable( wxGridTableBase* aTable, bool aTakeOwnership )
165{
166 // wxGrid::SetTable() messes up the column widths from wxFormBuilder so we have to save
167 // and restore them.
168 int numberCols = GetNumberCols();
169 int* formBuilderColWidths = new int[numberCols];
170
171 for( int i = 0; i < numberCols; ++i )
172 formBuilderColWidths[ i ] = GetColSize( i );
173
174 wxGrid::SetTable( aTable );
175
176 // wxGrid::SetTable() may change the number of columns, so prevent out-of-bounds access
177 // to formBuilderColWidths
178 numberCols = std::min( numberCols, GetNumberCols() );
179
180 for( int i = 0; i < numberCols; ++i )
181 {
182 // correct wxFormBuilder width for large fonts and/or long translations
183 int headingWidth = GetTextExtent( GetColLabelValue( i ) ).x + 2 * MIN_GRIDCELL_MARGIN;
184
185 SetColSize( i, std::max( formBuilderColWidths[ i ], headingWidth ) );
186 }
187
188 delete[] formBuilderColWidths;
189
190 Connect( wxEVT_GRID_COL_MOVE, wxGridEventHandler( WX_GRID::onGridColMove ), nullptr, this );
191 Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( WX_GRID::onGridCellSelect ), nullptr, this );
192
193 m_weOwnTable = aTakeOwnership;
194}
195
196
197void WX_GRID::onGridCellSelect( wxGridEvent& aEvent )
198{
199 // Highlight the selected cell.
200 // Calling SelectBlock() allows a visual effect when cells are selected by tab or arrow keys.
201 // Otherwise, one cannot really know what actual cell is selected.
202 int row = aEvent.GetRow();
203 int col = aEvent.GetCol();
204
205 if( row >= 0 && col >= 0 )
206 SelectBlock( row, col, row, col, false );
207}
208
209
210void WX_GRID::onCellEditorShown( wxGridEvent& aEvent )
211{
212 if( alg::contains( m_autoEvalCols, aEvent.GetCol() ) )
213 {
214 int row = aEvent.GetRow();
215 int col = aEvent.GetCol();
216
217 const std::pair<wxString, wxString>& beforeAfter = m_evalBeforeAfter[ { row, col } ];
218
219 if( GetCellValue( row, col ) == beforeAfter.second )
220 SetCellValue( row, col, beforeAfter.first );
221 }
222}
223
224
225void WX_GRID::onCellEditorHidden( wxGridEvent& aEvent )
226{
227 if( alg::contains( m_autoEvalCols, aEvent.GetCol() ) )
228 {
229 UNITS_PROVIDER* unitsProvider = m_unitsProviders[ aEvent.GetCol() ];
230
231 if( !unitsProvider )
232 unitsProvider = m_unitsProviders.begin()->second;
233
234 m_eval->SetDefaultUnits( unitsProvider->GetUserUnits() );
235
236 int row = aEvent.GetRow();
237 int col = aEvent.GetCol();
238
239 CallAfter(
240 [this, row, col, unitsProvider]()
241 {
242 wxString stringValue = GetCellValue( row, col );
243
244 if( m_eval->Process( stringValue ) )
245 {
246 int val = unitsProvider->ValueFromString( m_eval->Result() );
247 wxString evalValue = unitsProvider->StringFromValue( val, true );
248
249 if( stringValue != evalValue )
250 {
251 SetCellValue( row, col, evalValue );
252 m_evalBeforeAfter[ { row, col } ] = { stringValue, evalValue };
253 }
254 }
255 } );
256 }
257
258 aEvent.Skip();
259}
260
261
262void WX_GRID::DestroyTable( wxGridTableBase* aTable )
263{
264 // wxGrid's destructor will crash trying to look up the cell attr if the edit control
265 // is left open. Normally it's closed in Validate(), but not if the user hit Cancel.
266 CommitPendingChanges( true /* quiet mode */ );
267
268 Disconnect( wxEVT_GRID_COL_MOVE, wxGridEventHandler( WX_GRID::onGridColMove ), nullptr, this );
269 Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( WX_GRID::onGridCellSelect ), nullptr, this );
270
271 wxGrid::SetTable( nullptr );
272 delete aTable;
273}
274
275
277{
278 wxString shownColumns;
279
280 for( int i = 0; i < GetNumberCols(); ++i )
281 {
282 if( IsColShown( i ) )
283 {
284 if( shownColumns.Length() )
285 shownColumns << wxT( " " );
286
287 shownColumns << i;
288 }
289 }
290
291 return shownColumns;
292}
293
294
295void WX_GRID::ShowHideColumns( const wxString& shownColumns )
296{
297 for( int i = 0; i < GetNumberCols(); ++i )
298 HideCol( i );
299
300 wxStringTokenizer shownTokens( shownColumns );
301
302 while( shownTokens.HasMoreTokens() )
303 {
304 long colNumber;
305 shownTokens.GetNextToken().ToLong( &colNumber );
306
307 if( colNumber >= 0 && colNumber < GetNumberCols() )
308 ShowCol( (int) colNumber );
309 }
310}
311
312
314{
315 if( m_nativeColumnLabels )
316 wxGrid::DrawCornerLabel( dc );
317
318 wxRect rect( wxSize( m_rowLabelWidth, m_colLabelHeight ) );
319
321
322 // It is reported that we need to erase the background to avoid display
323 // artifacts, see #12055.
324 {
325 // wxWidgets renamed this variable between 3.1.2 and 3.1.3 ...
326#if wxCHECK_VERSION( 3, 1, 3 )
327 wxDCBrushChanger setBrush( dc, m_colLabelWin->GetBackgroundColour() );
328 wxDCPenChanger setPen( dc, m_colLabelWin->GetBackgroundColour() );
329#else
330 wxDCBrushChanger setBrush( dc, m_colWindow->GetBackgroundColour() );
331 wxDCPenChanger setPen( dc, m_colWindow->GetBackgroundColour() );
332#endif
333 dc.DrawRectangle( rect.Inflate( 1 ) );
334 }
335
336 rend.DrawBorder( *this, dc, rect );
337}
338
339
340void WX_GRID::DrawColLabel( wxDC& dc, int col )
341{
342 if( m_nativeColumnLabels )
343 wxGrid::DrawColLabel( dc, col );
344
345 if( GetColWidth( col ) <= 0 || m_colLabelHeight <= 0 )
346 return;
347
348 wxRect rect( GetColLeft( col ), 0, GetColWidth( col ), m_colLabelHeight );
349
351
352 // It is reported that we need to erase the background to avoid display
353 // artifacts, see #12055.
354 {
355 // wxWidgets renamed this variable between 3.1.2 and 3.1.3 ...
356#if wxCHECK_VERSION( 3, 1, 3 )
357 wxDCBrushChanger setBrush( dc, m_colLabelWin->GetBackgroundColour() );
358 wxDCPenChanger setPen( dc, m_colLabelWin->GetBackgroundColour() );
359#else
360 wxDCBrushChanger setBrush( dc, m_colWindow->GetBackgroundColour() );
361 wxDCPenChanger setPen( dc, m_colWindow->GetBackgroundColour() );
362#endif
363 dc.DrawRectangle( rect.Inflate( 1 ) );
364 }
365
366 rend.DrawBorder( *this, dc, rect );
367
368 // Make sure fonts get scaled correctly on GTK HiDPI monitors
369 dc.SetFont( GetLabelFont() );
370
371 int hAlign, vAlign;
372 GetColLabelAlignment( &hAlign, &vAlign );
373 const int orient = GetColLabelTextOrientation();
374
375 if( col == 0 )
376 hAlign = wxALIGN_LEFT;
377
378 if( hAlign == wxALIGN_LEFT )
379 rect.SetLeft( rect.GetLeft() + MIN_GRIDCELL_MARGIN );
380
381 rend.DrawLabel( *this, dc, GetColLabelValue( col ), rect, hAlign, vAlign, orient );
382}
383
384
385void WX_GRID::DrawRowLabel( wxDC& dc, int row )
386{
387 if ( GetRowHeight( row ) <= 0 || m_rowLabelWidth <= 0 )
388 return;
389
390 wxRect rect( 0, GetRowTop( row ), m_rowLabelWidth, GetRowHeight( row ) );
391
392 static WX_GRID_ROW_HEADER_RENDERER rend;
393
394 // It is reported that we need to erase the background to avoid display
395 // artifacts, see #12055.
396 {
397 // wxWidgets renamed this variable between 3.1.2 and 3.1.3 ...
398#if wxCHECK_VERSION( 3, 1, 3 )
399 wxDCBrushChanger setBrush( dc, m_colLabelWin->GetBackgroundColour() );
400 wxDCPenChanger setPen( dc, m_colLabelWin->GetBackgroundColour() );
401#else
402 wxDCBrushChanger setBrush( dc, m_colWindow->GetBackgroundColour() );
403 wxDCPenChanger setPen( dc, m_colWindow->GetBackgroundColour() );
404#endif
405 dc.DrawRectangle( rect.Inflate( 1 ) );
406 }
407
408 rend.DrawBorder( *this, dc, rect );
409
410 // Make sure fonts get scaled correctly on GTK HiDPI monitors
411 dc.SetFont( GetLabelFont() );
412
413 int hAlign, vAlign;
414 GetRowLabelAlignment(&hAlign, &vAlign);
415
416 if( hAlign == wxALIGN_LEFT )
417 rect.SetLeft( rect.GetLeft() + MIN_GRIDCELL_MARGIN );
418
419 rend.DrawLabel( *this, dc, GetRowLabelValue( row ), rect, hAlign, vAlign, wxHORIZONTAL );
420}
421
422
423bool WX_GRID::CommitPendingChanges( bool aQuietMode )
424{
425 if( !IsCellEditControlEnabled() )
426 return true;
427
428 if( !aQuietMode && SendEvent( wxEVT_GRID_EDITOR_HIDDEN ) == -1 )
429 return false;
430
431 HideCellEditControl();
432
433 // do it after HideCellEditControl()
434 m_cellEditCtrlEnabled = false;
435
436 int row = m_currentCellCoords.GetRow();
437 int col = m_currentCellCoords.GetCol();
438
439 wxString oldval = GetCellValue( row, col );
440 wxString newval;
441
442 wxGridCellAttr* attr = GetCellAttr( row, col );
443 wxGridCellEditor* editor = attr->GetEditor( this, row, col );
444
445 bool changed = editor->EndEdit( row, col, this, oldval, &newval );
446
447 editor->DecRef();
448 attr->DecRef();
449
450 if( changed )
451 {
452 if( !aQuietMode && SendEvent( wxEVT_GRID_CELL_CHANGING, newval ) == -1 )
453 return false;
454
455 editor->ApplyEdit( row, col, this );
456
457 // for compatibility reasons dating back to wx 2.8 when this event
458 // was called wxEVT_GRID_CELL_CHANGE and wxEVT_GRID_CELL_CHANGING
459 // didn't exist we allow vetoing this one too
460 if( !aQuietMode && SendEvent( wxEVT_GRID_CELL_CHANGED, oldval ) == -1 )
461 {
462 // Event has been vetoed, set the data back.
463 SetCellValue( row, col, oldval );
464 return false;
465 }
466 }
467
468 return true;
469}
470
471
472void WX_GRID::SetUnitsProvider( UNITS_PROVIDER* aProvider, int aCol )
473{
474 m_unitsProviders[ aCol ] = aProvider;
475
476 if( !m_eval )
477 m_eval = std::make_unique<NUMERIC_EVALUATOR>( aProvider->GetUserUnits() );
478}
479
480
481int WX_GRID::GetUnitValue( int aRow, int aCol )
482{
483 UNITS_PROVIDER* unitsProvider = m_unitsProviders[ aCol ];
484
485 if( !unitsProvider )
486 unitsProvider = m_unitsProviders.begin()->second;
487
488 wxString stringValue = GetCellValue( aRow, aCol );
489
490 if( alg::contains( m_autoEvalCols, aCol ) )
491 {
492 m_eval->SetDefaultUnits( unitsProvider->GetUserUnits() );
493
494 if( m_eval->Process( stringValue ) )
495 stringValue = m_eval->Result();
496 }
497
498 return unitsProvider->ValueFromString( stringValue );
499}
500
501
502void WX_GRID::SetUnitValue( int aRow, int aCol, int aValue )
503{
504 UNITS_PROVIDER* unitsProvider = m_unitsProviders[ aCol ];
505
506 if( !unitsProvider )
507 unitsProvider = m_unitsProviders.begin()->second;
508
509 SetCellValue( aRow, aCol, unitsProvider->StringFromValue( aValue, true ) );
510}
511
512
513void WX_GRID::onGridColMove( wxGridEvent& aEvent )
514{
515 // wxWidgets won't move an open editor, so better just to close it
516 CommitPendingChanges( true );
517}
518
519
520int WX_GRID::GetVisibleWidth( int aCol, bool aHeader, bool aContents, bool aKeep )
521{
522 int size = 0;
523
524 if( aCol < 0 )
525 {
526 if( aKeep )
527 size = GetRowLabelSize();
528
529 for( int row = 0; aContents && row < GetNumberRows(); row++ )
530 size = std::max( size, int( GetTextExtent( GetRowLabelValue( row ) + wxS( "M" ) ).x ) );
531 }
532 else
533 {
534 if( aKeep )
535 size = GetColSize( aCol );
536
537 // 'M' is generally the widest character, so we buffer the column width by default to
538 // ensure we don't write a continuous line of text at the column header
539 if( aHeader )
540 {
542
543 size = std::max( size, int( GetTextExtent( GetColLabelValue( aCol ) + wxS( "M" ) ).x ) );
544 }
545
546 for( int row = 0; aContents && row < GetNumberRows(); row++ )
547 {
548 // If we have text, get the size. Otherwise, use a placeholder for the checkbox
549 if( GetTable()->CanGetValueAs( row, aCol, wxGRID_VALUE_STRING ) )
550 size = std::max( size, GetTextExtent( GetCellValue( row, aCol ) + wxS( "M" ) ).x );
551 else
552 size = std::max( size, GetTextExtent( "MM" ).x );
553 }
554 }
555
556 return size;
557}
558
559
561{
562 int line_height = int( GetTextExtent( "Mj" ).y ) + 3;
563 int row_height = GetColLabelSize();
564 int initial_row_height = row_height;
565
566 // Headers can be multiline. Fix the Column Label Height to show the full header
567 // However GetTextExtent does not work on multiline strings,
568 // and do not return the full text height (only the height of one line)
569 for( int col = 0; col < GetNumberCols(); col++ )
570 {
571 int nl_count = GetColLabelValue( col ).Freq( '\n' );
572
573 if( nl_count )
574 {
575 // Col Label height must be able to show nl_count+1 lines
576 if( row_height < line_height * ( nl_count+1 ) )
577 row_height += line_height * nl_count;
578 }
579 }
580
581 // Update the column label size, but only if needed, to avoid generating useless
582 // and perhaps annoying UI events when the size does not change
583 if( initial_row_height != row_height )
584 SetColLabelSize( row_height );
585}
const char * name
Definition: DXF_plotter.cpp:56
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
Definition: color4d.h:311
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Converts aValue in internal units into a united string.
int ValueFromString(const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Converts aTextValue in aUnits to internal units used by the frame.
EDA_UNITS GetUserUnits() const
void DrawBorder(const wxGrid &grid, wxDC &dc, wxRect &rect) const override
Definition: wx_grid.cpp:66
void DrawBorder(const wxGrid &grid, wxDC &dc, wxRect &rect) const override
Definition: wx_grid.cpp:49
void DrawBorder(const wxGrid &grid, wxDC &dc, wxRect &rect) const override
Definition: wx_grid.cpp:83
int GetVisibleWidth(int aCol, bool aHeader=true, bool aContents=true, bool aKeep=false)
Calculates the specified column based on the actual size of the text on screen.
Definition: wx_grid.cpp:520
void onGridCellSelect(wxGridEvent &aEvent)
Definition: wx_grid.cpp:197
~WX_GRID() override
Definition: wx_grid.cpp:120
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...
Definition: wx_grid.cpp:158
bool m_weOwnTable
Definition: wx_grid.h:173
void ShowHideColumns(const wxString &shownColumns)
Show/hide the grid columns based on a tokenized string of shown column indexes.
Definition: wx_grid.cpp:295
std::map< int, UNITS_PROVIDER * > m_unitsProviders
Definition: wx_grid.h:175
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...
Definition: wx_grid.cpp:164
void DestroyTable(wxGridTableBase *aTable)
Work-around for a bug in wxGrid which crashes when deleting the table if the cell edit control was no...
Definition: wx_grid.cpp:262
void SetColLabelSize(int aHeight)
Hide wxGrid's SetColLabelSize() method with one which makes sure the size is tall enough for the syst...
Definition: wx_grid.cpp:144
void SetUnitValue(int aRow, int aCol, int aValue)
Set a unitized cell's value.
Definition: wx_grid.cpp:502
WX_GRID(wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxWANTS_CHARS, const wxString &name=wxGridNameStr)
Definition: wx_grid.cpp:97
int GetUnitValue(int aRow, int aCol)
Apply standard KiCad unit and eval services to a numeric cell.
Definition: wx_grid.cpp:481
std::vector< int > m_autoEvalCols
Definition: wx_grid.h:177
std::map< std::pair< int, int >, std::pair< wxString, wxString > > m_evalBeforeAfter
Definition: wx_grid.h:179
void DrawCornerLabel(wxDC &dc) override
A re-implementation of wxGrid::DrawCornerLabel which draws flat borders.
Definition: wx_grid.cpp:313
void onCellEditorHidden(wxGridEvent &aEvent)
Definition: wx_grid.cpp:225
void onGridColMove(wxGridEvent &aEvent)
Definition: wx_grid.cpp:513
void onCellEditorShown(wxGridEvent &aEvent)
Definition: wx_grid.cpp:210
void EnsureColLabelsVisible()
Ensure the height of the row displaying the column labels is enough, even if labels are multiline tex...
Definition: wx_grid.cpp:560
void DrawRowLabel(wxDC &dc, int row) override
A re-implementation of wxGrid::DrawRowLabel which draws flat borders.
Definition: wx_grid.cpp:385
wxString GetShownColumns()
Get a tokenized string containing the shown column indexes.
Definition: wx_grid.cpp:276
void SetUnitsProvider(UNITS_PROVIDER *aProvider, int aCol=0)
Set a UNITS_PROVIDER to enable use of unit- and eval-based Getters.
Definition: wx_grid.cpp:472
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:423
std::unique_ptr< NUMERIC_EVALUATOR > m_eval
Definition: wx_grid.h:176
void DrawColLabel(wxDC &dc, int col) override
A re-implementation of wxGrid::DrawColLabel which left-aligns the first column and draws flat borders...
Definition: wx_grid.cpp:340
wxFont GetControlFont(wxWindow *aWindow)
Definition: ui_common.cpp:162
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:99
Functions to provide common constants and other functions to assist in making a consistent UI.
wxColour getBorderColour()
Definition: wx_grid.cpp:37
#define MIN_GRIDCELL_MARGIN
Definition: wx_grid.cpp:34