KiCad PCB EDA Suite
|
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance. More...
#include <grid_tricks.h>
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_GRID * | m_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_COL > | m_tooltipEnabled |
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.
|
explicit |
Definition at line 42 of file grid_tricks.cpp.
GRID_TRICKS::GRID_TRICKS | ( | WX_GRID * | aGrid, |
std::function< void(wxCommandEvent &)> | aAddHandler | ||
) |
Definition at line 50 of file grid_tricks.cpp.
References init().
|
protectedvirtual |
Definition at line 829 of file grid_tricks.cpp.
References COL_SEP, isReadOnly(), isTextEntry(), m_grid, m_sel_col_count, m_sel_col_start, m_sel_row_count, m_sel_row_start, and ROW_SEP.
Referenced by doPopupSelection(), and onKeyDown().
|
protectedvirtual |
Reimplemented in FIELDS_EDITOR_GRID_TRICKS, FIELDS_GRID_TRICKS, SIGNALS_GRID_TRICKS, CURSORS_GRID_TRICKS, MEASUREMENTS_GRID_TRICKS, and LIB_TABLE_GRID_TRICKS.
Definition at line 418 of file grid_tricks.cpp.
References WX_GRID::CommitPendingChanges(), cutcopy(), GRIDTRICKS_FIRST_SHOWHIDE, GRIDTRICKS_ID_COPY, GRIDTRICKS_ID_CUT, GRIDTRICKS_ID_DELETE, GRIDTRICKS_ID_PASTE, GRIDTRICKS_ID_SELECT, m_grid, and paste_clipboard().
Referenced by FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), FIELDS_GRID_TRICKS::doPopupSelection(), CURSORS_GRID_TRICKS::doPopupSelection(), MEASUREMENTS_GRID_TRICKS::doPopupSelection(), LIB_TABLE_GRID_TRICKS::doPopupSelection(), and onPopupSelection().
|
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().
|
inline |
Query if the tooltip for a column is enabled.
aCol | is the column to query |
Definition at line 86 of file grid_tricks.h.
References m_tooltipEnabled.
|
protectedvirtual |
Reimplemented in LIB_TABLE_GRID_TRICKS.
Definition at line 275 of file grid_tricks.cpp.
Referenced by onGridCellLeftDClick().
|
protected |
Shared initialization for various ctors.
Definition at line 58 of file grid_tricks.cpp.
References GRIDTRICKS_FIRST_ID, GRIDTRICKS_LAST_ID, m_grid, m_sel_col_count, m_sel_col_start, m_sel_row_count, m_sel_row_start, onCharHook(), onGridCellLeftClick(), onGridCellLeftDClick(), onGridCellRightClick(), onGridLabelLeftClick(), onGridLabelRightClick(), onGridMotion(), onKeyDown(), onPopupSelection(), and onUpdateUI().
Referenced by GRID_TRICKS().
|
protected |
|
protected |
Definition at line 112 of file grid_tricks.cpp.
References m_grid.
Referenced by cutcopy(), paste_text(), showEditor(), and showPopupMenu().
|
protected |
Definition at line 91 of file grid_tricks.cpp.
References editor, and m_grid.
Referenced by cutcopy(), and showPopupMenu().
|
protected |
Definition at line 461 of file grid_tricks.cpp.
References WX_GRID::CancelPendingChanges(), COL_SEP, WX_GRID::CommitPendingChanges(), dummy, m_addHandler, m_grid, paste_text(), ROW_SEP, and ROW_SEP_R.
Referenced by init().
|
protected |
Definition at line 198 of file grid_tricks.cpp.
References getSelectedArea(), m_grid, m_sel_row_count, m_sel_row_start, showEditor(), and toggleCell().
Referenced by init(), and onGridCellLeftDClick().
|
protected |
Definition at line 245 of file grid_tricks.cpp.
References handleDoubleClick(), and onGridCellLeftClick().
Referenced by init().
|
protected |
|
protected |
Definition at line 330 of file grid_tricks.cpp.
References WX_GRID::CommitPendingChanges(), and m_grid.
Referenced by init().
|
protected |
Definition at line 338 of file grid_tricks.cpp.
References GRIDTRICKS_FIRST_SHOWHIDE, and m_grid.
Referenced by init().
|
protected |
Definition at line 252 of file grid_tricks.cpp.
References m_grid, and m_tooltipEnabled.
Referenced by init().
|
protected |
Definition at line 526 of file grid_tricks.cpp.
References cutcopy(), getSelectedArea(), m_grid, paste_clipboard(), and toggleCell().
Referenced by init().
|
protected |
Definition at line 412 of file grid_tricks.cpp.
References doPopupSelection().
Referenced by init().
|
protected |
|
protectedvirtual |
Definition at line 684 of file grid_tricks.cpp.
References m_grid, paste_text(), and text.
Referenced by doPopupSelection(), and onKeyDown().
|
protectedvirtual |
Reimplemented in DESIGN_BLOCK_GRID_TRICKS, SYMBOL_GRID_TRICKS, and FP_GRID_TRICKS.
Definition at line 713 of file grid_tricks.cpp.
References COL_SEP, dummy, isReadOnly(), m_addHandler, m_grid, m_sel_col_count, m_sel_col_start, m_sel_row_count, m_sel_row_start, and ROW_SEP.
Referenced by onCharHook(), paste_clipboard(), DESIGN_BLOCK_GRID_TRICKS::paste_text(), SYMBOL_GRID_TRICKS::paste_text(), and FP_GRID_TRICKS::paste_text().
|
inline |
Enable the tooltip for a column.
The tooltip is read from the string contained in the cell data.
aCol | is the column to use |
aEnable | is 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().
|
protected |
Definition at line 158 of file grid_tricks.cpp.
References isReadOnly(), m_grid, m_sel_col_count, m_sel_col_start, m_sel_row_count, m_sel_row_start, and WX_GRID::ShowEditorOnMouseUp().
Referenced by onGridCellLeftClick().
|
protectedvirtual |
Reimplemented in FIELDS_EDITOR_GRID_TRICKS, FIELDS_GRID_TRICKS, SIGNALS_GRID_TRICKS, CURSORS_GRID_TRICKS, MEASUREMENTS_GRID_TRICKS, and LIB_TABLE_GRID_TRICKS.
Definition at line 353 of file grid_tricks.cpp.
References _, getSelectedArea(), GRIDTRICKS_ID_COPY, GRIDTRICKS_ID_CUT, GRIDTRICKS_ID_DELETE, GRIDTRICKS_ID_PASTE, GRIDTRICKS_ID_SELECT, isReadOnly(), isTextEntry(), m_grid, m_sel_col_count, m_sel_col_start, m_sel_row_count, and m_sel_row_start.
Referenced by onGridCellRightClick(), FIELDS_EDITOR_GRID_TRICKS::showPopupMenu(), FIELDS_GRID_TRICKS::showPopupMenu(), CURSORS_GRID_TRICKS::showPopupMenu(), MEASUREMENTS_GRID_TRICKS::showPopupMenu(), and LIB_TABLE_GRID_TRICKS::showPopupMenu().
|
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().
|
protected |
Definition at line 134 of file grid_tricks.h.
Referenced by onCharHook(), and paste_text().
|
protected |
I don't own the grid, but he owns me.
Definition at line 125 of file grid_tricks.h.
Referenced by cutcopy(), doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), FIELDS_GRID_TRICKS::doPopupSelection(), SIGNALS_GRID_TRICKS::doPopupSelection(), CURSORS_GRID_TRICKS::doPopupSelection(), MEASUREMENTS_GRID_TRICKS::doPopupSelection(), LIB_TABLE_GRID_TRICKS::doPopupSelection(), getSelectedArea(), init(), isCheckbox(), isReadOnly(), isTextEntry(), onCharHook(), onGridCellLeftClick(), onGridLabelLeftClick(), onGridLabelRightClick(), onGridMotion(), onKeyDown(), onUpdateUI(), DESIGN_BLOCK_GRID_TRICKS::optionsEditor(), SYMBOL_GRID_TRICKS::optionsEditor(), FP_GRID_TRICKS::optionsEditor(), paste_clipboard(), paste_text(), DESIGN_BLOCK_GRID_TRICKS::paste_text(), SYMBOL_GRID_TRICKS::paste_text(), FP_GRID_TRICKS::paste_text(), showEditor(), showPopupMenu(), FIELDS_EDITOR_GRID_TRICKS::showPopupMenu(), FIELDS_GRID_TRICKS::showPopupMenu(), SIGNALS_GRID_TRICKS::showPopupMenu(), CURSORS_GRID_TRICKS::showPopupMenu(), MEASUREMENTS_GRID_TRICKS::showPopupMenu(), LIB_TABLE_GRID_TRICKS::showPopupMenu(), and toggleCell().
|
protected |
Definition at line 132 of file grid_tricks.h.
Referenced by cutcopy(), getSelectedArea(), init(), paste_text(), showEditor(), and showPopupMenu().
|
protected |
Definition at line 130 of file grid_tricks.h.
Referenced by cutcopy(), getSelectedArea(), init(), paste_text(), showEditor(), and showPopupMenu().
|
protected |
Definition at line 131 of file grid_tricks.h.
Referenced by cutcopy(), LIB_TABLE_GRID_TRICKS::doPopupSelection(), getSelectedArea(), init(), onGridCellLeftClick(), paste_text(), showEditor(), showPopupMenu(), and LIB_TABLE_GRID_TRICKS::showPopupMenu().
|
protected |
Definition at line 129 of file grid_tricks.h.
Referenced by cutcopy(), LIB_TABLE_GRID_TRICKS::doPopupSelection(), getSelectedArea(), init(), onGridCellLeftClick(), paste_text(), showEditor(), showPopupMenu(), and LIB_TABLE_GRID_TRICKS::showPopupMenu().
|
protected |
Definition at line 136 of file grid_tricks.h.
Referenced by GetTooltipEnabled(), onGridMotion(), and SetTooltipEnable().