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

Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance. More...

#include <grid_tricks.h>

Inheritance diagram for GRID_TRICKS:
CURSORS_GRID_TRICKS FIELDS_EDITOR_GRID_TRICKS FIELDS_GRID_TRICKS LIB_TABLE_GRID_TRICKS MEASUREMENTS_GRID_TRICKS PLUGINS_GRID_TRICKS SIGNALS_GRID_TRICKS DESIGN_BLOCK_GRID_TRICKS FP_GRID_TRICKS SYMBOL_GRID_TRICKS

Public Member Functions

 GRID_TRICKS (WX_GRID *aGrid)
 
 GRID_TRICKS (WX_GRID *aGrid, std::function< void(wxCommandEvent &)> aAddHandler)
 
void SetTooltipEnable (int aCol, bool aEnable=true)
 Enable the tooltip for a column.
 
bool GetTooltipEnabled (int aCol)
 Query if the tooltip for a column is enabled.
 

Protected Member Functions

void init ()
 Shared initialization for various ctors.
 
void getSelectedArea ()
 Puts the selected area into a sensible rectangle of m_sel_{row,col}_{start,count} above.
 
void onGridCellLeftClick (wxGridEvent &event)
 
void onGridCellLeftDClick (wxGridEvent &event)
 
void onGridCellRightClick (wxGridEvent &event)
 
void onGridLabelLeftClick (wxGridEvent &event)
 
void onGridLabelRightClick (wxGridEvent &event)
 
void onPopupSelection (wxCommandEvent &event)
 
void onKeyDown (wxKeyEvent &event)
 
void onCharHook (wxKeyEvent &event)
 
void onUpdateUI (wxUpdateUIEvent &event)
 
void onGridMotion (wxMouseEvent &event)
 
virtual bool handleDoubleClick (wxGridEvent &aEvent)
 
virtual void showPopupMenu (wxMenu &menu, wxGridEvent &aEvent)
 
virtual void doPopupSelection (wxCommandEvent &event)
 
bool isTextEntry (int aRow, int aCol)
 
bool isCheckbox (int aRow, int aCol)
 
bool isReadOnly (int aRow, int aCol)
 
virtual bool toggleCell (int aRow, int aCol, bool aPreserveSelection=false)
 
bool showEditor (int aRow, int aCol)
 
virtual void paste_clipboard ()
 
virtual void paste_text (const wxString &cb_text)
 
virtual void cutcopy (bool doCopy, bool doDelete)
 

Protected Attributes

WX_GRIDm_grid
 I don't own the grid, but he owns me.
 
int m_sel_row_start
 
int m_sel_col_start
 
int m_sel_row_count
 
int m_sel_col_count
 
std::function< void(wxCommandEvent &)> m_addHandler
 
std::bitset< GRIDTRICKS_MAX_COLm_tooltipEnabled
 

Detailed Description

Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.

Definition at line 60 of file grid_tricks.h.

Constructor & Destructor Documentation

◆ GRID_TRICKS() [1/2]

GRID_TRICKS::GRID_TRICKS ( WX_GRID aGrid)
explicit

Definition at line 42 of file grid_tricks.cpp.

◆ GRID_TRICKS() [2/2]

GRID_TRICKS::GRID_TRICKS ( WX_GRID aGrid,
std::function< void(wxCommandEvent &)>  aAddHandler 
)

Definition at line 50 of file grid_tricks.cpp.

References init().

Member Function Documentation

◆ cutcopy()

void GRID_TRICKS::cutcopy ( bool  doCopy,
bool  doDelete 
)
protectedvirtual

◆ doPopupSelection()

◆ getSelectedArea()

void GRID_TRICKS::getSelectedArea ( )
protected

Puts the selected area into a sensible rectangle of m_sel_{row,col}_{start,count} above.

Definition at line 282 of file grid_tricks.cpp.

References m_grid, m_sel_col_count, m_sel_col_start, m_sel_row_count, and m_sel_row_start.

Referenced by onGridCellLeftClick(), onKeyDown(), showPopupMenu(), and LIB_TABLE_GRID_TRICKS::showPopupMenu().

◆ GetTooltipEnabled()

bool GRID_TRICKS::GetTooltipEnabled ( int  aCol)
inline

Query if the tooltip for a column is enabled.

Parameters
aColis the column to query
Returns
if the tooltip is enabled for the column

Definition at line 86 of file grid_tricks.h.

References m_tooltipEnabled.

◆ handleDoubleClick()

bool GRID_TRICKS::handleDoubleClick ( wxGridEvent &  aEvent)
protectedvirtual

Reimplemented in LIB_TABLE_GRID_TRICKS.

Definition at line 275 of file grid_tricks.cpp.

Referenced by onGridCellLeftDClick().

◆ init()

◆ isCheckbox()

bool GRID_TRICKS::isCheckbox ( int  aRow,
int  aCol 
)
protected

Definition at line 102 of file grid_tricks.cpp.

References m_grid.

Referenced by toggleCell().

◆ isReadOnly()

bool GRID_TRICKS::isReadOnly ( int  aRow,
int  aCol 
)
protected

Definition at line 112 of file grid_tricks.cpp.

References m_grid.

Referenced by cutcopy(), paste_text(), showEditor(), and showPopupMenu().

◆ isTextEntry()

bool GRID_TRICKS::isTextEntry ( int  aRow,
int  aCol 
)
protected

Definition at line 91 of file grid_tricks.cpp.

References editor, and m_grid.

Referenced by cutcopy(), and showPopupMenu().

◆ onCharHook()

void GRID_TRICKS::onCharHook ( wxKeyEvent &  event)
protected

◆ onGridCellLeftClick()

void GRID_TRICKS::onGridCellLeftClick ( wxGridEvent &  event)
protected

◆ onGridCellLeftDClick()

void GRID_TRICKS::onGridCellLeftDClick ( wxGridEvent &  event)
protected

Definition at line 245 of file grid_tricks.cpp.

References handleDoubleClick(), and onGridCellLeftClick().

Referenced by init().

◆ onGridCellRightClick()

void GRID_TRICKS::onGridCellRightClick ( wxGridEvent &  event)
protected

Definition at line 322 of file grid_tricks.cpp.

References showPopupMenu().

Referenced by init().

◆ onGridLabelLeftClick()

void GRID_TRICKS::onGridLabelLeftClick ( wxGridEvent &  event)
protected

Definition at line 330 of file grid_tricks.cpp.

References WX_GRID::CommitPendingChanges(), and m_grid.

Referenced by init().

◆ onGridLabelRightClick()

void GRID_TRICKS::onGridLabelRightClick ( wxGridEvent &  event)
protected

Definition at line 338 of file grid_tricks.cpp.

References GRIDTRICKS_FIRST_SHOWHIDE, and m_grid.

Referenced by init().

◆ onGridMotion()

void GRID_TRICKS::onGridMotion ( wxMouseEvent &  event)
protected

Definition at line 252 of file grid_tricks.cpp.

References m_grid, and m_tooltipEnabled.

Referenced by init().

◆ onKeyDown()

void GRID_TRICKS::onKeyDown ( wxKeyEvent &  event)
protected

Definition at line 526 of file grid_tricks.cpp.

References cutcopy(), getSelectedArea(), m_grid, paste_clipboard(), and toggleCell().

Referenced by init().

◆ onPopupSelection()

void GRID_TRICKS::onPopupSelection ( wxCommandEvent &  event)
protected

Definition at line 412 of file grid_tricks.cpp.

References doPopupSelection().

Referenced by init().

◆ onUpdateUI()

void GRID_TRICKS::onUpdateUI ( wxUpdateUIEvent &  event)
protected

Definition at line 876 of file grid_tricks.cpp.

References m_grid.

Referenced by init().

◆ paste_clipboard()

void GRID_TRICKS::paste_clipboard ( )
protectedvirtual

Definition at line 684 of file grid_tricks.cpp.

References m_grid, paste_text(), and text.

Referenced by doPopupSelection(), and onKeyDown().

◆ paste_text()

◆ SetTooltipEnable()

void GRID_TRICKS::SetTooltipEnable ( int  aCol,
bool  aEnable = true 
)
inline

Enable the tooltip for a column.

The tooltip is read from the string contained in the cell data.

Parameters
aColis the column to use
aEnableis true to enable the tooltip (default)

Definition at line 75 of file grid_tricks.h.

References m_tooltipEnabled.

Referenced by PANEL_FP_PROPERTIES_3D_MODEL::PANEL_FP_PROPERTIES_3D_MODEL().

◆ showEditor()

bool GRID_TRICKS::showEditor ( int  aRow,
int  aCol 
)
protected

◆ showPopupMenu()

◆ toggleCell()

bool GRID_TRICKS::toggleCell ( int  aRow,
int  aCol,
bool  aPreserveSelection = false 
)
protectedvirtual

Reimplemented in FP_GRID_TRICKS.

Definition at line 118 of file grid_tricks.cpp.

References isCheckbox(), and m_grid.

Referenced by onGridCellLeftClick(), onKeyDown(), and FP_GRID_TRICKS::toggleCell().

Member Data Documentation

◆ m_addHandler

std::function<void( wxCommandEvent& )> GRID_TRICKS::m_addHandler
protected

Definition at line 134 of file grid_tricks.h.

Referenced by onCharHook(), and paste_text().

◆ m_grid

◆ m_sel_col_count

int GRID_TRICKS::m_sel_col_count
protected

Definition at line 132 of file grid_tricks.h.

Referenced by cutcopy(), getSelectedArea(), init(), paste_text(), showEditor(), and showPopupMenu().

◆ m_sel_col_start

int GRID_TRICKS::m_sel_col_start
protected

Definition at line 130 of file grid_tricks.h.

Referenced by cutcopy(), getSelectedArea(), init(), paste_text(), showEditor(), and showPopupMenu().

◆ m_sel_row_count

◆ m_sel_row_start

◆ m_tooltipEnabled

std::bitset<GRIDTRICKS_MAX_COL> GRID_TRICKS::m_tooltipEnabled
protected

Definition at line 136 of file grid_tricks.h.

Referenced by GetTooltipEnabled(), onGridMotion(), and SetTooltipEnable().


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