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:
@@ -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,
|
||||
|
@@ -503,6 +503,71 @@ public:
|
||||
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
|
||||
*/
|
||||
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_medium
|
||||
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()
|
||||
*/
|
||||
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()
|
||||
*/
|
||||
virtual void SetButtonTextMinWidth(int button_id, const wxString& label);
|
||||
|
||||
/**
|
||||
Returns the active item of the button bar or NULL if there is none.
|
||||
The active button is the one being clicked.
|
||||
|
Reference in New Issue
Block a user