Public Member Functions | List of all members
BOptionPopUp Class Reference

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...
 

Detailed Description

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.

Since
BeOS R5

Member Function Documentation

◆ AddOptionAt()

BOptionPopUp::AddOptionAt ( const char *  name,
int32  value,
int32  index 
)
virtual

Add an option to the menu.

Note that the option value is independent from its position in the menu.

◆ AllAttached()

virtual void BOptionPopUp::AllAttached ( )
virtual

Similar to AttachedToWindow() but this method is triggered after all child views have already been detached from a window.

Since
BeOS R3

Reimplemented from BControl.

◆ AttachedToWindow()

virtual void BOptionPopUp::AttachedToWindow ( )
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.

See also
BView::AttachedToWindow()
Invoke()
BInvoker::SetTarget()
Since
BeOS R3

Reimplemented from BControl.

◆ GetPreferredSize()

virtual void BOptionPopUp::GetPreferredSize ( float *  _width,
float *  _height 
)
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.

Parameters
[out]_widthPointer to a float to hold the width of the control.
[out]_heightPointer to a float to hold the height of the control.
See also
BView::GetPreferredSize()
Since
BeOS R3

Reimplemented from BControl.

◆ MessageReceived()

virtual void BOptionPopUp::MessageReceived ( BMessage message)
virtual

Handle message received by the associated looper.

Parameters
messageThe message received by the associated looper.
See also
BHandler::MessageReceived()
Since
BeOS R3

Reimplemented from BControl.

◆ ResizeToPreferred()

virtual void BOptionPopUp::ResizeToPreferred ( )
virtual

Resize the control to its preferred size.

See also
BView::ResizeToPreferred()
Since
BeOS R3

Reimplemented from BControl.

◆ SetEnabled()

virtual void BOptionPopUp::SetEnabled ( bool  enabled)
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.

Parameters
enabledIf true enables the control, if false, disables it.
Since
BeOS R3

Reimplemented from BControl.

◆ SetLabel()

virtual void BOptionPopUp::SetLabel ( const char *  label)
virtual

Sets the label of the control.

If the label changes the control is redrawn.

Parameters
labelThe label to set, can be NULL.
Since
BeOS R3

Reimplemented from BControl.

◆ SetValue()

virtual void BOptionPopUp::SetValue ( int32  value)
virtual

Sets the value of the control.

If the value changes the control is redrawn.

Parameters
valueThe value to set.
See also
SetValueNoUpdate()
Since
BeOS R3

Reimplemented from BControl.