Add EVT_RIBBONGALLERY_CLICKED event.
This event is sent whenever an item is clicked, even if it's already selected, unlike the existing EVT_RIBBONGALLERY_SELECTED. Closes #12128. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65077 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -412,6 +412,7 @@ All (GUI):
|
||||
|
||||
- wxAUI: support auto-orientable toolbars (wsu).
|
||||
- wxHTML: render in RTL order inside RTL window (Richard Bullington-McGuire).
|
||||
- wxRibbon: added EVT_RIBBONGALLERY_CLICKED event (John Roberts).
|
||||
- Add support for CP-866 encoding to wxEncodingConverter (madnut).
|
||||
|
||||
|
||||
|
@@ -159,6 +159,7 @@ private:
|
||||
|
||||
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_COMMAND_RIBBONGALLERY_HOVER_CHANGED, wxRibbonGalleryEvent);
|
||||
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_COMMAND_RIBBONGALLERY_SELECTED, wxRibbonGalleryEvent);
|
||||
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_COMMAND_RIBBONGALLERY_CLICKED, wxRibbonGalleryEvent);
|
||||
|
||||
typedef void (wxEvtHandler::*wxRibbonGalleryEventFunction)(wxRibbonGalleryEvent&);
|
||||
|
||||
@@ -169,6 +170,8 @@ typedef void (wxEvtHandler::*wxRibbonGalleryEventFunction)(wxRibbonGalleryEvent&
|
||||
wx__DECLARE_EVT1(wxEVT_COMMAND_RIBBONGALLERY_HOVER_CHANGED, winid, wxRibbonGalleryEventHandler(fn))
|
||||
#define EVT_RIBBONGALLERY_SELECTED(winid, fn) \
|
||||
wx__DECLARE_EVT1(wxEVT_COMMAND_RIBBONGALLERY_SELECTED, winid, wxRibbonGalleryEventHandler(fn))
|
||||
#define EVT_RIBBONGALLERY_CLICKED(winid, fn) \
|
||||
wx__DECLARE_EVT1(wxEVT_COMMAND_RIBBONGALLERY_CLICKED, winid, wxRibbonGalleryEventHandler(fn))
|
||||
#else
|
||||
|
||||
// wxpython/swig event work
|
||||
@@ -179,7 +182,7 @@ typedef void (wxEvtHandler::*wxRibbonGalleryEventFunction)(wxRibbonGalleryEvent&
|
||||
EVT_RIBBONGALLERY_HOVER_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_RIBBONGALLERY_HOVER_CHANGED, 1 )
|
||||
EVT_RIBBONGALLERY_SELECTED = wx.PyEventBinder( wxEVT_COMMAND_RIBBONGALLERY_SELECTED, 1 )
|
||||
}
|
||||
#endif
|
||||
#endif // SWIG
|
||||
|
||||
#endif // wxUSE_RIBBON
|
||||
|
||||
|
@@ -16,7 +16,7 @@ enum wxRibbonGalleryButtonState
|
||||
|
||||
/**
|
||||
@class wxRibbonGallery
|
||||
|
||||
|
||||
A ribbon gallery is like a wxListBox, but for bitmaps rather than strings.
|
||||
It displays a collection of bitmaps arranged in a grid and allows the user
|
||||
to choose one. As there are typically more bitmaps in a gallery than can
|
||||
@@ -25,11 +25,16 @@ enum wxRibbonGalleryButtonState
|
||||
has an "extension" button, the behaviour of which is outside the scope of
|
||||
the gallery control itself, though it typically displays some kind of
|
||||
dialog related to the gallery.
|
||||
|
||||
|
||||
@beginEventEmissionTable{wxRibbonGalleryEvent}
|
||||
@event{EVT_RIBBONGALLERY_SELECTED(id, func)}
|
||||
Triggered when the user selects an item from the gallery. Note that the
|
||||
ID is that of the gallery, not of the item.
|
||||
@event{EVT_RIBBONGALLERY_CLICKED(id, func)}
|
||||
Similar to EVT_RIBBONGALLERY_SELECTED but triggered every time a
|
||||
gallery item is clicked, even if it is already selected. Note that the
|
||||
ID of the event is that of the gallery, not of the item, just as above.
|
||||
This event is available since wxWidgets 2.9.2.
|
||||
@event{EVT_RIBBONGALLERY_HOVER_CHANGED(id, func)}
|
||||
Triggered when the item being hovered over by the user changes. The
|
||||
item in the event will be the new item being hovered, or NULL if there
|
||||
@@ -98,17 +103,17 @@ public:
|
||||
Query if the gallery has no items in it.
|
||||
*/
|
||||
bool IsEmpty() const;
|
||||
|
||||
|
||||
/**
|
||||
Get the number of items in the gallery.
|
||||
*/
|
||||
unsigned int GetCount() const;
|
||||
|
||||
|
||||
/**
|
||||
Get an item by index.
|
||||
*/
|
||||
wxRibbonGalleryItem* GetItem(unsigned int n);
|
||||
|
||||
|
||||
/**
|
||||
Add an item to the gallery (with no client data).
|
||||
@param bitmap
|
||||
@@ -119,7 +124,7 @@ public:
|
||||
anything important.
|
||||
*/
|
||||
wxRibbonGalleryItem* Append(const wxBitmap& bitmap, int id);
|
||||
|
||||
|
||||
/**
|
||||
Add an item to the gallery (with simple client data).
|
||||
@param bitmap
|
||||
@@ -132,7 +137,7 @@ public:
|
||||
An opaque pointer to associate with the item.
|
||||
*/
|
||||
wxRibbonGalleryItem* Append(const wxBitmap& bitmap, int id, void* clientData);
|
||||
|
||||
|
||||
/**
|
||||
Add an item to the gallery (with complex client data)
|
||||
@param bitmap
|
||||
@@ -153,17 +158,17 @@ public:
|
||||
Set the client object associated with a gallery item.
|
||||
*/
|
||||
void SetItemClientObject(wxRibbonGalleryItem* item, wxClientData* data);
|
||||
|
||||
|
||||
/**
|
||||
Get the client object associated with a gallery item.
|
||||
*/
|
||||
wxClientData* GetItemClientObject(const wxRibbonGalleryItem* item) const;
|
||||
|
||||
|
||||
/**
|
||||
Set the client data associated with a gallery item.
|
||||
*/
|
||||
void SetItemClientData(wxRibbonGalleryItem* item, void* data);
|
||||
|
||||
|
||||
/**
|
||||
Get the client data associated with a gallery item.
|
||||
*/
|
||||
@@ -172,44 +177,44 @@ public:
|
||||
/**
|
||||
Set the selection to the given item, or removes the selection if
|
||||
@a item == NULL.
|
||||
|
||||
|
||||
Note that this not cause any events to be emitted.
|
||||
*/
|
||||
void SetSelection(wxRibbonGalleryItem* item);
|
||||
|
||||
/**
|
||||
Get the currently selected item, or NULL if there is none.
|
||||
|
||||
|
||||
The selected item is set by SetSelection(), or by the user clicking on
|
||||
an item.
|
||||
*/
|
||||
wxRibbonGalleryItem* GetSelection() const;
|
||||
|
||||
|
||||
/**
|
||||
Get the currently hovered item, or NULL if there is none.
|
||||
|
||||
|
||||
The hovered item is the item underneath the mouse cursor.
|
||||
*/
|
||||
wxRibbonGalleryItem* GetHoveredItem() const;
|
||||
|
||||
|
||||
/**
|
||||
Get the currently active item, or NULL if there is none.
|
||||
|
||||
|
||||
The active item is the item being pressed by the user, and will thus
|
||||
become the selected item if the user releases the mouse button.
|
||||
*/
|
||||
wxRibbonGalleryItem* GetActiveItem() const;
|
||||
|
||||
|
||||
/**
|
||||
Get the state of the scroll up button.
|
||||
*/
|
||||
wxRibbonGalleryButtonState GetUpButtonState() const;
|
||||
|
||||
|
||||
/**
|
||||
Get the state of the scroll down button.
|
||||
*/
|
||||
wxRibbonGalleryButtonState GetDownButtonState() const;
|
||||
|
||||
|
||||
/**
|
||||
Get the state of the "extension" button.
|
||||
*/
|
||||
@@ -217,24 +222,24 @@ public:
|
||||
|
||||
/**
|
||||
Query is the mouse is currently hovered over the gallery.
|
||||
|
||||
|
||||
@return @true if the cursor is within the bounds of the gallery (not
|
||||
just hovering over an item), @false otherwise.
|
||||
*/
|
||||
bool IsHovered() const;
|
||||
|
||||
|
||||
/**
|
||||
Scroll the gallery contents by some amount.
|
||||
|
||||
|
||||
@param lines
|
||||
Positive values scroll toward the end of the gallery, while negative
|
||||
values scroll toward the start.
|
||||
|
||||
|
||||
@return @true if the gallery scrolled at least one pixel in the given
|
||||
direction, @false if it did not scroll.
|
||||
*/
|
||||
virtual bool ScrollLines(int lines);
|
||||
|
||||
|
||||
/**
|
||||
Scroll the gallery to ensure that the given item is visible.
|
||||
*/
|
||||
@@ -264,18 +269,18 @@ public:
|
||||
Returns the gallery which the event relates to.
|
||||
*/
|
||||
wxRibbonGallery* GetGallery();
|
||||
|
||||
|
||||
/**
|
||||
Returns the gallery item which the event relates to, or NULL if it does
|
||||
not relate to an item.
|
||||
*/
|
||||
wxRibbonGalleryItem* GetGalleryItem();
|
||||
|
||||
|
||||
/**
|
||||
Sets the gallery relating to this event.
|
||||
*/
|
||||
void SetGallery(wxRibbonGallery* gallery);
|
||||
|
||||
|
||||
/**
|
||||
Sets the gallery item relating to this event.
|
||||
*/
|
||||
|
@@ -32,6 +32,7 @@
|
||||
|
||||
wxDEFINE_EVENT(wxEVT_COMMAND_RIBBONGALLERY_HOVER_CHANGED, wxRibbonGalleryEvent);
|
||||
wxDEFINE_EVENT(wxEVT_COMMAND_RIBBONGALLERY_SELECTED, wxRibbonGalleryEvent);
|
||||
wxDEFINE_EVENT(wxEVT_COMMAND_RIBBONGALLERY_CLICKED, wxRibbonGalleryEvent);
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRibbonGalleryEvent, wxCommandEvent)
|
||||
IMPLEMENT_CLASS(wxRibbonGallery, wxRibbonControl)
|
||||
@@ -356,6 +357,13 @@ void wxRibbonGallery::OnMouseUp(wxMouseEvent& evt)
|
||||
notification.SetGalleryItem(m_selected_item);
|
||||
ProcessWindowEvent(notification);
|
||||
}
|
||||
|
||||
wxRibbonGalleryEvent notification(
|
||||
wxEVT_COMMAND_RIBBONGALLERY_CLICKED, GetId());
|
||||
notification.SetEventObject(this);
|
||||
notification.SetGallery(this);
|
||||
notification.SetGalleryItem(m_selected_item);
|
||||
ProcessWindowEvent(notification);
|
||||
}
|
||||
}
|
||||
m_mouse_active_rect = NULL;
|
||||
|
Reference in New Issue
Block a user