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