KiCad PCB EDA Suite
Loading...
Searching...
No Matches
WX_GRID_AUTOSIZER Class Reference

Class that manages autosizing of columns in a wxGrid. More...

#include <wx_grid_autosizer.h>

Public Types

using COL_MIN_WIDTHS = std::map< int, int >
 Map of column indices to minimum widths.
 

Public Member Functions

 WX_GRID_AUTOSIZER (wxGrid &aGrid, COL_MIN_WIDTHS aAutosizedCols, unsigned aFlexibleCol)
 

Private Member Functions

void recomputeGridWidths ()
 
void onSizeEvent (wxSizeEvent &aEvent)
 

Private Attributes

wxGrid & m_grid
 
COL_MIN_WIDTHS m_autosizedCols
 
int m_flexibleCol
 
bool m_gridWidthsDirty = true
 
int m_gridWidth = 0
 

Detailed Description

Class that manages autosizing of columns in a wxGrid.

The class will automatically resize the columns in the grid to fit the content, with one column being flexible and taking up the remaining space.

Definition at line 37 of file wx_grid_autosizer.h.

Member Typedef Documentation

◆ COL_MIN_WIDTHS

using WX_GRID_AUTOSIZER::COL_MIN_WIDTHS = std::map<int, int>

Map of column indices to minimum widths.

Use 0 to indicate that a column should be autosized to fit content, but without a minimum width.

Definition at line 46 of file wx_grid_autosizer.h.

Constructor & Destructor Documentation

◆ WX_GRID_AUTOSIZER()

WX_GRID_AUTOSIZER::WX_GRID_AUTOSIZER ( wxGrid &  aGrid,
COL_MIN_WIDTHS  aAutosizedCols,
unsigned  aFlexibleCol 
)
Parameters
aGridThe grid to manage.
aAutosizedColsA map of columns to autosize: these will sized to fit, but not smaller than the width specified.
aFlexibleColThe column that will take up the remaining space, with a minimum width if given in the aAutosizedCols map.

Definition at line 31 of file wx_grid_autosizer.cpp.

References m_autosizedCols, m_flexibleCol, m_grid, m_gridWidthsDirty, onSizeEvent(), and recomputeGridWidths().

Member Function Documentation

◆ onSizeEvent()

void WX_GRID_AUTOSIZER::onSizeEvent ( wxSizeEvent &  aEvent)
private

Definition at line 105 of file wx_grid_autosizer.cpp.

References m_gridWidth, and m_gridWidthsDirty.

Referenced by WX_GRID_AUTOSIZER().

◆ recomputeGridWidths()

void WX_GRID_AUTOSIZER::recomputeGridWidths ( )
private

Definition at line 65 of file wx_grid_autosizer.cpp.

References m_autosizedCols, m_flexibleCol, m_grid, m_gridWidth, and m_gridWidthsDirty.

Referenced by WX_GRID_AUTOSIZER().

Member Data Documentation

◆ m_autosizedCols

COL_MIN_WIDTHS WX_GRID_AUTOSIZER::m_autosizedCols
private

Definition at line 63 of file wx_grid_autosizer.h.

Referenced by recomputeGridWidths(), and WX_GRID_AUTOSIZER().

◆ m_flexibleCol

int WX_GRID_AUTOSIZER::m_flexibleCol
private

Definition at line 64 of file wx_grid_autosizer.h.

Referenced by recomputeGridWidths(), and WX_GRID_AUTOSIZER().

◆ m_grid

wxGrid& WX_GRID_AUTOSIZER::m_grid
private

Definition at line 62 of file wx_grid_autosizer.h.

Referenced by recomputeGridWidths(), and WX_GRID_AUTOSIZER().

◆ m_gridWidth

int WX_GRID_AUTOSIZER::m_gridWidth = 0
private

Definition at line 67 of file wx_grid_autosizer.h.

Referenced by onSizeEvent(), and recomputeGridWidths().

◆ m_gridWidthsDirty

bool WX_GRID_AUTOSIZER::m_gridWidthsDirty = true
private

Definition at line 66 of file wx_grid_autosizer.h.

Referenced by onSizeEvent(), recomputeGridWidths(), and WX_GRID_AUTOSIZER().


The documentation for this class was generated from the following files: