2009-09-16 08:06:02 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: ribbon/gallery.h
|
|
|
|
// Purpose: interface of wxRibbonGallery
|
|
|
|
// Author: Peter Cawley
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
enum wxRibbonGalleryButtonState
|
|
|
|
{
|
|
|
|
wxRIBBON_GALLERY_BUTTON_NORMAL,
|
|
|
|
wxRIBBON_GALLERY_BUTTON_HOVERED,
|
|
|
|
wxRIBBON_GALLERY_BUTTON_ACTIVE,
|
|
|
|
wxRIBBON_GALLERY_BUTTON_DISABLED,
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxRibbonGallery
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
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
|
|
|
|
be displayed in the space used for a ribbon, a gallery always has scroll
|
|
|
|
buttons to allow the user to navigate through the entire gallery. It also
|
|
|
|
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.
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
@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.
|
2010-07-24 08:27:25 -04:00
|
|
|
@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.
|
2009-09-16 08:06:02 -04:00
|
|
|
@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
|
|
|
|
is no longer an item being hovered. Note that the ID is that of the
|
|
|
|
gallery, not of the item.
|
|
|
|
@endEventTable
|
|
|
|
@beginEventEmissionTable{wxCommandEvent}
|
|
|
|
@event{EVT_BUTTON(id, func)}
|
|
|
|
Triggered when the "extension" button of the gallery is pressed.
|
|
|
|
@endEventTable
|
|
|
|
|
|
|
|
@library{wxribbon}
|
|
|
|
@category{ribbon}
|
|
|
|
*/
|
|
|
|
class wxRibbonGallery : public wxRibbonControl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Default constructor.
|
|
|
|
With this constructor, Create() should be called in order to create
|
|
|
|
the gallery.
|
|
|
|
*/
|
|
|
|
wxRibbonGallery();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Construct a ribbon gallery with the given parameters.
|
|
|
|
@param parent
|
|
|
|
Parent window for the gallery (typically a wxRibbonPanel).
|
2009-12-20 09:50:50 -05:00
|
|
|
@param id
|
|
|
|
An identifier for the gallery. @c wxID_ANY is taken to mean a default.
|
2009-09-16 08:06:02 -04:00
|
|
|
@param pos
|
|
|
|
Initial position of the gallery.
|
|
|
|
@param size
|
|
|
|
Initial size of the gallery.
|
|
|
|
@param style
|
|
|
|
Gallery style, currently unused.
|
|
|
|
*/
|
|
|
|
wxRibbonGallery(wxWindow* parent,
|
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor.
|
|
|
|
*/
|
|
|
|
virtual ~wxRibbonGallery();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Create a gallery in two-step gallery construction.
|
|
|
|
Should only be called when the default constructor is used, and
|
|
|
|
arguments have the same meaning as in the full constructor.
|
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent,
|
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Remove all items from the gallery.
|
|
|
|
*/
|
|
|
|
void Clear();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Query if the gallery has no items in it.
|
|
|
|
*/
|
|
|
|
bool IsEmpty() const;
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
/**
|
|
|
|
Get the number of items in the gallery.
|
|
|
|
*/
|
|
|
|
unsigned int GetCount() const;
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
/**
|
|
|
|
Get an item by index.
|
|
|
|
*/
|
|
|
|
wxRibbonGalleryItem* GetItem(unsigned int n);
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
/**
|
|
|
|
Add an item to the gallery (with no client data).
|
|
|
|
@param bitmap
|
|
|
|
The bitmap to display for the item. Note that all items must
|
|
|
|
have equally sized bitmaps.
|
|
|
|
@param id
|
|
|
|
ID number to associate with the item. Not currently used for
|
|
|
|
anything important.
|
|
|
|
*/
|
|
|
|
wxRibbonGalleryItem* Append(const wxBitmap& bitmap, int id);
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
/**
|
|
|
|
Add an item to the gallery (with simple client data).
|
|
|
|
@param bitmap
|
|
|
|
The bitmap to display for the item. Note that all items must
|
|
|
|
have equally sized bitmaps.
|
|
|
|
@param id
|
|
|
|
ID number to associate with the item. Not currently used for
|
|
|
|
anything important.
|
|
|
|
@param clientData
|
|
|
|
An opaque pointer to associate with the item.
|
|
|
|
*/
|
|
|
|
wxRibbonGalleryItem* Append(const wxBitmap& bitmap, int id, void* clientData);
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
/**
|
|
|
|
Add an item to the gallery (with complex client data)
|
|
|
|
@param bitmap
|
|
|
|
The bitmap to display for the item. Note that all items must
|
|
|
|
have equally sized bitmaps.
|
|
|
|
@param id
|
|
|
|
ID number to associate with the item. Not currently used for
|
|
|
|
anything important.
|
|
|
|
@param clientData
|
|
|
|
An object which contains data to associate with the item. The item
|
|
|
|
takes ownership of this pointer, and will delete it when the item
|
|
|
|
client data is changed to something else, or when the item is
|
|
|
|
destroyed.
|
|
|
|
*/
|
|
|
|
wxRibbonGalleryItem* Append(const wxBitmap& bitmap, int id, wxClientData* clientData);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Set the client object associated with a gallery item.
|
|
|
|
*/
|
|
|
|
void SetItemClientObject(wxRibbonGalleryItem* item, wxClientData* data);
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
/**
|
|
|
|
Get the client object associated with a gallery item.
|
|
|
|
*/
|
|
|
|
wxClientData* GetItemClientObject(const wxRibbonGalleryItem* item) const;
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
/**
|
|
|
|
Set the client data associated with a gallery item.
|
|
|
|
*/
|
|
|
|
void SetItemClientData(wxRibbonGalleryItem* item, void* data);
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
/**
|
|
|
|
Get the client data associated with a gallery item.
|
|
|
|
*/
|
|
|
|
void* GetItemClientData(const wxRibbonGalleryItem* item) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Set the selection to the given item, or removes the selection if
|
|
|
|
@a item == NULL.
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
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.
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
The selected item is set by SetSelection(), or by the user clicking on
|
|
|
|
an item.
|
|
|
|
*/
|
|
|
|
wxRibbonGalleryItem* GetSelection() const;
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
/**
|
|
|
|
Get the currently hovered item, or NULL if there is none.
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
The hovered item is the item underneath the mouse cursor.
|
|
|
|
*/
|
|
|
|
wxRibbonGalleryItem* GetHoveredItem() const;
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
/**
|
|
|
|
Get the currently active item, or NULL if there is none.
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
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;
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
/**
|
|
|
|
Get the state of the scroll up button.
|
|
|
|
*/
|
|
|
|
wxRibbonGalleryButtonState GetUpButtonState() const;
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
/**
|
|
|
|
Get the state of the scroll down button.
|
|
|
|
*/
|
|
|
|
wxRibbonGalleryButtonState GetDownButtonState() const;
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
/**
|
|
|
|
Get the state of the "extension" button.
|
|
|
|
*/
|
|
|
|
wxRibbonGalleryButtonState GetExtensionButtonState() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Query is the mouse is currently hovered over the gallery.
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
@return @true if the cursor is within the bounds of the gallery (not
|
|
|
|
just hovering over an item), @false otherwise.
|
|
|
|
*/
|
|
|
|
bool IsHovered() const;
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
/**
|
|
|
|
Scroll the gallery contents by some amount.
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
@param lines
|
|
|
|
Positive values scroll toward the end of the gallery, while negative
|
|
|
|
values scroll toward the start.
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
@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);
|
2010-11-06 19:46:25 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Scroll the gallery contents by some fine-grained amount.
|
|
|
|
|
|
|
|
@param pixels
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
bool ScrollPixels(int pixels);
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
/**
|
|
|
|
Scroll the gallery to ensure that the given item is visible.
|
|
|
|
*/
|
|
|
|
void EnsureVisible(const wxRibbonGalleryItem* item);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxRibbonGalleryEvent
|
|
|
|
|
|
|
|
@library{wxribbon}
|
|
|
|
@category{events,ribbon}
|
|
|
|
|
|
|
|
@see wxRibbonBar
|
|
|
|
*/
|
2010-05-11 17:12:10 -04:00
|
|
|
class wxRibbonGalleryEvent : public wxCommandEvent
|
2009-09-16 08:06:02 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Constructor.
|
|
|
|
*/
|
2010-05-11 17:12:10 -04:00
|
|
|
wxRibbonGalleryEvent(wxEventType command_type = wxEVT_NULL,
|
|
|
|
int win_id = 0,
|
|
|
|
wxRibbonGallery* gallery = NULL,
|
|
|
|
wxRibbonGalleryItem* item = NULL);
|
2009-09-16 08:06:02 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the gallery which the event relates to.
|
|
|
|
*/
|
|
|
|
wxRibbonGallery* GetGallery();
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
/**
|
|
|
|
Returns the gallery item which the event relates to, or NULL if it does
|
|
|
|
not relate to an item.
|
|
|
|
*/
|
|
|
|
wxRibbonGalleryItem* GetGalleryItem();
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
/**
|
|
|
|
Sets the gallery relating to this event.
|
|
|
|
*/
|
|
|
|
void SetGallery(wxRibbonGallery* gallery);
|
2010-07-24 08:27:25 -04:00
|
|
|
|
2009-09-16 08:06:02 -04:00
|
|
|
/**
|
|
|
|
Sets the gallery item relating to this event.
|
|
|
|
*/
|
|
|
|
void SetGalleryItem(wxRibbonGalleryItem* item);
|
|
|
|
};
|