A BMenuField based BControl implementation. More...
Inherits BOptionControl.
Public Member Functions | |
virtual status_t | AddOptionAt (const char *name, int32 value, int32 index) |
Add an option to the menu. More... | |
virtual void | AllAttached () |
Similar to AttachedToWindow() but this method is triggered after all child views have already been detached from a window. More... | |
virtual void | AttachedToWindow () |
Hook method called when the control is attached to a window. More... | |
virtual int32 | CountOptions () const |
Count options in the menu. | |
virtual bool | GetOptionAt (int32 index, const char **_name, int32 *_value) |
Get option at given index. | |
virtual void | GetPreferredSize (float *_width, float *_height) |
Fill out the preferred width and height of the control into the _width and _height parameters. More... | |
virtual void | MessageReceived (BMessage *message) |
Handle message received by the associated looper. More... | |
virtual void | RemoveOptionAt (int32 index) |
Remove option at given index from the menu. | |
virtual void | ResizeToPreferred () |
Resize the control to its preferred size. More... | |
virtual int32 | SelectedOption (const char **_name=0, int32 *_value=0) const |
Get the label and/or value of the currently selected option. | |
virtual void | SetEnabled (bool enabled) |
Enables or disables the control. More... | |
virtual void | SetLabel (const char *text) |
Sets the label of the control. More... | |
virtual void | SetValue (int32 value) |
Sets the value of the control. More... | |
A BMenuField based BControl implementation.
This class is a wrapper around BMenuField that implements BControl semantics. Each menu item holds a value, which is used as the control value when that item is selected.
The menu is populated using the AddOptionAt() method, giving the label and value for each option. It is set to radio mode by default.
|
virtual |
Add an option to the menu.
Note that the option value is independent from its position in the menu.
|
virtual |
Similar to AttachedToWindow() but this method is triggered after all child views have already been detached from a window.
Reimplemented from BControl.
|
virtual |
Hook method called when the control is attached to a window.
This method overrides BView::AttachedToWindow() setting the low color and view color of the BControl so that it matches the view color of the control's parent view. It also makes the attached window the default target for Invoke() as long as another target has not already been set.
Reimplemented from BControl.
|
virtual |
Fill out the preferred width and height of the control into the _width and _height parameters.
Derived classes can override this method to set the preferred width and height of the control.
[out] | _width | Pointer to a float to hold the width of the control. |
[out] | _height | Pointer to a float to hold the height of the control. |
Reimplemented from BControl.
|
virtual |
Handle message received by the associated looper.
message | The message received by the associated looper. |
Reimplemented from BControl.
|
virtual |
Resize the control to its preferred size.
Reimplemented from BControl.
|
virtual |
Enables or disables the control.
BControl objects are enabled by default. If the control changes enabled state then it is redrawn.
Disabled controls generally won't allow the user to focus on them (The B_NAVIGABLE
flag is turned off), and don't post any messages.
Disabled controls in derived classes should be drawn in subdued colors to visually indicate that they are disabled and should not respond to keyboard or mouse events.
enabled | If true enables the control, if false , disables it. |
Reimplemented from BControl.
|
virtual |
Sets the label of the control.
If the label changes the control is redrawn.
label | The label to set, can be NULL . |
Reimplemented from BControl.
|
virtual |
Sets the value of the control.
If the value changes the control is redrawn.
value | The value to set. |
Reimplemented from BControl.