xref: /haiku/src/kits/interface/AbstractLayoutItem.cpp (revision f23596149e0d173463f70629581aa10cc305d32e)
1 /*
2  * Copyright 2006, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 
6 #include <AbstractLayoutItem.h>
7 
8 #include <LayoutUtils.h>
9 
10 
11 // constructor
12 BAbstractLayoutItem::BAbstractLayoutItem()
13 	: fMinSize(),
14 	  fMaxSize(),
15 	  fPreferredSize(),
16 	  fAlignment()
17 {
18 }
19 
20 // destructor
21 BAbstractLayoutItem::~BAbstractLayoutItem()
22 {
23 }
24 
25 // MinSize
26 BSize
27 BAbstractLayoutItem::MinSize()
28 {
29 	return BLayoutUtils::ComposeSize(fMinSize, BaseMinSize());
30 }
31 
32 // MaxSize
33 BSize
34 BAbstractLayoutItem::MaxSize()
35 {
36 	return BLayoutUtils::ComposeSize(fMaxSize, BaseMaxSize());
37 }
38 
39 // PreferredSize
40 BSize
41 BAbstractLayoutItem::PreferredSize()
42 {
43 	return BLayoutUtils::ComposeSize(fMaxSize, BaseMaxSize());
44 }
45 
46 // Alignment
47 BAlignment
48 BAbstractLayoutItem::Alignment()
49 {
50 	return BLayoutUtils::ComposeAlignment(fAlignment, BaseAlignment());
51 }
52 
53 // SetExplicitMinSize
54 void
55 BAbstractLayoutItem::SetExplicitMinSize(BSize size)
56 {
57 	fMinSize = size;
58 }
59 
60 // SetExplicitMaxSize
61 void
62 BAbstractLayoutItem::SetExplicitMaxSize(BSize size)
63 {
64 	fMaxSize = size;
65 }
66 
67 // SetExplicitPreferredSize
68 void
69 BAbstractLayoutItem::SetExplicitPreferredSize(BSize size)
70 {
71 	fPreferredSize = size;
72 }
73 
74 // SetExplicitAlignment
75 void
76 BAbstractLayoutItem::SetExplicitAlignment(BAlignment alignment)
77 {
78 	fAlignment = alignment;
79 }
80 
81 // BaseMinSize
82 BSize
83 BAbstractLayoutItem::BaseMinSize()
84 {
85 	return BSize(0, 0);
86 }
87 
88 // BaseMaxSize
89 BSize
90 BAbstractLayoutItem::BaseMaxSize()
91 {
92 	return BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED);
93 }
94 
95 // BasePreferredSize
96 BSize
97 BAbstractLayoutItem::BasePreferredSize()
98 {
99 	return BSize(0, 0);
100 }
101 
102 // BaseAlignment
103 BAlignment
104 BAbstractLayoutItem::BaseAlignment()
105 {
106 	return BAlignment(B_ALIGN_HORIZONTAL_CENTER, B_ALIGN_VERTICAL_CENTER);
107 }
108