2010-10-23 06:33:08 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2010, Haiku, Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Documentation by:
|
2011-08-10 01:46:13 +04:00
|
|
|
* Alex Wilson <yourpalal2@gmail.com>
|
2010-10-23 06:33:08 +04:00
|
|
|
* Corresponds to:
|
|
|
|
* /trunk/headers/os/interface/Layout.h rev 38207
|
|
|
|
* /trunk/src/kits/interface/Layout.cpp rev 38207
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2011-08-10 01:46:13 +04:00
|
|
|
\file Layout.h
|
|
|
|
\brief Defines the BLayout class.
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\class BLayout
|
2010-10-23 06:33:08 +04:00
|
|
|
\ingroup interface
|
|
|
|
\ingroup layout
|
|
|
|
\ingroup libbe
|
|
|
|
\brief The BLayout class provides an interface, and some basic
|
2011-08-10 01:46:13 +04:00
|
|
|
implementation to manage the positioning and sizing of BLayoutItem s.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
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.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
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()
|
|
|
|
then that BView becomes the target of the layout. When a BLayout is nested
|
|
|
|
in another BLayout (via BLayout::AddItem()) the nested BLayout inherits the
|
|
|
|
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
|
2011-08-10 01:46:13 +04:00
|
|
|
BLayoutItem::View()) is added to the BLayout's target view.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
\code
|
|
|
|
BView* topView = new BGroupView();
|
|
|
|
BLayout* topLayout = topView->GetLayout();
|
|
|
|
|
|
|
|
BLayout* nestedLayout = new BGroupLayout(B_HORIZONTAL);
|
|
|
|
topLayout->AddItem(nestedLayout);
|
|
|
|
|
|
|
|
BLayout* veryNestedLayout = new BGroupLayout(B_VERTICAL);
|
|
|
|
nestedLayout->AddItem(veryNestedLayout);
|
|
|
|
\endcode
|
|
|
|
|
|
|
|
After executing this code, \c veryNestedLayout, \c nestedLayout, and
|
|
|
|
\c topLayout all have the same target view: \c topView.
|
|
|
|
|
|
|
|
Continuing with the same objects...
|
|
|
|
|
|
|
|
\code
|
|
|
|
BLayout* nestedLayoutWithView = (new BGroupView())->GetLayout();
|
|
|
|
topLayout->AddItem(nestedLayoutWithView);
|
|
|
|
\endcode
|
|
|
|
|
|
|
|
\c nestedLayoutWithView does have a target view of \c topView. This is
|
|
|
|
because \c nestedLayoutWithView is attached directly to a BView.
|
|
|
|
|
|
|
|
\warning This class is not yet finalized, if you use it in your software
|
|
|
|
assume that it will break some time in the future.
|
|
|
|
*/
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BLayout::BLayout()
|
2010-10-23 06:33:08 +04:00
|
|
|
\brief Default constructor.
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
After this constructor has finished, this BLayout holds no
|
|
|
|
BLayoutItem's and does not have a target BView.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
\warning Because a new BLayout does not have a target BView, calls to the
|
|
|
|
AddItem() and AddView() will fail methods will fail.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn BLayout::BLayout(BMessage* archive)
|
2010-10-23 06:33:08 +04:00
|
|
|
\brief Archive constructor.
|
2011-08-10 01:46:13 +04:00
|
|
|
|
|
|
|
\param archive The archive message.
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\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.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
Each BLayoutItem's BView (as returned by BLayoutItem::View()) is also
|
2010-10-23 06:33:08 +04:00
|
|
|
removed from their parent.
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
\note Because nested BLayout's are treated as BLayoutItem's,
|
|
|
|
any layouts nested in this BLayout will be deleted.
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name BView targeting and attachment information.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BView* BLayout::Owner() const
|
2010-10-23 06:33:08 +04:00
|
|
|
\brief Returns the Owner of this layout, i.e. the view this layout manages.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn BView* BLayout::TargetView() const
|
2010-10-23 06:33:08 +04:00
|
|
|
\brief Returns the target view of this layout.
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
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.
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn BView* BLayout::View()
|
|
|
|
\brief Returns the same BView* as BLayout::Owner(), this method is
|
|
|
|
inherited from BLayoutItem.
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
//! @}
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2011-08-10 01:46:13 +04:00
|
|
|
\name Adding, removing, counting and accessing BLayout children
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
2010-10-23 06:33:08 +04:00
|
|
|
/*!
|
|
|
|
\fn BLayoutItem* BLayout::AddView(BView* child)
|
|
|
|
\brief Creates a BLayoutItem to represent a BView, and adds that item to
|
|
|
|
this layout.
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
\a child is added to this BLayout's target view.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
\returns The BLayoutItem created to represent \a child is, or \c NULL if
|
|
|
|
there was an error.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
\param child The BView to be added to this BLayout.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn BLayoutItem* BLayout::AddView(int32 index, BView* child)
|
2010-10-23 06:33:08 +04:00
|
|
|
\brief Creates a BLayoutItem to represent \a child, and adds that item at
|
2011-08-10 01:46:13 +04:00
|
|
|
\a index to this layout. \a child is added to this BLayout's target view.
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BLayout::AddItem(BLayoutItem* item)
|
|
|
|
\brief Adds a BLayoutItem to this layout, and adds the BView it represents
|
2011-08-10 01:46:13 +04:00
|
|
|
to this BLayout's target view.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
\param item The BLayoutItem to be added.
|
|
|
|
\retval true success
|
|
|
|
\retval false failure
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BLayout::AddItem(int32 index, BLayoutItem* item)
|
|
|
|
\brief Adds \a item to this layout, and adds the BView \a item represents
|
2011-08-10 01:46:13 +04:00
|
|
|
to this BLayout's target view.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
\param item The BLayoutItem to be added.
|
|
|
|
\param index The index at which to add \c item.
|
|
|
|
|
|
|
|
If \a index is out of bounds, \a item will be added at the end. If \a index
|
|
|
|
is somewhere between the first and last indices, then items from \a index
|
|
|
|
to the end will be shuffled over by one.
|
|
|
|
|
|
|
|
\retval true success
|
|
|
|
\retval false failure
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BLayout::RemoveView(BView* child)
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Removes and deletes all BLayoutItem representing a BView from
|
|
|
|
this layout.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
\param child The BView to be removed.
|
|
|
|
|
|
|
|
\retval true success
|
|
|
|
\retval false failure
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BLayout::RemoveItem(BLayoutItem* item)
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Removes a BLayoutItem from this layout, and also removes the view
|
|
|
|
it represents from this BLayout's target view.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
\param item The BLayoutItem to be removed
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
\warning \a item is not deleted, you must delete it manually, or add it to
|
|
|
|
another BLayout.
|
2011-09-10 00:37:41 +04:00
|
|
|
\warning \a item->View(), even when it is removed from the target view,
|
|
|
|
is not deleted. If you want it deleted, you must delete it yourself!
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
\retval true success
|
|
|
|
\retval false failure
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn BLayoutItem* BLayout::RemoveItem(int32 index)
|
2010-10-23 06:33:08 +04:00
|
|
|
\brief Remove the BLayoutItem at \a index.
|
|
|
|
|
|
|
|
\see RemoveItem(BLayoutItem*)
|
|
|
|
|
|
|
|
\returns The BLayoutItem that was removed.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BLayoutItem* BLayout::ItemAt(int32 index) const
|
|
|
|
\brief Get the BLayoutItem at \a index. Returns \c NULL if \a index is
|
|
|
|
out of bounds.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BLayout::CountItems() const
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Get the number of BLayoutItem s in this layout.
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BLayout::IndexOfItem(const BLayoutItem* item) const
|
|
|
|
\brief Get the index of a BLayoutItem in this layout.
|
|
|
|
|
|
|
|
\param item The BLayoutItem whose index you want.
|
|
|
|
|
|
|
|
\retval -1 \a item was not found in this BLayout.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BLayout::IndexOfView(BView* child) const
|
|
|
|
\brief Get the index of \a child in this layout.
|
|
|
|
|
|
|
|
\note This finds the index of views added through BLayout::AddView(), not
|
|
|
|
the index of an item which represents \a child that was added through
|
|
|
|
BLayout::AddItem().
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
//! @}
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Subclass helpers.
|
|
|
|
\brief These methods are meant to ease the development of BLayout
|
|
|
|
subclasses.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BLayout::AncestorsVisible()
|
2010-10-23 06:33:08 +04:00
|
|
|
\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
|
2011-08-10 01:46:13 +04:00
|
|
|
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.
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BRect BLayout::LayoutArea()
|
|
|
|
\brief Returns the on-screen area this layout has received to lay out its
|
|
|
|
items in.
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
The return value is in the coordinate space of this BLayout's target
|
|
|
|
view. If this BLayout is attached directly to a BView, then
|
2010-10-23 06:33:08 +04:00
|
|
|
<tt> LayoutArea().LeftTop() == B_ORIGIN </tt>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BLayout::VisibilityChanged(bool show)
|
|
|
|
\brief Method to be called by derived classes in their SetVisible()
|
|
|
|
implementation. Calls AncestorVisibilityChanged() on the items in this
|
|
|
|
BLayout.
|
2011-08-10 01:46:13 +04:00
|
|
|
|
|
|
|
\param show \c true to show, \c false to hide.
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
//! @}
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Methods triggering or related to laying out this BLayout.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BLayout::Relayout(bool immediate = false)
|
2010-10-23 06:33:08 +04:00
|
|
|
\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
|
2011-08-10 01:46:13 +04:00
|
|
|
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.
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BLayout::LayoutItems(bool force = false)
|
|
|
|
\brief If there is no layout currently ongoing, and \a force is \c false,
|
2011-09-10 01:20:01 +04:00
|
|
|
creates a new BLayoutContext and calls the DoLayout() method
|
2011-08-10 01:46:13 +04:00
|
|
|
of this BLayout and any BLayout s nested in this BLayout.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
2011-12-07 10:39:16 +04:00
|
|
|
This method also guarantees that the owner view of this layout (as returned
|
2010-10-23 06:33:08 +04:00
|
|
|
by BLayout::Owner()) performs a layout as well (if it is suitable to do so).
|
2011-08-10 01:46:13 +04:00
|
|
|
|
|
|
|
\param force Force the LayoutItems.
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BLayoutContext* BLayout::LayoutContext()
|
|
|
|
\brief Returns the BLayoutContext this BLayout is currently operating in,
|
|
|
|
or \c NULL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
//! @}
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Invalidation and state mutators and accessors.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
2010-10-23 06:33:08 +04:00
|
|
|
/*!
|
|
|
|
\fn void BLayout::RequireLayout()
|
|
|
|
\brief Flag this layout as stale, i.e. any cached data may still be valid,
|
|
|
|
but the items need to be repositioned or resized.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BLayout::InvalidateLayout(bool children = false)
|
|
|
|
\brief Invalidate this layout and any cached data this layout has relating
|
|
|
|
to positioning and sizing of its items.
|
|
|
|
|
|
|
|
Invalidating a BLayout also invalidates the view it is connected to
|
2011-08-10 01:46:13 +04:00
|
|
|
(if there is one) and the BLayout this layout (or this BLayout's view)
|
2010-10-23 06:33:08 +04:00
|
|
|
resides in.
|
|
|
|
|
2011-12-07 10:39:16 +04:00
|
|
|
Although this method is virtual, you should not override it, override the
|
|
|
|
BLayout::LayoutInvalidated() hook instead.
|
|
|
|
|
2010-10-23 06:33:08 +04:00
|
|
|
This method should be called whenever the layout becomes invalid. This might
|
|
|
|
happen if the size constraints of an item in this layout change, this layout
|
|
|
|
is given more or less space than it previously had, or an object in this
|
|
|
|
layout has had its InvalidateLayout() method called.
|
|
|
|
|
2011-12-07 10:39:16 +04:00
|
|
|
\sa BView::InvalidateLayout(), BLayoutItem::InvalidateLayout(),
|
|
|
|
BLayout::LayoutInvalidated()
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BLayout::IsValid()
|
|
|
|
\brief Returns whether this layout has been invalidated (via
|
|
|
|
BLayout::InvalidateLayout()) and has not yet been validated (by doing a
|
|
|
|
layout, or by its ResetLayoutInvalidation() method.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BLayout::EnableLayoutInvalidation()
|
|
|
|
\brief Re-enable layout invalidation after a call to
|
|
|
|
DisableLayoutInvalidation().
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn void BLayout::DisableLayoutInvalidation()
|
2010-10-23 06:33:08 +04:00
|
|
|
\brief Disable layout invalidation notifications, i.e. calls to
|
|
|
|
this object's InvalidateLayout() method.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BLayout::ResetLayoutInvalidation()
|
|
|
|
\brief Reset layout invalidation, causing InvalidateLayout calls to proceed
|
|
|
|
again. This method should be called once any cached data has been
|
|
|
|
validated, or updated to valid values.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
//! @}
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Archiving methods
|
|
|
|
\brief These methods relate to the archiving or unarchiving of this object
|
2011-08-10 01:46:13 +04:00
|
|
|
and the BLayoutItem's it contains
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
2010-10-23 06:33:08 +04:00
|
|
|
/*!
|
|
|
|
\fn status_t BLayout::Archive(BMessage* archive, bool deep = true) const
|
|
|
|
\brief Archives this layout into \a archive. If deep is true, also archives
|
|
|
|
the items in this layout, calling ItemArchived() for each one.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BLayout::AllUnarchived(const BMessage* from)
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Unarchives the BLayoutItem's for this layout, calling
|
|
|
|
ItemUnarchived() for each one.
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BLayout::ItemArchived(BMessage* into, BLayoutItem* item,
|
|
|
|
int32 index) const
|
|
|
|
\brief Hook for derived classes to add data specific to \a item to the
|
|
|
|
\a into BMessage. \a item resides at \a index.
|
|
|
|
|
|
|
|
\note The same archive is passed to BLayout::ItemArchived() for all items,
|
|
|
|
so any data added for each item will be stored in an array.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BLayout::ItemUnarchived(const BMessage* from,
|
|
|
|
BLayoutItem* item, int32 index)
|
|
|
|
\brief Hook for derived classes to retrieve data specific to \a item from
|
|
|
|
the \a from BMessage. \a item resides at \a index.
|
|
|
|
|
|
|
|
\note The same archive is passed to BLayout::ItemArchived() for all items,
|
|
|
|
so any data added for each item will be stored in an array. You should pass
|
|
|
|
\a index to the BMessage methods you will be using in this method.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
//! @}
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name BLayout Hook methods
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
2010-10-23 06:33:08 +04:00
|
|
|
/*!
|
|
|
|
\fn bool BLayout::ItemAdded(BLayoutItem* item, int32 atIndex)
|
|
|
|
\brief Hook method called when \a item is added to this layout.
|
|
|
|
|
|
|
|
\param item The BLayoutItem that is being added.
|
|
|
|
\param atIndex The index of the BLayoutItem.
|
|
|
|
|
|
|
|
\retval true success
|
|
|
|
\retval false failure, \a item will not be added.
|
|
|
|
|
|
|
|
\note This is a good time to allocate data for a BLayoutItem and attach it
|
|
|
|
to \a item via BLayoutItem::SetLayoutData().
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BLayout::ItemRemoved(BLayoutItem* item, int32 fromIndex)
|
|
|
|
\brief Hook method called when \a item is removed from this layout.
|
|
|
|
|
|
|
|
\param item The BLayoutItem being removed.
|
|
|
|
\param fromIndex The index where \a item used to reside.
|
|
|
|
|
2011-09-10 00:37:41 +04:00
|
|
|
When this hook is called, \a item is not yet completely removed. It can
|
|
|
|
no longer be accessed with LayoutItemAt(), nor does it contribute to the
|
|
|
|
value of CountItems(), but the item has not yet had its ItemDetached()
|
|
|
|
hook called.
|
|
|
|
|
2010-10-23 06:33:08 +04:00
|
|
|
\note This is a good time to delete the data you've attached to \a item
|
|
|
|
via BLayoutItem::SetLayoutData().
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2011-09-10 01:20:01 +04:00
|
|
|
\fn void BLayout::DoLayout() = 0
|
2010-10-23 06:33:08 +04:00
|
|
|
\brief Implemented by derived classes to position and resize the items in
|
|
|
|
this layout.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-12-07 10:39:16 +04:00
|
|
|
/*!
|
|
|
|
\fn void BLayout::LayoutInvalidated() = 0
|
|
|
|
|
|
|
|
Hook method called when this layout becomes invalid. This is a good place
|
|
|
|
to clear any caches your object might hold.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2010-10-23 06:33:08 +04:00
|
|
|
/*!
|
|
|
|
\fn void BLayout::OwnerChanged(BView* was)
|
|
|
|
\brief Hook method called when this layout is attached to a BView.
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
\param was The previous owner of this BLayout, for new BLayout s, this
|
|
|
|
will be \c NULL.
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BLayout::AttachedToLayout()
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Hook method inherited from BLayoutItem, classes derived from
|
|
|
|
BLayout must include the BLayout version of this method in their
|
2010-10-23 06:33:08 +04:00
|
|
|
implementation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BLayout::DetachedFromLayout(BLayout* layout)
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Hook method inherited from BLayoutItem, classes derived from
|
|
|
|
BLayout must include the BLayout version of this method in their
|
2010-10-23 06:33:08 +04:00
|
|
|
implementation.
|
|
|
|
|
|
|
|
\param layout The BLayout that this BLayout was detached from.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BLayout::AncestorVisibilityChanged(bool shown)
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Hook method inherited from BLayoutItem, classes derived from
|
|
|
|
BLayout must include the BLayout version of this method in their
|
2010-10-23 06:33:08 +04:00
|
|
|
implementation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
//! @}
|