Merged GSOC Ribbon work from SOC2009_RIBBON branch into trunk.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61944 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
937
interface/wx/ribbon/art.h
Normal file
937
interface/wx/ribbon/art.h
Normal file
@@ -0,0 +1,937 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: ribbon/art.h
|
||||
// Purpose: interface of wxRibbonArtProvider
|
||||
// Author: Peter Cawley
|
||||
// RCS-ID: $Id$
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
Identifiers for common settings on ribbon art providers which can be used
|
||||
to tweak the appearance of the art provider.
|
||||
|
||||
@see wxRibbonArtProvider::GetColour()
|
||||
@see wxRibbonArtProvider::GetFont()
|
||||
@see wxRibbonArtProvider::GetMetric()
|
||||
@see wxRibbonArtProvider::SetColour()
|
||||
@see wxRibbonArtProvider::SetFont()
|
||||
@see wxRibbonArtProvider::SetMetric()
|
||||
*/
|
||||
enum wxRibbonArtSetting
|
||||
{
|
||||
wxRIBBON_ART_TAB_SEPARATION_SIZE,
|
||||
wxRIBBON_ART_PAGE_BORDER_LEFT_SIZE,
|
||||
wxRIBBON_ART_PAGE_BORDER_TOP_SIZE,
|
||||
wxRIBBON_ART_PAGE_BORDER_RIGHT_SIZE,
|
||||
wxRIBBON_ART_PAGE_BORDER_BOTTOM_SIZE,
|
||||
wxRIBBON_ART_PANEL_X_SEPARATION_SIZE,
|
||||
wxRIBBON_ART_PANEL_Y_SEPARATION_SIZE,
|
||||
wxRIBBON_ART_TOOL_GROUP_SEPARATION_SIZE,
|
||||
wxRIBBON_ART_GALLERY_BITMAP_PADDING_LEFT_SIZE,
|
||||
wxRIBBON_ART_GALLERY_BITMAP_PADDING_RIGHT_SIZE,
|
||||
wxRIBBON_ART_GALLERY_BITMAP_PADDING_TOP_SIZE,
|
||||
wxRIBBON_ART_GALLERY_BITMAP_PADDING_BOTTOM_SIZE,
|
||||
wxRIBBON_ART_PANEL_LABEL_FONT,
|
||||
wxRIBBON_ART_BUTTON_BAR_LABEL_FONT,
|
||||
wxRIBBON_ART_TAB_LABEL_FONT,
|
||||
wxRIBBON_ART_BUTTON_BAR_LABEL_COLOUR,
|
||||
wxRIBBON_ART_BUTTON_BAR_HOVER_BORDER_COLOUR,
|
||||
wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_COLOUR,
|
||||
wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_COLOUR,
|
||||
wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_BUTTON_BAR_ACTIVE_BORDER_COLOUR,
|
||||
wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_TOP_COLOUR,
|
||||
wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_COLOUR,
|
||||
wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_GALLERY_BORDER_COLOUR,
|
||||
wxRIBBON_ART_GALLERY_HOVER_BACKGROUND_COLOUR,
|
||||
wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_COLOUR,
|
||||
wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_TOP_COLOUR,
|
||||
wxRIBBON_ART_GALLERY_BUTTON_FACE_COLOUR,
|
||||
wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_COLOUR,
|
||||
wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_TOP_COLOUR,
|
||||
wxRIBBON_ART_GALLERY_BUTTON_HOVER_FACE_COLOUR,
|
||||
wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_COLOUR,
|
||||
wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_TOP_COLOUR,
|
||||
wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_FACE_COLOUR,
|
||||
wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_COLOUR,
|
||||
wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_TOP_COLOUR,
|
||||
wxRIBBON_ART_GALLERY_BUTTON_DISABLED_FACE_COLOUR,
|
||||
wxRIBBON_ART_GALLERY_ITEM_BORDER_COLOUR,
|
||||
wxRIBBON_ART_TAB_LABEL_COLOUR,
|
||||
wxRIBBON_ART_TAB_SEPARATOR_COLOUR,
|
||||
wxRIBBON_ART_TAB_SEPARATOR_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_TAB_CTRL_BACKGROUND_COLOUR,
|
||||
wxRIBBON_ART_TAB_CTRL_BACKGROUND_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_TAB_HOVER_BACKGROUND_TOP_COLOUR,
|
||||
wxRIBBON_ART_TAB_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_TAB_HOVER_BACKGROUND_COLOUR,
|
||||
wxRIBBON_ART_TAB_HOVER_BACKGROUND_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_COLOUR,
|
||||
wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_COLOUR,
|
||||
wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_TAB_BORDER_COLOUR,
|
||||
wxRIBBON_ART_PANEL_BORDER_COLOUR,
|
||||
wxRIBBON_ART_PANEL_BORDER_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_PANEL_MINIMISED_BORDER_COLOUR,
|
||||
wxRIBBON_ART_PANEL_MINIMISED_BORDER_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_PANEL_LABEL_BACKGROUND_COLOUR,
|
||||
wxRIBBON_ART_PANEL_LABEL_BACKGROUND_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_PANEL_LABEL_COLOUR,
|
||||
wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_COLOUR,
|
||||
wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_PANEL_HOVER_LABEL_COLOUR,
|
||||
wxRIBBON_ART_PANEL_MINIMISED_LABEL_COLOUR,
|
||||
wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_TOP_COLOUR,
|
||||
wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_COLOUR,
|
||||
wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_PAGE_BORDER_COLOUR,
|
||||
wxRIBBON_ART_PAGE_BACKGROUND_TOP_COLOUR,
|
||||
wxRIBBON_ART_PAGE_BACKGROUND_TOP_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_PAGE_BACKGROUND_COLOUR,
|
||||
wxRIBBON_ART_PAGE_BACKGROUND_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_PAGE_HOVER_BACKGROUND_TOP_COLOUR,
|
||||
wxRIBBON_ART_PAGE_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_PAGE_HOVER_BACKGROUND_COLOUR,
|
||||
wxRIBBON_ART_PAGE_HOVER_BACKGROUND_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_TOOLBAR_BORDER_COLOUR,
|
||||
wxRIBBON_ART_TOOLBAR_HOVER_BORDER_COLOUR,
|
||||
wxRIBBON_ART_TOOLBAR_FACE_COLOUR,
|
||||
wxRIBBON_ART_TOOL_BACKGROUND_TOP_COLOUR,
|
||||
wxRIBBON_ART_TOOL_BACKGROUND_TOP_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_TOOL_BACKGROUND_COLOUR,
|
||||
wxRIBBON_ART_TOOL_BACKGROUND_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_TOOL_HOVER_BACKGROUND_TOP_COLOUR,
|
||||
wxRIBBON_ART_TOOL_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_TOOL_HOVER_BACKGROUND_COLOUR,
|
||||
wxRIBBON_ART_TOOL_HOVER_BACKGROUND_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_TOP_COLOUR,
|
||||
wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR,
|
||||
wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_COLOUR,
|
||||
wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_GRADIENT_COLOUR,
|
||||
};
|
||||
|
||||
/**
|
||||
Flags used to describe the direction, state, and/or purpose of a
|
||||
ribbon-style scroll button.
|
||||
|
||||
@see wxRibbonArtProvider::DrawScrollButton()
|
||||
@see wxRibbonArtProvider::GetScrollButtonMinimumSize()
|
||||
*/
|
||||
enum wxRibbonScrollButtonStyle
|
||||
{
|
||||
wxRIBBON_SCROLL_BTN_LEFT = 0, /**< Button will scroll to the left. */
|
||||
wxRIBBON_SCROLL_BTN_RIGHT = 1, /**< Button will scroll to the right. */
|
||||
wxRIBBON_SCROLL_BTN_UP = 2, /**< Button will scroll upward. */
|
||||
wxRIBBON_SCROLL_BTN_DOWN = 3, /**< Button will scroll downward. */
|
||||
|
||||
/** A mask to extract direction from a combination of flags. */
|
||||
wxRIBBON_SCROLL_BTN_DIRECTION_MASK = 3,
|
||||
|
||||
wxRIBBON_SCROLL_BTN_NORMAL = 0, /**< Button is not active or hovered. */
|
||||
wxRIBBON_SCROLL_BTN_HOVERED = 4, /**< Button has a cursor hovering over it. */
|
||||
wxRIBBON_SCROLL_BTN_ACTIVE = 8, /**< Button is being pressed. */
|
||||
|
||||
/** A mask to extract state from a combination of flags. */
|
||||
wxRIBBON_SCROLL_BTN_STATE_MASK = 12,
|
||||
|
||||
wxRIBBON_SCROLL_BTN_FOR_OTHER = 0, /**< Button is not for scrolling tabs nor pages. */
|
||||
wxRIBBON_SCROLL_BTN_FOR_TABS = 16, /**< Button is for scrolling tabs. */
|
||||
wxRIBBON_SCROLL_BTN_FOR_PAGE = 32, /**< Button is for scrolling pages. */
|
||||
|
||||
/** A mask to extract purpose from a combination of flags. */
|
||||
wxRIBBON_SCROLL_BTN_FOR_MASK = 48,
|
||||
};
|
||||
|
||||
/**
|
||||
Buttons on a ribbon button bar and tools on a ribbon tool bar can each be
|
||||
one of three different kinds.
|
||||
*/
|
||||
enum wxRibbonButtonKind
|
||||
{
|
||||
/**
|
||||
Normal button or tool with a clickable area which causes some generic
|
||||
action.
|
||||
*/
|
||||
wxRIBBON_BUTTON_NORMAL = 1 << 0,
|
||||
|
||||
/**
|
||||
Dropdown button or tool with a clickable area which typically causes a
|
||||
dropdown menu.
|
||||
*/
|
||||
wxRIBBON_BUTTON_DROPDOWN = 1 << 1,
|
||||
|
||||
/**
|
||||
Button or tool with two clickable areas - one which causes a dropdown
|
||||
menu, and one which causes a generic action.
|
||||
*/
|
||||
wxRIBBON_BUTTON_HYBRID = wxRIBBON_BUTTON_NORMAL | wxRIBBON_BUTTON_DROPDOWN,
|
||||
};
|
||||
|
||||
/**
|
||||
@class wxRibbonArtProvider
|
||||
|
||||
wxRibbonArtProvider is responsible for drawing all the components of the ribbon
|
||||
interface. This allows a ribbon bar to have a pluggable look-and-feel, while
|
||||
retaining the same underlying behaviour. As a single art provider is used for
|
||||
all ribbon components, a ribbon bar usually has a consistent (though unique)
|
||||
appearance.
|
||||
|
||||
By default, a wxRibbonBar uses an instance of this class called
|
||||
wxRibbonDefaultArtProvider, which resolves to wxRibbonAUIArtProvider,
|
||||
wxRibbonMSWArtProvider, or wxRibbonOSXArtProvider - whichever is most appropriate
|
||||
to the current platform. These art providers are all slightly configurable with
|
||||
regard to colours and fonts, but for larger modifications, you can derive from
|
||||
one of these classes, or write a completely new art provider class.
|
||||
Call wxRibbonBar::SetArtProvider to change the art provider being used.
|
||||
|
||||
@library{wxribbon}
|
||||
@category{ribbon}
|
||||
|
||||
@see wxRibbonBar
|
||||
*/
|
||||
class wxRibbonArtProvider
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRibbonArtProvider();
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
virtual ~wxRibbonArtProvider();
|
||||
|
||||
/**
|
||||
Create a new art provider which is a clone of this one.
|
||||
*/
|
||||
virtual wxRibbonArtProvider* Clone() const = 0;
|
||||
|
||||
/**
|
||||
Set the style flags.
|
||||
|
||||
Normally called automatically by wxRibbonBar::SetArtProvider with the ribbon
|
||||
bar's style flags, so that the art provider has the same flags as the bar which
|
||||
it is serving.
|
||||
*/
|
||||
virtual void SetFlags(long flags) = 0;
|
||||
|
||||
/**
|
||||
Get the previously set style flags.
|
||||
*/
|
||||
virtual long GetFlags() const = 0;
|
||||
|
||||
/**
|
||||
Get the value of a certain integer setting.
|
||||
@a id can be one of the size values of @ref wxRibbonArtSetting.
|
||||
*/
|
||||
virtual int GetMetric(int id) const = 0;
|
||||
|
||||
/**
|
||||
Set the value of a certain integer setting to the value @e new_val.
|
||||
@a id can be one of the size values of @ref wxRibbonArtSetting.
|
||||
*/
|
||||
virtual void SetMetric(int id, int new_val) = 0;
|
||||
|
||||
/**
|
||||
Set the value of a certain font setting to the value @e font.
|
||||
@a id can be one of the font values of @ref wxRibbonArtSetting.
|
||||
*/
|
||||
virtual void SetFont(int id, const wxFont& font) = 0;
|
||||
|
||||
/**
|
||||
Get the value of a certain font setting.
|
||||
@a id can be one of the font values of @ref wxRibbonArtSetting.
|
||||
*/
|
||||
virtual wxFont GetFont(int id) const = 0;
|
||||
|
||||
/**
|
||||
Get the value of a certain colour setting.
|
||||
@a id can be one of the colour values of @ref wxRibbonArtSetting.
|
||||
*/
|
||||
virtual wxColour GetColour(int id) const = 0;
|
||||
|
||||
/**
|
||||
Set the value of a certain colour setting to the value @e colour.
|
||||
@a id can be one of the colour values of @ref wxRibbonArtSetting, though
|
||||
not all colour settings will have an affect on every art provider.
|
||||
|
||||
\see SetColourScheme()
|
||||
*/
|
||||
virtual void SetColour(int id, const wxColor& colour) = 0;
|
||||
|
||||
/**
|
||||
\see wxRibbonArtProvider::GetColour()
|
||||
*/
|
||||
wxColour GetColor(int id) const;
|
||||
|
||||
/**
|
||||
\see wxRibbonArtProvider::SetColour()
|
||||
*/
|
||||
void SetColor(int id, const wxColour& color);
|
||||
|
||||
/**
|
||||
Get the current colour scheme.
|
||||
|
||||
Returns three colours such that if SetColourScheme() were called with
|
||||
them, the colour scheme would be restored to what it was when
|
||||
SetColourScheme() was last called. In practice, this usually means that
|
||||
the returned values are the three colours given in the last call to
|
||||
SetColourScheme(), however if SetColourScheme() performs an idempotent
|
||||
operation upon the colours it is given (like clamping a component of
|
||||
the colour), then the returned values may not be the three colours
|
||||
given in the last call to SetColourScheme().
|
||||
If SetColourScheme() has not been called, then the returned values
|
||||
should result in a colour scheme similar to, if not identical to, the
|
||||
default colours of the art provider.
|
||||
Note that if SetColour() is called, then GetColourScheme() does not try
|
||||
and return a colour scheme similar to colours being used - it's return
|
||||
values are dependant upon the last values given to SetColourScheme(),
|
||||
as described above.
|
||||
|
||||
\param[out] primary
|
||||
Pointer to a location to store the primary colour, or NULL.
|
||||
\param[out] secondary
|
||||
Pointer to a location to store the secondary colour, or NULL.
|
||||
\param[out] tertiary
|
||||
Pointer to a location to store the tertiary colour, or NULL.
|
||||
*/
|
||||
virtual void GetColourScheme(wxColour* primary,
|
||||
wxColour* secondary,
|
||||
wxColour* tertiary) const = 0;
|
||||
|
||||
/**
|
||||
Set all applicable colour settings from a few base colours.
|
||||
|
||||
Uses any or all of the three given colours to create a colour scheme,
|
||||
and then sets all colour settings which are relevant to the art
|
||||
provider using that scheme.
|
||||
Note that some art providers may not use the tertiary colour for
|
||||
anything, and some may not use the secondary colour either.
|
||||
|
||||
\see SetColour()
|
||||
\see GetColourScheme()
|
||||
*/
|
||||
virtual void SetColourScheme(const wxColour& primary,
|
||||
const wxColour& secondary,
|
||||
const wxColour& tertiary) = 0;
|
||||
|
||||
/**
|
||||
Draw the background of the tab region of a ribbon bar.
|
||||
|
||||
@param dc
|
||||
The device context to draw onto.
|
||||
@param wnd
|
||||
The window which is being drawn onto.
|
||||
@param rect
|
||||
The rectangle within which to draw.
|
||||
*/
|
||||
virtual void DrawTabCtrlBackground(
|
||||
wxDC& dc,
|
||||
wxWindow* wnd,
|
||||
const wxRect& rect) = 0;
|
||||
|
||||
/**
|
||||
Draw a single tab in the tab region of a ribbon bar.
|
||||
|
||||
@param dc
|
||||
The device context to draw onto.
|
||||
@param wnd
|
||||
The window which is being drawn onto (not the wxRibbonPage
|
||||
associated with the tab being drawn).
|
||||
@param tab
|
||||
The rectangle within which to draw, and also the tab label, icon,
|
||||
and state (active and/or hovered). The drawing rectangle will be
|
||||
entirely within a rectangle on the same device context previously
|
||||
painted with DrawTabCtrlBackground(). The rectangle's width will
|
||||
be at least the minimum value returned by GetBarTabWidth(), and
|
||||
height will be the value returned by GetTabCtrlHeight().
|
||||
*/
|
||||
virtual void DrawTab(wxDC& dc,
|
||||
wxWindow* wnd,
|
||||
const wxRibbonPageTabInfo& tab) = 0;
|
||||
|
||||
/**
|
||||
Draw a separator between two tabs in a ribbon bar.
|
||||
|
||||
@param dc
|
||||
The device context to draw onto.
|
||||
@param wnd
|
||||
The window which is being drawn onto.
|
||||
@param rect
|
||||
The rectangle within which to draw, which will be entirely within a
|
||||
rectangle on the same device context previously painted with
|
||||
DrawTabCtrlBackground().
|
||||
@param visibility
|
||||
The opacity with which to draw the separator. Values are in the range
|
||||
[0, 1], with 0 being totally transparent, and 1 being totally opaque.
|
||||
*/
|
||||
virtual void DrawTabSeparator(wxDC& dc,
|
||||
wxWindow* wnd,
|
||||
const wxRect& rect,
|
||||
double visibility) = 0;
|
||||
|
||||
/**
|
||||
Draw the background of a ribbon page.
|
||||
|
||||
@param dc
|
||||
The device context to draw onto.
|
||||
@param wnd
|
||||
The window which is being drawn onto (which is commonly the wxRibbonPage
|
||||
whose background is being drawn, but doesn't have to be).
|
||||
@param rect
|
||||
The rectangle within which to draw.
|
||||
|
||||
@sa GetPageBackgroundRedrawArea
|
||||
*/
|
||||
virtual void DrawPageBackground(
|
||||
wxDC& dc,
|
||||
wxWindow* wnd,
|
||||
const wxRect& rect) = 0;
|
||||
|
||||
/**
|
||||
Draw a ribbon-style scroll button.
|
||||
|
||||
@param dc
|
||||
The device context to draw onto.
|
||||
@param wnd
|
||||
The window which is being drawn onto.
|
||||
@param rect
|
||||
The rectangle within which to draw. The size of this rectangle
|
||||
will be at least the size returned by GetScrollButtonMinimumSize()
|
||||
for a scroll button with the same style. For tab scroll buttons,
|
||||
this rectangle will be entirely within a rectangle on the same
|
||||
device context previously painted with DrawTabCtrlBackground(), but
|
||||
this is not guaranteed for other types of button (for example,
|
||||
page scroll buttons will not be painted on an area previously
|
||||
painted with DrawPageBackground()).
|
||||
@param style
|
||||
A combination of flags from @ref wxRibbonScrollButtonStyle, including
|
||||
a direction, a for flag, and one or more states.
|
||||
*/
|
||||
virtual void DrawScrollButton(
|
||||
wxDC& dc,
|
||||
wxWindow* wnd,
|
||||
const wxRect& rect,
|
||||
long style) = 0;
|
||||
|
||||
/**
|
||||
Draw the background and chrome for a ribbon panel. This should draw
|
||||
the border, background, label, and any other items of a panel which
|
||||
are outside the client area of a panel.
|
||||
|
||||
Note that when a panel is minimised, this function is not called - only
|
||||
DrawMinimisedPanel() is called, so a background should be explicitly
|
||||
painted by that if required.
|
||||
|
||||
@param dc
|
||||
The device context to draw onto.
|
||||
@param wnd
|
||||
The window which is being drawn onto, which is always the panel
|
||||
whose background and chrome is being drawn. The panel label and
|
||||
other panel attributes can be obtained by querying this.
|
||||
@param rect
|
||||
The rectangle within which to draw.
|
||||
*/
|
||||
virtual void DrawPanelBackground(
|
||||
wxDC& dc,
|
||||
wxRibbonPanel* wnd,
|
||||
const wxRect& rect) = 0;
|
||||
|
||||
/**
|
||||
Draw the background and chrome for a wxRibbonGallery control. This
|
||||
should draw the border, brackground, scroll buttons, extension button,
|
||||
and any other UI elements which are not attached to a specific gallery
|
||||
item.
|
||||
|
||||
@param dc
|
||||
The device context to draw onto.
|
||||
@param wnd
|
||||
The window which is being drawn onto, which is always the gallery
|
||||
whose background and chrome is being drawn. Attributes used during
|
||||
drawing like the gallery hover state and individual button states
|
||||
can be queried from this parameter by wxRibbonGallery::IsHovered(),
|
||||
wxRibbonGallery::GetExtensionButtonState(),
|
||||
wxRibbonGallery::GetUpButtonState(), and
|
||||
wxRibbonGallery::GetDownButtonState().
|
||||
@param rect
|
||||
The rectangle within which to draw. This rectangle is the entire
|
||||
area of the gallery control, not just the client rectangle.
|
||||
*/
|
||||
virtual void DrawGalleryBackground(
|
||||
wxDC& dc,
|
||||
wxRibbonGallery* wnd,
|
||||
const wxRect& rect) = 0;
|
||||
|
||||
/**
|
||||
Draw the background of a single item in a wxRibbonGallery control. This
|
||||
is painted on top of a gallery background, and behind the items bitmap.
|
||||
Unlike DrawButtonBarButton() and DrawTool(), it is not expected to draw
|
||||
the item bitmap - that is done by the gallery control itself.
|
||||
|
||||
@param dc
|
||||
The device context to draw onto.
|
||||
@param wnd
|
||||
The window which is being drawn onto, which is always the gallery
|
||||
which contains the item being drawn.
|
||||
@param rect
|
||||
The rectangle within which to draw. The size of this rectangle will
|
||||
be the size of the item's bitmap, expanded by gallery item padding
|
||||
values (wxRIBBON_ART_GALLERY_BITMAP_PADDING_LEFT_SIZE,
|
||||
wxRIBBON_ART_GALLERY_BITMAP_PADDING_RIGHT_SIZE,
|
||||
wxRIBBON_ART_GALLERY_BITMAP_PADDING_TOP_SIZE, and
|
||||
wxRIBBON_ART_GALLERY_BITMAP_PADDING_BOTTOM_SIZE). The drawing
|
||||
rectangle will be entirely within a rectangle on the same device
|
||||
context previously painted with DrawGalleryBackground().
|
||||
@param item
|
||||
The item whose background is being painted. Typically the
|
||||
background will vary if the item is hovered, active, or selected;
|
||||
wxRibbonGallery::GetSelection(), wxRibbonGallery::GetActiveItem(),
|
||||
and wxRibbonGallery::GetHoveredItem() can be called to test if the
|
||||
given item is in one of these states.
|
||||
*/
|
||||
virtual void DrawGalleryItemBackground(
|
||||
wxDC& dc,
|
||||
wxRibbonGallery* wnd,
|
||||
const wxRect& rect,
|
||||
wxRibbonGalleryItem* item) = 0;
|
||||
|
||||
/**
|
||||
Draw a minimised ribbon panel.
|
||||
|
||||
@param dc
|
||||
The device context to draw onto.
|
||||
@param wnd
|
||||
The window which is being drawn onto, which is always the panel
|
||||
which is minimised. The panel label can be obtained from this
|
||||
window. The minimised icon obtained from querying the window may
|
||||
not be the size requested by GetMinimisedPanelMinimumSize() - the
|
||||
@a bitmap argument contains the icon in the requested size.
|
||||
@param rect
|
||||
The rectangle within which to draw. The size of the rectangle will
|
||||
be at least the size returned by GetMinimisedPanelMinimumSize().
|
||||
@param bitmap
|
||||
A copy of the panel's minimised bitmap rescaled to the size
|
||||
returned by GetMinimisedPanelMinimumSize().
|
||||
*/
|
||||
virtual void DrawMinimisedPanel(
|
||||
wxDC& dc,
|
||||
wxRibbonPanel* wnd,
|
||||
const wxRect& rect,
|
||||
wxBitmap& bitmap) = 0;
|
||||
|
||||
/**
|
||||
Draw the background for a wxRibbonButtonBar control.
|
||||
|
||||
@param dc
|
||||
The device context to draw onto.
|
||||
@param wnd
|
||||
The window which is being drawn onto (which will typically be the
|
||||
button bar itself, though this is not guaranteed).
|
||||
@param rect
|
||||
The rectangle within which to draw.
|
||||
*/
|
||||
virtual void DrawButtonBarBackground(
|
||||
wxDC& dc,
|
||||
wxWindow* wnd,
|
||||
const wxRect& rect) = 0;
|
||||
|
||||
/**
|
||||
Draw a single button for a wxRibbonButtonBar control.
|
||||
|
||||
@param dc
|
||||
The device context to draw onto.
|
||||
@param wnd
|
||||
The window which is being drawn onto.
|
||||
@param rect
|
||||
The rectangle within which to draw. The size of this rectangle will
|
||||
be a size previously returned by GetButtonBarButtonSize(), and the
|
||||
rectangle will be entirely within a rectangle on the same device
|
||||
context previously painted with DrawButtonBarBackground().
|
||||
@param kind
|
||||
The kind of button to draw (normal, dropdown or hybrid).
|
||||
@param state
|
||||
Combination of a size flag and state flags from the
|
||||
wxRibbonButtonBarButtonState enumeration.
|
||||
@param label
|
||||
The label of the button.
|
||||
@param bitmap_large
|
||||
The large bitmap of the button (or the large disabled bitmap when
|
||||
wxRIBBON_BUTTONBAR_BUTTON_DISABLED is set in @a state).
|
||||
@param bitmap_small
|
||||
The small bitmap of the button (or the small disabled bitmap when
|
||||
wxRIBBON_BUTTONBAR_BUTTON_DISABLED is set in @a state).
|
||||
*/
|
||||
virtual void DrawButtonBarButton(
|
||||
wxDC& dc,
|
||||
wxWindow* wnd,
|
||||
const wxRect& rect,
|
||||
wxRibbonButtonBarButtonKind kind,
|
||||
long state,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap_large,
|
||||
const wxBitmap& bitmap_small) = 0;
|
||||
|
||||
/**
|
||||
Draw the background for a wxRibbonToolBar control.
|
||||
|
||||
@param dc
|
||||
The device context to draw onto.
|
||||
@param wnd
|
||||
The which is being drawn onto. In most cases this will be a
|
||||
wxRibbonToolBar, but it doesn't have to be.
|
||||
@param rect
|
||||
The rectangle within which to draw. Some of this rectangle will
|
||||
later be drawn over using DrawToolGroupBackground() and DrawTool(),
|
||||
but not all of it will (unless there is only a single group of
|
||||
tools).
|
||||
*/
|
||||
virtual void DrawToolBarBackground(
|
||||
wxDC& dc,
|
||||
wxWindow* wnd,
|
||||
const wxRect& rect) = 0;
|
||||
|
||||
/**
|
||||
Draw the background for a group of tools on a wxRibbonToolBar control.
|
||||
|
||||
@param dc
|
||||
The device context to draw onto.
|
||||
@param wnd
|
||||
The window which is being drawn onto. In most cases this will be a
|
||||
wxRibbonToolBar, but it doesn't have to be.
|
||||
@param rect
|
||||
The rectangle within which to draw. This rectangle is a union of
|
||||
the individual tools' rectangles. As there are no gaps between
|
||||
tools, this rectangle will be painted over exactly once by calls to
|
||||
DrawTool(). The group background could therefore be painted by
|
||||
DrawTool(), though it can be conceptually easier and more efficient
|
||||
to draw it all at once here. The rectangle will be entirely within
|
||||
a rectangle on the same device context previously painted with
|
||||
DrawToolBarBackground().
|
||||
*/
|
||||
virtual void DrawToolGroupBackground(
|
||||
wxDC& dc,
|
||||
wxWindow* wnd,
|
||||
const wxRect& rect) = 0;
|
||||
|
||||
/**
|
||||
Draw a single tool (for a wxRibbonToolBar control).
|
||||
|
||||
@param dc
|
||||
The device context to draw onto.
|
||||
@param wnd
|
||||
The window which is being drawn onto. In most cases this will be a
|
||||
wxRibbonToolBar, but it doesn't have to be.
|
||||
@param rect
|
||||
The rectangle within which to draw. The size of this rectangle will
|
||||
at least the size returned by GetToolSize(), and the height of it
|
||||
will be equal for all tools within the same group. The rectangle
|
||||
will be entirely within a rectangle on the same device context
|
||||
previously painted with DrawToolGroupBackground().
|
||||
@param bitmap
|
||||
The bitmap to use as the tool's foreground. If the tool is a hybrid
|
||||
or dropdown tool, then the foreground should also contain a
|
||||
standard dropdown button.
|
||||
@param kind
|
||||
The kind of tool to draw (normal, dropdown, or hybrid).
|
||||
@param state
|
||||
A combination of wxRibbonToolBarToolState flags giving the state of
|
||||
the tool and it's relative position within a tool group.
|
||||
*/
|
||||
virtual void DrawTool(
|
||||
wxDC& dc,
|
||||
wxWindow* wnd,
|
||||
const wxRect& rect,
|
||||
const wxBitmap& bitmap,
|
||||
wxRibbonButtonKind kind,
|
||||
long state) = 0;
|
||||
|
||||
/**
|
||||
Calculate the ideal and minimum width (in pixels) of a tab in a ribbon
|
||||
bar.
|
||||
|
||||
@param dc
|
||||
A device context to use when one is required for size calculations.
|
||||
@param wnd
|
||||
The window onto which the tab will eventually be drawn.
|
||||
@param label
|
||||
The tab's label (or wxEmptyString if it has none).
|
||||
@param bitmap
|
||||
The tab's icon (or wxNullBitmap if it has none).
|
||||
@param[out] ideal
|
||||
The ideal width (in pixels) of the tab.
|
||||
@param[out] small_begin_need_separator
|
||||
A size less than the @a ideal size, at which a tab separator should
|
||||
begin to be drawn (i.e. drawn, but still fairly transparent).
|
||||
@param[out] small_must_have_separator
|
||||
A size less than the @a small_begin_need_separator size, at which a
|
||||
tab separator must be drawn (i.e. drawn at full opacity).
|
||||
@param[out] minimum
|
||||
A size less than the @a small_must_have_separator size, and greater
|
||||
than or equal to zero, which is the minimum pixel width for the tab.
|
||||
*/
|
||||
virtual void GetBarTabWidth(
|
||||
wxDC& dc,
|
||||
wxWindow* wnd,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
int* ideal,
|
||||
int* small_begin_need_separator,
|
||||
int* small_must_have_separator,
|
||||
int* minimum) = 0;
|
||||
|
||||
/**
|
||||
Calculate the height (in pixels) of the tab region of a ribbon bar.
|
||||
Note that as the tab region can contain scroll buttons, the height
|
||||
should be greater than or equal to the minimum height for a tab scroll
|
||||
button.
|
||||
|
||||
@param dc
|
||||
A device context to use when one is required for size calculations.
|
||||
@param wnd
|
||||
The window onto which the tabs will eventually be drawn.
|
||||
@param pages
|
||||
The tabs which will acquire the returned height.
|
||||
*/
|
||||
virtual int GetTabCtrlHeight(
|
||||
wxDC& dc,
|
||||
wxWindow* wnd,
|
||||
const wxRibbonPageTabInfoArray& pages) = 0;
|
||||
|
||||
/**
|
||||
Calculate the minimum size (in pixels) of a scroll button.
|
||||
|
||||
@param dc
|
||||
A device context to use when one is required for size calculations.
|
||||
@param wnd
|
||||
The window onto which the scroll button will eventually be drawn.
|
||||
@param style
|
||||
A combination of flags from @ref wxRibbonScrollButtonStyle, including
|
||||
a direction, and a for flag (state flags may be given too, but
|
||||
should be ignored, as a button should retain a constant size,
|
||||
regardless of its state).
|
||||
*/
|
||||
virtual wxSize GetScrollButtonMinimumSize(
|
||||
wxDC& dc,
|
||||
wxWindow* wnd,
|
||||
long style) = 0;
|
||||
|
||||
/**
|
||||
Calculate the size of a panel for a given client size. This should
|
||||
increment the given size by enough to fit the panel label and other
|
||||
chrome.
|
||||
|
||||
@param dc
|
||||
A device context to use if one is required for size calculations.
|
||||
@param wnd
|
||||
The ribbon panel in question.
|
||||
@param client_size
|
||||
The client size.
|
||||
@param[out] client_offset
|
||||
The offset where the client rectangle begins within the panel (may
|
||||
be NULL).
|
||||
|
||||
@sa GetPanelClientSize()
|
||||
*/
|
||||
virtual wxSize GetPanelSize(
|
||||
wxDC& dc,
|
||||
const wxRibbonPanel* wnd,
|
||||
wxSize client_size,
|
||||
wxPoint* client_offset) = 0;
|
||||
|
||||
/**
|
||||
Calculate the client size of a panel for a given overall size. This
|
||||
should act as the inverse to GetPanelSize(), and decrement the given
|
||||
size by enough to fit the panel label and other chrome.
|
||||
|
||||
@param dc
|
||||
A device context to use if one is required for size calculations.
|
||||
@param wnd
|
||||
The ribbon panel in question.
|
||||
@param size
|
||||
The overall size to calculate client size for.
|
||||
@param[out] client_offset
|
||||
The offset where the returned client size begins within the given
|
||||
@a size (may be NULL).
|
||||
|
||||
@sa GetPanelSize()
|
||||
*/
|
||||
virtual wxSize GetPanelClientSize(
|
||||
wxDC& dc,
|
||||
const wxRibbonPanel* wnd,
|
||||
wxSize size,
|
||||
wxPoint* client_offset) = 0;
|
||||
|
||||
/**
|
||||
Calculate the size of a wxRibbonGallery control for a given client
|
||||
size. This should increment the given size by enough to fit the gallery
|
||||
border, buttons, and any other chrome.
|
||||
|
||||
@param dc
|
||||
A device context to use if one is required for size calculations.
|
||||
@param wnd
|
||||
The gallery in question.
|
||||
@param client_size
|
||||
The client size.
|
||||
|
||||
@sa GetGalleryClientSize()
|
||||
*/
|
||||
virtual wxSize GetGallerySize(
|
||||
wxDC& dc,
|
||||
const wxRibbonGallery* wnd,
|
||||
wxSize client_size) = 0;
|
||||
|
||||
/**
|
||||
Calculate the client size of a wxRibbonGallery control for a given
|
||||
size. This should act as the inverse to GetGallerySize(), and decrement
|
||||
the given size by enough to fir the gallery border, buttons, and other
|
||||
chrome.
|
||||
|
||||
@param dc
|
||||
A device context to use if one is required for size calculations.
|
||||
@param wnd
|
||||
The gallery in question.
|
||||
@param size
|
||||
The overall size to calculate the client size for.
|
||||
@param[out] client_offset
|
||||
The position within the given size at which the returned client
|
||||
size begins.
|
||||
@param[out] scroll_up_button
|
||||
The rectangle within the given size which the scroll up button
|
||||
occupies.
|
||||
@param[out] scroll_down_button
|
||||
The rectangle within the given size which the scroll down button
|
||||
occupies.
|
||||
@param[out] extension_button
|
||||
The rectangle within the given size which the extension button
|
||||
occupies.
|
||||
*/
|
||||
virtual wxSize GetGalleryClientSize(
|
||||
wxDC& dc,
|
||||
const wxRibbonGallery* wnd,
|
||||
wxSize size,
|
||||
wxPoint* client_offset,
|
||||
wxRect* scroll_up_button,
|
||||
wxRect* scroll_down_button,
|
||||
wxRect* extension_button) = 0;
|
||||
|
||||
/**
|
||||
Calculate the portion of a page background which needs to be redrawn
|
||||
when a page is resized. To optimise the drawing of page backgrounds, as
|
||||
small an area as possible should be returned. Of couse, if the way in
|
||||
which a background is drawn means that the entire background needs to
|
||||
be repainted on resize, then the entire new size should be returned.
|
||||
|
||||
@param dc
|
||||
A device context to use when one is required for size calculations.
|
||||
@param wnd
|
||||
The page which is being resized.
|
||||
@param page_old_size
|
||||
The size of the page prior to the resize (which has already been
|
||||
painted).
|
||||
@param page_new_size
|
||||
The size of the page after the resize.
|
||||
*/
|
||||
virtual wxRect GetPageBackgroundRedrawArea(
|
||||
wxDC& dc,
|
||||
const wxRibbonPage* wnd,
|
||||
wxSize page_old_size,
|
||||
wxSize page_new_size) = 0;
|
||||
|
||||
/**
|
||||
Calculate the size of a button within a wxRibbonButtonBar.
|
||||
|
||||
@param dc
|
||||
A device context to use when one is required for size calculations.
|
||||
@param wnd
|
||||
The window onto which the button will eventually be drawn (which is
|
||||
normally a wxRibbonButtonBar, though this is not guaranteed).
|
||||
@param kind
|
||||
The kind of button.
|
||||
@param size
|
||||
The size-class to calculate the size for. Buttons on a button bar
|
||||
can have three distinct sizes: wxRIBBON_BUTTONBAR_BUTTON_SMALL,
|
||||
wxRIBBON_BUTTONBAR_BUTTON_MEDIUM, and wxRIBBON_BUTTONBAR_BUTTON_LARGE.
|
||||
If the requested size-class is not applicable, then @false should
|
||||
be returned.
|
||||
@param label
|
||||
The label of the button.
|
||||
@param bitmap_size_large
|
||||
The size of all "large" bitmaps on the button bar.
|
||||
@param bitmap_size_small
|
||||
The size of all "small" bitmaps on the button bar.
|
||||
@param[out] button_size
|
||||
The size, in pixels, of the button.
|
||||
@param[out] normal_region
|
||||
The region of the button which constitutes the normal button.
|
||||
@param[out] dropdown_region
|
||||
The region of the button which constitutes the dropdown button.
|
||||
|
||||
@return @true if a size exists for the button, @false otherwise.
|
||||
*/
|
||||
virtual bool GetButtonBarButtonSize(
|
||||
wxDC& dc,
|
||||
wxWindow* wnd,
|
||||
wxRibbonButtonBarButtonKind kind,
|
||||
wxRibbonButtonBarButtonState size,
|
||||
const wxString& label,
|
||||
wxSize bitmap_size_large,
|
||||
wxSize bitmap_size_small,
|
||||
wxSize* button_size,
|
||||
wxRect* normal_region,
|
||||
wxRect* dropdown_region) = 0;
|
||||
|
||||
/**
|
||||
Calculate the size of a minimised ribbon panel.
|
||||
|
||||
@param dc
|
||||
A device context to use when one is required for size calculations.
|
||||
@param wnd
|
||||
The ribbon panel in question. Attributes like the panel label can
|
||||
be queried from this.
|
||||
@param[out] desired_bitmap_size
|
||||
|
||||
*/
|
||||
virtual wxSize GetMinimisedPanelMinimumSize(
|
||||
wxDC& dc,
|
||||
const wxRibbonPanel* wnd,
|
||||
wxSize* desired_bitmap_size,
|
||||
wxDirection* expanded_panel_direction) = 0;
|
||||
|
||||
/**
|
||||
Calculate the size of a tool within a wxRibbonToolBar.
|
||||
|
||||
@param dc
|
||||
A device context to use when one is required for size calculations.
|
||||
@param wnd
|
||||
The window onto which the tool will eventually be drawn.
|
||||
@param bitmap_size
|
||||
The size of the tool's foreground bitmap.
|
||||
@param kind
|
||||
The kind of tool (normal, dropdown, or hybrid).
|
||||
@param is_first
|
||||
@true if the tool is the first within its group. @false otherwise.
|
||||
@param is_last
|
||||
@true if the tool is the last within its group. @false otherwise.
|
||||
@param[out] dropdown_region
|
||||
For dropdown and hybrid tools, the region within the returned
|
||||
size which counts as the dropdown part.
|
||||
*/
|
||||
virtual wxSize GetToolSize(
|
||||
wxDC& dc,
|
||||
wxWindow* wnd,
|
||||
wxSize bitmap_size,
|
||||
wxRibbonButtonKind kind,
|
||||
bool is_first,
|
||||
bool is_last,
|
||||
wxRect* dropdown_region) = 0;
|
||||
};
|
224
interface/wx/ribbon/bar.h
Normal file
224
interface/wx/ribbon/bar.h
Normal file
@@ -0,0 +1,224 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: ribbon/bar.h
|
||||
// Purpose: interface of wxRibbonBar
|
||||
// Author: Peter Cawley
|
||||
// RCS-ID: $Id$
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxRibbonBarEvent
|
||||
|
||||
Event used to indicate various actions relating to a wxRibbonBar.
|
||||
|
||||
See wxRibbonBar for available event types.
|
||||
|
||||
@library{wxribbon}
|
||||
@category{events,ribbon}
|
||||
|
||||
@see wxRibbonBar
|
||||
*/
|
||||
class wxRibbonBarEvent : public wxNotifyEvent
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRibbonBarEvent(wxEventType command_type = wxEVT_NULL,
|
||||
int win_id = 0,
|
||||
wxRibbonPage* page = NULL);
|
||||
|
||||
/**
|
||||
Returns the page being changed to, or being clicked on.
|
||||
*/
|
||||
wxRibbonPage* GetPage();
|
||||
|
||||
/**
|
||||
Sets the page relating to this event.
|
||||
*/
|
||||
void SetPage(wxRibbonPage* page);
|
||||
};
|
||||
|
||||
/**
|
||||
@class wxRibbonBar
|
||||
|
||||
Top-level control in a ribbon user interface. Serves as a tabbed container
|
||||
for wxRibbonPage - a ribbon user interface typically has a ribbon bar,
|
||||
which contains one or more wxRibbonPages, which in turn each contain one
|
||||
or more wxRibbonPanels, which in turn contain controls.
|
||||
|
||||
While a wxRibbonBar has tabs similar to a wxNotebook, it does not follow
|
||||
the same API for adding pages. Containers like wxNotebook can contain any
|
||||
type of window as a page, hence the normal procedure is to create the
|
||||
sub-window and then call wxBookCtrlBase::AddPage(). As wxRibbonBar can only
|
||||
have wxRibbonPage as children (and a wxRibbonPage can only have a
|
||||
wxRibbonBar as parent), when a page is created, it is automatically added
|
||||
to the bar - there is no AddPage equivalent to call.
|
||||
|
||||
After all pages have been created, and all controls and panels placed on
|
||||
those pages, Realize() must be called.
|
||||
|
||||
@sa wxRibbonPage
|
||||
@sa wxRibbonPanel
|
||||
|
||||
@beginStyleTable
|
||||
@style{wxRIBBON_BAR_DEFAULT_STYLE}
|
||||
Defined as wxRIBBON_BAR_FLOW_HORIZONTAL |
|
||||
wxRIBBON_BAR_SHOW_PAGE_LABELS | wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS
|
||||
@style{wxRIBBON_BAR_FOLDBAR_STYLE}
|
||||
Defined as wxRIBBON_BAR_FLOW_VERTICAL | wxRIBBON_BAR_SHOW_PAGE_ICONS
|
||||
| wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS |
|
||||
wxRIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS
|
||||
@style{wxRIBBON_BAR_SHOW_PAGE_LABELS}
|
||||
Causes labels to be shown on the tabs in the ribbon bar.
|
||||
@style{wxRIBBON_BAR_SHOW_PAGE_ICONS}
|
||||
Causes icons to be shown on the tabs in the ribbon bar.
|
||||
@style{wxRIBBON_BAR_FLOW_HORIZONTAL}
|
||||
Causes panels within pages to stack horizontally.
|
||||
@style{wxRIBBON_BAR_FLOW_VERTICAL}
|
||||
Causes panels within pages to stack vertically.
|
||||
@style{wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS}
|
||||
Causes extension buttons to be shown on panels (where the panel has
|
||||
such a button).
|
||||
@style{wxRIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS}
|
||||
Causes minimise buttons to be shown on panels (where the panel has
|
||||
such a button).
|
||||
@endStyleTable
|
||||
|
||||
|
||||
@beginEventEmissionTable{wxRibbonBarEvent}
|
||||
@event{EVT_RIBBONBAR_PAGE_CHANGED(id, func)}
|
||||
Triggered after the transition from one page being active to a different
|
||||
page being active.
|
||||
@event{EVT_RIBBONBAR_PAGE_CHANGING(id, func)}
|
||||
Triggered prior to the transition from one page being active to a
|
||||
different page being active, and can veto the change.
|
||||
@event{EVT_RIBBONBAR_TAB_MIDDLE_DOWN(id, func)}
|
||||
Triggered when the middle mouse button is pressed on a tab.
|
||||
@event{EVT_RIBBONBAR_TAB_MIDDLE_UP(id, func)}
|
||||
Triggered when the middle mouse button is released on a tab.
|
||||
@event{EVT_RIBBONBAR_TAB_RIGHT_DOWN(id, func)}
|
||||
Triggered when the right mouse button is pressed on a tab.
|
||||
@event{EVT_RIBBONBAR_TAB_RIGHT_UP(id, func)}
|
||||
Triggered when the right mouse button is released on a tab.
|
||||
@endEventTable
|
||||
|
||||
@library{wxribbon}
|
||||
@category{ribbon}
|
||||
*/
|
||||
class wxRibbonBar : public wxRibbonControl
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Default constructor.
|
||||
With this constructor, Create() should be called in order to create
|
||||
the ribbon bar.
|
||||
*/
|
||||
wxRibbonBar();
|
||||
|
||||
/**
|
||||
Construct a ribbon bar with the given parameters.
|
||||
*/
|
||||
wxRibbonBar(wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxRIBBON_BAR_DEFAULT_STYLE);
|
||||
|
||||
/**
|
||||
Create a ribbon bar in two-step ribbon bar 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 = wxRIBBON_BAR_DEFAULT_STYLE);
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
virtual ~wxRibbonBar();
|
||||
|
||||
/**
|
||||
Set the margin widths (in pixels) on the left and right sides of the
|
||||
tab bar region of the ribbon bar. These margins will be painted with
|
||||
the tab background, but tabs and scroll buttons will never be painted
|
||||
in the margins.
|
||||
|
||||
The left margin could be used for rendering something equivalent to the
|
||||
"Office Button", though this is not currently implemented. The right
|
||||
margin could be used for rendering a help button, and/or MDI buttons,
|
||||
but again, this is not currently implemented.
|
||||
*/
|
||||
void SetTabCtrlMargins(int left, int right);
|
||||
|
||||
/**
|
||||
Set the art provider to be used be the ribbon bar. Also sets the art
|
||||
provider on all current wxRibbonPage children, and any wxRibbonPage
|
||||
children added in the future.
|
||||
|
||||
Note that unlike most other ribbon controls, the ribbon bar creates a
|
||||
default art provider when initialised, so an explicit call to
|
||||
SetArtProvider() is not required if the default art provider is
|
||||
sufficient. Alos unlike other ribbon controls, the ribbon bar takes
|
||||
ownership of the given pointer, and will delete it when the art
|
||||
provider is changed or the bar is destroyed. If this behaviour is not
|
||||
desired, then clone the art provider before setting it.
|
||||
*/
|
||||
void SetArtProvider(wxRibbonArtProvider* art);
|
||||
|
||||
/**
|
||||
Set the active page by index, without triggering any events.
|
||||
|
||||
@param page
|
||||
The zero-based index of the page to activate.
|
||||
@return @true if the specified page is now active, @false if it could
|
||||
not be activated (for example because the page index is invalid).
|
||||
*/
|
||||
bool SetActivePage(size_t page);
|
||||
|
||||
/**
|
||||
Set the active page, without triggering any events.
|
||||
|
||||
@param page
|
||||
The page to activate.
|
||||
@return @true if the specified page is now active, @false if it could
|
||||
not be activated (for example because the given page is not a child
|
||||
of the ribbon bar).
|
||||
*/
|
||||
bool SetActivePage(wxRibbonPage* page);
|
||||
|
||||
/**
|
||||
Get the index of the active page.
|
||||
|
||||
In the rare case of no page being active, -1 is returned.
|
||||
*/
|
||||
int GetActivePage() const;
|
||||
|
||||
/**
|
||||
Get a page by index.
|
||||
|
||||
NULL will be returned if the given index is out of range.
|
||||
*/
|
||||
wxRibbonPage* GetPage(int n);
|
||||
|
||||
/**
|
||||
Dismiss the expanded panel of the currently active page.
|
||||
|
||||
Calls and returns the value fromwxRibbonPage::DismissExpandedPanel()
|
||||
for the currently active page, or @false if there is no active page.
|
||||
*/
|
||||
bool DismissExpandedPanel();
|
||||
|
||||
/**
|
||||
Perform initial layout and size calculations of the bar and its
|
||||
children. This must be called after all of the bar's children have been
|
||||
created (and their children created, etc.) - if it is not, then windows
|
||||
may not be laid out or sized correctly.
|
||||
|
||||
Also calls wxRibbonPage::Realize() on each child page.
|
||||
*/
|
||||
virtual bool Realize();
|
||||
};
|
306
interface/wx/ribbon/buttonbar.h
Normal file
306
interface/wx/ribbon/buttonbar.h
Normal file
@@ -0,0 +1,306 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: ribbon/buttonbar.h
|
||||
// Purpose: interface of wxRibbonButtonBar
|
||||
// Author: Peter Cawley
|
||||
// RCS-ID: $Id$
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
Flags for button bar button size and state.
|
||||
|
||||
Buttons on a ribbon button bar can each come in three sizes: small, medium,
|
||||
and large. In some places this is called the size class, and the term size
|
||||
used for the pixel width and height associated with a particular size
|
||||
class.
|
||||
|
||||
A button can also be in zero or more hovered or active states, or in the
|
||||
disabled state.
|
||||
*/
|
||||
enum wxRibbonButtonBarButtonState
|
||||
{
|
||||
/**
|
||||
Button is small (the interpretation of small is dependant upon the art
|
||||
provider, but it will be smaller than medium).
|
||||
*/
|
||||
wxRIBBON_BUTTONBAR_BUTTON_SMALL = 0 << 0,
|
||||
|
||||
/**
|
||||
Button is medium sized (the interpretation of medium is dependant upon
|
||||
the art provider, but it will be between small and large).
|
||||
*/
|
||||
wxRIBBON_BUTTONBAR_BUTTON_MEDIUM = 1 << 0,
|
||||
|
||||
/**
|
||||
Button is large (the interpretation of large is dependant upon the art
|
||||
provider, but it will be larger than medium).
|
||||
*/
|
||||
wxRIBBON_BUTTONBAR_BUTTON_LARGE = 2 << 0,
|
||||
|
||||
/**
|
||||
A mask to extract button size from a combination of flags.
|
||||
*/
|
||||
wxRIBBON_BUTTONBAR_BUTTON_SIZE_MASK = 3 << 0,
|
||||
|
||||
/**
|
||||
The normal (non-dropdown) region of the button is being hovered over by
|
||||
the mouse cursor. Only applicable to normal and hybrid buttons.
|
||||
*/
|
||||
wxRIBBON_BUTTONBAR_BUTTON_NORMAL_HOVERED = 1 << 3,
|
||||
|
||||
/**
|
||||
The dropdown region of the button is being hovered over by the mouse
|
||||
cursor. Only applicable to dropdown and hybrid buttons.
|
||||
*/
|
||||
wxRIBBON_BUTTONBAR_BUTTON_DROPDOWN_HOVERED = 1 << 4,
|
||||
|
||||
/**
|
||||
A mask to extract button hover state from a combination of flags.
|
||||
*/
|
||||
wxRIBBON_BUTTONBAR_BUTTON_HOVER_MASK = wxRIBBON_BUTTONBAR_BUTTON_NORMAL_HOVERED | wxRIBBON_BUTTONBAR_BUTTON_DROPDOWN_HOVERED,
|
||||
|
||||
/**
|
||||
The normal (non-dropdown) region of the button is being pressed.
|
||||
Only applicable to normal and hybrid buttons.
|
||||
*/
|
||||
wxRIBBON_BUTTONBAR_BUTTON_NORMAL_ACTIVE = 1 << 5,
|
||||
|
||||
/**
|
||||
The dropdown region of the button is being pressed.
|
||||
Only applicable to dropdown and hybrid buttons.
|
||||
*/
|
||||
wxRIBBON_BUTTONBAR_BUTTON_DROPDOWN_ACTIVE = 1 << 6,
|
||||
|
||||
/**
|
||||
The button is disabled. Hover flags may still be set when a button
|
||||
is disabled, but should be ignored during drawing if the button is
|
||||
disabled.
|
||||
*/
|
||||
wxRIBBON_BUTTONBAR_BUTTON_DISABLED = 1 << 7,
|
||||
|
||||
/**
|
||||
A mask to extract button state from a combination of flags.
|
||||
*/
|
||||
wxRIBBON_BUTTONBAR_BUTTON_STATE_MASK = 0xF8,
|
||||
};
|
||||
|
||||
/**
|
||||
@class wxRibbonButtonBar
|
||||
|
||||
A ribbon button bar is similar to a traditional toolbar. It contains one or
|
||||
more buttons (button bar buttons, not wxButtons), each of which has a label
|
||||
and an icon. It differs from a wxRibbonToolBar in several ways:
|
||||
@li Individual buttons can grow and contract.
|
||||
@li Buttons have labels as well as bitmaps.
|
||||
@li Bitmaps are typically larger (at least 32x32 pixels) on a button bar
|
||||
compared to a tool bar (which typically has 16x15).
|
||||
@li There is no grouping of buttons on a button bar
|
||||
@li A button bar typically has a border around each individual button,
|
||||
whereas a tool bar typically has a border around each group of buttons.
|
||||
|
||||
@beginEventEmissionTable{wxRibbonButtonBarEvent}
|
||||
@event{EVT_RIBBONBUTTONBAR_CLICKED(id, func)}
|
||||
Triggered when the normal (non-dropdown) region of a button on the
|
||||
button bar is clicked.
|
||||
@event{EVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED(id, func)}
|
||||
Triggered when the dropdown region of a button on the button bar is
|
||||
clicked. wxRibbonButtonBarEvent::PopupMenu() should be called by the
|
||||
event handler if it wants to display a popup menu (which is what most
|
||||
dropdown buttons should be doing).
|
||||
@endEventTable
|
||||
|
||||
@library{wxribbon}
|
||||
@category{ribbon}
|
||||
*/
|
||||
class wxRibbonButtonBar : public wxRibbonControl
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Default constructor.
|
||||
With this constructor, Create() should be called in order to create
|
||||
the button bar.
|
||||
*/
|
||||
wxRibbonButtonBar();
|
||||
|
||||
/**
|
||||
Construct a ribbon button bar with the given parameters.
|
||||
@param parent
|
||||
Parent window for the button bar (typically a wxRibbonPanel).
|
||||
@param pos
|
||||
Initial position of the button bar.
|
||||
@param size
|
||||
Initial size of the button bar.
|
||||
@param style
|
||||
Button bar style, currently unused.
|
||||
*/
|
||||
wxRibbonButtonBar(wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0);
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
virtual ~wxRibbonButtonBar();
|
||||
|
||||
/**
|
||||
Create a button bar in two-step button bar 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);
|
||||
|
||||
/**
|
||||
Add a button to the button bar (simple version).
|
||||
*/
|
||||
virtual wxRibbonButtonBarButtonBase* AddButton(
|
||||
int button_id,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxString& help_string,
|
||||
wxRibbonButtonBarButtonKind kind = wxRIBBON_BUTTONBAR_BUTTON_NORMAL);
|
||||
|
||||
/**
|
||||
Add a dropdown button to the button bar (simple version).
|
||||
|
||||
@see AddButton()
|
||||
*/
|
||||
virtual wxRibbonButtonBarButtonBase* AddDropdownButton(
|
||||
int button_id,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxString& help_string = wxEmptyString);
|
||||
|
||||
/**
|
||||
Add a hybrid button to the button bar (simple version).
|
||||
|
||||
@see AddButton()
|
||||
*/
|
||||
virtual wxRibbonButtonBarButtonBase* AddHybridButton(
|
||||
int button_id,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxString& help_string = wxEmptyString);
|
||||
|
||||
/**
|
||||
Add a button to the button bar.
|
||||
|
||||
@param button_id
|
||||
ID of the new button (used for event callbacks).
|
||||
@param label
|
||||
Label of the new button.
|
||||
@param bitmap
|
||||
Large bitmap of the new button. Must be the same size as all other
|
||||
large bitmaps used on the button bar.
|
||||
@param bitmap_small
|
||||
Small bitmap of the new button. If left as null, then a small
|
||||
bitmap will be automatically generated. Must be the same size as
|
||||
all other small bitmaps used on the button bar.
|
||||
@param bitmap_disabled
|
||||
Large bitmap of the new button when it is disabled. If left as
|
||||
null, then a bitmap will be automatically generated from @a bitmap.
|
||||
@param bitmap_small_disabled
|
||||
Small bitmap of the new button when it is disabled. If left as
|
||||
null, then a bitmap will be automatically generated from @a
|
||||
bitmap_small.
|
||||
@param kind
|
||||
The kind of button to add.
|
||||
@param help_string
|
||||
The UI help string to associate with the new button.
|
||||
@param client_data
|
||||
Client data to associate with the new button.
|
||||
|
||||
@return An opaque pointer which can be used only with other button bar
|
||||
methods.
|
||||
|
||||
@see AddDropdownButton()
|
||||
@see AddHybridButton()
|
||||
*/
|
||||
virtual wxRibbonButtonBarButtonBase* AddButton(
|
||||
int button_id,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxBitmap& bitmap_small = wxNullBitmap,
|
||||
const wxBitmap& bitmap_disabled = wxNullBitmap,
|
||||
const wxBitmap& bitmap_small_disabled = wxNullBitmap,
|
||||
wxRibbonButtonBarButtonKind kind = wxRIBBON_BUTTONBAR_BUTTON_NORMAL,
|
||||
const wxString& help_string = wxEmptyString,
|
||||
wxObject* client_data = NULL);
|
||||
|
||||
/**
|
||||
Calculate button layouts and positions.
|
||||
|
||||
Must be called after buttons are added to the button bar, as otherwise
|
||||
the newly added buttons will not be displayed. In normal situations, it
|
||||
will be called automatically when wxRibbonBar::Realize() is called.
|
||||
*/
|
||||
virtual bool Realize();
|
||||
|
||||
/**
|
||||
Delete all buttons from the button bar.
|
||||
|
||||
@see DeleteButton()
|
||||
*/
|
||||
virtual void ClearButtons();
|
||||
|
||||
/**
|
||||
Delete a single button from the button bar.
|
||||
|
||||
@see ClearButtons()
|
||||
*/
|
||||
virtual bool DeleteButton(int button_id);
|
||||
|
||||
/**
|
||||
Enable or disable a single button on the bar.
|
||||
|
||||
@param button_id
|
||||
ID of the button to enable or disable.
|
||||
@param enable
|
||||
@true to enable the button, @false to disable it.
|
||||
*/
|
||||
virtual void EnableButton(int button_id, bool enable = true);
|
||||
};
|
||||
|
||||
/**
|
||||
@class wxRibbonButtonBarEvent
|
||||
|
||||
Event used to indicate various actions relating to a button on a
|
||||
wxRibbonButtonBar.
|
||||
|
||||
See wxRibbonButtonBar for available event types.
|
||||
|
||||
@library{wxribbon}
|
||||
@category{events,ribbon}
|
||||
|
||||
@see wxRibbonBar
|
||||
*/
|
||||
class wxRibbonButtonBarEvent : public wxCommandEvent
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRibbonButtonBarEvent(wxEventType command_type = wxEVT_NULL,
|
||||
int win_id = 0,
|
||||
wxRibbonButtonBar* bar = NULL);
|
||||
|
||||
/**
|
||||
Returns the bar which contains the button which the event relates to.
|
||||
*/
|
||||
wxRibbonButtonBar* GetBar();
|
||||
|
||||
/**
|
||||
Sets the button bar relating to this event.
|
||||
*/
|
||||
void SetBar(wxRibbonButtonBar* bar);
|
||||
|
||||
/**
|
||||
Display a popup menu as a result of this (dropdown clicked) event.
|
||||
*/
|
||||
bool PopupMenu(wxMenu* menu);
|
||||
};
|
167
interface/wx/ribbon/control.h
Normal file
167
interface/wx/ribbon/control.h
Normal file
@@ -0,0 +1,167 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: ribbon/control.h
|
||||
// Purpose: interface of wxRibbonControl
|
||||
// Author: Peter Cawley
|
||||
// RCS-ID: $Id$
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxRibbonControl
|
||||
|
||||
wxRibbonControl serves as a base class for all controls which share the
|
||||
ribbon charactertics of having a ribbon art provider, and (optionally)
|
||||
non-continous resizing. Despite what the name may imply, it is not the
|
||||
top-level control for creating a ribbon interface - that is wxRibbonBar.
|
||||
|
||||
Ribbon controls often have a region which is "transparent", and shows the
|
||||
contents of the ribbon page or panel behind it. If implementing a new
|
||||
ribbon control, then it may be useful to realise that this effect is done
|
||||
by the art provider when painting the background of the control, and hence
|
||||
in the paint handler for the new control, you should call a draw background
|
||||
method on the art provider (wxRibbonArtProvider::DrawButtonBarBackground()
|
||||
and wxRibbonArtProvider::DrawToolBarBackground() typically just redraw what
|
||||
is behind the rectangle being painted) if you want transparent regions.
|
||||
|
||||
@library{wxribbon}
|
||||
@category{ribbon}
|
||||
*/
|
||||
class wxRibbonControl : public wxControl
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRibbonControl();
|
||||
|
||||
/**
|
||||
Constructor.
|
||||
|
||||
If @a parent is a wxRibbonControl with a non-NULL art provider, then
|
||||
the art provider of new control is set to that of @a parent.
|
||||
*/
|
||||
wxRibbonControl(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxControlNameStr);
|
||||
|
||||
/**
|
||||
Set the art provider to be used. In many cases, setting the art provider
|
||||
will also set the art provider on all child windows which extend
|
||||
wxRibbonControl.
|
||||
|
||||
In most cases, controls will not take ownership of the given pointer,
|
||||
with the notable exception being wxRibbonBar::SetArtProvider().
|
||||
*/
|
||||
virtual void SetArtProvider(wxRibbonArtProvider* art);
|
||||
|
||||
/**
|
||||
Get the art provider to be used. Note that until an art provider has
|
||||
been set in some way, this function may return NULL.
|
||||
*/
|
||||
wxRibbonArtProvider* GetArtProvider() const;
|
||||
|
||||
/**
|
||||
@return @true if this window can take any size (greater than its minimum
|
||||
size), @false if it can only take certain sizes.
|
||||
|
||||
@see GetNextSmallerSize()
|
||||
@see GetNextLargerSize()
|
||||
*/
|
||||
virtual bool IsSizingContinuous() const;
|
||||
|
||||
/**
|
||||
If sizing is not continuous, then return a suitable size for the control
|
||||
which is smaller than the current size.
|
||||
|
||||
@param direction
|
||||
The direction(s) in which the size should reduce.
|
||||
@return
|
||||
The current size if there is no smaller size, otherwise a suitable
|
||||
size which is smaller in the given direction(s), and the same as the
|
||||
current size in the other direction (if any).
|
||||
|
||||
@see IsSizingContinuous()
|
||||
*/
|
||||
wxSize GetNextSmallerSize(wxOrientation direction) const;
|
||||
|
||||
/**
|
||||
If sizing is not continuous, then return a suitable size for the control
|
||||
which is smaller than the given size.
|
||||
|
||||
@param direction
|
||||
The direction(s) in which the size should reduce.
|
||||
@param relative_to
|
||||
The size for which a smaller size should be found.
|
||||
@return
|
||||
@a relative_to if there is no smaller size, otherwise a suitable
|
||||
size which is smaller in the given direction(s), and the same as
|
||||
@a relative_to in the other direction (if any).
|
||||
|
||||
@see IsSizingContinuous()
|
||||
@see DoGetNextSmallerSize()
|
||||
*/
|
||||
wxSize GetNextSmallerSize(wxOrientation direction, wxSize relative_to) const;
|
||||
|
||||
/**
|
||||
If sizing is not continuous, then return a suitable size for the control
|
||||
which is larger then the current size.
|
||||
|
||||
@param direction
|
||||
The direction(s) in which the size should increase.
|
||||
@return
|
||||
The current size if there is no larger size, otherwise a suitable
|
||||
size which is larger in the given direction(s), and the same as the
|
||||
current size in the other direction (if any).
|
||||
|
||||
@see IsSizingContinuous()
|
||||
*/
|
||||
wxSize GetNextLargerSize(wxOrientation direction) const;
|
||||
|
||||
/**
|
||||
If sizing is not continuous, then return a suitable size for the control
|
||||
which is larger then the given size.
|
||||
|
||||
@param direction
|
||||
The direction(s) in which the size should increase.
|
||||
@param relative_to
|
||||
The size for which a larger size should be found.
|
||||
@return
|
||||
@a relative_to if there is no larger size, otherwise a suitable
|
||||
size which is larger in the given direction(s), and the same as
|
||||
@a relative_to in the other direction (if any).
|
||||
|
||||
@see IsSizingContinuous()
|
||||
@see DoGetNextLargerSize()
|
||||
*/
|
||||
wxSize GetNextLargerSize(wxOrientation direction, wxSize relative_to) const;
|
||||
|
||||
/**
|
||||
Perform initial size and layout calculations after children have been
|
||||
added, and/or realize children.
|
||||
*/
|
||||
virtual bool Realize();
|
||||
|
||||
/**
|
||||
Alias for Realize().
|
||||
*/
|
||||
bool Realise();
|
||||
|
||||
protected:
|
||||
/**
|
||||
Implementation of GetNextSmallerSize().
|
||||
Controls which have non-continuous sizing must override this virtual
|
||||
function rather than GetNextSmallerSize().
|
||||
*/
|
||||
virtual wxSize DoGetNextSmallerSize(wxOrientation direction,
|
||||
wxSize relative_to) const;
|
||||
|
||||
/**
|
||||
Implementation of GetNextLargerSize().
|
||||
Controls which have non-continuous sizing must override this virtual
|
||||
function rather than GetNextLargerSize().
|
||||
*/
|
||||
virtual wxSize DoGetNextLargerSize(wxOrientation direction,
|
||||
wxSize relative_to) const;
|
||||
};
|
281
interface/wx/ribbon/gallery.h
Normal file
281
interface/wx/ribbon/gallery.h
Normal file
@@ -0,0 +1,281 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// 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
|
||||
|
||||
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.
|
||||
|
||||
@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_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).
|
||||
@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;
|
||||
|
||||
/**
|
||||
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
|
||||
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);
|
||||
|
||||
/**
|
||||
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);
|
||||
|
||||
/**
|
||||
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);
|
||||
|
||||
/**
|
||||
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.
|
||||
*/
|
||||
void* GetItemClientData(const wxRibbonGalleryItem* item) const;
|
||||
|
||||
/**
|
||||
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.
|
||||
*/
|
||||
wxRibbonGalleryButtonState GetExtensionButtonState() const;
|
||||
|
||||
/**
|
||||
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.
|
||||
*/
|
||||
void EnsureVisible(const wxRibbonGalleryItem* item);
|
||||
};
|
||||
|
||||
/**
|
||||
@class wxRibbonGalleryEvent
|
||||
|
||||
@library{wxribbon}
|
||||
@category{events,ribbon}
|
||||
|
||||
@see wxRibbonBar
|
||||
*/
|
||||
class wxRibbonButtonBarEvent : public wxCommandEvent
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRibbonButtonBarEvent(wxEventType command_type = wxEVT_NULL,
|
||||
int win_id = 0,
|
||||
wxRibbonGallery* gallery = NULL,
|
||||
wxRibbonGalleryItem* item = NULL);
|
||||
|
||||
/**
|
||||
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.
|
||||
*/
|
||||
void SetGalleryItem(wxRibbonGalleryItem* item);
|
||||
};
|
182
interface/wx/ribbon/page.h
Normal file
182
interface/wx/ribbon/page.h
Normal file
@@ -0,0 +1,182 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: ribbon/page.h
|
||||
// Purpose: interface of wxRibbonPage
|
||||
// Author: Peter Cawley
|
||||
// RCS-ID: $Id$
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxRibbonPage
|
||||
|
||||
Container for related ribbon panels, and a tab within a ribbon bar.
|
||||
|
||||
@see wxRibbonBar
|
||||
@see wxRibbonPanel
|
||||
|
||||
@library{wxribbon}
|
||||
@category{ribbon}
|
||||
*/
|
||||
class wxRibbonPage : public wxRibbonControl
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Default constructor.
|
||||
With this constructor, Create() should be called in order to create
|
||||
the ribbon page.
|
||||
*/
|
||||
wxRibbonPage();
|
||||
|
||||
/**
|
||||
Constructs a ribbon page, which must be a child of a ribbon bar.
|
||||
|
||||
@param parent
|
||||
Pointer to a parent wxRibbonBar (unlike most controls, a wxRibbonPage
|
||||
can only have wxRibbonBar as a parent).
|
||||
@param id
|
||||
Window identifier.
|
||||
@param label
|
||||
Label to be used in the wxRibbonBar's tab list for this page (if the
|
||||
ribbon bar is set to display labels).
|
||||
@param icon
|
||||
Icon to be used in the wxRibbonBar's tab list for this page (if the
|
||||
ribbon bar is set to display icons).
|
||||
@param style
|
||||
Currently unused, should be zero.
|
||||
*/
|
||||
wxRibbonPage(wxRibbonBar* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& label = wxEmptyString,
|
||||
const wxBitmap& icon = wxNullBitmap,
|
||||
long style = 0);
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
virtual ~wxRibbonPage();
|
||||
|
||||
/**
|
||||
Create a ribbon page in two-step ribbon page construction.
|
||||
Should only be called when the default constructor is used, and
|
||||
arguments have the same meaning as in the full constructor.
|
||||
*/
|
||||
bool Create(wxRibbonBar* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& label = wxEmptyString,
|
||||
const wxBitmap& icon = wxNullBitmap,
|
||||
long style = 0);
|
||||
|
||||
/**
|
||||
Set the art provider to be used. Normally called automatically by
|
||||
wxRibbonBar when the page is created, or the art provider changed on the
|
||||
bar.
|
||||
|
||||
The new art provider will be propagated to the children of the page.
|
||||
*/
|
||||
void SetArtProvider(wxRibbonArtProvider* art);
|
||||
|
||||
/**
|
||||
Get the icon used for the page in the ribbon bar tab area (only
|
||||
displayed if the ribbon bar is actuallt showing icons).
|
||||
*/
|
||||
wxBitmap& GetIcon();
|
||||
|
||||
/**
|
||||
Set the size of the page and the external scroll buttons (if any).
|
||||
|
||||
When a page is too small to display all of its children, scroll buttons
|
||||
will appear (and if the page is sized up enough, they will disappear again).
|
||||
Slightly counter-intuively, these buttons are created as siblings of the
|
||||
page rather than children of the page (to achieve correct cropping and
|
||||
paint ordering of the children and the buttons). When there are no scroll
|
||||
buttons, this function behaves the same as SetSize(), however when there
|
||||
are scroll buttons, it positions them at the edges of the given area, and
|
||||
then calls SetSize() with the remaining area.
|
||||
|
||||
This is provided as a separate function to SetSize() rather than within
|
||||
the implementation of SetSize(), as iteracting algorithms may not expect
|
||||
SetSize() to also set the size of siblings.
|
||||
*/
|
||||
void SetSizeWithScrollButtonAdjustment(int x, int y, int width, int height);
|
||||
|
||||
/**
|
||||
Expand a rectangle of the page to include external scroll buttons (if
|
||||
any). When no scroll buttons are shown, has no effect.
|
||||
|
||||
@param[in,out] rect
|
||||
The rectangle to adjust. The width and height will not be reduced,
|
||||
and the x and y will not be increased.
|
||||
*/
|
||||
void AdjustRectToIncludeScrollButtons(wxRect* rect) const;
|
||||
|
||||
/**
|
||||
Dismiss the current externally expanded panel, if there is one.
|
||||
|
||||
When a ribbon panel automatically minimises, it can be externally
|
||||
expanded into a floating window. When the user clicks a button in such
|
||||
a panel, the panel should generally re-minimise. Event handlers for
|
||||
buttons on ribbon panels should call this method to achieve this
|
||||
behaviour.
|
||||
|
||||
@return @true if a panel was minimised, @false otherwise.
|
||||
*/
|
||||
bool DismissExpandedPanel();
|
||||
|
||||
/**
|
||||
Perform a full re-layout of all panels on the page.
|
||||
|
||||
Should be called after panels are added to the page, or the sizing
|
||||
behaviour of a panel on the page changes (i.e. due to children being
|
||||
added to it). Usually called automatically when wxRibbonBar::Realize()
|
||||
is called.
|
||||
|
||||
Will invoke wxRibbonPanel::Realize() for all child panels.
|
||||
*/
|
||||
virtual bool Realize();
|
||||
|
||||
/**
|
||||
Scroll the page by some amount up / down / left / right.
|
||||
|
||||
When the page's children are too big to fit in the onscreen area given to
|
||||
the page, scroll buttons will appear, and the page can be programatically
|
||||
scrolled. Positive values of @a lines will scroll right or down, while
|
||||
negative values will scroll up or left (depending on the direction in which
|
||||
panels are stacked). A line is equivalent to a constant number of pixels.
|
||||
|
||||
@return @true if the page scrolled at least one pixel in the given
|
||||
direction, @false if it did not scroll.
|
||||
|
||||
@see GetMajorAxis()
|
||||
@see ScrollPixels()
|
||||
*/
|
||||
virtual bool ScrollLines(int lines);
|
||||
|
||||
/**
|
||||
Scroll the page by a set number of pixels up / down / left / right.
|
||||
|
||||
When the page's children are too big to fit in the onscreen area given to
|
||||
the page, scroll buttons will appear, and the page can be programatically
|
||||
scrolled. Positive values of @a lines will scroll right or down, while
|
||||
negative values will scroll up or left (depending on the direction in which
|
||||
panels are stacked).
|
||||
|
||||
@return @true if the page scrolled at least one pixel in the given
|
||||
direction, @false if it did not scroll.
|
||||
|
||||
@see GetMajorAxis()
|
||||
@see ScrollLines()
|
||||
*/
|
||||
bool ScrollPixels(int pixels);
|
||||
|
||||
/**
|
||||
Get the direction in which ribbon panels are stacked within the page.
|
||||
|
||||
This is controlled by the style of the containing wxRibbonBar, meaning
|
||||
that all pages within a bar will have the same major axis. As well as
|
||||
being the direction in which panels are stacked, it is also the axis in
|
||||
which scrolling will occur (when required).
|
||||
|
||||
@return wxHORIZONTAL or wxVERTICAL (never wxBOTH).
|
||||
*/
|
||||
wxOrientation GetMajorAxis() const;
|
||||
};
|
200
interface/wx/ribbon/panel.h
Normal file
200
interface/wx/ribbon/panel.h
Normal file
@@ -0,0 +1,200 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: ribbon/panel.h
|
||||
// Purpose: interface of wxRibbonPage
|
||||
// Author: Peter Cawley
|
||||
// RCS-ID: $Id$
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxRibbonPanel
|
||||
|
||||
Serves as a container for a group of (ribbon) controls. A wxRibbonPage will
|
||||
typically have panels for children, with the controls for that page placed
|
||||
on the panels.
|
||||
|
||||
A panel adds a border and label to a group of controls, and can be
|
||||
minimised (either automatically to conserve space, or manually by the user).
|
||||
|
||||
@sa wxRibbonPage
|
||||
|
||||
@beginStyleTable
|
||||
@style{wxRIBBON_PANEL_DEFAULT_STYLE}
|
||||
Defined as no other flags set.
|
||||
@style{wxRIBBON_PANEL_NO_AUTO_MINIMISE}
|
||||
Prevents the panel from automatically minimising to conserve screen
|
||||
space.
|
||||
@style{wxRIBBON_PANEL_EXT_BUTTON}
|
||||
Causes an extension button to be shown in the panel's chrome (if the
|
||||
bar in which it is contained has wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS
|
||||
set). The behaviour of this button is application controlled, but
|
||||
typically will show an extended drop-down menu relating to the
|
||||
panel.
|
||||
@style{wxRIBBON_PANEL_MINIMISE_BUTTON}
|
||||
Causes a (de)minimise button to be shown in the panel's chrome (if
|
||||
the bar in which it is contained has the
|
||||
wxRIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS style set). This flag is
|
||||
typically combined with wxRIBBON_PANEL_NO_AUTO_MINIMISE to make a
|
||||
panel which the user always has manual control over when it
|
||||
minimises.
|
||||
@endStyleTable
|
||||
|
||||
@library{wxribbon}
|
||||
@category{ribbon}
|
||||
*/
|
||||
class wxRibbonPanel : public wxRibbonControl
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Default constructor.
|
||||
With this constructor, Create() should be called in order to create
|
||||
the ribbon panel.
|
||||
*/
|
||||
wxRibbonPanel();
|
||||
|
||||
/**
|
||||
Constructs a ribbon panel.
|
||||
|
||||
@param parent
|
||||
Pointer to a parent window, which is typically a wxRibbonPage,
|
||||
though it can be any window.
|
||||
@param id
|
||||
Window identifier.
|
||||
@param label
|
||||
Label to be used in the wxRibbonPanel's chrome.
|
||||
@param minimised_icon
|
||||
Icon to be used in place of the panel's children when the panel
|
||||
is minimised.
|
||||
@param pos
|
||||
The initial position of the panel. Not relevant when the parent is
|
||||
a ribbon page, as the position and size of the panel will be
|
||||
dictated by the page.
|
||||
@param size
|
||||
The initial size of the panel. Not relevant when the parent is a
|
||||
ribbon page, as the position and size of the panel will be
|
||||
dictated by the page.
|
||||
@param style
|
||||
Style flags for the panel.
|
||||
*/
|
||||
wxRibbonPanel(wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& label = wxEmptyString,
|
||||
const wxBitmap& minimised_icon = wxNullBitmap,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxRIBBON_PANEL_DEFAULT_STYLE);
|
||||
|
||||
/**
|
||||
Create a ribbon panel in two-step ribbon panel 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 wxString& label = wxEmptyString,
|
||||
const wxBitmap& icon = wxNullBitmap,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxRIBBON_PANEL_DEFAULT_STYLE);
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
virtual ~wxRibbonPanel();
|
||||
|
||||
/**
|
||||
Get the bitmap to be used in place of the panel children when it is
|
||||
minimised.
|
||||
*/
|
||||
wxBitmap& GetMinimisedIcon();
|
||||
const wxBitmap& GetMinimisedIcon() const;
|
||||
|
||||
/**
|
||||
Query if the panel is currently minimised.
|
||||
*/
|
||||
bool IsMinimised() const;
|
||||
|
||||
/**
|
||||
Query if the panel would be minimised at a given size.
|
||||
*/
|
||||
bool IsMinimised(wxSize at_size) const;
|
||||
|
||||
/**
|
||||
Query is the mouse is currently hovered over the panel.
|
||||
@return @true if the cursor is within the bounds of the panel (i.e.
|
||||
hovered over the panel or one of its children), @false otherwise.
|
||||
*/
|
||||
bool IsHovered() const;
|
||||
|
||||
/**
|
||||
Query if the panel can automatically minimise itself at small sizes.
|
||||
*/
|
||||
bool CanAutoMinimise() const;
|
||||
|
||||
/**
|
||||
Show the panel externally expanded.
|
||||
|
||||
When a panel is minimised, it can be shown full-size in a pop-out
|
||||
window, which is refered to as being (externally) expanded. Note that
|
||||
when a panel is expanded, there exist two panels - the original panel
|
||||
(which is refered to as the dummy panel) and the expanded panel. The
|
||||
original is termed a dummy as it sits in the ribbon bar doing nothing,
|
||||
while the expanded panel holds the panel children.
|
||||
|
||||
@return @true if the panel was expanded, @false if it was not (possibly
|
||||
due to it not being minimised, or already being expanded).
|
||||
|
||||
@see HideExpanded()
|
||||
@see GetExpandedPanel()
|
||||
*/
|
||||
bool ShowExpanded();
|
||||
|
||||
/**
|
||||
Hide the panel's external expansion.
|
||||
|
||||
@return @true if the panel was un-expanded, @false if it was not
|
||||
(normally due to it not being expanded in the first place).
|
||||
|
||||
@see HideExpanded()
|
||||
@see GetExpandedPanel()
|
||||
*/
|
||||
bool HideExpanded();
|
||||
|
||||
/**
|
||||
Set the art provider to be used. Normally called automatically by
|
||||
wxRibbonPage when the panel is created, or the art provider changed on the
|
||||
page.
|
||||
|
||||
The new art provider will be propagated to the children of the panel.
|
||||
*/
|
||||
void SetArtProvider(wxRibbonArtProvider* art);
|
||||
|
||||
/**
|
||||
Realize all children of the panel.
|
||||
*/
|
||||
bool Realize();
|
||||
|
||||
/**
|
||||
Get the dummy panel of an expanded panel.
|
||||
|
||||
Note that this should be called on an expanded panel to get the dummy
|
||||
associated with it - it will return NULL when called on the dummy
|
||||
itself.
|
||||
|
||||
@see ShowExpanded()
|
||||
@see GetExpandedPanel()
|
||||
*/
|
||||
wxRibbonPanel* GetExpandedDummy();
|
||||
|
||||
/**
|
||||
Get the expanded panel of a dummy panel.
|
||||
|
||||
Note that this should be called on a dummy panel to get the expanded
|
||||
panel associated with it - it will return NULL when called on the
|
||||
expanded panel itself.
|
||||
|
||||
@see ShowExpanded()
|
||||
@see GetExpandedDummy()
|
||||
*/
|
||||
wxRibbonPanel* GetExpandedPanel();
|
||||
};
|
159
interface/wx/ribbon/toolbar.h
Normal file
159
interface/wx/ribbon/toolbar.h
Normal file
@@ -0,0 +1,159 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: ribbon/toolbar.h
|
||||
// Purpose: interface of wxRibbonToolBar
|
||||
// Author: Peter Cawley
|
||||
// RCS-ID: $Id$
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxRibbonToolBar
|
||||
|
||||
A ribbon tool bar is similar to a traditional toolbar which has no labels.
|
||||
It contains one or more tool groups, each of which contains one or more
|
||||
tools. Each tool is represented by a (generally small, i.e. 16x15) bitmap.
|
||||
|
||||
@beginEventEmissionTable{wxRibbonToolBarEvent}
|
||||
@event{EVT_RIBBONTOOLBAR_CLICKED(id, func)}
|
||||
Triggered when the normal (non-dropdown) region of a tool on the tool
|
||||
bar is clicked.
|
||||
@event{EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED(id, func)}
|
||||
Triggered when the dropdown region of a tool on the tool bar is
|
||||
clicked. wxRibbonToolBarEvent::PopupMenu() should be called by the
|
||||
event handler if it wants to display a popup menu (which is what most
|
||||
dropdown tools should be doing).
|
||||
@endEventTable
|
||||
|
||||
@library{wxribbon}
|
||||
@category{ribbon}
|
||||
*/
|
||||
class wxRibbonToolBar : public wxRibbonControl
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Default constructor.
|
||||
With this constructor, Create() should be called in order to create
|
||||
the tool bar.
|
||||
*/
|
||||
wxRibbonToolBar();
|
||||
|
||||
/**
|
||||
Construct a ribbon tool bar with the given parameters.
|
||||
@param parent
|
||||
Parent window for the tool bar (typically a wxRibbonPanel).
|
||||
@param pos
|
||||
Initial position of the tool bar.
|
||||
@param size
|
||||
Initial size of the tool bar.
|
||||
@param style
|
||||
Tool bar style, currently unused.
|
||||
*/
|
||||
wxRibbonToolBar(wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0);
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
virtual ~wxRibbonToolBar();
|
||||
|
||||
/**
|
||||
Create a tool bar in two-step tool bar 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);
|
||||
|
||||
/**
|
||||
Add a tool to the tool bar (simple version).
|
||||
*/
|
||||
virtual wxRibbonToolBarToolBase* AddTool(
|
||||
int tool_id,
|
||||
const wxBitmap& bitmap,
|
||||
const wxString& help_string,
|
||||
wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL);
|
||||
|
||||
/**
|
||||
Add a dropdown tool to the tool bar (simple version).
|
||||
|
||||
@see AddTool()
|
||||
*/
|
||||
virtual wxRibbonToolBarToolBase* AddDropdownTool(
|
||||
int tool_id,
|
||||
const wxBitmap& bitmap,
|
||||
const wxString& help_string = wxEmptyString);
|
||||
|
||||
/**
|
||||
Add a hybrid tool to the tool bar (simple version).
|
||||
|
||||
@see AddTool()
|
||||
*/
|
||||
virtual wxRibbonToolBarToolBase* AddHybridTool(
|
||||
int tool_id,
|
||||
const wxBitmap& bitmap,
|
||||
const wxString& help_string = wxEmptyString);
|
||||
|
||||
/**
|
||||
Add a tool to the tool bar.
|
||||
|
||||
@param tool_id
|
||||
ID of the new tool (used for event callbacks).
|
||||
@param bitmap
|
||||
Bitmap to use as the foreground for the new tool. Does not have
|
||||
to be the same size as other tool bitmaps, but should be similar
|
||||
as otherwise it will look visually odd.
|
||||
@param bitmap_disabled
|
||||
Bitmap to use when the tool is disabled. If left as wxNullBitmap,
|
||||
then a bitmap will be automatically generated from @a bitmap.
|
||||
@param help_string
|
||||
The UI help string to associate with the new tool.
|
||||
@param kind
|
||||
The kind of tool to add.
|
||||
@param client_data
|
||||
Client data to associate with the new tool.
|
||||
|
||||
@return An opaque pointer which can be used only with other tool bar
|
||||
methods.
|
||||
|
||||
@see AddDropdownTool()
|
||||
@see AddHybridTool()
|
||||
@saa AddSeparator()
|
||||
*/
|
||||
virtual wxRibbonToolBarToolBase* AddTool(
|
||||
int tool_id,
|
||||
const wxBitmap& bitmap,
|
||||
const wxBitmap& bitmap_disabled = wxNullBitmap,
|
||||
const wxString& help_string = wxEmptyString,
|
||||
wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL,
|
||||
wxObject* client_data = NULL);
|
||||
|
||||
/**
|
||||
Add a separator to the tool bar.
|
||||
|
||||
Separators are used to separate tools into groups. As such, a separator
|
||||
is not explicity drawn, but is visually seen as the gap between tool
|
||||
groups.
|
||||
*/
|
||||
virtual wxRibbonToolBarToolBase* AddSeparator();
|
||||
|
||||
/**
|
||||
Set the number of rows to distribute tool groups over.
|
||||
|
||||
Tool groups can be distributed over a variable number of rows. The way
|
||||
in which groups are assigned to rows is not specificed, and the order
|
||||
of groups may change, but they will be distributed in such a way as to
|
||||
minimise the overall size of the tool bar.
|
||||
|
||||
@param nMin
|
||||
The minimum number of rows to use.
|
||||
@param nMax
|
||||
The maximum number of rows to use (defaults to nMin).
|
||||
*/
|
||||
virtual void SetRows(int nMin, int nMax = -1);
|
||||
};
|
Reference in New Issue
Block a user