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













SourceForge.net Logo

Switch

 

class Switch : public Ctrl

Switch provides selection of mutually exclusive options (cases).

 

Options can be visually aligned horizontally or vertically - U++ choses alignment based on size of options and Ctrl rectangle. Each option represents a case with associated text and value. Switch can be assigned any Value (not only Values associated with current cases); if there is no case with Value equal to the Value of Switch, no case is highlighted.

 

Derived from Ctrl

 

 

Constructor Detail

 

Switch()

Initializes the switch.

 


 

~Switch()

Default destructor.

 

 

Public Method List

 

Switch& SetLabel(int i, const char *text)

Sets text of case with specified index i. Text can contain '\b' for access-key assignment. Value of case is set to i. If i is greater than current number of cases, empty cases are added to Switch with values equivalent to their indexes.

i

Index of the case.

text

Text of the case.

Return value

*this for chaining.

 


 

Switch& SetLabel(const char *text)

Sets content of Switch. Each line of text represents one case with value equivalent to the index of line.

text

Content of the Switch.

Return value

*this for chaining.

 


 

String GetLabel(int iconst

Returns the text of case with specified index i.

 


 

String GetLabel() const

Returns the context of the Switch.

 


 

Switch& Set(int i, const Value& val, const char *text)

Sets text of case with specified index i. Text can contain '\b' for access-key assignment. Value of case is set to val. If i is greater than current number of cases, empty cases are added to Switch with values equivalent to their indexes.

i

Index of the case.

val

Value of the case.

text

Text of the case.

Return value

*this for chaining.

 


 

Switch& Set(int i, const Value& val)

Sets the Value of of case with specified index i. The text of case is unaltered.

i

Index of the case.

val

Value of the case.

Return value

*this for chaining.

 


 

Switch& Add(const Value& val, const char *text)

Adds a new case to the Switch.

val

Value of the case.

text

Text of the case.

Return value

*this for chaining.

 


 

Switch& Add(const char *text)

Adds a new case to the Switch. Value of the case is equal to its index.

text

Text of the case.

Return value

*this for chaining

 


 

void EnableCase(int i, bool enable = true)

Enables or disables case with the specified index i.

i

Index of the case to be enabled or disabled.

enable

Enable flag (true if case is to be enabled).

 


 

void DisableCase(int i)

Same as EnableCase(i, false).

 


 

void EnableValue(const Value& val, bool enable = true)

Enables or disables case based on its value.

val

Value of the case to be enabled / disabled.

enable

Enable flag (true if case is to be enabled).

 


 

void DisableValue(const Value& val)

Same as EnableValue(val, false).

 


 

void Reset()

Removes content of the Switch.

 


 

const Array<Case>& GetCases() const

Retrieves information of all cases in the Switch.

Return value

Array of Switch::Case structures.

 


 

operator int() const

Simplified access to Switch Value. Equivalent to (int)GetData().

Switch must be assigned an integer value.

Return value

Integer Value of Switch.

 


 

void operator=(const Value& v)

Equivalent to SetData(v).

 


 

Switch& SetFont(Font f)

Alters the font to be used in the Switch.

f

Font to be used.

Return value

*this for chaining.

 


 

Font GetFont() const

Retrieves the font used in the Switch.

Return value

*this for chaining.

 


 

Switch& MinCaseHeight(int cy)

Sets the minimal height of a case in the switch.

f

Font to be used.

Return value

*this for chaining.

 


 

Switch& SetAutoDirection()

Sets Switch layout to automatic mode, where items are layed out depending on the available area for switch (vertically is the are is high enough, horizontally otherwise).

 


 

Switch& SetHorizontal()

Forces horizontal layout.

 


 

Switch& SetVertical()

Forces vertical layout.

 

 

 

Switch::Case

 

struct Case : public Moveable<Case> 

This structure is returned by the Switch::GetCases method.

 

 

Public Field List

 

String label

Text of the case.

 


 

Value value

Value of the case.

 


 

int accesskey

Access key.

 


 

bool enabled

Enable flag.

 

 

Do you want to contribute?