tcp: Fix 64 bit build with debugging features enabled.
[haiku.git] / src / kits / interface / SplitLayoutBuilder.cpp
blob518bfc9a136aef0a0e3abdc1ed89aad04babdd72
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 <SplitLayoutBuilder.h>
8 #include <new>
11 using std::nothrow;
14 // constructor
15 BSplitLayoutBuilder::BSplitLayoutBuilder(orientation orientation,
16 float spacing)
17 : fView(new BSplitView(orientation, spacing))
21 // constructor
22 BSplitLayoutBuilder::BSplitLayoutBuilder(BSplitView* view)
23 : fView(view)
27 // SplitView
28 BSplitView*
29 BSplitLayoutBuilder::SplitView() const
31 return fView;
34 // GetSplitView
35 BSplitLayoutBuilder&
36 BSplitLayoutBuilder::GetSplitView(BSplitView** view)
38 *view = fView;
39 return *this;
42 // Add
43 BSplitLayoutBuilder&
44 BSplitLayoutBuilder::Add(BView* view)
46 fView->AddChild(view);
47 return *this;
50 // Add
51 BSplitLayoutBuilder&
52 BSplitLayoutBuilder::Add(BView* view, float weight)
54 fView->AddChild(view, weight);
55 return *this;
58 // Add
59 BSplitLayoutBuilder&
60 BSplitLayoutBuilder::Add(BLayoutItem* item)
62 fView->AddChild(item);
63 return *this;
66 // Add
67 BSplitLayoutBuilder&
68 BSplitLayoutBuilder::Add(BLayoutItem* item, float weight)
70 fView->AddChild(item, weight);
71 return *this;
74 // SetCollapsible
75 BSplitLayoutBuilder&
76 BSplitLayoutBuilder::SetCollapsible(bool collapsible)
78 int32 count = fView->CountChildren();
79 if (count > 0)
80 fView->SetCollapsible(count - 1, collapsible);
81 return *this;
84 // SetInsets
85 BSplitLayoutBuilder&
86 BSplitLayoutBuilder::SetInsets(float left, float top, float right, float bottom)
88 fView->SetInsets(left, top, right, bottom);
90 return *this;
93 // cast operator BSplitView*
94 BSplitLayoutBuilder::operator BSplitView*()
96 return fView;