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/GridLayoutBuilder.h hrev38512 10d450c75cSNiels Sascha Reedijk * src/kits/interface/GridLayoutBuilder.cpp hrev45833 11d450c75cSNiels Sascha Reedijk */ 12d450c75cSNiels Sascha Reedijk 13d450c75cSNiels Sascha Reedijk 14d450c75cSNiels Sascha Reedijk/*! 15d450c75cSNiels Sascha Reedijk \file GridLayoutBuilder.h 16*dba1e742SNiels Sascha Reedijk \ingroup libbe 17*dba1e742SNiels Sascha Reedijk \brief Provides \b deprecated GridLayoutBuilder class. 18d450c75cSNiels Sascha Reedijk 19d450c75cSNiels Sascha Reedijk \since Haiku R1 20d450c75cSNiels Sascha Reedijk*/ 21d450c75cSNiels Sascha Reedijk 22d450c75cSNiels Sascha Reedijk 23d450c75cSNiels Sascha Reedijk/*! 24d450c75cSNiels Sascha Reedijk \class BGridLayoutBuilder 25d450c75cSNiels Sascha Reedijk \ingroup layout 26d450c75cSNiels Sascha Reedijk \ingroup libbe 27*dba1e742SNiels Sascha Reedijk \brief \b Deprecated helper class that helps building a \ref BGridLayout. 28*dba1e742SNiels Sascha Reedijk 29*dba1e742SNiels Sascha Reedijk The modern builder can be found in \ref BLayoutBuilder::Grid<>. 30*dba1e742SNiels Sascha Reedijk 31*dba1e742SNiels Sascha Reedijk \warning This class is deprecated and should not be used in new projects. 32*dba1e742SNiels Sascha Reedijk It may be removed in newer releases. 33d450c75cSNiels Sascha Reedijk 34d450c75cSNiels Sascha Reedijk \since Haiku R1 35d450c75cSNiels Sascha Reedijk*/ 36d450c75cSNiels Sascha Reedijk 37d450c75cSNiels Sascha Reedijk 38d450c75cSNiels Sascha Reedijk/*! 39d450c75cSNiels Sascha Reedijk \fn BGridLayoutBuilder::BGridLayoutBuilder(float horizontal=B_USE_DEFAULT_SPACING, float vertical=B_USE_DEFAULT_SPACING) 40*dba1e742SNiels Sascha Reedijk \brief Create a new layout builder with a new underlying \ref BGridLayout. 41d450c75cSNiels Sascha Reedijk 42*dba1e742SNiels Sascha Reedijk \param horizontal Horizontal spacing. 43*dba1e742SNiels Sascha Reedijk \param vertical Vertical Spacing 44d450c75cSNiels Sascha Reedijk 45d450c75cSNiels Sascha Reedijk \since Haiku R1 46d450c75cSNiels Sascha Reedijk*/ 47d450c75cSNiels Sascha Reedijk 48d450c75cSNiels Sascha Reedijk 49d450c75cSNiels Sascha Reedijk/*! 50d450c75cSNiels Sascha Reedijk \fn BGridLayoutBuilder::BGridLayoutBuilder(BGridLayout *layout) 51*dba1e742SNiels Sascha Reedijk \brief Create a new layout builder that operates on a \a layout. 52d450c75cSNiels Sascha Reedijk 53*dba1e742SNiels Sascha Reedijk \param layout The existing layout you want the builder to alter. 54d450c75cSNiels Sascha Reedijk 55d450c75cSNiels Sascha Reedijk \since Haiku R1 56d450c75cSNiels Sascha Reedijk*/ 57d450c75cSNiels Sascha Reedijk 58d450c75cSNiels Sascha Reedijk 59d450c75cSNiels Sascha Reedijk/*! 60d450c75cSNiels Sascha Reedijk \fn BGridLayoutBuilder::BGridLayoutBuilder(BGridView *view) 61*dba1e742SNiels Sascha Reedijk \brief Create a new layout builder that operates on a \a view. 62d450c75cSNiels Sascha Reedijk 63*dba1e742SNiels Sascha Reedijk \param view The existing grid view you want the builder to alter. 64d450c75cSNiels Sascha Reedijk 65d450c75cSNiels Sascha Reedijk \since Haiku R1 66d450c75cSNiels Sascha Reedijk*/ 67d450c75cSNiels Sascha Reedijk 68d450c75cSNiels Sascha Reedijk 69d450c75cSNiels Sascha Reedijk/*! 70d450c75cSNiels Sascha Reedijk \fn BGridLayout* BGridLayoutBuilder::GridLayout() const 71*dba1e742SNiels Sascha Reedijk \brief Get a reference to the underlying \ref BGridLayout. 72d450c75cSNiels Sascha Reedijk 73*dba1e742SNiels Sascha Reedijk \return A borrowed pointer to the current underlaying layout. 74d450c75cSNiels Sascha Reedijk 75d450c75cSNiels Sascha Reedijk \since Haiku R1 76d450c75cSNiels Sascha Reedijk*/ 77d450c75cSNiels Sascha Reedijk 78d450c75cSNiels Sascha Reedijk 79d450c75cSNiels Sascha Reedijk/*! 80d450c75cSNiels Sascha Reedijk \fn BGridLayoutBuilder& BGridLayoutBuilder::GetGridLayout(BGridLayout **_layout) 81*dba1e742SNiels Sascha Reedijk \brief Get a reference to the underlying \ref BGridLayout. 82d450c75cSNiels Sascha Reedijk 83*dba1e742SNiels Sascha Reedijk \param[out] _layout The variable to store a borrowed pointer to the 84*dba1e742SNiels Sascha Reedijk underlying layout. 85d450c75cSNiels Sascha Reedijk 86*dba1e742SNiels Sascha Reedijk \return The method returns a self reference, so that calls to the builder 87*dba1e742SNiels Sascha Reedijk may be chained. 88d450c75cSNiels Sascha Reedijk 89d450c75cSNiels Sascha Reedijk \since Haiku R1 90d450c75cSNiels Sascha Reedijk*/ 91d450c75cSNiels Sascha Reedijk 92d450c75cSNiels Sascha Reedijk 93d450c75cSNiels Sascha Reedijk/*! 94d450c75cSNiels Sascha Reedijk \fn BView* BGridLayoutBuilder::View() const 95*dba1e742SNiels Sascha Reedijk \brief Get a reference to the owning \ref BView. 96d450c75cSNiels Sascha Reedijk 97*dba1e742SNiels Sascha Reedijk Returns the same BView* as BLayout::Owner(), this method is inherited from 98*dba1e742SNiels Sascha Reedijk BLayoutItem. 99*dba1e742SNiels Sascha Reedijk 100*dba1e742SNiels Sascha Reedijk \return A borrowed pointer to the owning \ref BView. 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 BGridLayoutBuilder& BGridLayoutBuilder::GetView(BView **_view) 108*dba1e742SNiels Sascha Reedijk \brief Get a reference to the owning \ref BView. 109d450c75cSNiels Sascha Reedijk 110*dba1e742SNiels Sascha Reedijk \param[out] _view The variable to store the borrowed pointer to the owning 111*dba1e742SNiels Sascha Reedijk \ref BView. 112d450c75cSNiels Sascha Reedijk 113*dba1e742SNiels Sascha Reedijk \return The method returns a self reference, so that calls to the builder 114*dba1e742SNiels Sascha Reedijk may be chained. 115d450c75cSNiels Sascha Reedijk 116d450c75cSNiels Sascha Reedijk \since Haiku R1 117d450c75cSNiels Sascha Reedijk*/ 118d450c75cSNiels Sascha Reedijk 119d450c75cSNiels Sascha Reedijk 120d450c75cSNiels Sascha Reedijk/*! 121d450c75cSNiels Sascha Reedijk \fn BGridLayoutBuilder& BGridLayoutBuilder::Add(BView *view, int32 column, int32 row, int32 columnCount=1, int32 rowCount=1) 122*dba1e742SNiels Sascha Reedijk \brief Add a \a view to the underlying \ref BGridLayout. 123d450c75cSNiels Sascha Reedijk 124*dba1e742SNiels Sascha Reedijk \param view The BView to add. 125*dba1e742SNiels Sascha Reedijk \param column The column number (zero-based) to use. 126*dba1e742SNiels Sascha Reedijk \param row The row number (zero-based) to use. 127*dba1e742SNiels Sascha Reedijk \param columnCount The number of columns to span over. 128*dba1e742SNiels Sascha Reedijk \param rowCount The number of rows to span over. 129d450c75cSNiels Sascha Reedijk 130*dba1e742SNiels Sascha Reedijk \return The method returns a self reference, so that calls to the builder 131*dba1e742SNiels Sascha Reedijk may be chained. 132d450c75cSNiels Sascha Reedijk 133d450c75cSNiels Sascha Reedijk \since Haiku R1 134d450c75cSNiels Sascha Reedijk*/ 135d450c75cSNiels Sascha Reedijk 136d450c75cSNiels Sascha Reedijk 137d450c75cSNiels Sascha Reedijk/*! 138d450c75cSNiels Sascha Reedijk \fn BGridLayoutBuilder& BGridLayoutBuilder::Add(BLayoutItem *item, int32 column, int32 row, int32 columnCount=1, int32 rowCount=1) 139*dba1e742SNiels Sascha Reedijk \brief Add a \ref BLayoutItem to the underlying \ref BGridLayout. 140d450c75cSNiels Sascha Reedijk 141*dba1e742SNiels Sascha Reedijk \param item The \ref BLayoutItem to add. 142*dba1e742SNiels Sascha Reedijk \param column The column number (zero-index) to use. 143*dba1e742SNiels Sascha Reedijk \param row The row number (zero-index) to use. 144*dba1e742SNiels Sascha Reedijk \param columnCount The number of columns to span over. 145*dba1e742SNiels Sascha Reedijk \param rowCount The number of rows to span over. 146d450c75cSNiels Sascha Reedijk 147*dba1e742SNiels Sascha Reedijk \return The method returns a self reference, so that calls to the builder 148*dba1e742SNiels Sascha Reedijk may be chained. 149d450c75cSNiels Sascha Reedijk 150d450c75cSNiels Sascha Reedijk \since Haiku R1 151d450c75cSNiels Sascha Reedijk*/ 152d450c75cSNiels Sascha Reedijk 153d450c75cSNiels Sascha Reedijk 154d450c75cSNiels Sascha Reedijk/*! 155d450c75cSNiels Sascha Reedijk \fn BGridLayoutBuilder& BGridLayoutBuilder::SetColumnWeight(int32 column, float weight) 156*dba1e742SNiels Sascha Reedijk \brief Set the weight for \a column to \a weight. 157d450c75cSNiels Sascha Reedijk 158*dba1e742SNiels Sascha Reedijk \param column The column to set. 159*dba1e742SNiels Sascha Reedijk \param weight The weight to set. 160d450c75cSNiels Sascha Reedijk 161*dba1e742SNiels Sascha Reedijk \return The method returns a self reference, so that calls to the builder 162*dba1e742SNiels Sascha Reedijk may be chained. 163d450c75cSNiels Sascha Reedijk 164d450c75cSNiels Sascha Reedijk \since Haiku R1 165d450c75cSNiels Sascha Reedijk*/ 166d450c75cSNiels Sascha Reedijk 167d450c75cSNiels Sascha Reedijk 168d450c75cSNiels Sascha Reedijk/*! 169d450c75cSNiels Sascha Reedijk \fn BGridLayoutBuilder& BGridLayoutBuilder::SetRowWeight(int32 row, float weight) 170*dba1e742SNiels Sascha Reedijk \brief Set the weight of \a row to \a weight. 171d450c75cSNiels Sascha Reedijk 172*dba1e742SNiels Sascha Reedijk \param row The \a row number. 173*dba1e742SNiels Sascha Reedijk \param weight The \a weight to set. 174d450c75cSNiels Sascha Reedijk 175*dba1e742SNiels Sascha Reedijk \return The method returns a self reference, so that calls to the builder 176*dba1e742SNiels Sascha Reedijk may be chained. 177d450c75cSNiels Sascha Reedijk 178d450c75cSNiels Sascha Reedijk \since Haiku R1 179d450c75cSNiels Sascha Reedijk*/ 180d450c75cSNiels Sascha Reedijk 181d450c75cSNiels Sascha Reedijk 182d450c75cSNiels Sascha Reedijk/*! 183d450c75cSNiels Sascha Reedijk \fn BGridLayoutBuilder& BGridLayoutBuilder::SetInsets(float left, float top, float right, float bottom) 184*dba1e742SNiels Sascha Reedijk \brief Set the insets for the layout. 185d450c75cSNiels Sascha Reedijk 186*dba1e742SNiels Sascha Reedijk \param left The left inset as a \c float. 187*dba1e742SNiels Sascha Reedijk \param top The top inset as a \c float. 188*dba1e742SNiels Sascha Reedijk \param right The right inset as a \c float. 189*dba1e742SNiels Sascha Reedijk \param bottom The bottom inset as a \c float. 190d450c75cSNiels Sascha Reedijk 191*dba1e742SNiels Sascha Reedijk \return The method returns a self reference, so that calls to the builder 192*dba1e742SNiels Sascha Reedijk may be chained. 193d450c75cSNiels Sascha Reedijk 194d450c75cSNiels Sascha Reedijk \since Haiku R1 195d450c75cSNiels Sascha Reedijk*/ 196d450c75cSNiels Sascha Reedijk 197d450c75cSNiels Sascha Reedijk 198d450c75cSNiels Sascha Reedijk/*! 199d450c75cSNiels Sascha Reedijk \fn BGridLayoutBuilder::operator BGridLayout *() 200*dba1e742SNiels Sascha Reedijk \brief Casts the builder to the underlying \ref BGridLayout. 201d450c75cSNiels Sascha Reedijk 202*dba1e742SNiels Sascha Reedijk Convenience method for the \ref GridLayout() method. 203d450c75cSNiels Sascha Reedijk 204d450c75cSNiels Sascha Reedijk \since Haiku R1 205d450c75cSNiels Sascha Reedijk*/ 206