|
template <class T>
class WithDropChoice : public T

This template class adds a list of choices, with drop down button placed at right side of the frame, to any widget with associated value accessible via SetData/GetData interface.
Callback WhenDrop
This callback is invoked when the drop button is pushed (before drop down list appears). Client code can use it to create or alter the list.
Callback WhenSelect
This callback is called after user selected an item from drop-down list and this value was assigned to the base widget.
void ClearList()
Clears the drop-down list.
void AddList(const Value& data)
Adds data to the drop-down list.
void SerializeList(Stream& s)
Serializes the drop-down list content.
void AddHistory(int max = 12)
This method puts the value to the begin of drop-down list. If value is already in the list, it is removed first (values in the list are unique). If there is more than max items in the list, list is trimmed. This method is ideal when you want to keep the history of previous values.
WithDropChoice& Dropping(bool b = true)
In this mode, drop button is visible. Can be used to temporarily remove the drop-down list capability. Default is on.
WithDropChoice& NoDropping()
Same as Dropping(false).
WithDropChoice& NoDropFocus()
If NoDropFocus is active, focus is not moved to base widget when drop button is pushed. Default is to move the focus.
WithDropChoice& Appending(const String& s = ", ")
s
WithDropChoice& SetDropLines(int n)
Sets the maximum height of drop-down list to accommodate n lines (scrollbar appears if there is more than that).
WithDropChoice& SetDisplay(int i, const Display& d)
Sets the Display to be used with drop-down list item i.
WithDropChoice& SetDisplay(const Display& d)
Sets the Display to be used with drop-down list, unless item-specific Display is assigned.
WithDropChoice& SetLineCy(int lcy)
Sets the line height of drop-down display.
WithDropChoice& SetDisplay(const Display& d, int lcy)
Same as SetDisplay(d).SetLineCy(lcy).
WithDropChoice& AlwaysDrop(bool b = true)
If active, drop button is visible even if the list is empty (client code can fill it using WhenDrop callback).
WithDropChoice& DropWidth(int w)
Set the width of the drop down list to w.
WithDropChoice& DropWidthZ(int w)
Set the width of the drop down list to a value obtained by zooming w in accordance with font scaling.
int GetCount() const
Returns the number of items in the drop down list.
Value Get(int i) const
Returns the item with the index i from the drop down list.
const MultiButton::Style& StyleDefault()
Returns the default style of the drop down frame added to the widget.
WithDropChoice& SetStyle(const MultiButton::Style& s)
Sets the frame style to MultiButton::Style s.
|