1d450c75cSNiels Sascha Reedijk/* 2*dba1e742SNiels Sascha Reedijk * Copyright 2020 Haiku, Inc. All rights reserved. 3d450c75cSNiels Sascha Reedijk * Distributed under the terms of the MIT License. 4d450c75cSNiels Sascha Reedijk * 5d450c75cSNiels Sascha Reedijk * Authors: 6*dba1e742SNiels Sascha Reedijk * Niels Sascha Reedijk, niels.reedijk@gmail.com 7d450c75cSNiels Sascha Reedijk * 8d450c75cSNiels Sascha Reedijk * Corresponds to: 9d450c75cSNiels Sascha Reedijk * headers/os/interface/GroupLayoutBuilder.h hrev45833 10*dba1e742SNiels Sascha Reedijk * src/kits/interface/GroupLayoutBuilder.cpp hrev38207 11d450c75cSNiels Sascha Reedijk */ 12d450c75cSNiels Sascha Reedijk 13d450c75cSNiels Sascha Reedijk 14d450c75cSNiels Sascha Reedijk/*! 15d450c75cSNiels Sascha Reedijk \file GroupLayoutBuilder.h 16d450c75cSNiels Sascha Reedijk \ingroup layout 17*dba1e742SNiels Sascha Reedijk \ingroup libbe 18*dba1e742SNiels Sascha Reedijk \brief Provides \b deprecated GroupLayoutBuilder class. 19d450c75cSNiels Sascha Reedijk 20d450c75cSNiels Sascha Reedijk \since Haiku R1 21d450c75cSNiels Sascha Reedijk*/ 22d450c75cSNiels Sascha Reedijk 23d450c75cSNiels Sascha Reedijk 24d450c75cSNiels Sascha Reedijk/*! 25d450c75cSNiels Sascha Reedijk \class BGroupLayoutBuilder 26d450c75cSNiels Sascha Reedijk \ingroup libbe 27*dba1e742SNiels Sascha Reedijk \brief \b Deprecated helper class that helps building a \ref BGroupLayout. 28*dba1e742SNiels Sascha Reedijk 29*dba1e742SNiels Sascha Reedijk The modern builder can be found in \ref BLayoutBuilder::Group<>. 30*dba1e742SNiels Sascha Reedijk 31*dba1e742SNiels Sascha Reedijk This builder supports nested group layouts. See \ref AddGroup() and 32*dba1e742SNiels Sascha Reedijk \ref End(). 33*dba1e742SNiels Sascha Reedijk 34*dba1e742SNiels Sascha Reedijk \warning This class is deprecated and should not be used in new projects. 35*dba1e742SNiels Sascha Reedijk It may be removed in newer releases. 36d450c75cSNiels Sascha Reedijk 37d450c75cSNiels Sascha Reedijk \since Haiku R1 38d450c75cSNiels Sascha Reedijk*/ 39d450c75cSNiels Sascha Reedijk 40d450c75cSNiels Sascha Reedijk 41d450c75cSNiels Sascha Reedijk/*! 42d450c75cSNiels Sascha Reedijk \fn BGroupLayoutBuilder::BGroupLayoutBuilder(orientation orientation=B_HORIZONTAL, float spacing=B_USE_DEFAULT_SPACING) 43*dba1e742SNiels Sascha Reedijk \brief Create a new layout builder with a new underlying BGroupLayout. 44d450c75cSNiels Sascha Reedijk 45*dba1e742SNiels Sascha Reedijk \param orientation The orientation of the group. 46*dba1e742SNiels Sascha Reedijk \param spacing The spacing between items. 47d450c75cSNiels Sascha Reedijk 48d450c75cSNiels Sascha Reedijk \since Haiku R1 49d450c75cSNiels Sascha Reedijk*/ 50d450c75cSNiels Sascha Reedijk 51d450c75cSNiels Sascha Reedijk 52d450c75cSNiels Sascha Reedijk/*! 53d450c75cSNiels Sascha Reedijk \fn BGroupLayoutBuilder::BGroupLayoutBuilder(BGroupLayout *layout) 54*dba1e742SNiels Sascha Reedijk \brief Create a new layout builder that operates on \a layout. 55d450c75cSNiels Sascha Reedijk 56*dba1e742SNiels Sascha Reedijk \param layout The existing layout you want the builder to alter. 57d450c75cSNiels Sascha Reedijk 58d450c75cSNiels Sascha Reedijk \since Haiku R1 59d450c75cSNiels Sascha Reedijk*/ 60d450c75cSNiels Sascha Reedijk 61d450c75cSNiels Sascha Reedijk 62d450c75cSNiels Sascha Reedijk/*! 63d450c75cSNiels Sascha Reedijk \fn BGroupLayoutBuilder::BGroupLayoutBuilder(BGroupView *view) 64*dba1e742SNiels Sascha Reedijk \brief Create a new layout builder that operates on \a view. 65d450c75cSNiels Sascha Reedijk 66*dba1e742SNiels Sascha Reedijk \param view The existing group view you want the builder to alter. 67d450c75cSNiels Sascha Reedijk 68d450c75cSNiels Sascha Reedijk \since Haiku R1 69d450c75cSNiels Sascha Reedijk*/ 70d450c75cSNiels Sascha Reedijk 71d450c75cSNiels Sascha Reedijk 72d450c75cSNiels Sascha Reedijk/*! 73d450c75cSNiels Sascha Reedijk \fn BGroupLayout* BGroupLayoutBuilder::RootLayout() const 74*dba1e742SNiels Sascha Reedijk \brief Get a reference to the closest underlying \ref BGroupLayout. 75d450c75cSNiels Sascha Reedijk 76*dba1e742SNiels Sascha Reedijk \return A borrowed pointer to the current underlaying layout. 77d450c75cSNiels Sascha Reedijk 78d450c75cSNiels Sascha Reedijk \since Haiku R1 79d450c75cSNiels Sascha Reedijk*/ 80d450c75cSNiels Sascha Reedijk 81d450c75cSNiels Sascha Reedijk 82d450c75cSNiels Sascha Reedijk/*! 83d450c75cSNiels Sascha Reedijk \fn BGroupLayout* BGroupLayoutBuilder::TopLayout() const 84*dba1e742SNiels Sascha Reedijk \brief Get a reference to the highest underlying \ref BGroupLayout. 85d450c75cSNiels Sascha Reedijk 86*dba1e742SNiels Sascha Reedijk \return A borrowed pointer to the current underlaying layout. 87d450c75cSNiels Sascha Reedijk 88d450c75cSNiels Sascha Reedijk \since Haiku R1 89d450c75cSNiels Sascha Reedijk*/ 90d450c75cSNiels Sascha Reedijk 91d450c75cSNiels Sascha Reedijk 92d450c75cSNiels Sascha Reedijk/*! 93d450c75cSNiels Sascha Reedijk \fn BGroupLayoutBuilder& BGroupLayoutBuilder::GetTopLayout(BGroupLayout **_layout) 94*dba1e742SNiels Sascha Reedijk \brief Get a reference to the highest underlying \ref BGroupLayout. 95d450c75cSNiels Sascha Reedijk 96*dba1e742SNiels Sascha Reedijk \param[out] _layout The variable to store a borrowed pointer to the 97*dba1e742SNiels Sascha Reedijk highest underlying layout. 98d450c75cSNiels Sascha Reedijk 99*dba1e742SNiels Sascha Reedijk \return The method returns a self reference, so that calls to the builder 100*dba1e742SNiels Sascha Reedijk may be chained. 101d450c75cSNiels Sascha Reedijk 102d450c75cSNiels Sascha Reedijk \since Haiku R1 103d450c75cSNiels Sascha Reedijk*/ 104d450c75cSNiels Sascha Reedijk 105d450c75cSNiels Sascha Reedijk 106d450c75cSNiels Sascha Reedijk/*! 107d450c75cSNiels Sascha Reedijk \fn BView* BGroupLayoutBuilder::TopView() const 108*dba1e742SNiels Sascha Reedijk \brief Get a reference to the owning \ref BView. 109d450c75cSNiels Sascha Reedijk 110*dba1e742SNiels Sascha Reedijk Returns the same BView* as BLayout::Owner(), this method is inherited from 111*dba1e742SNiels Sascha Reedijk BLayoutItem. 112*dba1e742SNiels Sascha Reedijk 113*dba1e742SNiels Sascha Reedijk \return A borrowed pointer to the owning \ref BView. 114d450c75cSNiels Sascha Reedijk 115d450c75cSNiels Sascha Reedijk \since Haiku R1 116d450c75cSNiels Sascha Reedijk*/ 117d450c75cSNiels Sascha Reedijk 118d450c75cSNiels Sascha Reedijk 119d450c75cSNiels Sascha Reedijk/*! 120d450c75cSNiels Sascha Reedijk \fn BGroupLayoutBuilder& BGroupLayoutBuilder::GetTopView(BView **_view) 121*dba1e742SNiels Sascha Reedijk \brief Get a reference to the owning \ref BView. 122d450c75cSNiels Sascha Reedijk 123*dba1e742SNiels Sascha Reedijk \param[out] _view The variable to store the borrowed pointer to the owning 124*dba1e742SNiels Sascha Reedijk \ref BView. 125d450c75cSNiels Sascha Reedijk 126*dba1e742SNiels Sascha Reedijk \return The method returns a self reference, so that calls to the builder 127*dba1e742SNiels Sascha Reedijk may be chained. 128d450c75cSNiels Sascha Reedijk 129d450c75cSNiels Sascha Reedijk \since Haiku R1 130d450c75cSNiels Sascha Reedijk*/ 131d450c75cSNiels Sascha Reedijk 132d450c75cSNiels Sascha Reedijk 133d450c75cSNiels Sascha Reedijk/*! 134d450c75cSNiels Sascha Reedijk \fn BGroupLayoutBuilder& BGroupLayoutBuilder::Add(BView *view) 135*dba1e742SNiels Sascha Reedijk \brief Add a \a view to the underlying \ref BGroupLayout. 136d450c75cSNiels Sascha Reedijk 137*dba1e742SNiels Sascha Reedijk \param view The BView to add. 138d450c75cSNiels Sascha Reedijk 139*dba1e742SNiels Sascha Reedijk \return The method returns a self reference, so that calls to the builder 140*dba1e742SNiels Sascha Reedijk may be chained. 141d450c75cSNiels Sascha Reedijk 142d450c75cSNiels Sascha Reedijk \since Haiku R1 143d450c75cSNiels Sascha Reedijk*/ 144d450c75cSNiels Sascha Reedijk 145d450c75cSNiels Sascha Reedijk 146d450c75cSNiels Sascha Reedijk/*! 147d450c75cSNiels Sascha Reedijk \fn BGroupLayoutBuilder& BGroupLayoutBuilder::Add(BView *view, float weight) 148*dba1e742SNiels Sascha Reedijk \brief Add a \a view to the underlying \ref BGroupLayout. 149d450c75cSNiels Sascha Reedijk 150*dba1e742SNiels Sascha Reedijk \param view The BView to add. 151*dba1e742SNiels Sascha Reedijk \param weight The weight of this view within the group. 152d450c75cSNiels Sascha Reedijk 153*dba1e742SNiels Sascha Reedijk \return The method returns a self reference, so that calls to the builder 154*dba1e742SNiels Sascha Reedijk may be chained. 155d450c75cSNiels Sascha Reedijk 156d450c75cSNiels Sascha Reedijk \since Haiku R1 157d450c75cSNiels Sascha Reedijk*/ 158d450c75cSNiels Sascha Reedijk 159d450c75cSNiels Sascha Reedijk 160d450c75cSNiels Sascha Reedijk/*! 161d450c75cSNiels Sascha Reedijk \fn BGroupLayoutBuilder& BGroupLayoutBuilder::Add(BLayoutItem *item) 162*dba1e742SNiels Sascha Reedijk \brief Add a \ref BLayoutItem to the underlying \ref BGroupLayout. 163d450c75cSNiels Sascha Reedijk 164*dba1e742SNiels Sascha Reedijk \param item The BLayoutItem to add. 165d450c75cSNiels Sascha Reedijk 166*dba1e742SNiels Sascha Reedijk \return The method returns a self reference, so that calls to the builder 167*dba1e742SNiels Sascha Reedijk may be chained. 168d450c75cSNiels Sascha Reedijk 169d450c75cSNiels Sascha Reedijk \since Haiku R1 170d450c75cSNiels Sascha Reedijk*/ 171d450c75cSNiels Sascha Reedijk 172d450c75cSNiels Sascha Reedijk 173d450c75cSNiels Sascha Reedijk/*! 174d450c75cSNiels Sascha Reedijk \fn BGroupLayoutBuilder& BGroupLayoutBuilder::Add(BLayoutItem *item, float weight) 175*dba1e742SNiels Sascha Reedijk \brief Add a \ref BLayoutItem to the underlying \ref BGroupLayout. 176d450c75cSNiels Sascha Reedijk 177*dba1e742SNiels Sascha Reedijk \param item The BLayoutItem to add. 178*dba1e742SNiels Sascha Reedijk \param weight The weight of this view within the group. 179d450c75cSNiels Sascha Reedijk 180*dba1e742SNiels Sascha Reedijk \return The method returns a self reference, so that calls to the builder 181*dba1e742SNiels Sascha Reedijk may be chained. 182d450c75cSNiels Sascha Reedijk 183d450c75cSNiels Sascha Reedijk \since Haiku R1 184d450c75cSNiels Sascha Reedijk*/ 185d450c75cSNiels Sascha Reedijk 186d450c75cSNiels Sascha Reedijk 187d450c75cSNiels Sascha Reedijk/*! 188d450c75cSNiels Sascha Reedijk \fn BGroupLayoutBuilder& BGroupLayoutBuilder::AddGroup(orientation orientation, float spacing=B_USE_DEFAULT_SPACING, float weight=1.0f) 189*dba1e742SNiels Sascha Reedijk \brief Add a subgroup to this layout, and return a reference to a builder 190*dba1e742SNiels Sascha Reedijk that works on that subgroup. 191d450c75cSNiels Sascha Reedijk 192*dba1e742SNiels Sascha Reedijk \param orientation The orientation of the subgroup. 193*dba1e742SNiels Sascha Reedijk \param spacing The spacing between elements of the subgroup. 194*dba1e742SNiels Sascha Reedijk \param weight The weight of the subgroup in the current group. 195d450c75cSNiels Sascha Reedijk 196*dba1e742SNiels Sascha Reedijk \return The method returns a reference to a builder that works on the newly 197*dba1e742SNiels Sascha Reedijk added group. See \ref End(). 198d450c75cSNiels Sascha Reedijk 199d450c75cSNiels Sascha Reedijk \since Haiku R1 200d450c75cSNiels Sascha Reedijk*/ 201d450c75cSNiels Sascha Reedijk 202d450c75cSNiels Sascha Reedijk 203d450c75cSNiels Sascha Reedijk/*! 204d450c75cSNiels Sascha Reedijk \fn BGroupLayoutBuilder& BGroupLayoutBuilder::End() 205*dba1e742SNiels Sascha Reedijk \brief Get a reference to a builder of the parent of the current subgroup. 206d450c75cSNiels Sascha Reedijk 207*dba1e742SNiels Sascha Reedijk When you are currently in a subgroup, you may use this method to go back to 208*dba1e742SNiels Sascha Reedijk the higher level layout. 209*dba1e742SNiels Sascha Reedijk 210*dba1e742SNiels Sascha Reedijk \return The method returns a reference to a builder that works on the 211*dba1e742SNiels Sascha Reedijk parent of the current subgroup. If you use this method on a toplevel 212*dba1e742SNiels Sascha Reedijk group, the returned reference will be unchanged from the level that you 213*dba1e742SNiels Sascha Reedijk are currently working on. 214d450c75cSNiels Sascha Reedijk 215d450c75cSNiels Sascha Reedijk \since Haiku R1 216d450c75cSNiels Sascha Reedijk*/ 217d450c75cSNiels Sascha Reedijk 218d450c75cSNiels Sascha Reedijk 219d450c75cSNiels Sascha Reedijk/*! 220d450c75cSNiels Sascha Reedijk \fn BGroupLayoutBuilder& BGroupLayoutBuilder::AddGlue(float weight=1.0f) 221*dba1e742SNiels Sascha Reedijk \brief Set the glue for the top level group. 222d450c75cSNiels Sascha Reedijk 223*dba1e742SNiels Sascha Reedijk \param weight The weight of the glue. 224d450c75cSNiels Sascha Reedijk 225*dba1e742SNiels Sascha Reedijk \return The method returns a self reference, so that calls to the builder 226*dba1e742SNiels Sascha Reedijk may be chained. 227d450c75cSNiels Sascha Reedijk 228d450c75cSNiels Sascha Reedijk \since Haiku R1 229d450c75cSNiels Sascha Reedijk*/ 230d450c75cSNiels Sascha Reedijk 231d450c75cSNiels Sascha Reedijk 232d450c75cSNiels Sascha Reedijk/*! 233d450c75cSNiels Sascha Reedijk \fn BGroupLayoutBuilder& BGroupLayoutBuilder::AddStrut(float size) 234*dba1e742SNiels Sascha Reedijk \brief Add a strut to the current group. 235d450c75cSNiels Sascha Reedijk 236*dba1e742SNiels Sascha Reedijk \param size The size of the strut. 237d450c75cSNiels Sascha Reedijk 238*dba1e742SNiels Sascha Reedijk \return The method returns a self reference, so that calls to the builder 239*dba1e742SNiels Sascha Reedijk may be chained. 240d450c75cSNiels Sascha Reedijk 241d450c75cSNiels Sascha Reedijk \since Haiku R1 242d450c75cSNiels Sascha Reedijk*/ 243d450c75cSNiels Sascha Reedijk 244d450c75cSNiels Sascha Reedijk 245d450c75cSNiels Sascha Reedijk/*! 246d450c75cSNiels Sascha Reedijk \fn BGroupLayoutBuilder& BGroupLayoutBuilder::SetInsets(float left, float top, float right, float bottom) 247*dba1e742SNiels Sascha Reedijk \brief Set the insets of the top level group. 248d450c75cSNiels Sascha Reedijk 249*dba1e742SNiels Sascha Reedijk \param left The left inset. 250*dba1e742SNiels Sascha Reedijk \param top The top inset. 251*dba1e742SNiels Sascha Reedijk \param right The right inset. 252*dba1e742SNiels Sascha Reedijk \param bottom The bottom inset. 253d450c75cSNiels Sascha Reedijk 254*dba1e742SNiels Sascha Reedijk \return The method returns a self reference, so that calls to the builder 255*dba1e742SNiels Sascha Reedijk may be chained. 256d450c75cSNiels Sascha Reedijk 257d450c75cSNiels Sascha Reedijk \since Haiku R1 258d450c75cSNiels Sascha Reedijk*/ 259d450c75cSNiels Sascha Reedijk 260d450c75cSNiels Sascha Reedijk 261d450c75cSNiels Sascha Reedijk/*! 262d450c75cSNiels Sascha Reedijk \fn BGroupLayoutBuilder::operator BGroupLayout *() 263*dba1e742SNiels Sascha Reedijk \brief Cast the builder to the underlying \ref BGroupLayout. 264d450c75cSNiels Sascha Reedijk 265*dba1e742SNiels Sascha Reedijk Convenience method for the \ref RootLayout() method. 266d450c75cSNiels Sascha Reedijk 267d450c75cSNiels Sascha Reedijk \since Haiku R1 268d450c75cSNiels Sascha Reedijk*/ 269