Merge branch 'grid-selected'
Split the wxGrid RANGE_SELECT event into separate SELECTING and SELECTED events. See https://github.com/wxWidgets/wxWidgets/pull/2028
This commit is contained in:
@@ -3405,7 +3405,8 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_LABEL_RIGHT_DCLICK, wxGri
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_ROW_SIZE, wxGridSizeEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_COL_SIZE, wxGridSizeEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_COL_AUTO_SIZE, wxGridSizeEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_RANGE_SELECT, wxGridRangeSelectEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_RANGE_SELECTING, wxGridRangeSelectEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_RANGE_SELECTED, wxGridRangeSelectEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_CELL_CHANGING, wxGridEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_CELL_CHANGED, wxGridEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_SELECT_CELL, wxGridEvent );
|
||||
@@ -3459,7 +3460,8 @@ typedef void (wxEvtHandler::*wxGridEditorCreatedEventFunction)(wxGridEditorCreat
|
||||
#define EVT_GRID_CMD_COL_AUTO_SIZE(id, fn) wx__DECLARE_GRIDSIZEEVT(COL_AUTO_SIZE, id, fn)
|
||||
#define EVT_GRID_CMD_COL_MOVE(id, fn) wx__DECLARE_GRIDEVT(COL_MOVE, id, fn)
|
||||
#define EVT_GRID_CMD_COL_SORT(id, fn) wx__DECLARE_GRIDEVT(COL_SORT, id, fn)
|
||||
#define EVT_GRID_CMD_RANGE_SELECT(id, fn) wx__DECLARE_GRIDRANGESELEVT(RANGE_SELECT, id, fn)
|
||||
#define EVT_GRID_CMD_RANGE_SELECTING(id, fn) wx__DECLARE_GRIDRANGESELEVT(RANGE_SELECTING, id, fn)
|
||||
#define EVT_GRID_CMD_RANGE_SELECTED(id, fn) wx__DECLARE_GRIDRANGESELEVT(RANGE_SELECTED, id, fn)
|
||||
#define EVT_GRID_CMD_CELL_CHANGING(id, fn) wx__DECLARE_GRIDEVT(CELL_CHANGING, id, fn)
|
||||
#define EVT_GRID_CMD_CELL_CHANGED(id, fn) wx__DECLARE_GRIDEVT(CELL_CHANGED, id, fn)
|
||||
#define EVT_GRID_CMD_SELECT_CELL(id, fn) wx__DECLARE_GRIDEVT(SELECT_CELL, id, fn)
|
||||
@@ -3484,7 +3486,8 @@ typedef void (wxEvtHandler::*wxGridEditorCreatedEventFunction)(wxGridEditorCreat
|
||||
#define EVT_GRID_COL_AUTO_SIZE(fn) EVT_GRID_CMD_COL_AUTO_SIZE(wxID_ANY, fn)
|
||||
#define EVT_GRID_COL_MOVE(fn) EVT_GRID_CMD_COL_MOVE(wxID_ANY, fn)
|
||||
#define EVT_GRID_COL_SORT(fn) EVT_GRID_CMD_COL_SORT(wxID_ANY, fn)
|
||||
#define EVT_GRID_RANGE_SELECT(fn) EVT_GRID_CMD_RANGE_SELECT(wxID_ANY, fn)
|
||||
#define EVT_GRID_RANGE_SELECTING(fn) EVT_GRID_CMD_RANGE_SELECTING(wxID_ANY, fn)
|
||||
#define EVT_GRID_RANGE_SELECTED(fn) EVT_GRID_CMD_RANGE_SELECTED(wxID_ANY, fn)
|
||||
#define EVT_GRID_CELL_CHANGING(fn) EVT_GRID_CMD_CELL_CHANGING(wxID_ANY, fn)
|
||||
#define EVT_GRID_CELL_CHANGED(fn) EVT_GRID_CMD_CELL_CHANGED(wxID_ANY, fn)
|
||||
#define EVT_GRID_SELECT_CELL(fn) EVT_GRID_CMD_SELECT_CELL(wxID_ANY, fn)
|
||||
@@ -3505,6 +3508,15 @@ typedef void (wxEvtHandler::*wxGridEditorCreatedEventFunction)(wxGridEditorCreat
|
||||
#define EVT_GRID_CELL_CHANGE EVT_GRID_CELL_CHANGED
|
||||
#endif // WXWIN_COMPATIBILITY_2_8
|
||||
|
||||
// same as above: RANGE_SELECT was split in RANGE_SELECTING and SELECTED in 3.2,
|
||||
// but we keep the old name for compatibility
|
||||
#if WXWIN_COMPATIBILITY_3_0
|
||||
#define wxEVT_GRID_RANGE_SELECT wxEVT_GRID_RANGE_SELECTED
|
||||
|
||||
#define EVT_GRID_RANGE_SELECT EVT_GRID_RANGE_SELECTED
|
||||
#endif // WXWIN_COMPATIBILITY_3_0
|
||||
|
||||
|
||||
#if 0 // TODO: implement these ? others ?
|
||||
|
||||
extern const int wxEVT_GRID_CREATE_CELL;
|
||||
|
@@ -21,6 +21,8 @@
|
||||
|
||||
typedef wxVector<wxGridBlockCoords> wxVectorGridBlockCoords;
|
||||
|
||||
// Note: for all eventType arguments of the methods of this class wxEVT_NULL
|
||||
// may be passed to forbid events generation completely.
|
||||
class WXDLLIMPEXP_CORE wxGridSelection
|
||||
{
|
||||
public:
|
||||
@@ -41,15 +43,15 @@ public:
|
||||
void SelectBlock(int topRow, int leftCol,
|
||||
int bottomRow, int rightCol,
|
||||
const wxKeyboardState& kbd = wxKeyboardState(),
|
||||
bool sendEvent = true );
|
||||
wxEventType eventType = wxEVT_GRID_RANGE_SELECTED);
|
||||
void SelectBlock(const wxGridCellCoords& topLeft,
|
||||
const wxGridCellCoords& bottomRight,
|
||||
const wxKeyboardState& kbd = wxKeyboardState(),
|
||||
bool sendEvent = true )
|
||||
wxEventType eventType = wxEVT_GRID_RANGE_SELECTED)
|
||||
{
|
||||
SelectBlock(topLeft.GetRow(), topLeft.GetCol(),
|
||||
bottomRight.GetRow(), bottomRight.GetCol(),
|
||||
kbd, sendEvent);
|
||||
kbd, eventType);
|
||||
}
|
||||
|
||||
// This function replaces all the existing selected blocks (which become
|
||||
@@ -58,7 +60,7 @@ public:
|
||||
|
||||
void DeselectBlock(const wxGridBlockCoords& block,
|
||||
const wxKeyboardState& kbd = wxKeyboardState(),
|
||||
bool sendEvent = true );
|
||||
wxEventType eventType = wxEVT_GRID_RANGE_SELECTED);
|
||||
|
||||
// Note that this method refreshes the previously selected blocks and sends
|
||||
// an event about the selection change.
|
||||
@@ -82,10 +84,16 @@ public:
|
||||
//
|
||||
// Both components of both blockStart and blockEnd must be valid.
|
||||
//
|
||||
// This function sends an event notifying about the selection change using
|
||||
// the provided event type, which is wxEVT_GRID_RANGE_SELECTED by default,
|
||||
// but may also be wxEVT_GRID_RANGE_SELECTING, when the selection is not
|
||||
// final yet.
|
||||
//
|
||||
// Return true if the current block was actually changed.
|
||||
bool ExtendCurrentBlock(const wxGridCellCoords& blockStart,
|
||||
const wxGridCellCoords& blockEnd,
|
||||
const wxKeyboardState& kbd);
|
||||
const wxKeyboardState& kbd,
|
||||
wxEventType eventType = wxEVT_GRID_RANGE_SELECTED);
|
||||
|
||||
|
||||
// Return the coordinates of the cell from which the selection should
|
||||
@@ -103,6 +111,8 @@ public:
|
||||
|
||||
wxVectorGridBlockCoords& GetBlocks() { return m_selection; }
|
||||
|
||||
void EndSelecting();
|
||||
|
||||
private:
|
||||
void SelectBlockNoEvent(const wxGridBlockCoords& block)
|
||||
{
|
||||
@@ -113,7 +123,8 @@ private:
|
||||
|
||||
// Really select the block and don't check for the current selection mode.
|
||||
void Select(const wxGridBlockCoords& block,
|
||||
const wxKeyboardState& kbd, bool sendEvent);
|
||||
const wxKeyboardState& kbd,
|
||||
wxEventType eventType);
|
||||
|
||||
// Ensure that the new "block" becomes part of "blocks", adding it to them
|
||||
// if necessary and, if we do it, also removing any existing elements of
|
||||
|
@@ -19,6 +19,7 @@
|
||||
class WXDLLIMPEXP_CORE wxKeyboardState
|
||||
{
|
||||
public:
|
||||
explicit
|
||||
wxKeyboardState(bool controlDown = false,
|
||||
bool shiftDown = false,
|
||||
bool altDown = false,
|
||||
|
Reference in New Issue
Block a user