wxRibbonButtonBarButton: Implemented mutable lables and minimum label width

Added new function SetButtonText() which modifies labels of
existing ribbon button bar buttons.
The new function SetButtonTextMinWidth() is used to specify the
label width in advance so that lables can be changed without
recalculating the layout.
wxRibbonArtProvider is modified to support these operation.
This commit is contained in:
Max Maisel
2018-03-14 16:55:58 +01:00
parent 5d6ba5d335
commit 7aed0e547b
6 changed files with 221 additions and 5 deletions

View File

@@ -934,6 +934,9 @@ public:
be returned.
@param label
The label of the button.
@param text_min_width
The minimum width of the button label.
Set this to 0 if it is not used.
@param bitmap_size_large
The size of all "large" bitmaps on the button bar.
@param bitmap_size_small
@@ -953,11 +956,38 @@ public:
wxRibbonButtonKind kind,
wxRibbonButtonBarButtonState size,
const wxString& label,
wxCoord text_min_width,
wxSize bitmap_size_large,
wxSize bitmap_size_small,
wxSize* button_size,
wxRect* normal_region,
wxRect* dropdown_region) = 0;
/**
Gets the width of the string if it is used as
a wxRibbonButtonBar button label.
@param dc
A device context to use when one is required for size calculations.
@param label
The string whose width shall be calculated.
@param kind
The kind of button.
@param size
The size-class to calculate the size for. Buttons on a button bar
can have three distinct sizes: wxRIBBON_BUTTONBAR_BUTTON_SMALL,
wxRIBBON_BUTTONBAR_BUTTON_MEDIUM, and wxRIBBON_BUTTONBAR_BUTTON_LARGE.
If the requested size-class is not applicable, then NULL should
be returned.
@return Width of the given label text in pixel.
@note This function only works with single-line strings.
*/
virtual wxCoord GetButtonBarButtonTextWidth(
wxDC& dc, const wxString& label,
wxRibbonButtonKind kind,
wxRibbonButtonBarButtonState size) = 0;
/**
Calculate the size of a minimised ribbon panel.
@@ -1208,6 +1238,7 @@ public:
wxRibbonButtonKind kind,
wxRibbonButtonBarButtonState size,
const wxString& label,
wxCoord text_min_width,
wxSize bitmap_size_large,
wxSize bitmap_size_small,
wxSize* button_size,