xref: /trunk/main/toolkit/source/layout/core/bin.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 /* A few simple binary containers */
25 
26 #ifndef LAYOUT_CORE_BIN_HXX
27 #define LAYOUT_CORE_BIN_HXX
28 
29 #include <layout/core/container.hxx>
30 
31 namespace layoutimpl
32 {
33 
34 class Bin : public Container
35 {
36 protected:
37     // Child
38     css::awt::Size maChildRequisition;
39     css::uno::Reference< css::awt::XLayoutConstrains > mxChild;
40 
41 public:
42     Bin();
~Bin()43     virtual ~Bin() {}
44 
45     // css::awt::XLayoutContainer
46     virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child );
47     virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child );
48 
49     virtual css::uno::Sequence< css::uno::Reference
50                 < css::awt::XLayoutConstrains > > SAL_CALL getChildren();
51 
52     virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea );
53 
54     virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
55         const css::uno::Reference< css::awt::XLayoutConstrains >& Child );
56 
57     virtual sal_Bool SAL_CALL hasHeightForWidth();
58     virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth );
59 
60     // css::awt::XLayoutConstrains
61     virtual css::awt::Size SAL_CALL getMinimumSize();
62 };
63 
64 // Align gives control over child position on the allocated space.
65 class Align : public Bin
66 {
67     friend class AlignChildProps;
68 protected:
69     // properties
70     float fHorAlign, fVerAlign;
71     float fHorFill, fVerFill;
72 
73 public:
74     Align();
75 
76     bool emptyVisible ();
77 
78     // css::awt::XLayoutContainer
79     virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea );
80 };
81 
82 // Makes child request its or a specified size, whatever is larger.
83 class MinSize : public Bin
84 {
85 protected:
86     // properties
87     long mnMinWidth, mnMinHeight;
88 
89 public:
90     MinSize();
91 
92     bool emptyVisible ();
93     // css::awt::XLayoutContainer
94     virtual css::awt::Size SAL_CALL getMinimumSize();
95 };
96 
97 } //  namespace layoutimpl
98 
99 #endif /* LAYOUT_CORE_BIN_HXX */
100