Merge work by John Scipione on the Haiku Book.
* Some new classes documented * Screenshots for the interface kit controls * A lot of typo fixes * Some css tweaks This has some backporting to the current version of Doxygen, since there are experiments to get coloring similar to the one in the Be Book that will hopefully be upstreamed in Doxygen. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42608 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,389 @@
|
||||
/*
|
||||
* Copyright 2011, Haiku inc.
|
||||
* Distributed under the terms of the MIT Licence.
|
||||
*
|
||||
* Documentation by:
|
||||
* John Scipione <[email protected]>
|
||||
* Corresponds to:
|
||||
* /trunk/headers/os/interface/Alert.h rev 42274
|
||||
* /trunk/src/kits/interface/Alert.cpp rev 42274
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\file Alert.h
|
||||
\brief BAlert class definition and support enums.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\enum alert_type
|
||||
Determines which icon (if any) is displayed in the alert dialog.
|
||||
Choose one option. If the constructor doesn't include an
|
||||
alert_type argument than \c B_EMPTY_ALERT is used.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\var alert_type B_EMPTY_ALERT
|
||||
No icon
|
||||
*/
|
||||
|
||||
/*!
|
||||
\var alert_type B_INFO_ALERT
|
||||
\image html http://api.haiku-os.org/images/alert_info_32.png
|
||||
Info icon
|
||||
*/
|
||||
|
||||
/*!
|
||||
\var alert_type B_IDEA_ALERT
|
||||
\image html http://api.haiku-os.org/images/alert_idea_32.png
|
||||
Idea icon
|
||||
*/
|
||||
|
||||
/*!
|
||||
\var alert_type B_WARNING_ALERT
|
||||
\image html http://api.haiku-os.org/images/alert_warning_32.png
|
||||
Warning icon
|
||||
*/
|
||||
|
||||
/*!
|
||||
\var alert_type B_STOP_ALERT
|
||||
\image html http://api.haiku-os.org/images/alert_stop_32.png
|
||||
Stop icon
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum button_spacing
|
||||
Determines how the buttons on the alert dialog are spaced relative
|
||||
to each other. Choose one option. If the constructor doesn't include a
|
||||
button_spacing argument than \c B_EVEN_SPACING is used.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\var button_spacing B_EVEN_SPACING
|
||||
If the alert dialog has more than one button than the buttons are
|
||||
spaced evenly across the bottom of the alert dialog.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\var button_spacing B_OFFSET_SPACING
|
||||
If the alert dialog has more than one button than the leftmost button
|
||||
is offset to the left-hand side of the dialog while the rest of the
|
||||
buttons are grouped on the right. This is useful to separate off a
|
||||
leftmost "Cancel" or "Delete" button.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\class BAlert
|
||||
\ingroup interface
|
||||
\brief The BAlert class defines a modal alert dialog which displays a short
|
||||
message and provides a set of labeled buttons that allow the user to
|
||||
respond.
|
||||
|
||||
The alert can be configured with a set of one to three buttons. These
|
||||
buttons are assigned indexes 0, 1, and 2 from right-to-left respectively
|
||||
and are automatically positioned by the system. The user can either click
|
||||
on one of the buttons or use a shortcut key to select a button.
|
||||
|
||||
The layout of the buttons can be configured by setting the #button_width
|
||||
and #button_spacing properties in the BAlert constructor. The icon displayed
|
||||
in the alert can also be configured by setting the #alert_type property. The
|
||||
right-most button (index 0) is the default button which can be activated
|
||||
by pushing the \key{Enter} key.
|
||||
|
||||
Below is an example of an unsaved changes alert dialog:
|
||||
|
||||
\image html BAlert_example.png
|
||||
|
||||
When the user responds by selecting one of the buttons the alert window is
|
||||
removed from the screen. The index of the selected button is returned to
|
||||
the calling application and the BAlert object is deleted.
|
||||
|
||||
The code used to create and display an alert dialog like the one shown
|
||||
above is shown below:
|
||||
|
||||
\code
|
||||
BAlert* alert = new BAlert("Close and save dialog", "Save changes to...",
|
||||
"Cancel", "Don't save", "Save", B_WIDTH_AS_USUAL, B_OFFSET_SPACING,
|
||||
B_WARNING_ALERT);
|
||||
alert->SetShortcut(0, B_ESCAPE);
|
||||
int32 button_index = alert->Go();
|
||||
\endcode
|
||||
|
||||
The messaged displayed in the dialog window along with the button labels
|
||||
are set by the strings in the contructor. The Cancel button is offset to
|
||||
the left relative to the other buttons by setting the \c B_OFFSET_SPACING
|
||||
flag. The \c B_WARNING_ALERT flag displays the exclamation mark icon in
|
||||
the dialog.
|
||||
|
||||
Any alert with a Cancel button should map the \key{Escape} key as shown in
|
||||
the example above. You can setup additional shortcut keys for the buttons
|
||||
with the SetShortcut() method.
|
||||
|
||||
The Go() method does the work of loading up and removing the alert
|
||||
window and returns the index of the button that the user selected.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BAlert::BAlert(const char *title, const char *text,
|
||||
const char *button1, const char *button2, const char *button3,
|
||||
button_width width, alert_type type)
|
||||
\brief Creates and initializes a BAlert dialog.
|
||||
|
||||
\param title The title of the window. Since the alert window doesn't have
|
||||
a title tab, the title is not actually displayed anywhere but is
|
||||
useful for debugging purposes.
|
||||
\param text The text that is displayed at the top of the window.
|
||||
\param button1 Button 1 label
|
||||
\param button2 Button 2 label
|
||||
\param button3 Button 3 label
|
||||
\param width A constant that describes how the button should be sized.
|
||||
Options are
|
||||
\li \c B_WIDTH_AS_USUAL
|
||||
\li \c B_WIDTH_FROM_WIDEST
|
||||
\li \c B_WIDTH_FROM_LABEL
|
||||
|
||||
See button_width for details.
|
||||
\param type Constant that determines which alert icon is displayed.
|
||||
Options are
|
||||
\li \c B_EMPTY_ALERT
|
||||
\li \c B_INFO_ALERT
|
||||
\li \c B_IDEA_ALERT
|
||||
\li \c B_WARNING_ALERT
|
||||
\li \c B_STOP_ALERT
|
||||
|
||||
See alert_type for details.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn BAlert::BAlert(const char *title, const char *text, const char *button1,
|
||||
const char *button2, const char *button3, button_width width,
|
||||
button_spacing spacing, alert_type type)
|
||||
\brief Creates and initializes a BAlert dialog.
|
||||
|
||||
You can also set the \a spacing with this constructor.
|
||||
|
||||
\param title The title of the window. Since the alert window doesn't have
|
||||
a title tab, the title is not actually displayed anywhere but is
|
||||
useful for debugging purposes.
|
||||
\param text The text that is displayed at the top of the window.
|
||||
\param button1 Button 1 label
|
||||
\param button2 Button 2 label
|
||||
\param button3 Button 3 label
|
||||
\param width A constant that describes how the button should be sized.
|
||||
Options are
|
||||
\li \c B_WIDTH_AS_USUAL
|
||||
\li \c B_WIDTH_FROM_WIDEST
|
||||
\li \c B_WIDTH_FROM_LABEL
|
||||
|
||||
See button_width for details.
|
||||
\param spacing Determines how the buttons are spaced. Options are
|
||||
\li \c B_EVEN_SPACING
|
||||
\li \c B_OFFSET_SPACING
|
||||
|
||||
See button_spacing for details.
|
||||
\param type Constant that determines which alert icon is displayed.
|
||||
Options are
|
||||
\li \c B_EMPTY_ALERT
|
||||
\li \c B_INFO_ALERT
|
||||
\li \c B_IDEA_ALERT
|
||||
\li \c B_WARNING_ALERT
|
||||
\li \c B_STOP_ALERT
|
||||
|
||||
See alert_type for details.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn BAlert::BAlert(BMessage* data)
|
||||
\brief Unarchives an alert from a BMessage.
|
||||
|
||||
\param data The archive.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn BAlert::~BAlert()
|
||||
\brief Destructor method.
|
||||
|
||||
Standard Destructor method to delete a BAlert.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn BArchivable* BAlert::Instantiate(BMessage* data)
|
||||
\brief Instantiates a BAlert from a BMessage.
|
||||
\param data The message to instantiate the BAlert.
|
||||
\returns a BArchivable object of the BAlert.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn status_t BAlert::Archive(BMessage* data, bool deep) const
|
||||
\brief Archives the BAlert into \a archive.
|
||||
|
||||
\param data The target archive which the BAlert \a data will go into.
|
||||
\param deep Whether or not to recursively archive the BAlert's children.
|
||||
\retval B_OK The archive operation was successful.
|
||||
\retval B_BAD_VALUE The archive operation failed.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void BAlert::SetShortcut(int32 index, char key)
|
||||
\brief Sets the shortcut character which is mapped to a button at the
|
||||
specified \a index.
|
||||
|
||||
A button can only have one shortcut except for the rightmost button which,
|
||||
in addition to the shortcut you set, is always mapped to \c B_ENTER.
|
||||
|
||||
If you create a "Cancel" button then you should set its shortcut to
|
||||
\c B_ESCAPE.
|
||||
|
||||
\param index The \a index of the button to set the shortcut to.
|
||||
\param key The shortcut character to set.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn char BAlert::Shortcut(int32 index) const
|
||||
\brief Gets the shortcut character which is mapped to a button at the
|
||||
specified \a index.
|
||||
|
||||
\param index The \a index of the button to get the shortcut of.
|
||||
|
||||
\return The shortcut character mapped to the button at the specified
|
||||
\a index.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int32 BAlert::Go()
|
||||
\brief Displays the alert window.
|
||||
|
||||
This version of Go() that does not include an invoker is
|
||||
synchronous. Go() returns once the user has clicked a button and
|
||||
the panel has been removed from the screen. The BAlert object is
|
||||
deleted before the method returns.
|
||||
|
||||
If the BAlert is sent a \c B_QUIT_REQUESTED message while the alert
|
||||
window is still on screen then Go() returns -1.
|
||||
|
||||
\returns The index of the button clicked.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn status_t BAlert::Go(BInvoker* invoker)
|
||||
\brief Displays the alert window from a specified \a invoker.
|
||||
|
||||
This version of Go() with an \a invoker is asynchronous. It returns
|
||||
immediately with \c B_OK and the button \a index is set to the field
|
||||
of the BMessage that is sent to the target of the \a invoker.
|
||||
|
||||
Go() deletes the BAlert object after the message is sent.
|
||||
|
||||
If you call Go() with a \c NULL invoker argument than the BMessage
|
||||
is not sent.
|
||||
|
||||
If the BAlert is sent a \c B_QUIT_REQUESTED method while the alert
|
||||
window is still on screen then the message is not sent.
|
||||
|
||||
\returns A status code.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void BAlert::MessageReceived(BMessage* msg)
|
||||
\brief Initiates an action from a received message.
|
||||
|
||||
\param msg The message
|
||||
|
||||
\see BWindow::MessagedReceived()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void BAlert::FrameResized(float newWidth, float newHeight)
|
||||
\brief Resizes the alert dialog.
|
||||
|
||||
\param newWidth The new alert dialog width.
|
||||
\param newHeight The new alert dialog height.
|
||||
|
||||
\see BWindow::FrameResized()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn BButton* BAlert::ButtonAt(int32 index) const
|
||||
\brief Returns a pointer to the BButton at the specified \a index.
|
||||
|
||||
The \a index of the buttons begins at \c 0 and counts from left to right.
|
||||
If a BButton does not exist for the specified \a index then \c NULL is
|
||||
returned.
|
||||
|
||||
\param index The \a index of the desired button.
|
||||
|
||||
\return A pointer to the BButton at the specified \a index.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn BTextView* BAlert::TextView() const
|
||||
\brief Returns a TextView containing the text of the Alert.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn BHandler* BAlert::ResolveSpecifier(BMessage* msg, int32 index,
|
||||
BMessage* specifier, int32 form, const char* property)
|
||||
\brief Resolves specifiers for properties.
|
||||
\see BHandler::ResolveSpecifier()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn status_t BAlert::GetSupportedSuites(BMessage* data)
|
||||
\brief Reports the suites of messages and specifiers that derived classes
|
||||
understand.
|
||||
|
||||
\param data The message to report the suite of messages and specifiers.
|
||||
|
||||
\see BWindow::GetSupportedSuites()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void BAlert::DispatchMessage(BMessage* msg, BHandler* handler)
|
||||
\brief Sends out a message.
|
||||
|
||||
\see BWindow::DispatchMessage()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void BAlert::Quit()
|
||||
\brief Quits the window closing it.
|
||||
|
||||
\see BWindow::Quit()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool BAlert::QuitRequested()
|
||||
\brief Hook method that gets called with the window is closed.
|
||||
|
||||
\returns \c true if the window closes.
|
||||
|
||||
\see BWindow::QuitRequested()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn BPoint BAlert::AlertPosition(float width, float height)
|
||||
\brief Resizes the Alert window to the width and height specified and
|
||||
return the Point of the top-left corner of the Alert window.
|
||||
|
||||
\param width The desired \a width of the alert window.
|
||||
\param height The desired \a height of the alert window.
|
||||
|
||||
\returns The BPoint of the top-left corner of the Alert window.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn status_t BAlert::Perform(perform_code code, void* _data)
|
||||
\brief Performs an action give a perform_code and data
|
||||
|
||||
Currently the only perform code available is \c PERFORM_CODE_SET_LAYOUT.
|
||||
|
||||
\param code The perform code
|
||||
\param _data A pointer to some data to perform on
|
||||
|
||||
\return A status code.
|
||||
|
||||
\see BWindow::Perform().
|
||||
*/
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
@@ -0,0 +1,556 @@
|
||||
/*
|
||||
* Copyright 2011, Haiku inc.
|
||||
* Distributed under the terms of the MIT Licence.
|
||||
*
|
||||
* Documentation by:
|
||||
* Axel Dörfler <[email protected]>
|
||||
* John Scipione <[email protected]>
|
||||
* Corresponds to:
|
||||
* /trunk/headers/os/interface/Bitmap.h rev 42274
|
||||
* /trunk/src/kits/interface/Bitmap.cpp rev 42274
|
||||
*/
|
||||
|
||||
/*!
|
||||
\file Bitmap.h
|
||||
\brief Defines the BBitmap class and global operators and functions for
|
||||
handling bitmaps.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\class BBitmap
|
||||
\ingroup interface
|
||||
\ingroup libbe
|
||||
\brief Access and manipulate digital images commonly known as bitmaps.
|
||||
|
||||
A BBitmap is a rectangular map of pixel data. The BBitmap class allows you
|
||||
to create a bitmap by specifying its pixel data and has operations for
|
||||
altering and accessing the properties of bitmaps.
|
||||
|
||||
To create a BBitmap object use one of the constructor methods below. You
|
||||
can determine if initialization was successful by calling the InitCheck()
|
||||
method. You can determine if a BBitmap object is valid at any time by
|
||||
calling the IsValid() method.
|
||||
|
||||
An example of creating a new 32x32 pixel BBitmap object and assigning the
|
||||
icon of the current application looks like this:
|
||||
\code
|
||||
BBitmap iconBitmap = new BBitmap(BRect(0, 0, 31, 31), B_RGBA32));
|
||||
appFileInfo.GetIcon(iconBitmap, B_LARGE_ICON);
|
||||
\endcode
|
||||
|
||||
You can access the properties of a bitmap by calling the Bounds(),
|
||||
Flags(), ColorSpace(), Area(), Bits(), BitsLength(), BytesPerRow(),
|
||||
and GetOverlayRestrictions() methods.
|
||||
|
||||
To directly set the pixel data of a bitmap call the Bits() or SetBits()
|
||||
methods or you can use the ImportBits() method to copy the bits from an
|
||||
existing bitmap.
|
||||
|
||||
You can also draw into a bitmap by attaching a child BView to the bitmap.
|
||||
To add and remove child BView's to a bitmap call the AddChild() and
|
||||
RemoveChild() methods respectively. You can access the child views of a
|
||||
bitmap by calling the CountChildren(), ChildAt(), and FindView() methods.
|
||||
|
||||
For off-screen bitmaps it is important to lock the bitmap before drawing
|
||||
the pixels and then unlock the bitmap when you are done to prevent
|
||||
flickering. To lock and unlock a bitmap call the LockBits() and UnLockBits()
|
||||
methods respectively. To lock and unlock the off-screen window that a
|
||||
bitmap resides in you should call the Lock() and UnLock() methods. To
|
||||
determine is a bitmap is currently locked you can call the IsLocked()
|
||||
method.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BBitmap::BBitmap(BRect bounds, uint32 flags, color_space colorSpace,
|
||||
int32 bytesPerRow, screen_id screenID)
|
||||
\brief Creates and initializes a BBitmap object.
|
||||
|
||||
\param bounds The bitmap dimensions.
|
||||
\param flags Creation flags.
|
||||
\param colorSpace The bitmap's color space.
|
||||
\param bytesPerRow The number of bytes per row the bitmap should use.
|
||||
\c B_ANY_BYTES_PER_ROW to let the constructor choose an appropriate
|
||||
value.
|
||||
\param screenID ???
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BBitmap::BBitmap(BRect bounds, color_space colorSpace,
|
||||
bool acceptsViews, bool needsContiguous)
|
||||
\brief Creates and initializes a BBitmap object.
|
||||
|
||||
\param bounds The bitmap dimensions.
|
||||
\param colorSpace The bitmap's color space.
|
||||
\param acceptsViews \c true, if the bitmap shall accept BViews, i.e. if
|
||||
it shall be possible to attach BView to the bitmap and draw into
|
||||
it.
|
||||
\param needsContiguous If \c true a physically contiguous chunk of memory
|
||||
will be allocated.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BBitmap::BBitmap(const BBitmap* source, bool acceptsViews,
|
||||
bool needsContiguous)
|
||||
\brief Creates a BBitmap object as a clone of another bitmap.
|
||||
|
||||
\param source The source bitmap.
|
||||
\param acceptsViews \c true, if the bitmap shall accept BViews, i.e. if
|
||||
it shall be possible to attach BView to the bitmap and draw into
|
||||
it.
|
||||
\param needsContiguous If \c true a physically contiguous chunk of memory
|
||||
will be allocated.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BBitmap::BBitmap(const BBitmap& source, uint32 flags)
|
||||
\brief Creates a BBitmap object as a clone of another bitmap.
|
||||
|
||||
\param source The source bitmap.
|
||||
\param flags Creation flags.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BBitmap::BBitmap(const BBitmap& source)
|
||||
\brief Creates a BBitmap object as a clone of another bitmap.
|
||||
|
||||
\param source The source bitmap.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BBitmap::~BBitmap()
|
||||
\brief Destructor Method
|
||||
|
||||
Frees all resources associated with this object.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\name Archiving
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn BBitmap::BBitmap(BMessage* data)
|
||||
\brief Unarchives a bitmap from a BMessage.
|
||||
|
||||
\param data The archive.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BArchivable* BBitmap::Instantiate(BMessage* data)
|
||||
\brief Instantiates a BBitmap from an archive.
|
||||
|
||||
\param data The archive.
|
||||
\return A bitmap reconstructed from the archive or \c NULL, if an error
|
||||
occurred.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BBitmap::Archive(BMessage* data, bool deep) const
|
||||
\brief Archives the BBitmap object.
|
||||
|
||||
\param data The archive.
|
||||
\param deep if \c true, child object will be archived as well.
|
||||
\return \c B_OK, if everything went fine, an error code otherwise.
|
||||
*/
|
||||
|
||||
|
||||
//! @}
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BBitmap::InitCheck() const
|
||||
\brief Gets the status of the constructor.
|
||||
|
||||
\returns B_OK if initialization succeeded, otherwise returns an
|
||||
error status.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool BBitmap::IsValid() const
|
||||
\brief Determines whether or not the BBitmap object is valid.
|
||||
|
||||
\return \c true, if the object is properly initialized, \c false otherwise.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\name Locking
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BBitmap::LockBits(uint32* state)
|
||||
\brief Locks the bitmap bits so that they cannot be relocated.
|
||||
|
||||
This is currently only used for overlay bitmaps; whenever you
|
||||
need to access their Bits() you must lock them first.
|
||||
On resolution change overlay bitmaps can be relocated in memory;
|
||||
using this call prevents you from accessing an invalid pointer
|
||||
and clobbering memory that doesn't belong you.
|
||||
|
||||
\param state Unused
|
||||
\returns \c B_OK on success or an error status code.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BBitmap::UnlockBits()
|
||||
\brief Unlocks the bitmap's buffer.
|
||||
|
||||
Counterpart to BBitmap::LockBits().
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool BBitmap::Lock()
|
||||
\brief Locks the off-screen window that belongs to the bitmap.
|
||||
|
||||
The bitmap must accept views, if locking should work.
|
||||
|
||||
\returns \c true, if the lock was acquired successfully.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BBitmap::Unlock()
|
||||
\brief Unlocks the off-screen window that belongs to the bitmap.
|
||||
|
||||
The bitmap must accept views, if locking should work.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool BBitmap::IsLocked() const
|
||||
\brief Determines whether or not the bitmap's off-screen window is locked.
|
||||
|
||||
The bitmap must accept views, if locking should work.
|
||||
|
||||
\return \c true, if the caller owns a lock , \c false otherwise.
|
||||
*/
|
||||
|
||||
|
||||
//! @}
|
||||
|
||||
|
||||
/*!
|
||||
\name Accessors
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn area_id BBitmap::Area() const
|
||||
\brief Gets the ID of the area the bitmap data reside in.
|
||||
|
||||
\return The ID of the area the bitmap data reside in.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void* BBitmap::Bits() const
|
||||
\brief Gets the pointer to the bitmap data.
|
||||
|
||||
\return The pointer to the bitmap data.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn int32 BBitmap::BitsLength() const
|
||||
\brief Gets the length of the bitmap data.
|
||||
|
||||
\return The length of the bitmap data as an int32.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn int32 BBitmap::BytesPerRow() const
|
||||
\brief Gets the number of bytes used to store a row of bitmap data.
|
||||
|
||||
\return The number of bytes used to store a row of bitmap data.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn color_space BBitmap::ColorSpace() const
|
||||
\brief Gets the bitmap's color space.
|
||||
|
||||
\return The bitmap's color space.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BRect BBitmap::Bounds() const
|
||||
\brief Gets a BRect the size of the bitmap's dimensions.
|
||||
|
||||
\return A BRect the size of the bitmap's dimensions.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn uint32 BBitmap::Flags() const
|
||||
\brief Accesses the bitmap's creation flags.
|
||||
|
||||
This method informs about which flags have been used to create the
|
||||
bitmap. It would for example tell you wether this is an overlay
|
||||
bitmap. If bitmap creation succeeded, all flags are fulfilled.
|
||||
|
||||
\return The bitmap's creation flags.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BBitmap::GetOverlayRestrictions(overlay_restrictions*
|
||||
restrictions) const
|
||||
\brief Gets the overlay_restrictions structure for this bitmap.
|
||||
|
||||
\note This function is not part of the BeOS R5 API.
|
||||
|
||||
\param restrictions The overlay restrictions flag
|
||||
|
||||
\retval B_OK The overlay restriction structure was found.
|
||||
\retval B_BAD_TYPE The overlay restriction structure for the bitmap could
|
||||
not be found.
|
||||
*/
|
||||
|
||||
|
||||
//! @}
|
||||
|
||||
|
||||
/*!
|
||||
\name Setters
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BBitmap::SetBits(const void* data, int32 length, int32 offset,
|
||||
color_space colorSpace)
|
||||
\brief Assigns data to the bitmap.
|
||||
|
||||
Data are directly written into the bitmap's data buffer, being converted
|
||||
beforehand, if necessary. Some conversions do not work intuitively:
|
||||
- \c B_RGB32: The source buffer is supposed to contain \c B_RGB24_BIG
|
||||
data without padding at the end of the rows.
|
||||
- \c B_RGB32: The source buffer is supposed to contain \c B_CMAP8
|
||||
data without padding at the end of the rows.
|
||||
- other color spaces: The source buffer is supposed to contain data
|
||||
according to the specified color space being padded to int32 row-wise.
|
||||
|
||||
The currently supported source/target color spaces are
|
||||
<code>B_RGB{32,24,16,15}[_BIG]</code>, \c B_CMAP8 and
|
||||
<code>B_GRAY{8,1}</code>.
|
||||
|
||||
\note Since this methods is a bit strange to use, Haiku has introduced
|
||||
the ImportBits() method which is the recommended replacement.
|
||||
|
||||
\param data The data to be copied.
|
||||
\param length The length in bytes of the data to be copied.
|
||||
\param offset The offset (in bytes) relative to beginning of the bitmap
|
||||
data specifying the position at which the source data shall be
|
||||
written.
|
||||
\param colorSpace Color space of the source data.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BBitmap::ImportBits(const void* data, int32 length, int32 bpr,
|
||||
int32 offset, color_space colorSpace)
|
||||
\brief Assigns data to the bitmap.
|
||||
|
||||
Data are directly written into the bitmap's data buffer, being converted
|
||||
beforehand, if necessary. Unlike for SetBits(), the meaning of
|
||||
\a colorSpace is exactly the expected one here, i.e. the source buffer
|
||||
is supposed to contain data of that color space. \a bpr specifies how
|
||||
many bytes the source contains per row. \c B_ANY_BYTES_PER_ROW can be
|
||||
supplied, if standard padding to int32 is used.
|
||||
|
||||
The currently supported source/target color spaces are
|
||||
<code>B_RGB{32,24,16,15}[_BIG]</code>, \c B_CMAP8 and
|
||||
<code>B_GRAY{8,1}</code>.
|
||||
|
||||
\note This function is not part of the BeOS R5 API.
|
||||
|
||||
\param data The data to be copied.
|
||||
\param length The length in bytes of the data to be copied.
|
||||
\param bpr The number of bytes per row in the source data.
|
||||
\param offset The offset (in bytes) relative to beginning of the bitmap
|
||||
data specifying the position at which the source data shall be
|
||||
written.
|
||||
\param colorSpace Color space of the source data.
|
||||
|
||||
\retval B_OK The bits were imported into the bitmap.
|
||||
\retval B_BAD_VALUE \c NULL \a data, invalid \a bpr or \a offset, or
|
||||
unsupported \a colorSpace.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BBitmap::ImportBits(const void* data, int32 length,
|
||||
int32 bpr, color_space colorSpace, BPoint from, BPoint to,
|
||||
int32 width, int32 height)
|
||||
\brief Assigns data to the bitmap.
|
||||
|
||||
Allows for a BPoint offset in the source and in the bitmap. The region
|
||||
of the source at \a from extending \a width and \a height is assigned
|
||||
(and converted if necessary) to the bitmap at \a to.
|
||||
|
||||
The currently supported source/target color spaces are
|
||||
<code>B_RGB{32,24,16,15}[_BIG]</code>, \c B_CMAP8 and
|
||||
<code>B_GRAY{8,1}</code>.
|
||||
|
||||
\note This function is not part of the BeOS R5 API.
|
||||
|
||||
\param data The data to be copied.
|
||||
\param length The length in bytes of the data to be copied.
|
||||
\param bpr The number of bytes per row in the source data.
|
||||
\param colorSpace Color space of the source data.
|
||||
\param from The offset in the source where reading should begin.
|
||||
\param to The offset in the bitmap where the source should be written.
|
||||
\param width The width (in pixels) to be imported.
|
||||
\param height The height (in pixels) to be imported.
|
||||
|
||||
\retval B_OK The bits were imported into the bitmap.
|
||||
\retval B_BAD_VALUE: \c NULL \a data, invalid \a bpr, unsupported
|
||||
\a colorSpace or invalid \a width or \a height.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BBitmap::ImportBits(const BBitmap* bitmap)
|
||||
\brief Assigns another bitmap's data to this bitmap.
|
||||
|
||||
The supplied bitmap must have the exactly same dimensions as this bitmap.
|
||||
Its data is converted to the color space of this bitmap.
|
||||
|
||||
The currently supported source/target color spaces are
|
||||
<code>B_RGB{32,24,16,15}[_BIG]</code>, \c B_CMAP8 and
|
||||
<code>B_GRAY{8,1}</code>.
|
||||
|
||||
\note This function is not part of the BeOS R5 API.
|
||||
|
||||
\param bitmap The source bitmap.
|
||||
|
||||
\retval B_OK The bits were imported into the bitmap.
|
||||
\retval B_BAD_VALUE \c NULL \a bitmap, or \a bitmap has other dimensions,
|
||||
or the conversion from or to one of the color spaces is not supported.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BBitmap::ImportBits(const BBitmap* bitmap, BPoint from,
|
||||
BPoint to,int32 width, int32 height)
|
||||
\brief Assigns data to the bitmap.
|
||||
|
||||
Allows for a BPoint offset in the source and in the bitmap. The region
|
||||
of the source at \a from extending \a width and \a height is assigned
|
||||
(and converted if necessary) to the bitmap at \a to. The source bitmap is
|
||||
clipped to the bitmap and they don't need to have the same dimensions.
|
||||
|
||||
The currently supported source/target color spaces are
|
||||
<code>B_RGB{32,24,16,15}[_BIG]</code>, \c B_CMAP8 and
|
||||
<code>B_GRAY{8,1}</code>.
|
||||
|
||||
\note This function is not part of the BeOS R5 API.
|
||||
|
||||
\param bitmap The source bitmap.
|
||||
\param from The offset in the source where reading should begin.
|
||||
\param to The offset in the bitmap where the source should be written.
|
||||
\param width The width (in pixels) to be imported.
|
||||
\param height The height (in pixels) to be imported.
|
||||
|
||||
\retval B_OK The bits were imported into the bitmap.
|
||||
\retval B_BAD_VALUE \c NULL \a bitmap, the conversion from or to one of
|
||||
the color spaces is not supported, or invalid \a width or \a height.
|
||||
*/
|
||||
|
||||
|
||||
//! @}
|
||||
|
||||
|
||||
/*!
|
||||
\name Child View Methods
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BBitmap::AddChild(BView* view)
|
||||
\brief Adds a BView to the bitmap's view hierarchy.
|
||||
|
||||
The bitmap must accept views and the supplied view must not be child of
|
||||
another parent.
|
||||
|
||||
\param view The view to be added.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool BBitmap::RemoveChild(BView* view)
|
||||
\brief Removes a BView from the bitmap's view hierarchy.
|
||||
|
||||
\param view The view to be removed.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn int32 BBitmap::CountChildren() const
|
||||
\brief Gets the number of BViews currently belonging to the bitmap.
|
||||
|
||||
\returns The number of BViews currently belonging to the bitmap.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BView* BBitmap::ChildAt(int32 index) const
|
||||
\brief Gets the BView at a certain index in the bitmap's list of views.
|
||||
|
||||
\param index The index of the BView to be returned.
|
||||
\returns The BView at index \a index or \c NULL if the index is out of
|
||||
range.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BView* BBitmap::FindView(const char* viewName) const
|
||||
\brief Accesses a bitmap's child BView with a the name \a viewName.
|
||||
|
||||
\param viewName The name of the BView to be returned.
|
||||
\returns The BView with the name \a name or \c NULL if the bitmap doesn't
|
||||
know a view with that name.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BView* BBitmap::FindView(BPoint point) const
|
||||
\brief Accesses a bitmap's BView at a certain location.
|
||||
|
||||
\param point The location.
|
||||
\returns The BView with located at \a point or \c NULL if the bitmap
|
||||
doesn't know a view at this location.
|
||||
*/
|
||||
|
||||
|
||||
//! @}
|
||||
+217
-118
@@ -3,166 +3,253 @@
|
||||
* Distributed under the terms of the MIT Licence.
|
||||
*
|
||||
* Documentation by:
|
||||
* Clark Gaeble
|
||||
* Adrien Destugues <[email protected]>
|
||||
* Clark Gaeble
|
||||
* Adrien Destugues <[email protected]>
|
||||
* John Scipione <[email protected]>
|
||||
* Corresponds to:
|
||||
* /trunk/headers/os/interface/Box.h rev 39685
|
||||
* /trunk/src/kits/interface/Box.cpp rev 39685
|
||||
* /trunk/headers/os/interface/Box.h rev 42274
|
||||
* /trunk/src/kits/interface/Box.cpp rev 42274
|
||||
|
||||
|
||||
/*!
|
||||
\file Box.h
|
||||
\brief Defines the BBox class
|
||||
\file Box.h
|
||||
\brief Defines the BBox class
|
||||
*/
|
||||
|
||||
/*! \class BBox
|
||||
|
||||
/*!
|
||||
\class BBox
|
||||
\ingroup interface
|
||||
\brief Class just drawing a square box with a label in a window.
|
||||
|
||||
A Box represents a square on the interface with dimensions, an optional
|
||||
name, and no interactivity.
|
||||
\brief The BBox class is used to draw a square box in a window with an
|
||||
optional label to group related subviews.
|
||||
|
||||
This would be used to visually group elements together.
|
||||
A BBox is an organizational interface element used to group related views
|
||||
together visually. A basic BBox looks like this:
|
||||
|
||||
\image html B_FANCY_BORDER.png
|
||||
|
||||
A box's label can either be text or it can be another control such
|
||||
as a checkbox or dropdown box. See SetLabel() for more details on setting
|
||||
the label on a BBox.
|
||||
*/
|
||||
|
||||
/*! \fn BBox::BBox(BRect frame, const char *name = NULL, uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP, uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, border_style border = B_FANCY_BORDER)
|
||||
\brief Constructs a Box from a set of dimensions.
|
||||
|
||||
This is the only constructor that can be used if the box is to be inserted
|
||||
in a window that doesn't use the layout system.
|
||||
/*!
|
||||
\fn BBox::BBox(BRect frame, const char *name = NULL,
|
||||
uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP,
|
||||
border_style border = B_FANCY_BORDER)
|
||||
\brief Constructs a BBox from a set of dimensions.
|
||||
|
||||
\param frame The bounds of the box.
|
||||
\param name The name of the box.
|
||||
\param resizingMode Defines the behavior of the box as the parent view
|
||||
\note This is the only constructor that can be used if the BBox is to be
|
||||
inserted in a window that doesn't use the layout system.
|
||||
|
||||
\param frame The bounds of the BBox.
|
||||
\param name The name of the BBox.
|
||||
\param resizingMode Defines the behavior of the BBox as the parent view
|
||||
resizes.
|
||||
\param flags Behavior flags for the box. See BView page for more
|
||||
info.
|
||||
\param border Sets the initial style of the border. See SetBorder for
|
||||
more details.
|
||||
\param flags Behavior flags for the BBox. See BView for details.
|
||||
\param border The border_style of the BBox.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn BBox::BBox(const char* name, uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, border_style border = B_FANCY_BORDER, BView* child = NULL)
|
||||
\brief Constructs a named Box, with dimensions defined automatically by the
|
||||
/*!
|
||||
\fn BBox::BBox(const char* name,
|
||||
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP,
|
||||
border_style border = B_FANCY_BORDER, BView* child = NULL)
|
||||
\brief Constructs a named BBox with dimensions defined automatically by the
|
||||
Layout Kit.
|
||||
|
||||
\param name The name of the box.
|
||||
\param flags Behavior flags for the box.
|
||||
\param border Defines the initial border style.
|
||||
\param child Adds an initial child to the box. See: Layout Kit
|
||||
\param name The name of the BBox.
|
||||
\param flags Behavior flags for the BBox. See BView for details.
|
||||
\param border The border_style of the BBox.
|
||||
\param child Adds an initial child to the BBox. See the Layout Kit for
|
||||
details.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn BBox::BBox(border_style border, BView* child)
|
||||
\brief Constructs an anonymous Box, with a defined border style and a child.
|
||||
/*!
|
||||
\fn BBox::BBox(border_style border, BView* child)
|
||||
\brief Constructs an anonymous BBox, with a defined border style and
|
||||
a child.
|
||||
|
||||
There can only be a single child view in the box. This view can, however,
|
||||
act as a nesting container if you need more things to show inside the box.
|
||||
|
||||
\param border The initial border style of the box.
|
||||
\param child The child of the Box.
|
||||
There can only be a single child view in the BBox. This view can, however,
|
||||
act as a nesting container if you need more things to show inside the BBox.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn BBox::BBox(BMessage* archive)
|
||||
\brief For archive restoration, allows a box to be constructed from an
|
||||
archive message.
|
||||
/*!
|
||||
\fn BBox::BBox(BMessage* archive)
|
||||
\brief For archive restoration, allows a BBox to be constructed from an
|
||||
\a archive message.
|
||||
|
||||
You don't usually call this directly, if you want to build a BBox from a
|
||||
message, prefer calling Instantiate, which can properly handle errors.
|
||||
This method is usually not called directly. If you want to build a BBox
|
||||
from a message then you should call Instantiate() which can handle errors
|
||||
properly.
|
||||
|
||||
If the archive is a deep one, the box will also unarchive all of its
|
||||
children recursively.
|
||||
If the \a archive is a deep one, the BBox will also unarchive all
|
||||
of its children recursively.
|
||||
|
||||
\param archive The archive to restore from.
|
||||
\param archive The \a archive to restore from.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn static BArchivable* BBox::Instantiate(BMessage* archive)
|
||||
\brief Creates a new BBox from an archive.
|
||||
/*!
|
||||
\fn BBox::~BBox()
|
||||
\brief Destructor method.
|
||||
|
||||
If the message is a valid box, an instance of BBox (created from the
|
||||
archive) will be returned. Otherwise, this function will return NULL.
|
||||
Calling the destructor will also free the memory used by the box's label
|
||||
if it has one.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn virtual status_t BBox::Archive(BMessage* archive, bool deep = true) const;
|
||||
\brief Archives the box into archive.
|
||||
/*!
|
||||
\fn static BArchivable* BBox::Instantiate(BMessage* archive)
|
||||
\brief Creates a new BBox from an \a archive.
|
||||
|
||||
\param archive The target archive which the box data will go into.
|
||||
\param deep Whether or not to recursively archive the children.
|
||||
\returns B_OK if the archive was successful.
|
||||
If the message is a valid BBox then an instance of BBox created from the
|
||||
passed in \a archive will be returned. Otherwise this method will
|
||||
return \c NULL.
|
||||
|
||||
\param archive The \a archive message.
|
||||
|
||||
\returns An instance of BBox if the \a archive is valid or \c NULL.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn virtual void BBox::SetBorder(border_style border)
|
||||
/*!
|
||||
\fn virtual status_t BBox::Archive(BMessage* archive,
|
||||
bool deep = true) const;
|
||||
\brief Archives the BBox into \a archive.
|
||||
|
||||
\param archive The target \a archive which the BBox data will go
|
||||
into.
|
||||
\param deep Whether or not to recursively archive the children.
|
||||
\returns A status flag indicating if the archive operation was successful.
|
||||
|
||||
\retval B_OK The archive operation was successful.
|
||||
\retval B_BAD_VALUE The archive operation failed.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn virtual void BBox::SetBorder(border_style border)
|
||||
\brief Sets the border style.
|
||||
|
||||
Possible values are B_PLAIN_BORDER (a single 1-pixel line border),
|
||||
B_FANCY_BORDER (the default, slightly beveled look), and B_NO_BORDER, which
|
||||
is used to make an invisible box.
|
||||
Possible values are \c B_PLAIN_BORDER (a single 1-pixel line border),
|
||||
\c B_FANCY_BORDER (the default, beveled look), and \c B_NO_BORDER, which
|
||||
is used to make an invisible box. See border_style for more details.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn border_style BBox::Border() const
|
||||
\brief Gets the border style.
|
||||
/*!
|
||||
\fn border_style BBox::Border() const
|
||||
\brief Gets the current border_style of a BBox.
|
||||
|
||||
\returns The border_style flag that is currently set to the BBox.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn float BBox::TopBorderOffset()
|
||||
\brief Gets the distance from the very top of the Box to the top border
|
||||
line, in pixels.
|
||||
/*!
|
||||
\fn float BBox::TopBorderOffset()
|
||||
\brief Gets the distance from the very top of the BBox to the top border
|
||||
line in pixels as a \c float.
|
||||
|
||||
\warning This method is not part of the BeOS R5 API and is not yet
|
||||
finalized.
|
||||
|
||||
The distance may vary depending on the text or view used as label, and the
|
||||
font settings. The border is drawn center aligned with the label.
|
||||
font settings. The border is drawn center aligned with the label. You can
|
||||
use this value to line up two boxes visually if one has a label and the
|
||||
other does not.
|
||||
|
||||
You can use this value to line up two boxes visually, if one has a label and
|
||||
the other has not.
|
||||
\returns The distance offset of the BBox as a \c float.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn BRect BBox::InnerFrame()
|
||||
\brief Returns the rectangle just inside the border.
|
||||
/*!
|
||||
\fn BRect BBox::InnerFrame()
|
||||
\brief Gets the rectangle just inside the border of the BBox as a BRect.
|
||||
|
||||
\warning This method is not part of the BeOS R5 API and is not yet
|
||||
finalized.
|
||||
|
||||
\returns A BRect of the dimensions of the box's inside border.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn void BBox::SetLabel(const char* string)
|
||||
\brief Sets the label's text.
|
||||
/*!
|
||||
\fn void BBox::SetLabel(const char* string)
|
||||
\brief Sets the box's label text.
|
||||
|
||||
This text is shown as the box title on screen, so the user can identify the
|
||||
purpose of it.
|
||||
Below is an example of a BBox with a simple text label:
|
||||
|
||||
\image html BBox_example.png
|
||||
|
||||
The code to create a BBox with a text label looks like this:
|
||||
|
||||
\code
|
||||
fIconBox = new BBox("Icon Box");
|
||||
fIconBox->SetLabel("Icon");
|
||||
\endcode
|
||||
|
||||
\param string The label text string to set as the box's title.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn status_t BBox::SetLabel(BView* viewLabel)
|
||||
/*!
|
||||
\fn status_t BBox::SetLabel(BView* viewLabel)
|
||||
\brief Sets the label from a pre-existing BView.
|
||||
|
||||
You can use any type of BView for this, such as a BPopupMenu.
|
||||
This version of SetLabel is much more powerful than
|
||||
SetLabel(const char* string). It allows building a box which contents can
|
||||
be changed depending on the label widget.
|
||||
This version of SetLabel() allows building a BBox with a control as a
|
||||
label widget. You can pass in any type of BView derived control for this
|
||||
such as a BPopupMenu or BCheckBox.
|
||||
|
||||
An example of a BBox with a BCheckBox control attached is shown below:
|
||||
|
||||
\image html BBox_with_checkbox.png
|
||||
|
||||
The code to create such a BBox looks like this:
|
||||
|
||||
\code
|
||||
fVirtualMemoryEnabledCheckBox = new BCheckBox("Virtual memory check box",
|
||||
"Enable virtual memory", new BMessage(kVirtualMemoryEnabled));
|
||||
|
||||
BBox* fVirtualMemoryBox = new BBox("Virtual memory box");
|
||||
fVirtualMemoryBox->SetLabel(fVirtualMemoryEnabledCheckBox);
|
||||
\endcode
|
||||
|
||||
\param viewLabel A BView.
|
||||
\returns \c B_OK
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn const char* BBox::Label() const
|
||||
/*!
|
||||
\fn const char* BBox::Label() const
|
||||
\brief Gets the label's text.
|
||||
|
||||
This only works if the label was set as text. If you set another view as the
|
||||
label, you have to get its text by other means, likely starting with
|
||||
LabelView.
|
||||
|
||||
\returns The label text of the BBox as a <tt>const char*</tt> if the BBox
|
||||
has a text label or \c NULL otherwise.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn BView* BBox::LabelView() const
|
||||
/*!
|
||||
\fn BView* BBox::LabelView() const
|
||||
\brief Gets the BView representing the label.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn virtual void BBox::Draw(BRect updateRect)
|
||||
\brief Draws onto the parent window the part of the box that intersects
|
||||
/*!
|
||||
\fn virtual void BBox::Draw(BRect updateRect)
|
||||
\brief Draws onto the parent window the part of the BBox that intersects
|
||||
the dirty area.
|
||||
|
||||
This is an hook function called by the interface kit. You don't have to call
|
||||
it yourself. If you need to force redrawing of (part of) the box, consider
|
||||
This is an hook method called by the interface kit. You don't have to call
|
||||
it yourself. If you need to force redrawing of (part of) the BBox, consider
|
||||
using Invalidate instead.
|
||||
|
||||
\param updateRect The area that needs to be redrawn. Note the box may draw
|
||||
@@ -170,83 +257,95 @@
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn virtual void BBox::AttachedToWindow()
|
||||
\brief Hook called when the box is attached to a window.
|
||||
/*!
|
||||
\fn virtual void BBox::AttachedToWindow()
|
||||
\brief Hook method called when the BBox is attached to a window.
|
||||
|
||||
This function sets the box background color to the parent's one.
|
||||
This method sets the box's background color to the background of the
|
||||
parent view.
|
||||
|
||||
If you are using the layout system, the box is also resized depending
|
||||
on the layout of the parent view.
|
||||
If you are using the layout system, the BBox is also resized according to
|
||||
the layout of the parent view.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn virtual void BBox::FrameResized(float width, float height)
|
||||
\brief Called when the box needs to change its size.
|
||||
/*!
|
||||
\fn virtual void BBox::FrameResized(float width, float height)
|
||||
\brief Called when the BBox needs to change its size.
|
||||
|
||||
This function may be called either because the window in which the box is
|
||||
This method may be called either because the window in which the BBox is
|
||||
was resized, or because the window layout was otherwise altered.
|
||||
|
||||
It recomputes the layouting of the box (including label and contents) and
|
||||
makes it redraw itself as needed.
|
||||
It recomputes the layout of the BBox (including label and contents) and
|
||||
makes it redraw as necessary.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn virtual void BBox::ResizeToPreferred()
|
||||
\brief Resizes the box to its preferred dimensions.
|
||||
/*!
|
||||
\fn virtual void BBox::ResizeToPreferred()
|
||||
\brief Resizes the BBox to its preferred dimensions.
|
||||
|
||||
This only works in the non-layout mode, as it forces the resizing.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn virtual void BBox::GetPreferredSize(float* _width, float* _height)
|
||||
\brief Gets the dimensions the box would prefer to be.
|
||||
/*!
|
||||
\fn virtual void BBox::GetPreferredSize(float* _width, float* _height)
|
||||
\brief Gets the dimensions that the BBox would prefer to be.
|
||||
|
||||
The size is computed from the children sizes, unless it was explicitly set
|
||||
for the box (which canbe done only in layouted mode).
|
||||
for the BBox (which can be done only if the BBox is configured to
|
||||
use the Layout Kit).
|
||||
|
||||
\note Either one of the parameters may be set to NULL if you only want to
|
||||
get the other one.
|
||||
\note Either the \a _width or \a _height parameter may be set to \c NULL
|
||||
if you only want to get the other one.
|
||||
|
||||
\param _width An output parameter. The width of the preferred size is
|
||||
placed in here.
|
||||
\param _height An output parameter. The height of the preferred size is
|
||||
placed in here.
|
||||
\param[out] _width The width of the preferred size is placed in here.
|
||||
\param[out] _height The height of the preferred size is placed in here.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn virtual BSize BBox::MinSize()
|
||||
\brief Gets the minimum possible size of the Box.
|
||||
/*!
|
||||
\fn virtual BSize BBox::MinSize()
|
||||
\brief Gets the minimum possible size of the BBox.
|
||||
|
||||
Drawing the box at this size ensures the label and the child view are
|
||||
Drawing the BBox at this size ensures the label and the child view are
|
||||
visible. Going smaller means something may get invisible on screen for lack
|
||||
of space.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn virtual BSize BBox::MaxSize()
|
||||
\brief Gets the maximum possible size of the Box.
|
||||
/*!
|
||||
\fn virtual BSize BBox::MaxSize()
|
||||
\brief Gets the maximum possible size of the BBox.
|
||||
|
||||
The maximum size depends on the child view's one.
|
||||
|
||||
\returns A BSize of the maximum possible size of the BBox.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn virtual BSize BBox::PreferredSize()
|
||||
/*!
|
||||
\fn virtual BSize BBox::PreferredSize()
|
||||
\brief Returns the box's preferred size.
|
||||
|
||||
This is the same as GetPreferredSize, but using the more convenient BSize
|
||||
struct.
|
||||
|
||||
\returns A BSize of the minimum possible size of the BBox.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn virtual void BBox::DoLayout()
|
||||
\brief Lays out the box. Moves everything to its appropriate position.
|
||||
/*!
|
||||
\fn virtual void BBox::DoLayout()
|
||||
\brief Lays out the BBox. Moves everything into its appropriate position.
|
||||
|
||||
This only works if the box uses the layout system, ie., was created with
|
||||
one of the BRect-less constructors.
|
||||
This only works if the BBox uses the layout system from the Layout Kit,
|
||||
i.e. it was created with one of the BRect-less constructors.
|
||||
|
||||
Once the size of the box is known, from layouting of the parent views, this
|
||||
function is called so the box can adjust the position and size of the label,
|
||||
eventually truncating the text if there is not enough space. The exact
|
||||
border positions are also computed, then the child view is also layouted if
|
||||
its size constraints changed.
|
||||
Once the size of the BBox is known, from layouting of the parent views,
|
||||
this method is called so the BBox can adjust the position and size of the
|
||||
label, eventually truncating the text if there is not enough space. The
|
||||
exact border positions are also computed, then the child view is also
|
||||
layouted if its size constraints changed.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,456 @@
|
||||
/*
|
||||
* Copyright 2011, Haiku inc.
|
||||
* Distributed under the terms of the MIT Licence.
|
||||
*
|
||||
* Documentation by:
|
||||
* John Scipione <[email protected]>
|
||||
* Corresponds to:
|
||||
* /trunk/headers/os/interface/Button.h
|
||||
* /trunk/src/kits/interface/Button.cpp
|
||||
|
||||
|
||||
/*!
|
||||
\file Button.h
|
||||
\brief Describes the BButton class.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\class BButton Button.h
|
||||
\ingroup interface
|
||||
\brief A BButton is a labeled on-screen button.
|
||||
|
||||
A BButton control is used to initiate an action. An action is activated
|
||||
by clicking on the button with the mouse or by a keyboard button.
|
||||
If the BButton is the default button for the active window then you can
|
||||
activate it by pushing the <span class="keycap">Enter</span> key.
|
||||
|
||||
\image html BButton_example.png
|
||||
|
||||
A BButton, unlike other user interface elements such as check boxes and
|
||||
radio buttons has only a single state. During a click event the
|
||||
BButton's value is set to \c 1, (\c B_CONTROL_ON) otherwise this value
|
||||
is \c 0 (\c B_CONTROL_OFF).
|
||||
|
||||
BButton inherits from the BControl class.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BButton::BButton(BRect frame, const char* name, const char* label,
|
||||
BMessage* message, uint32 resizingMode, uint32 flags)
|
||||
\brief Creates and initializes a BButton control.
|
||||
|
||||
\note A BButton created with a constructor that includes a frame
|
||||
parameter does \b not utilize the Layout Kit to position and size the
|
||||
control.
|
||||
|
||||
BControl initializes the button's label and assigns it a message that
|
||||
identifies the action that should be carried out when the button is
|
||||
pressed. When the button is attached to a window it is resizes to the
|
||||
height of the button's frame rectangle to fit the button's border and
|
||||
label in the button's font.
|
||||
|
||||
The \a frame, \a name, \a resizingMode, and \a flags parameters are
|
||||
passed up the inheritance chain to the BView class.
|
||||
|
||||
\param frame The frame rectangle that the button is draw into.
|
||||
\param name The name of the button
|
||||
\param label The button label text
|
||||
\param message The BButtons's action message
|
||||
\param resizingMode Mask sets the parameters by which the BButton can be
|
||||
resized. It should be set to one option for vertical resizing combined
|
||||
with one option for horizontal resizing.
|
||||
\n\n Horizontal resizing options are
|
||||
\li \c B_FOLLOW_LEFT
|
||||
\li \c B_FOLLOW_RIGHT
|
||||
\li \c B_FOLLOW_LEFT_RIGHT
|
||||
\li \c B_FOLLOW_H_CENTER
|
||||
|
||||
Vertical resizing options are
|
||||
\li \c B_FOLLOW_TOP
|
||||
\li \c B_FOLLOW_BOTTOM
|
||||
\li \c B_FOLLOW_TOP_BOTTOM
|
||||
\li \c B_FOLLOW_V_CENTER
|
||||
|
||||
There are two other possibilities
|
||||
\li \c B_FOLLOW_ALL_SIDES
|
||||
\li \c B_FOLLOW_NONE
|
||||
|
||||
See BView for more information on resizing options.
|
||||
\param flags The flags mask sets what notifications the BButton can receive.
|
||||
\n\n Any combination of the following options is allowed
|
||||
\li \c B_WILL_DRAW
|
||||
\li \c B_PULSE_NEEDED
|
||||
\li \c B_FRAME_EVENTS
|
||||
\li \c B_FULL_UPDATE_ON_RESIZE
|
||||
\li \c B_NAVIAGBLE
|
||||
\li \c B_NAVIAGBLE_JUMP
|
||||
\li \c B_SUBPIXEL_PRECISE
|
||||
|
||||
See BView for more information on \a flags.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BButton::BButton(const char* name, const char* label, BMessage* message,
|
||||
uint32 flags)
|
||||
\brief Creates and initializes a BButton control.
|
||||
|
||||
BControl initializes the button's label and assigns it a message that
|
||||
identifies the action that should be carried out when the button is
|
||||
pressed. When the button is attached to a window it is resizes to the
|
||||
height of the button's frame rectange to fit the button's border and
|
||||
label in the button's font.
|
||||
|
||||
\param name The \a name of the button
|
||||
\param label The button's \a label text
|
||||
\param message The button's action \a message
|
||||
\param flags The \a flags mask sets what notifications the button can
|
||||
receive. Any combination of the following options is allowed:
|
||||
\li \c B_WILL_DRAW
|
||||
\li \c B_PULSE_NEEDED
|
||||
\li \c B_FRAME_EVENTS
|
||||
\li \c B_FULL_UPDATE_ON_RESIZE
|
||||
\li \c B_NAVIAGBLE
|
||||
\li \c B_NAVIAGBLE_JUMP
|
||||
\li \c B_SUBPIXEL_PRECISE
|
||||
|
||||
See BView for more information on \a flags.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BButton::BButton(const char* label, BMessage* message)
|
||||
\brief Creates and initializes a BButton control.
|
||||
|
||||
Creates the button with the specified \a label. The action carried out
|
||||
by the button is specified by the \a message.
|
||||
|
||||
\param label The button's \a label text
|
||||
\param message The buttons action \a message
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BButton::~BButton()
|
||||
\brief Destructor method.
|
||||
|
||||
Standard Destructor.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn BButton::BButton(BMessage* archive)
|
||||
\brief Creates a new BButton from an \a archive.
|
||||
|
||||
If the message is a valid button then an instance of BButton created
|
||||
from the passed in \a archive will be returned. Otherwise this method
|
||||
will return \c NULL.
|
||||
|
||||
\returns An instance of BButton if the \a archive is valid or \c NULL.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BArchivable* BButton::Instantiate(BMessage* archive)
|
||||
\brief Instantiates a BButton from a BMessage.
|
||||
|
||||
\param archive The \c archive message to instantiate the BButton.
|
||||
|
||||
\returns a BArchivable object of the BButton.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BButton::Archive(BMessage* archive, bool deep) const
|
||||
\brief Archives the BButton into \a archive.
|
||||
|
||||
\param archive The target \a archive which the BButton data will
|
||||
go into.
|
||||
\param deep Whether or not to recursively archive the BButton's children.
|
||||
|
||||
\retval B_OK The archive operation was successful.
|
||||
\retval B_BAD_VALUE The archive operation failed.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BButton::Draw(BRect updateRect)
|
||||
\brief Draws the button and sets its label.
|
||||
|
||||
\param updateRect The BRect which the button is drawn into.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BButton::MouseDown(BPoint point)
|
||||
\brief Hook method to respond to a MouseDown event.
|
||||
|
||||
\param point The point on the screen that the mouse pointer is located at.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BButton::AttachedToWindow()
|
||||
\brief Hook method that is called when the BButton view is attached
|
||||
to the window.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BButton::KeyDown(const char *bytes, int32 numBytes)
|
||||
\brief Hook method that is called when a keyboard key is pushed down.
|
||||
to the window.
|
||||
|
||||
\param bytes The key pressed.
|
||||
\param numBytes The number of keys pressed.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BButton::MakeDefault(bool flag)
|
||||
\brief Make the BButton the default button i.e. it will be activated
|
||||
when the user pushes the \key{Enter} key.
|
||||
|
||||
\param flag Pass in \c B_SUPPORTS_LAYOUT if the BButton is positioned
|
||||
by the Layout Kit.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BButton::SetLabel(const char *string)
|
||||
\brief Sets the BButton's label.
|
||||
|
||||
\param string The string to set the label to.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool BButton::IsDefault() const
|
||||
\brief Returns whether or not the BButton is the default button or not, i.e.
|
||||
it responds to the \key{Enter} key.
|
||||
|
||||
\retval true The button is the default button.
|
||||
\retval false The button is \b not the default button.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BButton::MessageReceived(BMessage *message)
|
||||
\brief Hook method that is called when a message is received by the BButton.
|
||||
|
||||
\param message The message received.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BButton::WindowActivated(bool active)
|
||||
\brief Sets the window that the BButton is attached to as activated or not.
|
||||
|
||||
\param active if \c true the window is activated, if \c false the window is
|
||||
deactivated.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BButton::MouseMoved(BPoint point, uint32 transit,
|
||||
const BMessage *message)
|
||||
\brief Hook method that is called when the mouse is moved.
|
||||
|
||||
\param point The point on the screen that the mouse pointer is located at.
|
||||
\param transit ???
|
||||
\param message The message that is received when the mouse is moved.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BButton::MouseUp(BPoint point)
|
||||
\brief Hook method that is called when a mouse button is unpressed.
|
||||
|
||||
\param point The point on the screen that the mouse pointer is located at.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BButton::DetachedFromWindow()
|
||||
\brief Detaches the BButton from the window.
|
||||
|
||||
\see BControl::DetachedFromWindow()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BButton::SetValue(int32 value)
|
||||
\brief Sets the value of the BButton.
|
||||
|
||||
\note This method can be overridden in order to take a different action
|
||||
when the value changes.
|
||||
|
||||
\param value The value to set to the BButton to. Options include:
|
||||
\li \c 0 (\c B_CONTROL_OFF)
|
||||
\li \c 1 (\c B_CONTROL_ON)
|
||||
|
||||
\see BControl::SetValue()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BButton::GetPreferredSize(float *_width, float *_height)
|
||||
\brief Gets the dimensions that the BButton would prefer to be.
|
||||
|
||||
The size is computed from the children sizes, unless it was explicitly set
|
||||
for the BButton (which can be done only if the BButton is configured to
|
||||
use the Layout Kit).
|
||||
|
||||
\note Either the \a _width or \a _height parameter may be set to \c NULL
|
||||
if you only want to get the other one.
|
||||
|
||||
\param[out] _width The width of the preferred size is placed in here.
|
||||
\param[out] _height The height of the preferred size is placed in here.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BButton::ResizeToPreferred()
|
||||
\brief Resizes the BButton to its preferred size.
|
||||
|
||||
\see BControl::ResizeToPreferred()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BButton::Invoke(BMessage *message)
|
||||
\brief The BButton is invoked from a message.
|
||||
|
||||
This method is used to post a message when the button is clicked or
|
||||
activated by a keyboard button. You can set the object that will
|
||||
handle the message by calling a BControl::SetTarget() from a
|
||||
BInvoker inherited control. A model for the message is set by the
|
||||
BButton constructor or by the BControl::SetMessage() method
|
||||
inherited from BInvoker.
|
||||
|
||||
\returns B_OK If the BButton was invoked, otherwise an error
|
||||
\a status_t flag is returned.
|
||||
|
||||
\see BControl::Invoke()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BButton::FrameMoved(BPoint newLocation)
|
||||
\brief Move the frame of the BButton.
|
||||
|
||||
\param newLocation The location on the screen that the BButton
|
||||
is moved to.
|
||||
|
||||
\see BControl::FrameMoved();
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BButton::FrameResized(float width, float height)
|
||||
\brief Resize the BButton.
|
||||
|
||||
\param width the new \a width of the BButton
|
||||
\param height the new \a height of the BButton
|
||||
|
||||
\see BControl::FrameResized();
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BButton::MakeFocus(bool focused)
|
||||
\brief Focus or unfocus the BButton.
|
||||
|
||||
\param focused If \c true focus the BButton, otherwise unfocus the BButton.
|
||||
|
||||
\see BControl::MakeFocus()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BButton::AllAttached()
|
||||
\brief Hook method that is called when the BButton is attached.
|
||||
|
||||
\see BControl::AllAttached()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BButton::AllDetached()
|
||||
\brief Hook method that is called when the BButton is deattached.
|
||||
|
||||
\see BControl::AllDetached()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BHandler* BButton::ResolveSpecifier(BMessage *message, int32 index,
|
||||
BMessage *specifier, int32 what, property)
|
||||
\brief Resolves specifiers for properties.
|
||||
\see BHandler::ResolveSpecifier()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BButton::GetSupportedSuites(BMessage *message)
|
||||
\brief Reports the suites of messages and specifiers that derived classes
|
||||
understand.
|
||||
|
||||
\param message The message to report the suite of messages and specifiers.
|
||||
|
||||
\see BWindow::GetSupportedSuites()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BButton::Perform(perform_code code, void* _data)
|
||||
\brief Perform an action on the BButton.
|
||||
|
||||
\param code The \a perform_code. One of the following:
|
||||
\li \c PERFORM_CODE_MIN_SIZE
|
||||
\li \c PERFORM_CODE_MAX_SIZE
|
||||
\li \c PERFORM_CODE_PREFERRED_SIZE
|
||||
\li \c PERFORM_CODE_LAYOUT_ALIGNMENT
|
||||
\li \c PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH
|
||||
\li \c PERFORM_CODE_GET_HEIGHT_FOR_WIDTH
|
||||
\li \c PERFORM_CODE_SET_LAYOUT
|
||||
\li \c PERFORM_CODE_INVALIDATE_LAYOUT
|
||||
\li \c PERFORM_CODE_DO_LAYOUT
|
||||
\param _data Data to use to act on.
|
||||
|
||||
\returns \c B_OK if the action was successful or an error code if not.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BButton::InvalidateLayout(bool descendants)
|
||||
\brief Redraws the BButton.
|
||||
|
||||
\param descendants Redraw subviews as well.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BSize BButton::MinSize()
|
||||
\brief Returns the minimum size of the BButton.
|
||||
|
||||
\returns The minimum BButton size as a BSize
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BSize BButton::MaxSize()
|
||||
\brief Returns the maximum size of the BButton.
|
||||
|
||||
\returns The maximum BButton size as a BSize
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BSize BButton::PreferredSize()
|
||||
\brief Returns the preferred size of the BButton.
|
||||
|
||||
\returns The preferred BButton size as a BSize
|
||||
*/
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* Copyright 2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Documentation by:
|
||||
* Alex Wilson <[email protected]>
|
||||
* Corresponds to:
|
||||
* /trunk/headers/os/interface/GridLayout.h rev 38207
|
||||
* /trunk/src/kits/interface/GridLayout.cpp rev 38207
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\file GridLayout.h
|
||||
Provides the BGridLayout class.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\class BGridLayout
|
||||
\ingroup interface
|
||||
@@ -18,150 +36,199 @@
|
||||
|
||||
/*!
|
||||
\fn BGridLayout::BGridLayout(float horizontal = 0.0f, float vertical = 0.0f)
|
||||
\brief Create a BGridLayout with \c horizontal space between columns and
|
||||
\c vertical space between rows.
|
||||
\brief Create a BGridLayout with \a horizontal space between columns and
|
||||
\a vertical space between rows.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BGridLayout::BGridLayout(BMessage* from)
|
||||
\brief Archive constructor.
|
||||
|
||||
\param from The message to build the BGridLayout from.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BGridLayout::~BGridLayout()
|
||||
\brief Destructor method.
|
||||
|
||||
Standard Destructor.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn int32 BGridLayout::CountColumns() const
|
||||
\brief Returns the number of active columns in this layout.
|
||||
|
||||
\returns The number of active columns in the layout.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn int32 BGridLayout::CountRows() const
|
||||
\brief Returns the number of active rows in this layout.
|
||||
|
||||
\returns the number of active rows in the layout.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn float BGridLayout::HorizontalSpacing() const
|
||||
\brief Returns the spacing between columns for this layout.
|
||||
|
||||
\returns The spacing between columns for the layout.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn float BGridLayout::VerticalSpacing() const
|
||||
\brief Returns the spacing between rows for this layout.
|
||||
|
||||
\returns The spacing between rows for the layout.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BGridLayout::SetHorizontalSpacing(float spacing);
|
||||
\brief Set the spacing between columns for this layout.
|
||||
|
||||
\param spacing The number of pixels of spacing to set.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BGridLayout::SetVerticalSpacing(float spacing)
|
||||
\brief Set the spacing between rows for this layout.
|
||||
|
||||
\param spacing The number of pixels of spacing to set.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BGridLayout::SetSpacing(float horizontal, float vertical)
|
||||
\brief Set the spacing between columns and rows for this layout.
|
||||
|
||||
\param horizontal The number of \a horizontal pixels of spacing to set.
|
||||
\param vertical The number of \a vertical pixels of spacing to set.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn float BGridLayout::ColumnWeight(int32 column) const
|
||||
\brief Returns the weight for \c column.
|
||||
\brief Returns the weight for the specified \a column.
|
||||
|
||||
\returns The \a column weight as a float.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BGridLayout::SetColumnWeight(int32 column, float weight)
|
||||
\brief Set the weight for \c column to \c weight.
|
||||
\brief Set the weight for \a column to \a weight.
|
||||
|
||||
\param column The column to set.
|
||||
\param weight The weight to set.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn float BGridLayout::MinColumnWidth(int32 column) const
|
||||
\brief Returns the minimum width for \c column.
|
||||
\brief Returns the minimum width for \a column.
|
||||
|
||||
\param column The column to get the minimum width of.
|
||||
|
||||
\returns The minimum width for \a column as a float.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BGridLayout::SetMinColumnWidth(int32 column, float width)
|
||||
\brief Sets the minimum width for \c column to \c width.
|
||||
\brief Sets the minimum width for \a column to \a width.
|
||||
|
||||
\param column The \a column to set the minimum width of.
|
||||
\param width The \a width to set.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn float BGridLayout::MaxColumnWidth(int32 column) const
|
||||
\brief Returns the maximum width for \c column.
|
||||
\brief Returns the maximum width for \a column.
|
||||
|
||||
\param column The column to get the maximum width of.
|
||||
|
||||
\returns The maximum width for \a column as a float.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BGridLayout::SetMaxColumnWidth(int32 column, float width)
|
||||
\brief Sets the maximum width for \c column to \c width.
|
||||
\brief Sets the maximum width for \a column to \a width.
|
||||
|
||||
\param column The column to set the maximum width of.
|
||||
\param width The \a width to set.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn float BGridLayout::RowWeight(int32 row) const
|
||||
\brief Returns the weight for \c row.
|
||||
\brief Returns the weight of the specified \a row.
|
||||
|
||||
\returns The weight of the \a row.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BGridLayout::SetRowWeight(int32 row, float weight)
|
||||
\brief Set the weight for \c row to \c weight.
|
||||
\brief Set the weight for \a row to \a weight.
|
||||
|
||||
\param row The \a row number.
|
||||
\param weight The \a
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn float BGridLayout::MinRowHeight(int32 row) const
|
||||
\brief Returns the minimum height for \c row.
|
||||
\brief Returns the minimum height for \a row.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BGridLayout::SetMinRowHeight(int32 row, float height)
|
||||
\brief Sets the minimum height for \c row to \c width.
|
||||
\brief Sets the minimum height for \a row to \a width.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn float BGridLayout::MaxRowHeight(int32 row) const
|
||||
\brief Returns the maximum height for \c row.
|
||||
\brief Returns the maximum height for \a row.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BGridLayout::SetMaxRowHeight(int32 row, float height)
|
||||
\brief Sets the maximum height for \c row to \c width.
|
||||
\brief Sets the maximum height for \a row to \a width.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BLayoutItem* BGridLayout::AddView(BView* child)
|
||||
\brief Adds \c child to this layout in the first empty cell available, or
|
||||
\brief Adds \a child to this layout in the first empty cell available, or
|
||||
in a new column in the first row if there are no emtpy cells.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BLayoutItem* BGridLayout::AddView(int32 index, BView* child);
|
||||
\copybrief BGridLayout::AddView(BView*)
|
||||
\brief BGridLayout::AddView(BView*)
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BLayoutItem* BGridLayout::AddView(BView* child, int32 column, int32 row,
|
||||
int32 columnCount = 1, int32 rowCount = 1);
|
||||
\brief Adds \c child to this layout at \c column and \c row. \c child may
|
||||
also occupy additional cells if \c columnCount or \c rowCount are
|
||||
greater than 1.
|
||||
\brief Adds \a child to this layout at \a column and \a row. \a child may
|
||||
also occupy additional cells if \a columnCount or \a rowCount are
|
||||
greater than \c 1.
|
||||
|
||||
Fails and returns NULL if the requested area is occupied, or if internal
|
||||
memory allocations fail.
|
||||
@@ -170,24 +237,24 @@
|
||||
|
||||
/*!
|
||||
\fn BLayoutItem* BGridLayout::AddItem(BLayoutItem* item)
|
||||
\brief Adds \c item to this layout in the first empty cell available, or
|
||||
\brief Adds \a item to this layout in the first empty cell available, or
|
||||
in a new column in the first row if there are no emtpy cells.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BLayoutItem* BGridLayout::AddItem(int32 index, BLayoutItem* item);
|
||||
\copybrief BGridLayout::AddItem(BLayoutItem*)
|
||||
\brief BGridLayout::AddItem(BLayoutItem*)
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BLayoutItem* BGridLayout::AddItem(BLayoutItem* item, int32 column,
|
||||
int32 row, int32 columnCount = 1, int32 rowCount = 1);
|
||||
\brief Adds \c item to this layout at \c column and \c row. \c item may
|
||||
also occupy additional cells if \c columnCount or \c rowCount are
|
||||
\brief Adds \a item to this layout at \a column and \a row. \a item may
|
||||
also occupy additional cells if \a columnCount or \a rowCount are
|
||||
greater than 1.
|
||||
|
||||
Fails and returns NULL if the requested area is occupied, or if internal
|
||||
Fails and returns \c NULL if the requested area is occupied, or if internal
|
||||
memory allocations fail.
|
||||
*/
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
/*
|
||||
* Copyright 2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Documentation by:
|
||||
* Alex Wilson <[email protected]>
|
||||
* Corresponds to:
|
||||
* /trunk/headers/os/interface/GroupLayout.h rev 38207
|
||||
* /trunk/src/kits/interface/GroupLayout.cpp rev 38207
|
||||
*/
|
||||
|
||||
|
||||
/*! \file GroupLayout.h
|
||||
Describes the BGroupLayout class
|
||||
*/
|
||||
|
||||
|
||||
/*! \class BGroupLayout
|
||||
\ingroup interface
|
||||
\ingroup layout
|
||||
@@ -29,118 +46,111 @@
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BGroupLayout::BGroupLayout(enum orientation, float spacing)
|
||||
/*! \fn BGroupLayout::BGroupLayout(enum orientation orientation, float spacing)
|
||||
\brief Creates a new BGroupLayout.
|
||||
|
||||
\param orientation The orientation of this BGroupLayout.
|
||||
\param orientation The #orientation of this BGroupLayout.
|
||||
\param spacing The spacing between BLayoutItems in this BGroupLayout.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BGroupLayout::BGroupLayout(BMessage* from)
|
||||
\brief Archive constructor.
|
||||
/*! \fn BGroupLayout::~BGroupLayout()
|
||||
\brief Destructor method.
|
||||
|
||||
Standard Destructor.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn float BGroupLayout::Spacing() const
|
||||
/*! \fn BGroupLayout::BGroupLayout(BMessage* from)
|
||||
\brief Archive constructor.
|
||||
|
||||
\param from The message to construct the BGroupLayout from.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn float BGroupLayout::Spacing() const
|
||||
\brief Get the amount of spacing (in pixels) between each item.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BGroupLayout::SetSpacing(float spacing)
|
||||
/*! \fn void BGroupLayout::SetSpacing(float spacing)
|
||||
\brief Set the amount of spacing (in pixels) between each item.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn orientation BGroupLayout::Orientation() const
|
||||
\brief Get the orientation of this BGroupLayout.
|
||||
/*! \fn orientation BGroupLayout::Orientation() const
|
||||
\brief Get the #orientation of this BGroupLayout.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BGroupLayout::SetOrientation(enum orientation)
|
||||
\brief Set the orientation of this BGroupLayout.
|
||||
\param orientation The new orientation of this BGroupLayout.
|
||||
/*! \fn void BGroupLayout::SetOrientation(enum orientation orientation)
|
||||
\brief Set the #orientation of this BGroupLayout.
|
||||
\param orientation The new #orientation of this BGroupLayout.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn float BGroupLayout::ItemWeight(int32 index) const
|
||||
\brief Get the weight of the item at \c index.
|
||||
/*! \fn float BGroupLayout::ItemWeight(int32 index) const
|
||||
\brief Get the weight of the item at \a index.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BGroupLayout::SetItemWeight(int32 index, float weight)
|
||||
\brief Set the weight of the item at \c index.
|
||||
/*! \fn void BGroupLayout::SetItemWeight(int32 index, float weight)
|
||||
\brief Set the weight of the item at \a index.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BLayoutItem* BGroupLayout::AddView(BView* child)
|
||||
/*! \fn BLayoutItem* BGroupLayout::AddView(BView* child)
|
||||
\brief Adds \a child to this layout as the last item. In a vertical
|
||||
BGroupLayout, \c child will be on the right, in a horizontal
|
||||
BGroupLayout, \c child will be at the bottom.
|
||||
BGroupLayout, \a child will be on the right, in a horizontal
|
||||
BGroupLayout, \a child will be at the bottom.
|
||||
|
||||
\c child will have a weight of 1.0f.
|
||||
\a child will have a weight of \c 1.0f.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BLayoutItem* BGroupLayout::AddView(int32 index, BView* child)
|
||||
\brief Adds \c child to this layout at \c index.
|
||||
/*! \fn BLayoutItem* BGroupLayout::AddView(int32 index, BView* child)
|
||||
\brief Adds \a child to this layout at \a index.
|
||||
|
||||
\c child will have a weight of 1.0f.
|
||||
\a child will have a weight of \c 1.0f.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BLayoutItem* BGroupLayout::AddView(BView* child, float weight)
|
||||
\brief Adds \c child to the end of this layout with a weight of
|
||||
\c weight.
|
||||
/*! \fn BLayoutItem* BGroupLayout::AddView(BView* child, float weight)
|
||||
\brief Adds \a child to the end of this layout with a weight of
|
||||
\a weight.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BLayoutItem* BGroupLayout::AddView(int32 index, BView* child,
|
||||
/*! \fn BLayoutItem* BGroupLayout::AddView(int32 index, BView* child,
|
||||
float weight)
|
||||
\brief Adds \c child this layout at \c index with a weight of
|
||||
\c weight.
|
||||
\brief Adds \a child this layout at \a index with a weight of
|
||||
\a weight.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool BGroupLayout::AddItem(BLayoutItem* item)
|
||||
/*! \fn bool BGroupLayout::AddItem(BLayoutItem* item)
|
||||
\brief Adds \a item to this layout as the last item. In a vertical
|
||||
BGroupLayout, \c item will be on the right, in a horizontal
|
||||
BGroupLayout, \c item will be at the bottom.
|
||||
BGroupLayout, \a item will be on the right, in a horizontal
|
||||
BGroupLayout, \a item will be at the bottom.
|
||||
|
||||
\c item will have a weight of 1.0f.
|
||||
\a item will have a weight of \c 1.0f.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool BGroupLayout::AddItem(int32 index, BLayoutItem* item)
|
||||
\brief Adds \c item to this layout at \c index.
|
||||
/*! \fn bool BGroupLayout::AddItem(int32 index, BLayoutItem* item)
|
||||
\brief Adds \a item to this layout at \a index.
|
||||
|
||||
\c item will have a weight of 1.0f.
|
||||
\a item will have a weight of \c 1.0f.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool BGroupLayout::AddItem(BLayoutItem* item, float weight)
|
||||
\brief Adds \c item to the end of this layout with a weight of
|
||||
\c weight.
|
||||
/*! \fn bool BGroupLayout::AddItem(BLayoutItem* item, float weight)
|
||||
\brief Adds \a item to the end of this layout with a weight of
|
||||
\a weight.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool BGroupLayout::AddItem(int32 index, BLayoutItem* item, float weight)
|
||||
\brief Adds \c item this layout at \c index with a weight of
|
||||
\c weight.
|
||||
/*! \fn bool BGroupLayout::AddItem(int32 index, BLayoutItem* item, float weight)
|
||||
\brief Adds \a item this layout at \a index with a weight of
|
||||
\a weight.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright 2001-2011, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
/*! \file InterfaceDefs.h
|
||||
\brief Defines standard interface definitions for controls.
|
||||
*/
|
||||
|
||||
/*! \enum border_style
|
||||
Collection of flags that determine the border style drawn around a BBox.
|
||||
*/
|
||||
|
||||
/*! \var border_style B_PLAIN_BORDER
|
||||
|
||||
\image html B_PLAIN_BORDER.png
|
||||
|
||||
The right and bottom sides of the box are darker than the top and
|
||||
left sides to produce a shadow effect and make the box look like it
|
||||
is raised slightly above the surrounding surface.
|
||||
*/
|
||||
|
||||
/*! \var border_style B_FANCY_BORDER
|
||||
|
||||
\image html B_FANCY_BORDER.png
|
||||
|
||||
The border is a bevelled to give it a 3D effect. The border is uniform
|
||||
in appearance on all four sides. This is the default appearance.
|
||||
*/
|
||||
|
||||
/*! \var border_style B_NO_BORDER
|
||||
No border.
|
||||
*/
|
||||
|
||||
/*! \enum orientation
|
||||
Orientation flag sets the layout to either horizontal or vertical
|
||||
alignment.
|
||||
*/
|
||||
|
||||
/*! \var orientation B_HORIZONTAL
|
||||
Horizontal alignment
|
||||
*/
|
||||
|
||||
/*! \var orientation B_VERTICAL
|
||||
Vertical alignment
|
||||
*/
|
||||
|
||||
/*! \enum button_width
|
||||
Collection of flags that determine how wide to draw the buttons in a
|
||||
BAlert dialog.
|
||||
*/
|
||||
|
||||
/*! \var button_width B_WIDTH_AS_USUAL
|
||||
Set the width of each button based on the standard width.
|
||||
*/
|
||||
|
||||
/*! \var button_width B_WIDTH_FROM_WIDEST
|
||||
Set the width of each button based on the width of the widest button.
|
||||
*/
|
||||
|
||||
/*! \var button_width B_WIDTH_FROM_LABEL
|
||||
Set the width of each button to accomidate the width of the button's
|
||||
label.
|
||||
*/
|
||||
|
||||
+121
-95
@@ -3,7 +3,7 @@
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Documentation by:
|
||||
* Alex Wilson <[email protected]>
|
||||
* Alex Wilson <[email protected]>
|
||||
* Corresponds to:
|
||||
* /trunk/headers/os/interface/Layout.h rev 38207
|
||||
* /trunk/src/kits/interface/Layout.cpp rev 38207
|
||||
@@ -11,21 +11,22 @@
|
||||
|
||||
|
||||
/*!
|
||||
\file Layout.h
|
||||
\brief Defines the BLayout class.
|
||||
\file Layout.h
|
||||
\brief Defines the BLayout class.
|
||||
*/
|
||||
|
||||
|
||||
/*! \class BLayout
|
||||
/*!
|
||||
\class BLayout
|
||||
\ingroup interface
|
||||
\ingroup layout
|
||||
\ingroup libbe
|
||||
\brief The BLayout class provides an interface, and some basic
|
||||
implementation to manage the positioning and sizing of BLayoutItems.
|
||||
implementation to manage the positioning and sizing of BLayoutItem s.
|
||||
|
||||
BLayouts can be attached to a BView, managing the BLayoutItems and BViews
|
||||
that reside in that view, or can be nested within another BLayout as a
|
||||
BLayoutItem.
|
||||
BLayouts can be attached to a BView, managing the BLayoutItem's and
|
||||
BView's that reside in that view, or can be nested within another
|
||||
BLayout as a BLayoutItem.
|
||||
|
||||
Before adding a BLayoutItem to a BLayout, that layout must have a target
|
||||
view. When a BLayout is attached directly to a BView via BView::SetLayout()
|
||||
@@ -34,7 +35,7 @@
|
||||
target of the layout it's nested in, if it does not have a target already.
|
||||
You can retrieve the target view for a layout with the TargetView() method.
|
||||
When adding a BLayoutItem to a BLayout, the item's view (as returned by
|
||||
BLayoutItem::View()) is added to the layout's target view.
|
||||
BLayoutItem::View()) is added to the BLayout's target view.
|
||||
|
||||
\code
|
||||
BView* topView = new BGroupView();
|
||||
@@ -64,97 +65,107 @@ topLayout->AddItem(nestedLayoutWithView);
|
||||
assume that it will break some time in the future.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn BLayout::BLayout()
|
||||
|
||||
/*!
|
||||
\fn BLayout::BLayout()
|
||||
\brief Default constructor.
|
||||
|
||||
After this constructor has finished, this BLayout holds no BLayoutItems and
|
||||
does not have a target BView.
|
||||
After this constructor has finished, this BLayout holds no
|
||||
BLayoutItem's and does not have a target BView.
|
||||
|
||||
\warning Because a new BLayout does not have a target BView, calls to the
|
||||
AddItem() and AddView() will fail methods will fail.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn BLayout::BLayout(BMessage* archive)
|
||||
/*!
|
||||
\fn BLayout::BLayout(BMessage* archive)
|
||||
\brief Archive constructor.
|
||||
|
||||
\param archive The archive message.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn BLayout::~BLayout()
|
||||
\brief Destructor, deletes all BLayoutItems that this layout manages,
|
||||
and detaches from this BLayout's owner view if there is one.
|
||||
/*!
|
||||
\fn BLayout::~BLayout()
|
||||
\brief Destructor, deletes all BLayoutItem's that this layout manages,
|
||||
and detaches from this BLayout's owner view if there is one.
|
||||
|
||||
Each BLayoutItem's BView (as returned by BLayoutItem::View()) is also
|
||||
Each BLayoutItem's BView (as returned by BLayoutItem::View()) is also
|
||||
removed from their parent.
|
||||
|
||||
\note Because nested BLayouts are treated as BLayoutItems, any layouts
|
||||
nested in this BLayout will be deleted.
|
||||
\note Because nested BLayout's are treated as BLayoutItem's,
|
||||
any layouts nested in this BLayout will be deleted.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\name BView targeting and attachment information.
|
||||
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn BView* BLayout::Owner() const
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn BView* BLayout::Owner() const
|
||||
\brief Returns the Owner of this layout, i.e. the view this layout manages.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn BView* BLayout::TargetView() const
|
||||
/*!
|
||||
\fn BView* BLayout::TargetView() const
|
||||
\brief Returns the target view of this layout.
|
||||
|
||||
The target view of a layout becomes the parent of any BViews in this layout,
|
||||
as well as the BViews returned by BLayoutItem::View() for each BLayoutItem
|
||||
in this layout.
|
||||
The target view of a layout becomes the parent of any BView's in this
|
||||
layout, as well as the BView's returned by BLayoutItem::View() for
|
||||
each BLayoutItem in this layout.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn BView* BLayout::View()
|
||||
\brief Returns the same BView* as BLayout::Owner(), this method is inherited
|
||||
from BLayoutItem.
|
||||
*/
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
/*!
|
||||
\name Adding, removing, counting and accessing BViews and BLayoutItems in \
|
||||
this BLayout.
|
||||
|
||||
@{
|
||||
\fn BView* BLayout::View()
|
||||
\brief Returns the same BView* as BLayout::Owner(), this method is
|
||||
inherited from BLayoutItem.
|
||||
*/
|
||||
|
||||
|
||||
//! @}
|
||||
|
||||
|
||||
/*!
|
||||
\name Adding, removing, counting and accessing BLayout children
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn BLayoutItem* BLayout::AddView(BView* child)
|
||||
\brief Creates a BLayoutItem to represent a BView, and adds that item to
|
||||
this layout.
|
||||
|
||||
\a child is added to this layout's target view.
|
||||
\a child is added to this BLayout's target view.
|
||||
|
||||
\returns The BLayoutItem created to represent \a child is, or NULL if there
|
||||
was an error.
|
||||
\returns The BLayoutItem created to represent \a child is, or \c NULL if
|
||||
there was an error.
|
||||
|
||||
\param child The BView to be added to this BLayout.
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn BLayoutItem* BLayout::AddView(int32 index, BView* child)
|
||||
/*!
|
||||
\fn BLayoutItem* BLayout::AddView(int32 index, BView* child)
|
||||
\brief Creates a BLayoutItem to represent \a child, and adds that item at
|
||||
\a index to this layout. \a child is added to this layout's target view.
|
||||
\a index to this layout. \a child is added to this BLayout's target view.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool BLayout::AddItem(BLayoutItem* item)
|
||||
\brief Adds a BLayoutItem to this layout, and adds the BView it represents
|
||||
to this layout's target view.
|
||||
to this BLayout's target view.
|
||||
|
||||
\param item The BLayoutItem to be added.
|
||||
\retval true success
|
||||
@@ -165,7 +176,7 @@ topLayout->AddItem(nestedLayoutWithView);
|
||||
/*!
|
||||
\fn bool BLayout::AddItem(int32 index, BLayoutItem* item)
|
||||
\brief Adds \a item to this layout, and adds the BView \a item represents
|
||||
to this layout's target view.
|
||||
to this BLayout's target view.
|
||||
|
||||
\param item The BLayoutItem to be added.
|
||||
\param index The index at which to add \c item.
|
||||
@@ -181,8 +192,8 @@ topLayout->AddItem(nestedLayoutWithView);
|
||||
|
||||
/*!
|
||||
\fn bool BLayout::RemoveView(BView* child)
|
||||
\brief Removes and deletes all BLayoutItems representing a BView from this
|
||||
layout.
|
||||
\brief Removes and deletes all BLayoutItem representing a BView from
|
||||
this layout.
|
||||
|
||||
\param child The BView to be removed.
|
||||
|
||||
@@ -193,10 +204,10 @@ topLayout->AddItem(nestedLayoutWithView);
|
||||
|
||||
/*!
|
||||
\fn bool BLayout::RemoveItem(BLayoutItem* item)
|
||||
\brief Removes a BLayoutITem from this layout, and also removes the view
|
||||
it represents from this layout's target view.
|
||||
\brief Removes a BLayoutItem from this layout, and also removes the view
|
||||
it represents from this BLayout's target view.
|
||||
|
||||
\param item The BLayoutitem to be removed
|
||||
\param item The BLayoutItem to be removed
|
||||
|
||||
\warning \a item is not deleted, you must delete it manually, or add it to
|
||||
another BLayout.
|
||||
@@ -206,7 +217,8 @@ topLayout->AddItem(nestedLayoutWithView);
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn BLayoutItem* BLayout::RemoveItem(int32 index)
|
||||
/*!
|
||||
\fn BLayoutItem* BLayout::RemoveItem(int32 index)
|
||||
\brief Remove the BLayoutItem at \a index.
|
||||
|
||||
\see RemoveItem(BLayoutItem*)
|
||||
@@ -224,7 +236,7 @@ topLayout->AddItem(nestedLayoutWithView);
|
||||
|
||||
/*!
|
||||
\fn int32 BLayout::CountItems() const
|
||||
\brief Get the number of BLayoutItems in this layout.
|
||||
\brief Get the number of BLayoutItem s in this layout.
|
||||
*/
|
||||
|
||||
|
||||
@@ -248,26 +260,28 @@ topLayout->AddItem(nestedLayoutWithView);
|
||||
*/
|
||||
|
||||
|
||||
//@}
|
||||
//! @}
|
||||
|
||||
|
||||
/*!
|
||||
\name Subclass helpers.
|
||||
\brief These methods are meant to ease the development of BLayout
|
||||
subclasses.
|
||||
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn bool BLayout::AncestorsVisible()
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool BLayout::AncestorsVisible()
|
||||
\brief Get the visibility of the ancestors of this layout.
|
||||
|
||||
If a BLayout is connected to a BView, this will always return \c true.
|
||||
If a BLayout is nested in another layout (it was passed to AddItem()), then
|
||||
this will reflect the visibility of this layout's parent layout. If any
|
||||
layout is hidden (by BLayout::SetVisible()) between this layout and its
|
||||
target view's layout, then this method will return \c false.
|
||||
this will reflect the visibility of this BLayout's parent layout. If
|
||||
any layout is hidden (by BLayout::SetVisible()) between this layout and its
|
||||
target BView's layout, then this method will return \c false.
|
||||
*/
|
||||
|
||||
|
||||
@@ -276,8 +290,8 @@ topLayout->AddItem(nestedLayoutWithView);
|
||||
\brief Returns the on-screen area this layout has received to lay out its
|
||||
items in.
|
||||
|
||||
The return value is in the coordinate space of this layout's target view.
|
||||
If this BLayout is attached directly to a BView, then
|
||||
The return value is in the coordinate space of this BLayout's target
|
||||
view. If this BLayout is attached directly to a BView, then
|
||||
<tt> LayoutArea().LeftTop() == B_ORIGIN </tt>.
|
||||
*/
|
||||
|
||||
@@ -287,27 +301,34 @@ topLayout->AddItem(nestedLayoutWithView);
|
||||
\brief Method to be called by derived classes in their SetVisible()
|
||||
implementation. Calls AncestorVisibilityChanged() on the items in this
|
||||
BLayout.
|
||||
|
||||
\param show \c true to show, \c false to hide.
|
||||
*/
|
||||
|
||||
|
||||
//@}
|
||||
//! @}
|
||||
|
||||
|
||||
/*!
|
||||
\name Methods triggering or related to laying out this BLayout.
|
||||
|
||||
//@{
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn void BLayout::Relayout(bool immediate = false)
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BLayout::Relayout(bool immediate = false)
|
||||
\brief Request this BLayout to reposition and resize its items as required.
|
||||
|
||||
If \a immediate is \c false, and there is already a request to have the
|
||||
window this layout resides in re-laid-out, then the layout will happen at
|
||||
that time. If \a immediate is \c true, and there is no such pending
|
||||
request, nor is this layout's parent layout in the process of laying out
|
||||
its items, then this BLayout will now layout its items.
|
||||
request, nor is this BLayout's parent layout in the process of laying
|
||||
out its items, then this BLayout will now layout its items.
|
||||
|
||||
\param immediate Whether or not to Relayout immediately or wait for pending
|
||||
requests first.
|
||||
*/
|
||||
|
||||
|
||||
@@ -315,10 +336,12 @@ topLayout->AddItem(nestedLayoutWithView);
|
||||
\fn void BLayout::LayoutItems(bool force = false)
|
||||
\brief If there is no layout currently ongoing, and \a force is \c false,
|
||||
creates a new BLayoutContext and calls the DerivedLayoutItems() method
|
||||
of this BLayout and any BLayouts nested in this BLayout.
|
||||
of this BLayout and any BLayout s nested in this BLayout.
|
||||
|
||||
If method also guarantees that the owner view of this layout (as returned
|
||||
by BLayout::Owner()) performs a layout as well (if it is suitable to do so).
|
||||
|
||||
\param force Force the LayoutItems.
|
||||
*/
|
||||
|
||||
|
||||
@@ -329,16 +352,17 @@ topLayout->AddItem(nestedLayoutWithView);
|
||||
*/
|
||||
|
||||
|
||||
//@}
|
||||
//! @}
|
||||
|
||||
|
||||
/*!
|
||||
\name Invalidation and state mutators and accessors.
|
||||
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BLayout::RequireLayout()
|
||||
\brief Flag this layout as stale, i.e. any cached data may still be valid,
|
||||
@@ -352,7 +376,7 @@ topLayout->AddItem(nestedLayoutWithView);
|
||||
to positioning and sizing of its items.
|
||||
|
||||
Invalidating a BLayout also invalidates the view it is connected to
|
||||
(if there is one) and the BLayout this layout (or this layout's view)
|
||||
(if there is one) and the BLayout this layout (or this BLayout's view)
|
||||
resides in.
|
||||
|
||||
This method should be called whenever the layout becomes invalid. This might
|
||||
@@ -379,7 +403,8 @@ topLayout->AddItem(nestedLayoutWithView);
|
||||
*/
|
||||
|
||||
|
||||
/*! \fn void BLayout::DisableLayoutInvalidation()
|
||||
/*!
|
||||
\fn void BLayout::DisableLayoutInvalidation()
|
||||
\brief Disable layout invalidation notifications, i.e. calls to
|
||||
this object's InvalidateLayout() method.
|
||||
*/
|
||||
@@ -393,18 +418,19 @@ topLayout->AddItem(nestedLayoutWithView);
|
||||
*/
|
||||
|
||||
|
||||
//@}
|
||||
//! @}
|
||||
|
||||
|
||||
/*!
|
||||
\name Archiving methods
|
||||
\brief These methods relate to the archiving or unarchiving of this object
|
||||
and the BLayoutItems it contains
|
||||
|
||||
@{
|
||||
and the BLayoutItem's it contains
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BLayout::Archive(BMessage* archive, bool deep = true) const
|
||||
\brief Archives this layout into \a archive. If deep is true, also archives
|
||||
@@ -414,8 +440,8 @@ topLayout->AddItem(nestedLayoutWithView);
|
||||
|
||||
/*!
|
||||
\fn status_t BLayout::AllUnarchived(const BMessage* from)
|
||||
\brief Unarchives the BLayoutItems for this layout, calling ItemUnarchived()
|
||||
for each one.
|
||||
\brief Unarchives the BLayoutItem's for this layout, calling
|
||||
ItemUnarchived() for each one.
|
||||
*/
|
||||
|
||||
|
||||
@@ -442,16 +468,17 @@ topLayout->AddItem(nestedLayoutWithView);
|
||||
*/
|
||||
|
||||
|
||||
//@}
|
||||
//! @}
|
||||
|
||||
|
||||
/*!
|
||||
\name BLayout Hook methods
|
||||
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool BLayout::ItemAdded(BLayoutItem* item, int32 atIndex)
|
||||
\brief Hook method called when \a item is added to this layout.
|
||||
@@ -490,23 +517,23 @@ topLayout->AddItem(nestedLayoutWithView);
|
||||
\fn void BLayout::OwnerChanged(BView* was)
|
||||
\brief Hook method called when this layout is attached to a BView.
|
||||
|
||||
\param was The previous owner of this BLayout, for new BLayouts, this will
|
||||
be NULL.
|
||||
\param was The previous owner of this BLayout, for new BLayout s, this
|
||||
will be \c NULL.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BLayout::AttachedToLayout()
|
||||
\brief Hook method inherited from BLayoutItem, classes derived from BLayout
|
||||
must include the BLayout version of this method in their
|
||||
\brief Hook method inherited from BLayoutItem, classes derived from
|
||||
BLayout must include the BLayout version of this method in their
|
||||
implementation.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BLayout::DetachedFromLayout(BLayout* layout)
|
||||
\brief Hook method inherited from BLayoutItem, classes derived from BLayout
|
||||
must include the BLayout version of this method in their
|
||||
\brief Hook method inherited from BLayoutItem, classes derived from
|
||||
BLayout must include the BLayout version of this method in their
|
||||
implementation.
|
||||
|
||||
\param layout The BLayout that this BLayout was detached from.
|
||||
@@ -515,11 +542,10 @@ topLayout->AddItem(nestedLayoutWithView);
|
||||
|
||||
/*!
|
||||
\fn void BLayout::AncestorVisibilityChanged(bool shown)
|
||||
\brief Hook method inherited from BLayoutItem, classes derived from BLayout
|
||||
must include the BLayout version of this method in their
|
||||
\brief Hook method inherited from BLayoutItem, classes derived from
|
||||
BLayout must include the BLayout version of this method in their
|
||||
implementation.
|
||||
*/
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
//! @}
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/*
|
||||
* Copyright 2011, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* John Scipione, [email protected]
|
||||
* Ingo Weinhold, [email protected]
|
||||
*
|
||||
* Corresponds to:
|
||||
* /trunk/headers/os/interface/GroupLayoutBuilder.h rev 42274
|
||||
* /trunk/src/kits/interface/GroupLayoutBuilder.cpp rev 42274
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\file GroupLayoutBuilder.h
|
||||
\brief Provides the BLayoutBuilder::Group<> class.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\class BLayoutBuilder::Group<>
|
||||
\ingroup interface
|
||||
@@ -32,14 +52,16 @@
|
||||
|
||||
/*!
|
||||
\name Constructors
|
||||
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn BLayoutBuilder::Group<ParentBuilder>::Group(BWindow* window,
|
||||
enum orientation, float spacing)
|
||||
\fn BLayoutBuilder::Group<ParentBuilder>::Group(BWindow *window,
|
||||
enum orientation orientation=B_HORIZONTAL,
|
||||
float spacing=B_USE_DEFAULT_SPACING)
|
||||
\brief Creates a new BGroupLayout, and attaches it to a BWindow.
|
||||
|
||||
\note The top BView* in \a window has its ViewColor set to
|
||||
@@ -71,8 +93,9 @@
|
||||
|
||||
|
||||
/*!
|
||||
\fn template <ParentBuilder> BLayoutBuilder::Group<ParentBuilder>::Group(
|
||||
enum orientation, float spacing)
|
||||
\fn BLayoutBuilder::Group<ParentBuilder>::Group(
|
||||
enum orientation orientation=B_HORIZONTAL,
|
||||
float spacing=B_USE_DEFAULT_SPACING)
|
||||
\brief Creates a new BGroupView and targets it.
|
||||
|
||||
Methods called on this builder will be directed to the new BGroupView's
|
||||
@@ -83,15 +106,16 @@
|
||||
*/
|
||||
|
||||
|
||||
//@}
|
||||
//! @}
|
||||
|
||||
|
||||
/*!
|
||||
\name Adding BViews and BLayoutItems
|
||||
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
/*!
|
||||
\fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::Add(BView* view)
|
||||
\brief Add a BView to the BGroupLayout this builder represents.
|
||||
@@ -133,7 +157,7 @@
|
||||
*/
|
||||
|
||||
|
||||
//@}
|
||||
//! @}
|
||||
|
||||
|
||||
/*!
|
||||
@@ -142,14 +166,16 @@
|
||||
BLayoutBuilder::Base subclass representing the newly added object. These
|
||||
methods push a new builder on top of the stack, you will not be using
|
||||
\c this builder again until you call End().
|
||||
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn GroupBuilder BLayoutBuilder::Group<ParentBuilder>::AddGroup(
|
||||
enum orientation, float spacing, float weight)
|
||||
enum orientation orientation, float spacing=B_USE_DEFAULT_SPACING,
|
||||
float weight=1.0f)
|
||||
\brief Construct and add a viewless BGroupLayout, then return a GroupBuilder
|
||||
representing the newly added layout.
|
||||
|
||||
@@ -157,6 +183,7 @@
|
||||
\param spacing The spacing to use for the new BGroupLayout.
|
||||
\param weight The weight for the new BGroupLayout in the BGroupLayout this
|
||||
builder represents.
|
||||
|
||||
\returns A GroupBuilder representing the newly created BGroupLayout.
|
||||
*/
|
||||
|
||||
@@ -233,7 +260,8 @@
|
||||
|
||||
/*!
|
||||
\fn SplitBuilder BLayoutBuilder::Group<ParentBuilder>::AddSplit(
|
||||
enum orientation, float spacing, float weight)
|
||||
enum orientation orientation, float spacing=B_USE_DEFAULT_SPACING,
|
||||
float weight=1.0f)
|
||||
|
||||
\brief Create and add a new BSplitView with a weight of \c weight, then
|
||||
return a SplitBuilder representing the new BSplitView.
|
||||
@@ -258,17 +286,18 @@
|
||||
*/
|
||||
|
||||
|
||||
//@}
|
||||
//! @}
|
||||
|
||||
|
||||
/*!
|
||||
\name Adding BSpaceLayoutItems
|
||||
Some convenience methods for adding special BSpaceLayoutItems.
|
||||
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::AddGlue(
|
||||
float weight = 1.0f)
|
||||
@@ -305,11 +334,12 @@
|
||||
|
||||
/*!
|
||||
\name Accessors
|
||||
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn BGroupLayout* BLayoutBuilder::Group<ParentBuilder>::Layout() const
|
||||
\brief Get the BGroupLayout this builder represents.
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
/*!
|
||||
\class BLayoutBuilder::Base<>
|
||||
/*
|
||||
* Copyright 2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Documentation by:
|
||||
* Alex Wilson <[email protected]>
|
||||
*/
|
||||
|
||||
|
||||
/*! \class BLayoutBuilder::Base<>
|
||||
\ingroup interface
|
||||
\ingroup layout
|
||||
\brief Base for all other layout builders in the BLayoutBuilder namespace.
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* Copyright 2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Documentation by:
|
||||
* Alex Wilson <[email protected]>
|
||||
* Corresponds to:
|
||||
* /trunk/headers/os/interface/LayoutItem.h rev 38207
|
||||
* /trunk/src/kits/interface/LayoutItem.cpp rev 38207
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\file LayoutItem.h
|
||||
Describes the BLayoutItem class
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\class BLayoutItem
|
||||
\ingroup interface
|
||||
@@ -20,7 +38,7 @@
|
||||
\fn BLayoutItem::BLayoutItem(BMessage* archive)
|
||||
\brief Archive constructor.
|
||||
|
||||
Creates a Bunarchiver for \a archive and calls its Finish() method.
|
||||
Creates a BLayoutItem from the \a archive message.
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,10 +49,21 @@
|
||||
|
||||
|
||||
/*!
|
||||
\name Reporting size and alignment constraints to a BLayout
|
||||
@{
|
||||
\fn BLayout::~BLayout()
|
||||
\brief Destructor method.
|
||||
|
||||
Standard Destructor.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\name Reporting size and alignment constraints to a BLayout
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn BSize BLayoutItem::MinSize() = 0
|
||||
\brief Returns the minimum desirable size for this item.
|
||||
@@ -67,7 +96,7 @@
|
||||
|
||||
/*!
|
||||
\fn bool BLayoutItem::HasHeightForWidth()
|
||||
\brief Returns whether or not this BLayoutItem's height constraints are
|
||||
\brief Returns whether or not this BLayoutItem's height constraints are
|
||||
dependent on its width.
|
||||
|
||||
\note By default, this method returns \c false.
|
||||
@@ -77,18 +106,18 @@
|
||||
/*!
|
||||
\fn void BLayoutItem::GetHeightForWidth(float width, float* min,
|
||||
float* max, float* preferred)
|
||||
\brief Get this BLayoutItem's height constraints for a given \a width.
|
||||
\brief Get this BLayoutItem's height constraints for a given \a width.
|
||||
|
||||
If a BLayoutItem does not have height for width constraints
|
||||
(HasHeightForWidth() returns \c false) it does not need to implement this
|
||||
method.
|
||||
|
||||
\note It is prudent to compare \a min, \a max, \a preferred to NULL before
|
||||
dereferencing them.
|
||||
\note It is prudent to compare \a min, \a max, \a preferred to \c NULL
|
||||
before dereferencing them.
|
||||
*/
|
||||
|
||||
|
||||
//@}
|
||||
//! @}
|
||||
|
||||
|
||||
/*!
|
||||
@@ -100,11 +129,12 @@
|
||||
in when reporting these constraints. It is recommended that all subclasses
|
||||
do this as well, the BAbstractLayoutItem class provides any easy way to
|
||||
include this behaviour in your class.
|
||||
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BLayoutItem::SetExplicitMinSize(BSize size) = 0
|
||||
\brief Set this item's explicit min size, to be used in MinSize().
|
||||
@@ -130,7 +160,7 @@
|
||||
*/
|
||||
|
||||
|
||||
//@}
|
||||
//! @}
|
||||
|
||||
|
||||
/*!
|
||||
@@ -138,11 +168,12 @@
|
||||
|
||||
These methods take into account only the local visibility of this
|
||||
item, not the visibility of its ancestors. \n
|
||||
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool BLayoutItem::IsVisible() = 0
|
||||
\brief Return the current local visibility of this item. If an item is not
|
||||
@@ -160,17 +191,17 @@
|
||||
*/
|
||||
|
||||
|
||||
//@}
|
||||
//! @}
|
||||
|
||||
|
||||
/*!
|
||||
\name Getting and setting the current on-screen positioning of \
|
||||
a BLayoutItem.
|
||||
|
||||
@{
|
||||
\name Getting and setting the current on-screen positioning of a BLayoutItem.
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BLayoutItem::AlignInFrame(BRect frame)
|
||||
\brief Position this BLayoutItem within \a frame, given the value returned
|
||||
@@ -191,21 +222,21 @@
|
||||
\fn void BLayoutItem::SetFrame(BRect frame) = 0
|
||||
\brief Set the bounding frame of this item.
|
||||
|
||||
\a frame is in the coordinate system of the target view of the
|
||||
BLayout this item belongs to.
|
||||
\a frame is in the coordinate system of the target view of the BLayout
|
||||
that this item belongs to.
|
||||
*/
|
||||
|
||||
|
||||
//@}
|
||||
//! @}
|
||||
|
||||
|
||||
/*!
|
||||
\fn BView* BLayoutItem::View()
|
||||
\brief Return the BView this item is representing, or NULL if it does not
|
||||
\brief Return the BView this item is representing, or \c NULL if it does not
|
||||
represent any view.
|
||||
|
||||
When a BLayoutItem is added to a BLayout, this method is called, and the
|
||||
returned BView will be added to the BLayout's target view.
|
||||
returned BView will be added to the BLayout's target view.
|
||||
*/
|
||||
|
||||
|
||||
@@ -216,11 +247,12 @@
|
||||
BLayout. In some implementations they may be handled directly by this
|
||||
BLayoutItem, but many implementations will forward these events to
|
||||
another object.
|
||||
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BLayoutItem::InvalidateLayout(bool children = false)
|
||||
\brief Invalidate the layout of this item, or the object it represents.
|
||||
@@ -237,18 +269,19 @@
|
||||
*/
|
||||
|
||||
|
||||
//@}
|
||||
//! @}
|
||||
|
||||
|
||||
/*!
|
||||
\name Utility methods for BLayout subclasses
|
||||
\brief Utility methods for the BLayout class to attach and retrieve
|
||||
arbitrary data for a BLayoutItem.
|
||||
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn void* BLayoutItem::LayoutData() const
|
||||
\brief Retrieve arbitrary data attached to this BLayoutItem.
|
||||
@@ -265,15 +298,17 @@
|
||||
*/
|
||||
|
||||
|
||||
//@}
|
||||
//! @}
|
||||
|
||||
|
||||
/*! \name Hook methods
|
||||
|
||||
@{
|
||||
/*!
|
||||
\name Hook methods
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BLayoutItem::AttachedToLayout()
|
||||
\brief Hook called when this object is attached to a BLayout (via
|
||||
@@ -288,16 +323,17 @@
|
||||
\fn void BLayoutItem::DetachedFromLayout(BLayout* layout)
|
||||
\brief Hook called when this object is attached to a BLayout (via
|
||||
BLayout::RemoveItem())
|
||||
\param layout The BLayout you were previously attached to.
|
||||
|
||||
\warning You should not use this hook to reattach \c this to \a BLayout,
|
||||
doing so will cause undefined behaviour (probably a crash).
|
||||
|
||||
\param layout The BLayout you were previously attached to.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BLayoutItem::AncestorVisibilityChanged(bool shown)
|
||||
\brief Hook called when this BLayoutItem's ancestors change visibility,
|
||||
\brief Hook called when this BLayoutItem's ancestors change visibility,
|
||||
effectively hiding or showing this item.
|
||||
|
||||
Implementations of this method should alter the onscreen visibility of this
|
||||
@@ -306,7 +342,9 @@
|
||||
|
||||
\note This method should not effect the value returned by this object's
|
||||
IsVisible() method.
|
||||
|
||||
\param shown \c true to show, \c false to hide.
|
||||
*/
|
||||
|
||||
|
||||
//@}
|
||||
//! @}
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* Copyright 2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Documentation by:
|
||||
* Alex Wilson <[email protected]>
|
||||
* Corresponds to:
|
||||
* /trunk/headers/os/interface/TwoDimensionalLayout.h rev 38207
|
||||
* /trunk/src/kits/interface/TwoDimensionalLayout.cpp rev 38207
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\file TwoDimensionalLayout.h
|
||||
\brief Defines the BTwoDimensionalLayout class.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\class BTwoDimensionalLayout
|
||||
\ingroup interface
|
||||
@@ -8,9 +26,9 @@
|
||||
|
||||
This class manages all the tricky work of actually positioning/resizing
|
||||
items, as well as calculating size constraints and providing extra features,
|
||||
such as spacing/insets and alignment of multiple BTwoDimensionalLayouts.
|
||||
Derived classes need only implement a few hook methods to get a working
|
||||
layout.
|
||||
such as spacing/insets and alignment of multiple
|
||||
BTwoDimensionalLayout's. Derived classes need only implement a few hook
|
||||
methods to get a working layout.
|
||||
|
||||
\warning This class is not yet finalized, if you use it in your software
|
||||
assume that it will break some time in the future.
|
||||
@@ -35,23 +53,23 @@
|
||||
|
||||
/*!
|
||||
\fn void BTwoDimensionalLayout::AlignLayoutWith(
|
||||
BTwoDimensionalLayout* other, enum orientation)
|
||||
\brief Align the BLayoutItems in two BTwoDimensionalLayouts with each other
|
||||
within a certain orientation.
|
||||
BTwoDimensionalLayout* other, enum orientation orientation)
|
||||
\brief Align the BLayoutItem's in the specified \a orientation within
|
||||
two or more BTwoDimensionalLayout's.
|
||||
|
||||
When two (or more) BTwoDimensionalLayouts are aligned within a certain
|
||||
orientation, then the BLayoutItems within those BTwoDimensionalLayouts will
|
||||
have identical widths or heights (depending on how the
|
||||
BTwoDimensionalLayouts are aligned).
|
||||
When two (or more) BTwoDimensionalLayout's are aligned within a
|
||||
certain \a orientation, then the BLayoutItem's within those
|
||||
BTwoDimensionalLayout's will have identical widths or heights
|
||||
(depending on how the BTwoDimensionalLayout's are aligned.)
|
||||
|
||||
If you align two BGroupLayouts horizontally, for example, then the
|
||||
BLayoutItems at index 0 in both BGroupLayouts will be given the same
|
||||
horizontal area. The same is true for the BLayoutItems at index 1, 2, etc..
|
||||
Not all BTwoDimensionalLayouts have to have an item at each index for the
|
||||
alignment to proceed.
|
||||
If you align two BGroupLayout's horizontally for example, then the
|
||||
BLayoutItem at index 0 in both BGroupLayout's will be given the same
|
||||
horizontal area. The same is true for the BLayoutItem at index 1,
|
||||
2, etc. Not all BTwoDimensionalLayout's have to have an item at each
|
||||
index for the alignment to proceed.
|
||||
|
||||
\param other The BTwoDimensionalLayout to be aligned with.
|
||||
\param orientation The orientation on which to be aligned.
|
||||
\param orientation The \a orientation on which to be aligned.
|
||||
*/
|
||||
|
||||
|
||||
@@ -61,7 +79,7 @@
|
||||
\brief Set the insets for this BTwoDimensionalLayout (in pixels).
|
||||
|
||||
Set the spacing around the edges of this BTwoDimensionalLayout. If you
|
||||
pass B_USE_DEFAULT_SPACING for a certain parameter, that parameter will
|
||||
pass \c B_USE_DEFAULT_SPACING for a certain parameter, that parameter will
|
||||
be replaced with the value returned by BControlLook::DefaultItemSpacing().
|
||||
|
||||
\see BTwoDimensionalLayout::GetInsets();
|
||||
@@ -71,9 +89,9 @@
|
||||
/*!
|
||||
\fn void BTwoDimensionalLayout::GetInsets(float* left, float* top,
|
||||
float* right, float* bottom) const
|
||||
\brief Get the insets for this BTwoDimensionalLayout (in pixels).
|
||||
\brief Get the insets for the BTwoDimensionalLayout (in pixels).
|
||||
|
||||
Passing NULL for any paramater is not an error, such parameters will
|
||||
Passing \c NULL for any parameter is not an error, those parameters will
|
||||
be ignored.
|
||||
|
||||
\see BTwoDimensionalLayout::SetInsets();
|
||||
@@ -85,16 +103,17 @@
|
||||
|
||||
These methods are called automatically as needed during layout, and
|
||||
provide the BTwoDimensionalLayout class with the necessary information
|
||||
to properly layout the BLayoutItems in this BTwoDimensionalLayout.
|
||||
|
||||
@{
|
||||
to properly layout the BLayoutItem in this BTwoDimensionalLayout.
|
||||
*/
|
||||
|
||||
|
||||
//! @{
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BTwoDimensionalLayout::PrepareItems(enum orientation)
|
||||
\brief Prepare the BLayoutItems in this BTwoDimensionalLayout subclass
|
||||
for layout within a certain orientation.
|
||||
\fn void BTwoDimensionalLayout::PrepareItems(enum orientation orientation)
|
||||
\brief Prepare the BLayoutItem in this BTwoDimensionalLayout subclass
|
||||
for layout within a certain \a orientation.
|
||||
|
||||
This is a good place to update cache information that will be used in
|
||||
other hook methods, for example.
|
||||
@@ -104,7 +123,7 @@
|
||||
/*!
|
||||
\fn bool BTwoDimensionalLayout::HasMultiColumnItems()
|
||||
\brief Tests whether or not this BTwoDimensionalLayout contains any
|
||||
BLayoutItems spanning more than one column.
|
||||
BLayoutItem's spanning more than one column.
|
||||
|
||||
The BTwoDimensionalLayout implementation returns false.
|
||||
*/
|
||||
@@ -113,7 +132,7 @@
|
||||
/*!
|
||||
\fn bool BTwoDimensionalLayout::HasMultiRowItems()
|
||||
\brief Tests whether or not this BTwoDimensionalLayout contains any
|
||||
BLayoutItems spanning more than one row.
|
||||
BLayoutItem's spanning more than one row.
|
||||
|
||||
The BTwoDimensionalLayout implementation returns false.
|
||||
*/
|
||||
@@ -121,33 +140,37 @@
|
||||
|
||||
/*!
|
||||
\fn int32 BTwoDimensionalLayout::InternalCountColumns()
|
||||
\brief Return the number of columns in this BTwoDimensionalLayout.
|
||||
\brief Get the number of columns in the BTwoDimensionalLayout.
|
||||
|
||||
\returns The number of columns in the BTwoDimensionalLayout.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn int32 BTwoDimensionalLayout::InternalCountRows()
|
||||
\brief Return the number of rows in this BTwoDimensionalLayout.
|
||||
\brief Get the number of rows in the BTwoDimensionalLayout.
|
||||
|
||||
\returns The number of rows in the BTwoDimensionalLayout.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BTwoDimensionalLayout::GetColumnRowConstraints(enum orientation,
|
||||
int32 index, ColumnRowConstraints* constraints)
|
||||
\fn void BTwoDimensionalLayout::GetColumnRowConstraints(enum orientation
|
||||
orientation, int32 index, ColumnRowConstraints* constraints)
|
||||
\brief Fill in the ColumnRowConstraints for a certain column or row in
|
||||
this BTwoDimensionalLayout.
|
||||
the BTwoDimensionalLayout.
|
||||
|
||||
This method is used to communicate the size constraints and weight for
|
||||
a given row/column in this BTwoDimensionalLayout.
|
||||
a given row/column in the BTwoDimensionalLayout.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BTwoDimensionalLayout::GetItemDimensions(BLayoutItem* item,
|
||||
Dimensions* dimensions)
|
||||
\brief Tell the base class what column and row a BLayoutItem is in, as
|
||||
\brief Tell the base class what column and row a BLayoutItem is in as
|
||||
well as how many columns and rows it covers.
|
||||
*/
|
||||
|
||||
|
||||
//@}
|
||||
//! @}
|
||||
|
||||
Reference in New Issue
Block a user