summaryrefslogtreecommitdiff
path: root/wx+/grid.h
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2019-03-12 16:09:20 -0400
committerB Stack <bgstack15@gmail.com>2019-03-12 16:09:20 -0400
commit27177c9cbc47d4114ccee56015fb0407e7e258cc (patch)
treedc226d83311470a23cdf0c02064feb525fcc5096 /wx+/grid.h
parentMerge branch '10.9' into 'master' (diff)
downloadFreeFileSync-27177c9cbc47d4114ccee56015fb0407e7e258cc.tar.gz
FreeFileSync-27177c9cbc47d4114ccee56015fb0407e7e258cc.tar.bz2
FreeFileSync-27177c9cbc47d4114ccee56015fb0407e7e258cc.zip
10.10
Diffstat (limited to 'wx+/grid.h')
-rw-r--r--wx+/grid.h25
1 files changed, 15 insertions, 10 deletions
diff --git a/wx+/grid.h b/wx+/grid.h
index 102396c3..dbd33c7a 100644
--- a/wx+/grid.h
+++ b/wx+/grid.h
@@ -22,6 +22,10 @@ namespace zen
enum class ColumnType { NONE = -1 }; //user-defiend column type
enum class HoverArea { NONE = -1 }; //user-defined area for mouse selections for a given row (may span multiple columns or split a single column into multiple areas)
+//wxContextMenuEvent? => automatically generated by wxWidgets when right mouse down/up is not handled; even OS-dependent in which case event is generated
+//=> inappropriate! client decides when to show context! => simulate right mouse click when WXK_WINDOWS_MENU button is pressed
+//=> same behavior as earlier wxWidgets: https://github.com/wxWidgets/wxWidgets/commit/2c69d27c0d225d3a331c773da466686153185320#diff-9f11c8f2cb1f734f7c0c1071aba491a5
+
//------------------------ events ------------------------------------------------
extern const wxEventType EVENT_GRID_MOUSE_LEFT_DOUBLE; //
extern const wxEventType EVENT_GRID_MOUSE_LEFT_DOWN; //
@@ -38,21 +42,21 @@ extern const wxEventType EVENT_GRID_COL_RESIZE; //generates: GridColumnResizeEve
//example: wnd.Connect(EVENT_GRID_COL_LABEL_LEFT_CLICK, GridClickEventHandler(MyDlg::OnLeftClick), nullptr, this);
-struct GridClickEvent : public wxMouseEvent
+struct GridClickEvent : public wxEvent
{
- GridClickEvent(wxEventType et, const wxMouseEvent& me, ptrdiff_t row, HoverArea hoverArea) :
- wxMouseEvent(me), row_(row), hoverArea_(hoverArea) { SetEventType(et); }
+ GridClickEvent(wxEventType et, ptrdiff_t row, HoverArea hoverArea, const wxPoint& mousePos) :
+ wxEvent(0 /*winid*/, et), row_(row), hoverArea_(hoverArea), mousePos_(mousePos) {}
GridClickEvent* Clone() const override { return new GridClickEvent(*this); }
const ptrdiff_t row_; //-1 for invalid position, >= rowCount if out of range
const HoverArea hoverArea_; //may be HoverArea::NONE
+ const wxPoint mousePos_; //client coordinates
};
-
-struct GridSelectEvent : public wxCommandEvent
+struct GridSelectEvent : public wxEvent
{
GridSelectEvent(size_t rowFirst, size_t rowLast, bool positive, const GridClickEvent* mouseClick) :
- wxCommandEvent(EVENT_GRID_SELECT_RANGE), rowFirst_(rowFirst), rowLast_(rowLast), positive_(positive),
+ wxEvent(0 /*winid*/, EVENT_GRID_SELECT_RANGE), rowFirst_(rowFirst), rowLast_(rowLast), positive_(positive),
mouseClick_(mouseClick ? *mouseClick : std::optional<GridClickEvent>()) { assert(rowFirst <= rowLast); }
GridSelectEvent* Clone() const override { return new GridSelectEvent(*this); }
@@ -62,17 +66,17 @@ struct GridSelectEvent : public wxCommandEvent
const std::optional<GridClickEvent> mouseClick_; //filled unless selection was performed via keyboard shortcuts
};
-struct GridLabelClickEvent : public wxMouseEvent
+struct GridLabelClickEvent : public wxEvent
{
- GridLabelClickEvent(wxEventType et, const wxMouseEvent& me, ColumnType colType) : wxMouseEvent(me), colType_(colType) { SetEventType(et); }
+ GridLabelClickEvent(wxEventType et, ColumnType colType) : wxEvent(0 /*winid*/, et), colType_(colType) {}
GridLabelClickEvent* Clone() const override { return new GridLabelClickEvent(*this); }
const ColumnType colType_; //may be ColumnType::NONE
};
-struct GridColumnResizeEvent : public wxCommandEvent
+struct GridColumnResizeEvent : public wxEvent
{
- GridColumnResizeEvent(int offset, ColumnType colType) : wxCommandEvent(EVENT_GRID_COL_RESIZE), colType_(colType), offset_(offset) {}
+ GridColumnResizeEvent(int offset, ColumnType colType) : wxEvent(0 /*winid*/, EVENT_GRID_COL_RESIZE), colType_(colType), offset_(offset) {}
GridColumnResizeEvent* Clone() const override { return new GridColumnResizeEvent(*this); }
const ColumnType colType_;
@@ -224,6 +228,7 @@ private:
void onPaintEvent(wxPaintEvent& event);
void onSizeEvent(wxSizeEvent& event) { updateWindowSizes(); event.Skip(); }
void onKeyDown(wxKeyEvent& event);
+ void onKeyUp (wxKeyEvent& event);
void updateWindowSizes(bool updateScrollbar = true);
bgstack15