vfs: check userland buffers before reading them.
[haiku.git] / src / kits / interface / GridLayoutBuilder.cpp
blob6e73bc84946d7c3723875bf80df7a9756e288e9c
1 /*
2 * Copyright 2006, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
3 * All rights reserved. Distributed under the terms of the MIT License.
4 */
6 #include <GridLayoutBuilder.h>
8 #include <new>
10 #include <SpaceLayoutItem.h>
13 using std::nothrow;
16 // constructor
17 BGridLayoutBuilder::BGridLayoutBuilder(float horizontalSpacing,
18 float verticalSpacing)
19 : fLayout((new BGridView(horizontalSpacing, verticalSpacing))
20 ->GridLayout())
24 // constructor
25 BGridLayoutBuilder::BGridLayoutBuilder(BGridLayout* layout)
26 : fLayout(layout)
31 // constructor
32 BGridLayoutBuilder::BGridLayoutBuilder(BGridView* view)
33 : fLayout(view->GridLayout())
37 // GridLayout
38 BGridLayout*
39 BGridLayoutBuilder::GridLayout() const
41 return fLayout;
44 // View
45 BView*
46 BGridLayoutBuilder::View() const
48 return fLayout->Owner();
51 // GetGridLayout
52 BGridLayoutBuilder&
53 BGridLayoutBuilder::GetGridLayout(BGridLayout** _layout)
55 *_layout = fLayout;
56 return *this;
59 // GetView
60 BGridLayoutBuilder&
61 BGridLayoutBuilder::GetView(BView** _view)
63 *_view = fLayout->Owner();
64 return *this;
67 // Add
68 BGridLayoutBuilder&
69 BGridLayoutBuilder::Add(BView* view, int32 column, int32 row,
70 int32 columnCount, int32 rowCount)
72 fLayout->AddView(view, column, row, columnCount, rowCount);
73 return *this;
76 // Add
77 BGridLayoutBuilder&
78 BGridLayoutBuilder::Add(BLayoutItem* item, int32 column, int32 row,
79 int32 columnCount, int32 rowCount)
81 fLayout->AddItem(item, column, row, columnCount, rowCount);
82 return *this;
85 // SetColumnWeight
86 BGridLayoutBuilder&
87 BGridLayoutBuilder::SetColumnWeight(int32 column, float weight)
89 fLayout->SetColumnWeight(column, weight);
90 return *this;
93 // SetRowWeight
94 BGridLayoutBuilder&
95 BGridLayoutBuilder::SetRowWeight(int32 row, float weight)
97 fLayout->SetRowWeight(row, weight);
98 return *this;
101 // SetInsets
102 BGridLayoutBuilder&
103 BGridLayoutBuilder::SetInsets(float left, float top, float right, float bottom)
105 fLayout->SetInsets(left, top, right, bottom);
106 return *this;
109 // cast operator BGridLayout*
110 BGridLayoutBuilder::operator BGridLayout*()
112 return fLayout;