initial commit
Signed-off-by: Peter Siegmund <mars3142@noreply.mars3142.dev>
This commit is contained in:
1085
libs/wxWidgets-3.3.1/interface/wx/ribbon/art.h
Normal file
1085
libs/wxWidgets-3.3.1/interface/wx/ribbon/art.h
Normal file
File diff suppressed because it is too large
Load Diff
475
libs/wxWidgets-3.3.1/interface/wx/ribbon/bar.h
Normal file
475
libs/wxWidgets-3.3.1/interface/wx/ribbon/bar.h
Normal file
@@ -0,0 +1,475 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: ribbon/bar.h
|
||||
// Purpose: interface of wxRibbonBar
|
||||
// Author: Peter Cawley
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
enum wxRibbonBarOption
|
||||
{
|
||||
wxRIBBON_BAR_SHOW_PAGE_LABELS,
|
||||
wxRIBBON_BAR_SHOW_PAGE_ICONS,
|
||||
wxRIBBON_BAR_FLOW_HORIZONTAL,
|
||||
wxRIBBON_BAR_FLOW_VERTICAL,
|
||||
wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS,
|
||||
wxRIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS,
|
||||
wxRIBBON_BAR_ALWAYS_SHOW_TABS,
|
||||
wxRIBBON_BAR_SHOW_TOGGLE_BUTTON,
|
||||
wxRIBBON_BAR_SHOW_HELP_BUTTON,
|
||||
wxRIBBON_BAR_DEFAULT_STYLE,
|
||||
wxRIBBON_BAR_FOLDBAR_STYLE
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
The possible display modes of the panel area of a wxRibbonBar widget.
|
||||
|
||||
@see wxRibbonBar::ShowPanels()
|
||||
@see wxRibbonBar::GetDisplayMode()
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
enum wxRibbonDisplayMode
|
||||
{
|
||||
/**
|
||||
The panel area is visible and pinned: it remains visible when the
|
||||
ribbon bar loses the focus.
|
||||
*/
|
||||
wxRIBBON_BAR_PINNED,
|
||||
|
||||
/**
|
||||
The panel area is hidden: only the pages tabs remain visible.
|
||||
*/
|
||||
wxRIBBON_BAR_MINIMIZED,
|
||||
|
||||
/**
|
||||
The panel area is visible, but not pinned: it minimizes as soon as the
|
||||
focus is lost.
|
||||
*/
|
||||
wxRIBBON_BAR_EXPANDED
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@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 = nullptr);
|
||||
|
||||
/**
|
||||
Returns the page being changed to, or being clicked on.
|
||||
*/
|
||||
wxRibbonPage* GetPage();
|
||||
|
||||
/**
|
||||
Sets the page relating to this event.
|
||||
*/
|
||||
void SetPage(wxRibbonPage* page);
|
||||
};
|
||||
|
||||
|
||||
wxEventType wxEVT_RIBBONBAR_PAGE_CHANGED;
|
||||
wxEventType wxEVT_RIBBONBAR_PAGE_CHANGING;
|
||||
wxEventType wxEVT_RIBBONBAR_TAB_MIDDLE_DOWN;
|
||||
wxEventType wxEVT_RIBBONBAR_TAB_MIDDLE_UP;
|
||||
wxEventType wxEVT_RIBBONBAR_TAB_RIGHT_DOWN;
|
||||
wxEventType wxEVT_RIBBONBAR_TAB_RIGHT_UP;
|
||||
wxEventType wxEVT_RIBBONBAR_TAB_LEFT_DCLICK;
|
||||
wxEventType wxEVT_RIBBONBAR_TOGGLED;
|
||||
wxEventType wxEVT_RIBBONBAR_HELP_CLICK;
|
||||
|
||||
|
||||
class wxRibbonPageTabInfo
|
||||
{
|
||||
public:
|
||||
wxRect rect;
|
||||
wxRibbonPage *page;
|
||||
int ideal_width;
|
||||
int small_begin_need_separator_width;
|
||||
int small_must_have_separator_width;
|
||||
int minimum_width;
|
||||
bool active;
|
||||
bool hovered;
|
||||
bool highlight;
|
||||
bool shown;
|
||||
};
|
||||
|
||||
/**
|
||||
A vector of wxRibbonPageTabInfo.
|
||||
|
||||
This class is actually a legacy container (see @ref overview_container for
|
||||
more details), but it can, and should be, handled as just a vector of
|
||||
wxRibbonPageTabInfo objects in the application code.
|
||||
*/
|
||||
class wxRibbonPageTabInfoArray : public std::vector<wxRibbonPageTabInfoArray>
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@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.
|
||||
|
||||
@see wxRibbonPage
|
||||
@see wxRibbonPanel
|
||||
|
||||
@beginStyleTable
|
||||
@style{wxRIBBON_BAR_DEFAULT_STYLE}
|
||||
Defined as wxRIBBON_BAR_FLOW_HORIZONTAL |
|
||||
wxRIBBON_BAR_SHOW_PAGE_LABELS | wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS |
|
||||
wxRIBBON_BAR_SHOW_TOGGLE_BUTTON | wxRIBBON_BAR_SHOW_HELP_BUTTON.
|
||||
@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).
|
||||
@style{wxRIBBON_BAR_SHOW_TOGGLE_BUTTON}
|
||||
Causes a toggle button to appear on the ribbon bar at top-right corner.
|
||||
This style is new since wxWidgets 2.9.5.
|
||||
@style{wxRIBBON_BAR_SHOW_HELP_BUTTON}
|
||||
Causes a help button to appear on the ribbon bar at the top-right corner.
|
||||
This style is new since wxWidgets 2.9.5.
|
||||
@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.
|
||||
@event{EVT_RIBBONBAR_TAB_LEFT_DCLICK(id, func)}
|
||||
Triggered when the left mouse button is double clicked on a tab.
|
||||
@event{EVT_RIBBONBAR_TOGGLED(id, func)}
|
||||
Triggered when the button triggering the ribbon bar is clicked. This
|
||||
event is new since wxWidgets 2.9.5.
|
||||
@event{EVT_RIBBONBAR_HELP_CLICK(id, func)}
|
||||
Triggered when the help button is clicked. This even is new since
|
||||
wxWidgets 2.9.5.
|
||||
@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. Also, 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);
|
||||
|
||||
/**
|
||||
Get a page by window ID.
|
||||
|
||||
@NULL will be returned if no page with the ID is found.
|
||||
|
||||
@since 3.3.0
|
||||
*/
|
||||
wxRibbonPage* GetPageById(wxWindowID id);
|
||||
|
||||
/**
|
||||
Get the number of pages in this bar.
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
size_t GetPageCount() const;
|
||||
|
||||
/**
|
||||
Dismiss the expanded panel of the currently active page.
|
||||
|
||||
Calls and returns the value from wxRibbonPage::DismissExpandedPanel()
|
||||
for the currently active page, or @false if there is no active page.
|
||||
*/
|
||||
bool DismissExpandedPanel();
|
||||
|
||||
/**
|
||||
Returns the number for a given ribbon bar page.
|
||||
|
||||
The number can be used in other ribbon bar calls.
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
int GetPageNumber(wxRibbonPage* page) const;
|
||||
|
||||
/**
|
||||
Delete a single page from this ribbon bar.
|
||||
|
||||
The user must call wxRibbonBar::Realize() after one (or more) calls to
|
||||
this function.
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
void DeletePage(size_t n);
|
||||
|
||||
/**
|
||||
Delete all pages from the ribbon bar.
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
void ClearPages();
|
||||
|
||||
/**
|
||||
Indicates whether the tab for the given page is shown to the user or
|
||||
not.
|
||||
|
||||
By default all page tabs are shown.
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
bool IsPageShown(size_t page) const;
|
||||
|
||||
/**
|
||||
Show or hide the tab for a given page.
|
||||
|
||||
After showing or hiding a tab, you need to call wxRibbonBar::Realize().
|
||||
If you hide the tab for the currently active page (GetActivePage) then
|
||||
you should call SetActivePage to activate a different page.
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
void ShowPage(size_t page, bool show_tab=true);
|
||||
|
||||
/**
|
||||
Hides the tab for a given page.
|
||||
|
||||
Equivalent to @c ShowPage(page, false).
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
void HidePage(size_t page);
|
||||
|
||||
/**
|
||||
Indicates whether a tab is currently highlighted.
|
||||
|
||||
@see AddPageHighlight()
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
bool IsPageHighlighted(size_t page) const;
|
||||
|
||||
/**
|
||||
Highlight the specified tab.
|
||||
|
||||
Highlighted tabs have a colour between that of the active tab
|
||||
and a tab over which the mouse is hovering. This can be used
|
||||
to make a tab (usually temporarily) more noticeable to the user.
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
void AddPageHighlight(size_t page, bool highlight = true);
|
||||
|
||||
/**
|
||||
Changes a tab to not be highlighted.
|
||||
|
||||
@see AddPageHighlight()
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
void RemovePageHighlight(size_t page);
|
||||
|
||||
/**
|
||||
Shows or hide the panel area of the ribbon bar according to the
|
||||
given display mode.
|
||||
|
||||
@since 3.1.0
|
||||
*/
|
||||
void ShowPanels(wxRibbonDisplayMode mode);
|
||||
|
||||
/**
|
||||
Shows or hides the panel area of the ribbon bar.
|
||||
|
||||
If the panel area is hidden, then only the tab of the ribbon bar will
|
||||
be shown. This is useful for giving the user more screen space to work
|
||||
with when he/she doesn't need to see the ribbon's options.
|
||||
|
||||
If the panel is currently shown, this method pins it, use the other
|
||||
overload of this method to specify the exact panel display mode to
|
||||
avoid it.
|
||||
|
||||
@since 2.9.2
|
||||
*/
|
||||
void ShowPanels(bool show = true);
|
||||
|
||||
/**
|
||||
Hides the panel area of the ribbon bar.
|
||||
|
||||
This method behaves like ShowPanels() with @false argument.
|
||||
|
||||
@since 2.9.2
|
||||
*/
|
||||
void HidePanels();
|
||||
|
||||
/**
|
||||
Indicates whether the panel area of the ribbon bar is shown.
|
||||
|
||||
@see ShowPanels()
|
||||
|
||||
@since 2.9.2
|
||||
*/
|
||||
bool ArePanelsShown() const;
|
||||
|
||||
/**
|
||||
Returns the current display mode of the panel area.
|
||||
|
||||
@see ShowPanels()
|
||||
|
||||
@since 3.1.0
|
||||
*/
|
||||
wxRibbonDisplayMode GetDisplayMode() const;
|
||||
|
||||
|
||||
/**
|
||||
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();
|
||||
};
|
||||
720
libs/wxWidgets-3.3.1/interface/wx/ribbon/buttonbar.h
Normal file
720
libs/wxWidgets-3.3.1/interface/wx/ribbon/buttonbar.h
Normal file
@@ -0,0 +1,720 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: ribbon/buttonbar.h
|
||||
// Purpose: interface of wxRibbonButtonBar
|
||||
// Author: Peter Cawley
|
||||
// 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 dependent 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 dependent 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 dependent 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,
|
||||
|
||||
/**
|
||||
A mask to extract active flags
|
||||
*/
|
||||
wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK = wxRIBBON_BUTTONBAR_BUTTON_NORMAL_ACTIVE | wxRIBBON_BUTTONBAR_BUTTON_DROPDOWN_ACTIVE,
|
||||
|
||||
/**
|
||||
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,
|
||||
|
||||
/**
|
||||
The button is a toggle button which is currently in the toggled state.
|
||||
*/
|
||||
wxRIBBON_BUTTONBAR_BUTTON_TOGGLED = 1 << 8,
|
||||
|
||||
/**
|
||||
A mask to extract button state from a combination of flags.
|
||||
*/
|
||||
wxRIBBON_BUTTONBAR_BUTTON_STATE_MASK = 0x1F8,
|
||||
};
|
||||
|
||||
/**
|
||||
@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 id
|
||||
An identifier for the button bar. @c wxID_ANY is taken to mean a default.
|
||||
@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,
|
||||
wxRibbonButtonKind kind = wxRIBBON_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 toggle button to the button bar (simple version).
|
||||
|
||||
@see AddButton()
|
||||
*/
|
||||
virtual wxRibbonButtonBarButtonBase* AddToggleButton(
|
||||
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.
|
||||
|
||||
@return An opaque pointer which can be used only with other button bar
|
||||
methods.
|
||||
|
||||
@see AddDropdownButton()
|
||||
@see AddHybridButton()
|
||||
@see AddToggleButton()
|
||||
*/
|
||||
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,
|
||||
wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL,
|
||||
const wxString& help_string = wxEmptyString);
|
||||
|
||||
/**
|
||||
Inserts a button to the button bar (simple version) at the given position.
|
||||
|
||||
@see AddButton()
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual wxRibbonButtonBarButtonBase* InsertButton(
|
||||
size_t pos,
|
||||
int button_id,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxString& help_string,
|
||||
wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL);
|
||||
|
||||
/**
|
||||
Inserts a dropdown button to the button bar (simple version) at the
|
||||
given position.
|
||||
|
||||
@see InsertButton()
|
||||
@see AddDropdownButton()
|
||||
@see AddButton()
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual wxRibbonButtonBarButtonBase* InsertDropdownButton(
|
||||
size_t pos,
|
||||
int button_id,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxString& help_string = wxEmptyString);
|
||||
|
||||
/**
|
||||
Inserts a hybrid button to the button bar (simple version) at the given
|
||||
position.
|
||||
|
||||
@see InsertButton()
|
||||
@see AddHybridButton()
|
||||
@see AddButton()
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual wxRibbonButtonBarButtonBase* InsertHybridButton(
|
||||
size_t pos,
|
||||
int button_id,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxString& help_string = wxEmptyString);
|
||||
|
||||
/**
|
||||
Inserts a toggle button to the button bar (simple version) at the given
|
||||
position.
|
||||
|
||||
@see InsertButton()
|
||||
@see AddToggleButton()
|
||||
@see AddButton()
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual wxRibbonButtonBarButtonBase* InsertToggleButton(
|
||||
size_t pos,
|
||||
int button_id,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxString& help_string = wxEmptyString);
|
||||
|
||||
/**
|
||||
Insert a button to the button bar at the given position.
|
||||
|
||||
@param pos
|
||||
Position of the new button in 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.
|
||||
|
||||
@return An opaque pointer which can be used only with other button bar
|
||||
methods.
|
||||
|
||||
@see InsertDropdownButton()
|
||||
@see InsertHybridButton()
|
||||
@see InsertToggleButton()
|
||||
@see AddButton()
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual wxRibbonButtonBarButtonBase* InsertButton(
|
||||
size_t pos,
|
||||
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,
|
||||
wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL,
|
||||
const wxString& help_string = wxEmptyString);
|
||||
|
||||
/**
|
||||
Returns the number of buttons in this button bar.
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual size_t GetButtonCount() const;
|
||||
|
||||
/**
|
||||
Set the client object associated with a button. The button bar
|
||||
owns the given object and takes care of its deletion.
|
||||
Please, note that you cannot use both client object and client data.
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
void SetItemClientObject(wxRibbonButtonBarButtonBase* item, wxClientData* data);
|
||||
|
||||
/**
|
||||
Get the client object associated with a button.
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
wxClientData* GetItemClientObject(const wxRibbonButtonBarButtonBase* item) const;
|
||||
|
||||
/**
|
||||
Set the client data associated with a button.
|
||||
Please, note that you cannot use both client object and client data.
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
void SetItemClientData(wxRibbonButtonBarButtonBase* item, void* data);
|
||||
|
||||
/**
|
||||
Get the client data associated with a button.
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
void* GetItemClientData(const wxRibbonButtonBarButtonBase* item) const;
|
||||
|
||||
/**
|
||||
Returns the N-th button of the bar.
|
||||
|
||||
@see GetButtonCount()
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
virtual wxRibbonButtonBarButtonBase *GetItem(size_t n) const;
|
||||
|
||||
/**
|
||||
Returns the first button having a given id or @NULL if none matches.
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
virtual wxRibbonButtonBarButtonBase *GetItemById(int id) const;
|
||||
|
||||
/**
|
||||
Returns the id of a button.
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
virtual int GetItemId(wxRibbonButtonBarButtonBase *item) const;
|
||||
|
||||
/**
|
||||
Returns the items's rect with coordinates relative to the button bar's
|
||||
parent, or a default-constructed rect if the tool is not found.
|
||||
|
||||
@param button_id
|
||||
ID of the button in question.
|
||||
|
||||
@since 3.1.7
|
||||
*/
|
||||
virtual wxRect GetItemRect(int button_id) const;
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
The corresponding button is deleted by this function, so any pointers to
|
||||
it previously obtained by GetItem() or GetItemById() become invalid.
|
||||
|
||||
@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);
|
||||
|
||||
/**
|
||||
Set a toggle button to the checked or unchecked state.
|
||||
|
||||
@param button_id
|
||||
ID of the toggle button to manipulate.
|
||||
@param checked
|
||||
@true to set the button to the toggled/pressed/checked state,
|
||||
@false to set it to the untoggled/unpressed/unchecked state.
|
||||
*/
|
||||
virtual void ToggleButton(int button_id, bool checked);
|
||||
|
||||
/**
|
||||
Changes the bitmap of an existing button.
|
||||
|
||||
@param button_id
|
||||
ID of the button to manipulate.
|
||||
@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.
|
||||
|
||||
@since 3.1.2
|
||||
*/
|
||||
virtual void SetButtonIcon(
|
||||
int button_id,
|
||||
const wxBitmap& bitmap,
|
||||
const wxBitmap& bitmap_small = wxNullBitmap,
|
||||
const wxBitmap& bitmap_disabled = wxNullBitmap,
|
||||
const wxBitmap& bitmap_small_disabled = wxNullBitmap);
|
||||
|
||||
/**
|
||||
Changes the label text of an existing button.
|
||||
|
||||
@param button_id
|
||||
ID of the button to manipulate.
|
||||
@param label
|
||||
New label of the button.
|
||||
|
||||
@remarks
|
||||
If text size has changed, Realize() must be called
|
||||
on the top level wxRibbonBar object to recalculate panel sizes.
|
||||
Use SetButtonTextMinWidth() to avoid calling Realize()
|
||||
after every change.
|
||||
|
||||
@see SetButtonTextMinWidth
|
||||
|
||||
@since 3.1.2
|
||||
*/
|
||||
virtual void SetButtonText(int button_id, const wxString& label);
|
||||
|
||||
/**
|
||||
Sets the minimum width of the button label, to indicate to
|
||||
the wxRibbonArtProvider layout mechanism that this is the
|
||||
minimum required size.
|
||||
|
||||
You have to call Realize() after calling this function to
|
||||
apply the given minimum width.
|
||||
|
||||
@param button_id
|
||||
ID of the button to manipulate.
|
||||
@param min_width_medium
|
||||
Requested minimum width of the button text in pixel
|
||||
if the button is medium size.
|
||||
@param min_width_large
|
||||
Requested minimum width of the button text in pixel
|
||||
if the button is large size.
|
||||
|
||||
@remarks
|
||||
This function is used together with SetButtonText() to change
|
||||
button labels on the fly without modifying the button bar layout.
|
||||
|
||||
@see SetButtonText()
|
||||
|
||||
@since 3.1.2
|
||||
*/
|
||||
virtual void SetButtonTextMinWidth(int button_id,
|
||||
int min_width_medium, int min_width_large);
|
||||
|
||||
/**
|
||||
Sets the minimum width of the button label, to indicate to
|
||||
the wxRibbonArtProvider layout mechanism that this is the
|
||||
minimum required size.
|
||||
|
||||
You have to call Realize() after calling this function to
|
||||
apply the given minimum width.
|
||||
|
||||
@param button_id
|
||||
ID of the button to manipulate.
|
||||
@param label
|
||||
The minimum width is set to the width of this label.
|
||||
|
||||
@remarks
|
||||
This function is used together with SetButtonText() to change
|
||||
button labels on the fly without modifying the button bar layout.
|
||||
|
||||
@see SetButtonText()
|
||||
|
||||
@since 3.1.2
|
||||
*/
|
||||
virtual void SetButtonTextMinWidth(int button_id, const wxString& label);
|
||||
|
||||
/**
|
||||
Sets the minimum size class of a ribbon button.
|
||||
|
||||
You have to call Realize() after calling this function to
|
||||
apply the given minimum size.
|
||||
|
||||
@param button_id
|
||||
ID of the button to manipulate.
|
||||
@param min_size_class
|
||||
The minimum size-class of the button. Buttons on a button bar
|
||||
can have three distinct sizes: wxRIBBON_BUTTONBAR_BUTTON_SMALL,
|
||||
wxRIBBON_BUTTONBAR_BUTTON_MEDIUM, and wxRIBBON_BUTTONBAR_BUTTON_LARGE.
|
||||
|
||||
@since 3.1.2
|
||||
*/
|
||||
virtual void SetButtonMinSizeClass(int button_id,
|
||||
wxRibbonButtonBarButtonState min_size_class);
|
||||
|
||||
/**
|
||||
Sets the maximum size class of a ribbon button.
|
||||
|
||||
You have to call Realize() after calling this function to
|
||||
apply the given maximum size.
|
||||
|
||||
@param button_id
|
||||
ID of the button to manipulate.
|
||||
@param max_size_class
|
||||
The maximum size-class of the button. Buttons on a button bar
|
||||
can have three distinct sizes: wxRIBBON_BUTTONBAR_BUTTON_SMALL,
|
||||
wxRIBBON_BUTTONBAR_BUTTON_MEDIUM, and wxRIBBON_BUTTONBAR_BUTTON_LARGE.
|
||||
|
||||
@since 3.1.2
|
||||
*/
|
||||
virtual void SetButtonMaxSizeClass(int button_id,
|
||||
wxRibbonButtonBarButtonState max_size_class);
|
||||
|
||||
/**
|
||||
Returns the active item of the button bar or @NULL if there is none.
|
||||
The active button is the one being clicked.
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
virtual wxRibbonButtonBarButtonBase *GetActiveItem() const;
|
||||
|
||||
/**
|
||||
Returns the hovered item of the button bar or @NULL if there is none.
|
||||
The hovered button is the one the mouse is over.
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
virtual wxRibbonButtonBarButtonBase *GetHoveredItem() const;
|
||||
|
||||
/**
|
||||
Indicates whether tooltips are shown for disabled buttons.
|
||||
|
||||
By default they are not shown.
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
void SetShowToolTipsForDisabled(bool show);
|
||||
|
||||
/**
|
||||
Sets whether tooltips should be shown for disabled buttons or not.
|
||||
|
||||
You may wish to show it to explain why a button is disabled or
|
||||
what it normally does when enabled.
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
bool GetShowToolTipsForDisabled() const;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@class wxRibbonButtonBarEvent
|
||||
|
||||
Event used to indicate various actions relating to a button on a
|
||||
wxRibbonButtonBar. For toggle buttons, IsChecked() can be used to test
|
||||
the state of the button.
|
||||
|
||||
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 = nullptr,
|
||||
wxRibbonButtonBarButtonBase* button = nullptr);
|
||||
|
||||
/**
|
||||
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);
|
||||
|
||||
/**
|
||||
Returns the button which the event relates to.
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
wxRibbonButtonBarButtonBase* GetButton();
|
||||
|
||||
/**
|
||||
Sets the button relating to this event.
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
void SetButton(wxRibbonButtonBarButtonBase* bar);
|
||||
|
||||
/**
|
||||
Display a popup menu as a result of this (dropdown clicked) event.
|
||||
*/
|
||||
bool PopupMenu(wxMenu* menu);
|
||||
};
|
||||
|
||||
|
||||
wxEventType wxEVT_RIBBONBUTTONBAR_CLICKED;
|
||||
wxEventType wxEVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED;
|
||||
180
libs/wxWidgets-3.3.1/interface/wx/ribbon/control.h
Normal file
180
libs/wxWidgets-3.3.1/interface/wx/ribbon/control.h
Normal file
@@ -0,0 +1,180 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: ribbon/control.h
|
||||
// Purpose: interface of wxRibbonControl
|
||||
// Author: Peter Cawley
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxRibbonControl
|
||||
|
||||
wxRibbonControl serves as a base class for all controls which share the
|
||||
ribbon characteristics of having a ribbon art provider, and (optionally)
|
||||
non-continuous 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 than 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 than 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();
|
||||
|
||||
/**
|
||||
Get the first ancestor which is a wxRibbonBar (or derived) or @NULL
|
||||
if not having such parent.
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual wxRibbonBar* GetAncestorRibbonBar()const;
|
||||
|
||||
|
||||
/**
|
||||
Finds the best width and height given the parent's width and height.
|
||||
Used to implement the wxRIBBON_PANEL_FLEXIBLE panel style.
|
||||
*/
|
||||
virtual wxSize GetBestSizeForParentSize(const wxSize& parentSize) const;
|
||||
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;
|
||||
};
|
||||
305
libs/wxWidgets-3.3.1/interface/wx/ribbon/gallery.h
Normal file
305
libs/wxWidgets-3.3.1/interface/wx/ribbon/gallery.h
Normal file
@@ -0,0 +1,305 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: ribbon/gallery.h
|
||||
// Purpose: interface of wxRibbonGallery
|
||||
// Author: Peter Cawley
|
||||
// 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_CLICKED(id, func)}
|
||||
Similar to EVT_RIBBONGALLERY_SELECTED but triggered every time a
|
||||
gallery item is clicked, even if it is already selected. Note that the
|
||||
ID of the event is that of the gallery, not of the item, just as above.
|
||||
This event is available since wxWidgets 2.9.2.
|
||||
@event{EVT_RIBBONGALLERY_HOVER_CHANGED(id, func)}
|
||||
Triggered when the item being hovered over by the user changes. The
|
||||
item in the event will be the new item being hovered, or @NULL if there
|
||||
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 id
|
||||
An identifier for the gallery. @c wxID_ANY is taken to mean a default.
|
||||
@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 == nullptr.
|
||||
|
||||
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 contents by some fine-grained amount.
|
||||
|
||||
@param pixels
|
||||
Positive values scroll toward the end of the gallery, while negative
|
||||
values scroll toward the start.
|
||||
|
||||
@return @true if the gallery scrolled at least one pixel in the given
|
||||
direction, @false if it did not scroll.
|
||||
*/
|
||||
bool ScrollPixels(int pixels);
|
||||
|
||||
/**
|
||||
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 wxRibbonGalleryEvent : public wxCommandEvent
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRibbonGalleryEvent(wxEventType command_type = wxEVT_NULL,
|
||||
int win_id = 0,
|
||||
wxRibbonGallery* gallery = nullptr,
|
||||
wxRibbonGalleryItem* item = nullptr);
|
||||
|
||||
/**
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
wxEventType wxEVT_RIBBONGALLERY_HOVER_CHANGED;
|
||||
wxEventType wxEVT_RIBBONGALLERY_SELECTED;
|
||||
wxEventType wxEVT_RIBBONGALLERY_CLICKED;
|
||||
|
||||
225
libs/wxWidgets-3.3.1/interface/wx/ribbon/page.h
Normal file
225
libs/wxWidgets-3.3.1/interface/wx/ribbon/page.h
Normal file
@@ -0,0 +1,225 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: ribbon/page.h
|
||||
// Purpose: interface of wxRibbonPage
|
||||
// Author: Peter Cawley
|
||||
// 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 actually 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-intuitively, 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 interacting 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 programmatically
|
||||
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()
|
||||
@see ScrollSections()
|
||||
*/
|
||||
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 programmatically
|
||||
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()
|
||||
@see ScrollSections()
|
||||
*/
|
||||
bool ScrollPixels(int pixels);
|
||||
|
||||
/**
|
||||
Scroll the page by an entire child section.
|
||||
|
||||
The @a sections parameter value should be 1 or -1. This will scroll
|
||||
enough to uncover a partially visible child section or totally uncover
|
||||
the next child section that may not be visible at all.
|
||||
|
||||
@return @true if the page scrolled at least one pixel in the given
|
||||
direction, @false if it did not scroll.
|
||||
|
||||
@see ScrollPixels()
|
||||
@see ScrollSections()
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
bool ScrollSections(int sections);
|
||||
|
||||
/**
|
||||
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;
|
||||
|
||||
/**
|
||||
Get a panel by index.
|
||||
|
||||
@NULL will be returned if the given index is out of range.
|
||||
|
||||
@since 3.3.0
|
||||
*/
|
||||
wxRibbonPanel* GetPanel(int n);
|
||||
|
||||
/**
|
||||
Get a panel by window ID.
|
||||
|
||||
@NULL will be returned if no panel with the ID is found.
|
||||
|
||||
@since 3.3.0
|
||||
*/
|
||||
wxRibbonPanel* GetPanelById(wxWindowID id);
|
||||
|
||||
/**
|
||||
Get the number of panels in this page.
|
||||
|
||||
@since 3.3.0
|
||||
*/
|
||||
size_t GetPanelCount() const;
|
||||
};
|
||||
306
libs/wxWidgets-3.3.1/interface/wx/ribbon/panel.h
Normal file
306
libs/wxWidgets-3.3.1/interface/wx/ribbon/panel.h
Normal file
@@ -0,0 +1,306 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: ribbon/panel.h
|
||||
// Purpose: interface of wxRibbonPage
|
||||
// Author: Peter Cawley
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
enum wxRibbonPanelOption
|
||||
{
|
||||
wxRIBBON_PANEL_NO_AUTO_MINIMISE,
|
||||
wxRIBBON_PANEL_EXT_BUTTON,
|
||||
wxRIBBON_PANEL_MINIMISE_BUTTON,
|
||||
wxRIBBON_PANEL_STRETCH,
|
||||
wxRIBBON_PANEL_FLEXIBLE,
|
||||
wxRIBBON_PANEL_DEFAULT_STYLE
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@class wxRibbonPanelEvent
|
||||
|
||||
Event used to indicate various actions relating to a wxRibbonPanel.
|
||||
|
||||
See wxRibbonPanel for available event types.
|
||||
|
||||
@since 2.9.4
|
||||
|
||||
@library{wxribbon}
|
||||
@category{events,ribbon}
|
||||
|
||||
@see wxRibbonPanel
|
||||
*/
|
||||
class wxRibbonPanelEvent : public wxCommandEvent
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRibbonPanelEvent(wxEventType command_type = wxEVT_NULL,
|
||||
int win_id = 0,
|
||||
wxRibbonPanel* panel = nullptr);
|
||||
|
||||
/**
|
||||
Returns the panel relating to this event.
|
||||
*/
|
||||
wxRibbonPanel* GetPanel();
|
||||
|
||||
/**
|
||||
Sets the page relating to this event.
|
||||
*/
|
||||
void SetPanel(wxRibbonPanel* page);
|
||||
};
|
||||
|
||||
wxEventType wxEVT_RIBBONPANEL_EXTBUTTON_ACTIVATED;
|
||||
|
||||
|
||||
/**
|
||||
@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).
|
||||
|
||||
Non-ribbon controls can be placed on a panel using wxSizers to manage
|
||||
layout. Panel size is governed by the sizer's minimum calculated size and
|
||||
the parent wxRibbonPage's dimensions. For functional and aesthetic reasons,
|
||||
it is recommended that ribbon and non-ribbon controls are not mixed in one
|
||||
panel.
|
||||
|
||||
A wxRibbonPage can show or hide its panels to offer a dynamic experience
|
||||
for the end user. For example, a page can hide certain panels and show others
|
||||
when the user interacts with other elements in the application. As an example
|
||||
of toggling the visibility of a panel:
|
||||
|
||||
@code
|
||||
wxRibbonPanel* panel = m_ribbon->GetPage(0)->GetPanelById(ID_EDITOR_PANEL);
|
||||
if ( panel != nullptr )
|
||||
{
|
||||
panel->Show(!panel->IsShown());
|
||||
}
|
||||
// Update the UI
|
||||
m_ribbon->Realise();
|
||||
m_ribbon->Layout();
|
||||
@endcode
|
||||
|
||||
@see 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.
|
||||
@style{wxRIBBON_PANEL_STRETCH}
|
||||
Stretches a single panel to fit the parent page.
|
||||
@style{wxRIBBON_PANEL_FLEXIBLE}
|
||||
Allows the panel to size in both directions; currently only useful
|
||||
when a single wxRibbonToolBar is the child of the panel, particularly
|
||||
in vertical orientation where the number of rows is dependent on the
|
||||
amount of horizontal space available. Set the minimum and maximum
|
||||
toolbar rows to take full advantage of this wrapping behaviour.
|
||||
@endStyleTable
|
||||
|
||||
@beginEventEmissionTable{wxRibbonPanelEvent}
|
||||
@event{EVT_RIBBONPANEL_EXTBUTTON_ACTIVATED(id, func)}
|
||||
Triggered when the user activate the panel extension button.
|
||||
@endEventTable
|
||||
|
||||
@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;
|
||||
|
||||
/**
|
||||
Test if the panel has an extension button.
|
||||
|
||||
Such button is shown in the top right corner of the panel if
|
||||
@c wxRIBBON_PANEL_EXT_BUTTON style is used for it.
|
||||
|
||||
@since 2.9.4
|
||||
|
||||
@return @true if the panel and its wxRibbonBar allow it in their styles.
|
||||
*/
|
||||
virtual bool HasExtButton() 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 mouse is currently hovered over the extension button.
|
||||
|
||||
Extension button is only shown for panels with @c
|
||||
wxRIBBON_PANEL_EXT_BUTTON style.
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
bool IsExtButtonHovered() 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 referred to as being (externally) expanded. Note that
|
||||
when a panel is expanded, there exist two panels - the original panel
|
||||
(which is referred 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();
|
||||
};
|
||||
544
libs/wxWidgets-3.3.1/interface/wx/ribbon/toolbar.h
Normal file
544
libs/wxWidgets-3.3.1/interface/wx/ribbon/toolbar.h
Normal file
@@ -0,0 +1,544 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: ribbon/toolbar.h
|
||||
// Purpose: interface of wxRibbonToolBar
|
||||
// Author: Peter Cawley
|
||||
// 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 id
|
||||
An identifier for the toolbar. @c wxID_ANY is taken to mean a default.
|
||||
@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 toggle tool to the tool bar (simple version).
|
||||
|
||||
@since 2.9.4
|
||||
|
||||
@see AddTool()
|
||||
*/
|
||||
virtual wxRibbonToolBarToolBase* AddToggleTool(
|
||||
int tool_id,
|
||||
const wxBitmap& bitmap,
|
||||
const wxString& help_string);
|
||||
|
||||
/**
|
||||
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 clientData
|
||||
Client data to associate with the new tool.
|
||||
|
||||
@return An opaque pointer which can be used only with other tool bar
|
||||
methods.
|
||||
|
||||
@see AddDropdownTool(), AddHybridTool(), AddSeparator(), InsertTool()
|
||||
*/
|
||||
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* clientData = nullptr);
|
||||
|
||||
/**
|
||||
Add a separator to the tool bar.
|
||||
|
||||
Separators are used to separate tools into groups. As such, a separator
|
||||
is not explicitly drawn, but is visually seen as the gap between tool
|
||||
groups.
|
||||
*/
|
||||
virtual wxRibbonToolBarToolBase* AddSeparator();
|
||||
|
||||
/**
|
||||
Insert a tool to the tool bar (simple version) as the specified
|
||||
position.
|
||||
|
||||
@since 2.9.4
|
||||
|
||||
@see InsertTool()
|
||||
*/
|
||||
virtual wxRibbonToolBarToolBase* InsertTool(
|
||||
size_t pos,
|
||||
int tool_id,
|
||||
const wxBitmap& bitmap,
|
||||
const wxString& help_string,
|
||||
wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL);
|
||||
|
||||
|
||||
/**
|
||||
Insert a dropdown tool to the tool bar (simple version) as the specified
|
||||
position.
|
||||
|
||||
@since 2.9.4
|
||||
|
||||
@see AddDropdownTool(), InsertTool()
|
||||
*/
|
||||
virtual wxRibbonToolBarToolBase* InsertDropdownTool(
|
||||
size_t pos,
|
||||
int tool_id,
|
||||
const wxBitmap& bitmap,
|
||||
const wxString& help_string = wxEmptyString);
|
||||
|
||||
/**
|
||||
Insert a hybrid tool to the tool bar (simple version) as the specified
|
||||
position.
|
||||
|
||||
@since 2.9.4
|
||||
|
||||
@see AddHybridTool(), InsertTool()
|
||||
*/
|
||||
virtual wxRibbonToolBarToolBase* InsertHybridTool(
|
||||
size_t pos,
|
||||
int tool_id,
|
||||
const wxBitmap& bitmap,
|
||||
const wxString& help_string = wxEmptyString);
|
||||
|
||||
/**
|
||||
Insert a toggle tool to the tool bar (simple version) as the specified
|
||||
position.
|
||||
|
||||
@since 2.9.4
|
||||
|
||||
@see AddToggleTool(), InsertTool()
|
||||
*/
|
||||
virtual wxRibbonToolBarToolBase* InsertToggleTool(
|
||||
size_t pos,
|
||||
int tool_id,
|
||||
const wxBitmap& bitmap,
|
||||
const wxString& help_string = wxEmptyString);
|
||||
|
||||
/**
|
||||
Insert a tool to the tool bar at the specified position.
|
||||
|
||||
@param pos
|
||||
Position of the new tool (number of tools and separators from the
|
||||
beginning of the toolbar).
|
||||
@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 clientData
|
||||
Client data to associate with the new tool.
|
||||
|
||||
@return An opaque pointer which can be used only with other tool bar
|
||||
methods.
|
||||
|
||||
@since 2.9.4
|
||||
|
||||
@see InsertDropdownTool(), InsertHybridTool(), InsertSeparator()
|
||||
*/
|
||||
virtual wxRibbonToolBarToolBase* InsertTool(
|
||||
size_t pos,
|
||||
int tool_id,
|
||||
const wxBitmap& bitmap,
|
||||
const wxBitmap& bitmap_disabled = wxNullBitmap,
|
||||
const wxString& help_string = wxEmptyString,
|
||||
wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL,
|
||||
wxObject* clientData = nullptr);
|
||||
|
||||
/**
|
||||
Insert a separator to the tool bar at the specified position.
|
||||
|
||||
@since 2.9.4
|
||||
|
||||
@see AddSeparator(), InsertTool()
|
||||
*/
|
||||
virtual wxRibbonToolBarToolBase* InsertSeparator(size_t pos);
|
||||
|
||||
/**
|
||||
Deletes all the tools in the toolbar.
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual void ClearTools();
|
||||
|
||||
/**
|
||||
Removes the specified tool from the toolbar and deletes it.
|
||||
|
||||
@param tool_id
|
||||
ID of the tool to delete.
|
||||
|
||||
@returns @true if the tool was deleted, @false otherwise.
|
||||
|
||||
@since 2.9.4
|
||||
|
||||
@see DeleteToolByPos()
|
||||
*/
|
||||
virtual bool DeleteTool(int tool_id);
|
||||
|
||||
/**
|
||||
This function behaves like DeleteTool() but it deletes the tool at the
|
||||
specified position and not the one with the given id.
|
||||
Useful to delete separators.
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual bool DeleteToolByPos(size_t pos);
|
||||
|
||||
/**
|
||||
Returns a pointer to the tool opaque structure by @a id or @NULL if no
|
||||
corresponding tool is found.
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual wxRibbonToolBarToolBase* FindById(int tool_id)const;
|
||||
|
||||
/**
|
||||
Return the opaque pointer corresponding to the given tool.
|
||||
|
||||
@return an opaque pointer, @NULL if is a separator or not found.
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
wxRibbonToolBarToolBase* GetToolByPos(size_t pos)const;
|
||||
|
||||
/**
|
||||
Returns the opaque pointer for the tool at the given coordinates,
|
||||
which are relative to the toolbar's parent.
|
||||
|
||||
@return an opaque pointer, @NULL if is not found.
|
||||
|
||||
@since 3.1.5
|
||||
*/
|
||||
virtual wxRibbonToolBarToolBase* GetToolByPos(wxCoord x, wxCoord y)const;
|
||||
|
||||
|
||||
/**
|
||||
Returns the number of tools in the toolbar.
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual size_t GetToolCount() const;
|
||||
|
||||
/**
|
||||
Return the id associated to the tool opaque structure.
|
||||
|
||||
The structure pointer must not be @NULL.
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual int GetToolId(const wxRibbonToolBarToolBase* tool)const;
|
||||
|
||||
/**
|
||||
Returns the active item of the tool bar or @NULL if there is none.
|
||||
|
||||
The active tool is the one being clicked.
|
||||
|
||||
@since 3.1.7
|
||||
*/
|
||||
virtual wxRibbonToolBarToolBase* GetActiveTool() const;
|
||||
|
||||
/**
|
||||
Get any client data associated with the tool.
|
||||
|
||||
@param tool_id
|
||||
ID of the tool in question, as passed to AddTool().
|
||||
|
||||
@return Client data, or @NULL if there is none.
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual wxObject* GetToolClientData(int tool_id)const;
|
||||
|
||||
/**
|
||||
Called to determine whether a tool is enabled (responds to user input).
|
||||
|
||||
@param tool_id
|
||||
ID of the tool in question, as passed to AddTool().
|
||||
|
||||
@return @true if the tool is enabled, @false otherwise.
|
||||
|
||||
@since 2.9.4
|
||||
|
||||
@see EnableTool()
|
||||
*/
|
||||
virtual bool GetToolEnabled(int tool_id)const;
|
||||
|
||||
/**
|
||||
Returns the help string for the given tool.
|
||||
|
||||
@param tool_id
|
||||
ID of the tool in question, as passed to AddTool().
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual wxString GetToolHelpString(int tool_id)const;
|
||||
|
||||
/**
|
||||
Return the kind of the given tool.
|
||||
|
||||
@param tool_id
|
||||
ID of the tool in question, as passed to AddTool().
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual wxRibbonButtonKind GetToolKind(int tool_id)const;
|
||||
|
||||
/**
|
||||
Returns the tool position in the toolbar, or @c wxNOT_FOUND if the tool
|
||||
is not found.
|
||||
|
||||
@param tool_id
|
||||
ID of the tool in question, as passed to AddTool().
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual int GetToolPos(int tool_id)const;
|
||||
|
||||
/**
|
||||
Returns the tool's rect with coordinates relative to the toolbar's parent,
|
||||
or a default-constructed rect if the tool is not found.
|
||||
|
||||
@param tool_id
|
||||
ID of the tool in question, as passed to AddTool().
|
||||
|
||||
@since 3.1.5
|
||||
*/
|
||||
virtual wxRect GetToolRect(int tool_id)const;
|
||||
|
||||
|
||||
/**
|
||||
Gets the on/off state of a toggle tool.
|
||||
|
||||
@param tool_id
|
||||
ID of the tool in question, as passed to AddTool().
|
||||
|
||||
@return @true if the tool is toggled on, @false otherwise.
|
||||
|
||||
@see ToggleTool()
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual bool GetToolState(int tool_id)const;
|
||||
|
||||
/**
|
||||
Calculate tool layouts and positions.
|
||||
|
||||
Must be called after tools are added to the tool bar, as otherwise
|
||||
the newly added tools will not be displayed.
|
||||
*/
|
||||
virtual bool Realize();
|
||||
|
||||
/**
|
||||
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 specified, 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);
|
||||
|
||||
/**
|
||||
Sets the client data associated with the tool.
|
||||
|
||||
@param tool_id
|
||||
ID of the tool in question, as passed to AddTool().
|
||||
@param clientData
|
||||
The client data to use.
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual void SetToolClientData(int tool_id, wxObject* clientData);
|
||||
|
||||
/**
|
||||
Sets the bitmap to be used by the tool with the given ID when the tool
|
||||
is in a disabled state.
|
||||
|
||||
@param tool_id
|
||||
ID of the tool in question, as passed to AddTool().
|
||||
@param bitmap
|
||||
Bitmap to use for disabled tools.
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual void SetToolDisabledBitmap(int tool_id, const wxBitmap &bitmap);
|
||||
|
||||
/**
|
||||
Sets the help string shown in tooltip for the given tool.
|
||||
|
||||
@param tool_id
|
||||
ID of the tool in question, as passed to AddTool().
|
||||
@param helpString
|
||||
A string for the help.
|
||||
|
||||
@see GetToolHelpString()
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual void SetToolHelpString(int tool_id, const wxString& helpString);
|
||||
|
||||
/**
|
||||
Sets the bitmap to be used by the tool with the given ID.
|
||||
|
||||
@param tool_id
|
||||
ID of the tool in question, as passed to AddTool().
|
||||
@param bitmap
|
||||
Bitmap to use for normals tools.
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual void SetToolNormalBitmap(int tool_id, const wxBitmap &bitmap);
|
||||
|
||||
/**
|
||||
Enable or disable a single tool on the bar.
|
||||
|
||||
@param tool_id
|
||||
ID of the tool to enable or disable.
|
||||
@param enable
|
||||
@true to enable the tool, @false to disable it.
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual void EnableTool(int tool_id, bool enable = true);
|
||||
|
||||
/**
|
||||
Set a toggle tool to the checked or unchecked state.
|
||||
|
||||
@param tool_id
|
||||
ID of the toggle tool to manipulate.
|
||||
@param checked
|
||||
@true to set the tool to the toggled/pressed/checked state,
|
||||
@false to set it to the untoggled/unpressed/unchecked state.
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual void ToggleTool(int tool_id, bool checked);
|
||||
};
|
||||
|
||||
|
||||
class wxRibbonToolBarEvent : public wxCommandEvent
|
||||
{
|
||||
public:
|
||||
wxRibbonToolBarEvent(wxEventType command_type = wxEVT_NULL,
|
||||
int win_id = 0,
|
||||
wxRibbonToolBar* bar = nullptr);
|
||||
|
||||
wxRibbonToolBar* GetBar();
|
||||
void SetBar(wxRibbonToolBar* bar);
|
||||
bool PopupMenu(wxMenu* menu);
|
||||
};
|
||||
|
||||
|
||||
wxEventType wxEVT_RIBBONTOOLBAR_CLICKED;
|
||||
wxEventType wxEVT_RIBBONTOOLBAR_DROPDOWN_CLICKED;
|
||||
Reference in New Issue
Block a user