BPictureButton

Derived From:BControl > BView > BHandler > BArchivable
Mix-in Classes:BInvoker
Declared In:interface/PictureButton.h
Library:libbe.so
Allocation:Constructor only
Class Overview

Constructor and Destructor

BPictureButton()

BPictureButton(BRect frame,
               const char* name,
               BPictureoff,
               BPictureon,
               BMessagemessage,
               uint32 behavior = B_ONE_STATE_BUTTON,
               uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
               uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
BPictureButton(BMessagearchive);

Creates a new BPictureButton. The off and an on images correspond to the object's B_CONTROL_OFF and B_CONTROL_ON values; the behavior argument sets the object to be a one-state (B_ONE_STATE_BUTTON) or two-state (B_TWO_STATE_BUTTON) control, as explained in the class overview. The other arguments are inherited from the BView and BControl constructors. The object's initial value is B_CONTROL_OFF.

If the BPictureButton can be disabled, it needs additional "disabled" images, as set through SetDisabledOff() and SetDisabledOn().

The BPictureButton copies all BPictures that are passed to it. It's the caller's responsibility to free the BPicture objects that are passed as arguments.

~BPictureButton()

virtual ~BPictureButton();

Deletes the object and its data.


Member Functions

Archive()

virtual Archive(BMessagearchive,
                bool deep = true) const;

Stores the BPictureButton in the BMessage archive.

See also: BArchivable::Archive(), Instantiate() static function

SetBehavior(), Behavior()

virtual void SetBehavior(uint32 behavior);uint32 Behavior() const;

These functions set and return whether the BPictureButton is a one-state (B_ONE_STATE_BUTTON) or a two-state (B_TWO_STATE_BUTTON) control. A one-state object acts like a normal button: It's on while the user is pressing it, and off otherwise. A two-state object switches to the opposite state each time the user presses and release the button.

SetEnabledOff(), SetEnabledOn(), SetDisabledOff(), SetDisabledOn(), EnabledOff(), EnabledOn(), DisabledOff(), DisabledOn()

virtual void SetEnabledOff(BPicturepicture);BPictureEnabledOff() const;virtual void SetEnabledOn(BPicturepicture);BPictureEnabledOn() const;virtual void SetDisabledOff(BPicturepicture);BPictureDisabledOff() const;virtual void SetDisabledOn(BPicturepicture);BPictureDisabledOn() const;

These pairs of functions set and return one of the four images the BPictureButton displays: enabled-and-on, enabled-and-off, disabled-and-on, and disabled-and-off, respectively. If this is a one-state object, the disabled-and-on image needn't be set since a disabled one-state control can never be on.

The BPicture-retrieving functions return NULL if the requested image hasn't been set.

The BPictureButton copies all BPicture that are passed to it. It's the caller's responsibility to free the BPicture objects that are passed as arguments.


Static Functions

Instantiate()

static BArchivableInstantiate(BMessagearchive);

Returns a new BPictureButton object, allocated by new and created with the version of the constructor that takes a BMessage archive. However, if the archive message doesn't contain data for a BPictureButton object, this function returns NULL.

See also: BArchivable::Instantiate(), instantiate_object(), Archive()


Archived Fields

The Archive() function adds the following fields to its BMessage argument:

FieldType codeDescription
_e_on (deep copy only)B_MESSAGE_TYPEBPicture displayed when control is enabled and on.
_e_off (deep copy only)B_MESSAGE_TYPEBPicture displayed when control is enabled and off.
_d_on (deep copy only)B_MESSAGE_TYPEBPicture displayed when control is disabled and on.
_d_off (deep copy only)B_MESSAGE_TYPEBPicture displayed when control is disabled and off.
_behaveB_INT32_TYPEBPictureButton behavior either B_ONE_STATE_BUTTON or B_TWO_STATE_BUTTON

See also: BArchivable::Archive()

Creative Commons License
Legal Notice
This work is licensed under a Creative Commons Attribution-Non commercial-No Derivative Works 3.0 License.