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
Switch()
Initializes the switch.
~Switch()
Default destructor.
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.
|
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 i) const
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.
|
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.
|
Return value |
*this for chaining. |
Switch& Add(const Value& val, const char *text)
Adds a new case to the Switch.
|
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.
|
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.
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.
|
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.
|
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.
struct Case : public Moveable<Case>
This structure is returned by the Switch::GetCases method.
String label
Text of the case.
Value value
Value of the case.
int accesskey
Access key.
bool enabled
Enable flag.
|