2011-11-02 12:36:02 +04:00
|
|
|
/*
|
2014-06-04 19:57:42 +04:00
|
|
|
* Copyright 2011-2014 Haiku, Inc. All rights reserved.
|
2011-11-02 12:36:02 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
2013-02-07 06:05:00 +04:00
|
|
|
* Authors:
|
2011-11-02 12:36:02 +04:00
|
|
|
* John Scipione, jscipione@gmail.com
|
2013-02-07 06:05:00 +04:00
|
|
|
*
|
2011-11-02 12:36:02 +04:00
|
|
|
* Corresponds to:
|
2014-05-28 22:05:45 +04:00
|
|
|
* headers/os/interface/Control.h hrev47274
|
|
|
|
* src/kits/interface/Control.cpp hrev47274
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
2013-02-07 06:05:00 +04:00
|
|
|
|
2011-11-02 12:36:02 +04:00
|
|
|
/*!
|
|
|
|
\file Control.h
|
2013-02-07 06:05:00 +04:00
|
|
|
\ingroup interface
|
|
|
|
\ingroup libbe
|
2011-11-02 12:36:02 +04:00
|
|
|
\brief BControl class definition and support enums.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var B_CONTROL_ON
|
2013-02-07 06:05:00 +04:00
|
|
|
|
|
|
|
Control on. Value equal to 1.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var B_CONTROL_OFF
|
2013-02-07 06:05:00 +04:00
|
|
|
|
|
|
|
Control off. Value equal to 0.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\class BControl
|
|
|
|
\ingroup interface
|
|
|
|
\ingroup libbe
|
|
|
|
\brief BControl is the base class for user-event handling objects.
|
|
|
|
|
|
|
|
Simple controls such as BCheckBox and BButton deviate only a bit from
|
|
|
|
BControl, whereas more complicated controls such as BColorControl and
|
|
|
|
BSlider re-implement much more functionality. Whether you are building
|
|
|
|
a simple control or something more complicated you should inherit from
|
|
|
|
BControl as it provides a common set of methods for intercepting
|
|
|
|
received messages from mouse and keyboard events.
|
|
|
|
|
|
|
|
Controls have state which they keep in their value. The value of a
|
|
|
|
control, stored as an int32, is read and set by the virtual Value() and
|
|
|
|
SetValue() methods. BControl defines \c B_CONTROL_ON and \c B_CONTROL_OFF
|
|
|
|
values that you can use as a convenience if your control has a simple
|
|
|
|
on/off state. If your BControl derived class stores a larger set of
|
|
|
|
states then you should define your own integer values instead.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2013-11-09 04:24:47 +04:00
|
|
|
\fn BControl::BControl(BRect frame, const char* name, const char* label,
|
|
|
|
BMessage* message, uint32 resizingMode, uint32 flags)
|
2011-11-02 12:36:02 +04:00
|
|
|
\brief Construct a control in the \a frame with a \a name, \a label,
|
2013-11-09 04:24:47 +04:00
|
|
|
model \a message, \a resizingMode, and creation \a flags.
|
2011-11-02 12:36:02 +04:00
|
|
|
|
|
|
|
The initial value of the control is set to 0 (\c B_CONTROL_OFF).
|
|
|
|
The \a label and the \a message parameters can be set to \c NULL.
|
|
|
|
|
|
|
|
\param frame The \a frame to draw the control in.
|
|
|
|
\param name The \a name of the control.
|
|
|
|
\param label The \a label displayed along with the control.
|
|
|
|
\param message The \a message to send when the control is activated.
|
|
|
|
\param resizingMode Defines the behavior of the control as the parent
|
2013-11-09 04:24:47 +04:00
|
|
|
view resizes, see BView for more details.
|
|
|
|
\param flags Behavior \a flags for the control, see BView for details.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2013-11-09 04:24:47 +04:00
|
|
|
\fn BControl::BControl(const char* name, const char* label,
|
|
|
|
BMessage* message, uint32 flags)
|
2011-11-02 12:36:02 +04:00
|
|
|
\brief Construct a control with a \a name, \a label, model \a message,
|
2013-11-09 04:24:47 +04:00
|
|
|
and creation \a flags suitable for use with the Layout API.
|
2011-11-02 12:36:02 +04:00
|
|
|
|
|
|
|
The initial value of the control is set to 0 (\c B_CONTROL_OFF).
|
|
|
|
The \a label and the \a message parameters can be set to \c NULL.
|
|
|
|
|
|
|
|
\param name The \a name of the control.
|
|
|
|
\param label The \a label displayed along with the control.
|
|
|
|
\param message The \a message to send when the control is activated.
|
2013-11-09 04:24:47 +04:00
|
|
|
\param flags Behavior \a flags for the control, see BView for details.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BControl::~BControl()
|
|
|
|
\brief Frees all memory used by the BControl object including the memory
|
2013-11-09 04:24:47 +04:00
|
|
|
used by the model message.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Archiving
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
2011-11-02 12:36:02 +04:00
|
|
|
/*!
|
2014-06-14 01:25:02 +04:00
|
|
|
\fn BControl::BControl(BMessage* data)
|
|
|
|
\brief Creates a new BControl object from an \a data message.
|
2011-11-02 12:36:02 +04:00
|
|
|
|
|
|
|
This method is usually not called directly. If you want to build a
|
|
|
|
control from a message you should call Instantiate() which can
|
|
|
|
handle errors properly.
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
If the \a data deep, the BControl object will also undata each
|
2011-11-02 12:36:02 +04:00
|
|
|
of its child views recursively.
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\param data The \a data message to restore from.
|
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2014-06-14 01:25:02 +04:00
|
|
|
\fn BArchivable* BControl::Instantiate(BMessage* data)
|
|
|
|
\brief Creates a new object from an \a data.
|
2011-11-02 12:36:02 +04:00
|
|
|
|
|
|
|
If the message is a valid object then the instance created from the
|
2014-06-14 01:25:02 +04:00
|
|
|
passed in \a data will be returned. Otherwise this method will
|
2011-11-02 12:36:02 +04:00
|
|
|
return \c NULL.
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\param data The \a data message.
|
2011-11-02 12:36:02 +04:00
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\returns An instance of the object if \a data is valid or \c NULL.
|
2011-11-02 12:36:02 +04:00
|
|
|
|
|
|
|
\sa BArchivable::Instantiate()
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2014-06-14 01:25:02 +04:00
|
|
|
\fn status_t BControl::Archive(BMessage* data, bool deep) const
|
|
|
|
\brief Archives the control into \a data.
|
2011-11-02 12:36:02 +04:00
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\param data The target \a data that the data will go into.
|
|
|
|
\param deep Whether or not to recursively data child views.
|
2013-11-09 04:24:47 +04:00
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\retval B_OK The data operation was successful.
|
|
|
|
\retval B_BAD_VALUE \c NULL \a data message.
|
2011-11-02 12:36:02 +04:00
|
|
|
\retval B_ERROR The archive operation failed.
|
|
|
|
|
|
|
|
\sa BArchivable::Archive()
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
2011-11-02 12:36:02 +04:00
|
|
|
/*!
|
|
|
|
\fn void BControl::WindowActivated(bool active)
|
2013-11-09 04:24:47 +04:00
|
|
|
\brief Hook method called when the attached window is activated or
|
|
|
|
deactivated.
|
2011-11-02 12:36:02 +04:00
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
Redraws the focus ring around the control when the window is activated
|
2013-11-09 04:24:47 +04:00
|
|
|
or deactivated if it is the window's current focus view.
|
2011-11-02 12:36:02 +04:00
|
|
|
|
|
|
|
\param active \c true if the window becomes activated, \c false if the
|
2013-11-09 04:24:47 +04:00
|
|
|
window becomes deactivated.
|
2011-11-02 12:36:02 +04:00
|
|
|
|
|
|
|
\sa BView::WindowActivated()
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BControl::AttachedToWindow()
|
2013-11-09 04:24:47 +04:00
|
|
|
\brief Hook method called when the control is attached to a window.
|
2011-11-02 12:36:02 +04:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
\sa BView::AttachedToWindow()
|
|
|
|
\sa Invoke()
|
|
|
|
\sa BInvoker::SetTarget()
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BControl::DetachedFromWindow()
|
2014-06-14 01:25:02 +04:00
|
|
|
\brief Hook method called when the control is detached from a window.
|
2014-05-28 22:05:45 +04:00
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\copydetails BView::DetachedFromWindow()
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BControl::AllAttached()
|
|
|
|
\brief Similar to AttachedToWindow() but this method is triggered after
|
2014-06-14 01:25:02 +04:00
|
|
|
all child views have already been detached from a window.
|
2014-05-28 22:05:45 +04:00
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\copydetails BView::AllAttached()
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BControl::AllDetached()
|
|
|
|
\brief Similar to AttachedToWindow() but this method is triggered after
|
2013-11-09 04:24:47 +04:00
|
|
|
all child views have already been detached from a window.
|
2011-11-02 12:36:02 +04:00
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\copydetails BView::AllDetached()
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2014-06-14 01:25:02 +04:00
|
|
|
\fn void BControl::MakeFocus(bool focus)
|
2011-11-02 12:36:02 +04:00
|
|
|
\brief Gives or removes focus from the control.
|
|
|
|
|
|
|
|
BControl::MakeFocus() overrides BView::MakeFocus() to call Draw() when
|
|
|
|
the focus changes. Derived classes generally don't have to re-implement
|
|
|
|
MakeFocus().
|
|
|
|
|
|
|
|
IsFocusChanging() returns \c true when Draw() is called from this method.
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\param focus \a true to set focus, \a false to remove it.
|
2011-11-02 12:36:02 +04:00
|
|
|
|
|
|
|
\sa BView::MakeFocus()
|
|
|
|
\sa IsFocusChanging()
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BControl::KeyDown(const char *bytes, int32 numBytes)
|
2013-11-09 04:24:47 +04:00
|
|
|
\brief Hook method called when a keyboard key is pressed.
|
2011-11-02 12:36:02 +04:00
|
|
|
|
|
|
|
Overrides BView::KeyDown() to toggle the control value and then
|
|
|
|
calls Invoke() for \c B_SPACE or \c B_ENTER. If this is not desired
|
|
|
|
you should override this method in derived classes.
|
|
|
|
|
|
|
|
The KeyDown() method is only called if the BControl is the focus view
|
|
|
|
in the active window. If the window has a default button, \c B_ENTER
|
|
|
|
will be passed to that object instead of the focus view.
|
|
|
|
|
|
|
|
\param bytes The bytes of the key combination pressed.
|
|
|
|
\param numBytes The number of bytes in \a bytes.
|
|
|
|
|
|
|
|
\sa BView::KeyDown()
|
|
|
|
\sa MakeFocus()
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2014-05-28 22:05:45 +04:00
|
|
|
\fn void BControl::MessageReceived(BMessage* message)
|
|
|
|
\brief Handle \a message received by the associated looper.
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\copydetails BView::MessageReceived()
|
2014-05-28 22:05:45 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BControl::MouseDown(BPoint where)
|
2013-11-09 04:24:47 +04:00
|
|
|
\brief Hook method called when a mouse button is pressed.
|
2011-11-02 12:36:02 +04:00
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\copydetails BView::MouseDown()
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2014-06-14 01:25:02 +04:00
|
|
|
\fn void BControl::MouseMoved(BPoint where, uint32 code,
|
|
|
|
const BMessage* dragMessage)
|
|
|
|
\brief Hook method called when the mouse is moved.
|
2011-11-02 12:36:02 +04:00
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\copydetails BView::MouseMoved()
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2014-06-14 01:25:02 +04:00
|
|
|
\fn void BControl::MouseUp(BPoint where)
|
|
|
|
\brief Hook method called when a mouse button is released.
|
2014-05-28 22:05:45 +04:00
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\copydetails BView::MouseUp()
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-11-02 12:36:02 +04:00
|
|
|
/*!
|
|
|
|
\fn void BControl::SetLabel(const char *label)
|
|
|
|
\brief Sets the \a label of the control.
|
|
|
|
|
|
|
|
If the \a label changes the control is redrawn.
|
|
|
|
|
|
|
|
\param label The \a label to set, can be \c NULL.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn const char* BControl::Label() const
|
|
|
|
\brief Gets the label of the control.
|
|
|
|
|
2013-11-09 04:24:47 +04:00
|
|
|
\return The control's label.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BControl::SetValue(int32 value)
|
|
|
|
\brief Sets the value of the control.
|
|
|
|
|
|
|
|
If the \a value changes the control is redrawn.
|
|
|
|
|
|
|
|
\param value The \a value to set.
|
|
|
|
|
|
|
|
\sa SetValueNoUpdate()
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BControl::SetValueNoUpdate(int32 value)
|
|
|
|
\brief Sets the value of the control without redrawing.
|
|
|
|
|
|
|
|
\param value The \a value to set.
|
|
|
|
|
|
|
|
\sa SetValue()
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BControl::Value() const
|
|
|
|
\brief Gets the value of the control.
|
|
|
|
|
2013-11-09 04:24:47 +04:00
|
|
|
\return The control's value.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BControl::SetEnabled(bool enabled)
|
|
|
|
\brief 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 \c 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.
|
|
|
|
|
|
|
|
\param enabled If \c true enables the control, if \c false, disables it.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BControl::IsEnabled() const
|
|
|
|
\brief Gets whether or not the control is currently enabled.
|
|
|
|
|
2013-11-09 04:24:47 +04:00
|
|
|
\return \c true if the control is enabled, \c false if it is disabled.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BControl::GetPreferredSize(float *_width, float *_height)
|
|
|
|
\brief Fill out the preferred width and height of the control
|
|
|
|
into the \a _width and \a _height parameters.
|
|
|
|
|
|
|
|
Derived classes can override this method to set the preferred
|
|
|
|
width and height of the control.
|
|
|
|
|
2014-05-28 22:05:45 +04:00
|
|
|
\param[out] _width Pointer to a \c float to hold the width of the control.
|
|
|
|
\param[out] _height Pointer to a \c float to hold the height of the control.
|
2011-11-02 12:36:02 +04:00
|
|
|
|
|
|
|
\sa BView::GetPreferredSize()
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BControl::ResizeToPreferred()
|
|
|
|
\brief Resize the control to its preferred size.
|
|
|
|
|
|
|
|
\sa BView::ResizeToPreferred()
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2013-11-09 04:24:47 +04:00
|
|
|
\fn status_t BControl::Invoke(BMessage* message)
|
2011-11-02 12:36:02 +04:00
|
|
|
\brief Sends a copy of the model \a message to the designated target.
|
|
|
|
|
|
|
|
BControl::Invoke() overrides BInvoker::Invoke(). Derived classes
|
|
|
|
should use this method in their MouseDown() and KeyDown() methods
|
|
|
|
and should call IsEnabled() to check if the control is enabled
|
|
|
|
before calling Invoke().
|
|
|
|
|
|
|
|
The following fields added to the BMessage:
|
|
|
|
- "when" \c B_INT64_TYPE system_time()
|
|
|
|
- "source" \c B_POINTER_TYPE A pointer to the BControl object.
|
|
|
|
|
|
|
|
\param message The \a message to send.
|
|
|
|
|
2014-05-28 22:05:45 +04:00
|
|
|
\return \c B_OK if the control was invoked, otherwise an error
|
|
|
|
code is returned.
|
|
|
|
|
2011-11-02 12:36:02 +04:00
|
|
|
\sa BInvoker::Invoke()
|
|
|
|
\sa IsEnabled()
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2013-11-09 04:24:47 +04:00
|
|
|
\fn BHandler* BControl::ResolveSpecifier(BMessage* message, int32 index,
|
|
|
|
BMessage* specifier, int32 what, const char* property)
|
2014-06-14 01:25:02 +04:00
|
|
|
\copydoc BHandler::ResolveSpecifier()
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2013-11-09 04:24:47 +04:00
|
|
|
\fn status_t BControl::GetSupportedSuites(BMessage* message)
|
2014-05-28 22:05:45 +04:00
|
|
|
\brief Report the suites of messages this control understands.
|
|
|
|
|
|
|
|
Adds the string "suite/vnd.Be-control" to the message.
|
|
|
|
|
2017-11-11 02:00:05 +03:00
|
|
|
\copydetails BHandler::GetSupportedSuites()
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BControl::Perform(perform_code code, void* _data)
|
2014-06-14 01:25:02 +04:00
|
|
|
\copydoc BView::Perform()
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
2014-05-28 22:05:45 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BControl::SetIcon(const BBitmap* icon, uint32 flags)
|
|
|
|
\brief This convenience method is used to set the bitmaps
|
|
|
|
for the standard states from a single bitmap.
|
|
|
|
|
|
|
|
It also supports cropping the icon to its non-transparent area.
|
|
|
|
The icon is meant as an addition to or replacement of the label.
|
|
|
|
|
|
|
|
\param icon The \a icon to set.
|
|
|
|
\param flags Modify how the icon is set.
|
|
|
|
- \c B_TRIM_ICON_BITMAP Crop the bitmap to the not fully transparent
|
|
|
|
area, may change the icon size.
|
|
|
|
- \c B_TRIM_ICON_BITMAP_KEEP_ASPECT Like \c B_TRIM_BITMAP, but keeps
|
|
|
|
the aspect ratio.
|
|
|
|
- \c B_CREATE_ACTIVE_ICON_BITMAP
|
|
|
|
- \c B_CREATE_PARTIALLY_ACTIVE_ICON_BITMAP
|
|
|
|
- \c B_CREATE_DISABLED_ICON_BITMAPS
|
|
|
|
|
|
|
|
\return \c B_OK if the icon was set or an error code otherwise.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2014-05-28 22:05:45 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BControl::SetIconBitmap(const BBitmap* bitmap,
|
|
|
|
uint32 which, uint32 flags)
|
|
|
|
\brief Icon bitmaps for various states of the control (off, on,
|
|
|
|
partially on, each enabled or disabled, plus up to 125
|
|
|
|
custom states) can be set individually.
|
|
|
|
|
|
|
|
\param bitmap The \a bitmap icon to set.
|
|
|
|
\param which The state to set the icon for.
|
|
|
|
\param flags Modify how the icon is set.
|
|
|
|
- \c B_KEEP_ICON_BITMAP Transfer ownership of the bitmap to the control.
|
|
|
|
|
|
|
|
\return \c B_OK if the icon was set or an error code otherwise.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|