Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
UppHub
Status & Roadmap
FAQ
Authors & License
Forums
Funding U++
Search on this site











SourceForge.net Logo

SourceForge.net Logo

GitHub Logo

Discord Logo

WithDropChoice

 

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.

 

 

Public Member List

 

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 FindAddList(const Value& data)

Adds data to the drop-down list, by only if it is not already there.

 


 

int Find(const Value& dataconst

Finds the index of first list entry equal to data.

 


 

void Set(int i, const Value& data)

Sets entry i in drop-down list to data .

 


 

void Remove(int i)

Removes entry i in 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& SetConvert(const Convert& d)

Sets the Convert to be used with drop-down list item i.

 


 

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& HideDrop(bool b = true)

Instead of disabling the drop arrow when the list is empty and AlwaysDrop is false, the drop arrow is hidden.

 


 

WithDropChoice& RdOnlyDrop(bool b = true)

If active, allows changing value even by drop even if ReadOnly.

 


 

WithDropChoice& WithWheel(bool b = true)

Widget reacts to mousewheel. This is active by default.

 


 

WithDropChoice& NoWithWheel()

Same as WithWheel(false).

 


 

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.

 


 

WithDropChoice& UpDownKeys(bool b = true)

If active, Up and Down keys cycle through the history. Default is active..

 


 

WithDropChoice& NoUpDownKeys()

Same as UpDownKeys(false).

 


 

int GetCount() const

Returns the number of items in the drop down list.

 


 

Value Get(int iconst

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.

 

 

Do you want to contribute?