2019-09-20 09:34:29 +03:00
|
|
|
/*
|
2020-03-15 13:56:19 +03:00
|
|
|
* Copyright 2020 Haiku, Inc. All rights reserved.
|
2019-09-20 09:34:29 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
2020-03-15 13:56:19 +03:00
|
|
|
* Niels Sascha Reedijk, niels.reedijk@gmail.com
|
2019-09-20 09:34:29 +03:00
|
|
|
*
|
|
|
|
* Corresponds to:
|
|
|
|
* headers/os/interface/GroupLayoutBuilder.h hrev45833
|
2020-03-15 13:56:19 +03:00
|
|
|
* src/kits/interface/GroupLayoutBuilder.cpp hrev38207
|
2019-09-20 09:34:29 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\file GroupLayoutBuilder.h
|
|
|
|
\ingroup layout
|
2020-03-15 13:56:19 +03:00
|
|
|
\ingroup libbe
|
|
|
|
\brief Provides \b deprecated GroupLayoutBuilder class.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\class BGroupLayoutBuilder
|
|
|
|
\ingroup libbe
|
2020-03-15 13:56:19 +03:00
|
|
|
\brief \b Deprecated helper class that helps building a \ref BGroupLayout.
|
|
|
|
|
|
|
|
The modern builder can be found in \ref BLayoutBuilder::Group<>.
|
|
|
|
|
|
|
|
This builder supports nested group layouts. See \ref AddGroup() and
|
|
|
|
\ref End().
|
|
|
|
|
|
|
|
\warning This class is deprecated and should not be used in new projects.
|
|
|
|
It may be removed in newer releases.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BGroupLayoutBuilder::BGroupLayoutBuilder(orientation orientation=B_HORIZONTAL, float spacing=B_USE_DEFAULT_SPACING)
|
2020-03-15 13:56:19 +03:00
|
|
|
\brief Create a new layout builder with a new underlying BGroupLayout.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\param orientation The orientation of the group.
|
|
|
|
\param spacing The spacing between items.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BGroupLayoutBuilder::BGroupLayoutBuilder(BGroupLayout *layout)
|
2020-03-15 13:56:19 +03:00
|
|
|
\brief Create a new layout builder that operates on \a layout.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\param layout The existing layout you want the builder to alter.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BGroupLayoutBuilder::BGroupLayoutBuilder(BGroupView *view)
|
2020-03-15 13:56:19 +03:00
|
|
|
\brief Create a new layout builder that operates on \a view.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\param view The existing group view you want the builder to alter.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BGroupLayout* BGroupLayoutBuilder::RootLayout() const
|
2020-03-15 13:56:19 +03:00
|
|
|
\brief Get a reference to the closest underlying \ref BGroupLayout.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\return A borrowed pointer to the current underlaying layout.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BGroupLayout* BGroupLayoutBuilder::TopLayout() const
|
2020-03-15 13:56:19 +03:00
|
|
|
\brief Get a reference to the highest underlying \ref BGroupLayout.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\return A borrowed pointer to the current underlaying layout.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BGroupLayoutBuilder& BGroupLayoutBuilder::GetTopLayout(BGroupLayout **_layout)
|
2020-03-15 13:56:19 +03:00
|
|
|
\brief Get a reference to the highest underlying \ref BGroupLayout.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\param[out] _layout The variable to store a borrowed pointer to the
|
|
|
|
highest underlying layout.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\return The method returns a self reference, so that calls to the builder
|
|
|
|
may be chained.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BView* BGroupLayoutBuilder::TopView() const
|
2020-03-15 13:56:19 +03:00
|
|
|
\brief Get a reference to the owning \ref BView.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
Returns the same BView* as BLayout::Owner(), this method is inherited from
|
|
|
|
BLayoutItem.
|
|
|
|
|
|
|
|
\return A borrowed pointer to the owning \ref BView.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BGroupLayoutBuilder& BGroupLayoutBuilder::GetTopView(BView **_view)
|
2020-03-15 13:56:19 +03:00
|
|
|
\brief Get a reference to the owning \ref BView.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\param[out] _view The variable to store the borrowed pointer to the owning
|
|
|
|
\ref BView.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\return The method returns a self reference, so that calls to the builder
|
|
|
|
may be chained.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BGroupLayoutBuilder& BGroupLayoutBuilder::Add(BView *view)
|
2020-03-15 13:56:19 +03:00
|
|
|
\brief Add a \a view to the underlying \ref BGroupLayout.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\param view The BView to add.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\return The method returns a self reference, so that calls to the builder
|
|
|
|
may be chained.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BGroupLayoutBuilder& BGroupLayoutBuilder::Add(BView *view, float weight)
|
2020-03-15 13:56:19 +03:00
|
|
|
\brief Add a \a view to the underlying \ref BGroupLayout.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\param view The BView to add.
|
|
|
|
\param weight The weight of this view within the group.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\return The method returns a self reference, so that calls to the builder
|
|
|
|
may be chained.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BGroupLayoutBuilder& BGroupLayoutBuilder::Add(BLayoutItem *item)
|
2020-03-15 13:56:19 +03:00
|
|
|
\brief Add a \ref BLayoutItem to the underlying \ref BGroupLayout.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\param item The BLayoutItem to add.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\return The method returns a self reference, so that calls to the builder
|
|
|
|
may be chained.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BGroupLayoutBuilder& BGroupLayoutBuilder::Add(BLayoutItem *item, float weight)
|
2020-03-15 13:56:19 +03:00
|
|
|
\brief Add a \ref BLayoutItem to the underlying \ref BGroupLayout.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\param item The BLayoutItem to add.
|
|
|
|
\param weight The weight of this view within the group.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\return The method returns a self reference, so that calls to the builder
|
|
|
|
may be chained.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BGroupLayoutBuilder& BGroupLayoutBuilder::AddGroup(orientation orientation, float spacing=B_USE_DEFAULT_SPACING, float weight=1.0f)
|
2020-03-15 13:56:19 +03:00
|
|
|
\brief Add a subgroup to this layout, and return a reference to a builder
|
|
|
|
that works on that subgroup.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\param orientation The orientation of the subgroup.
|
|
|
|
\param spacing The spacing between elements of the subgroup.
|
|
|
|
\param weight The weight of the subgroup in the current group.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\return The method returns a reference to a builder that works on the newly
|
|
|
|
added group. See \ref End().
|
2019-09-20 09:34:29 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BGroupLayoutBuilder& BGroupLayoutBuilder::End()
|
2020-03-15 13:56:19 +03:00
|
|
|
\brief Get a reference to a builder of the parent of the current subgroup.
|
|
|
|
|
|
|
|
When you are currently in a subgroup, you may use this method to go back to
|
|
|
|
the higher level layout.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\return The method returns a reference to a builder that works on the
|
|
|
|
parent of the current subgroup. If you use this method on a toplevel
|
|
|
|
group, the returned reference will be unchanged from the level that you
|
|
|
|
are currently working on.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BGroupLayoutBuilder& BGroupLayoutBuilder::AddGlue(float weight=1.0f)
|
2020-03-15 13:56:19 +03:00
|
|
|
\brief Set the glue for the top level group.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\param weight The weight of the glue.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\return The method returns a self reference, so that calls to the builder
|
|
|
|
may be chained.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BGroupLayoutBuilder& BGroupLayoutBuilder::AddStrut(float size)
|
2020-03-15 13:56:19 +03:00
|
|
|
\brief Add a strut to the current group.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\param size The size of the strut.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\return The method returns a self reference, so that calls to the builder
|
|
|
|
may be chained.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BGroupLayoutBuilder& BGroupLayoutBuilder::SetInsets(float left, float top, float right, float bottom)
|
2020-03-15 13:56:19 +03:00
|
|
|
\brief Set the insets of the top level group.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\param left The left inset.
|
|
|
|
\param top The top inset.
|
|
|
|
\param right The right inset.
|
|
|
|
\param bottom The bottom inset.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
\return The method returns a self reference, so that calls to the builder
|
|
|
|
may be chained.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BGroupLayoutBuilder::operator BGroupLayout *()
|
2020-03-15 13:56:19 +03:00
|
|
|
\brief Cast the builder to the underlying \ref BGroupLayout.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
2020-03-15 13:56:19 +03:00
|
|
|
Convenience method for the \ref RootLayout() method.
|
2019-09-20 09:34:29 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|