xref: /trunk/main/toolkit/source/awt/vclxsplitter.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 #ifndef LAYOUT_AWT_VCLXSPLITTER_HXX
25 #define LAYOUT_AWT_VCLXSPLITTER_HXX
26 
27 #include <com/sun/star/awt/MaxChildrenException.hpp>
28 #include <com/sun/star/beans/XPropertySet.hpp>
29 #include <comphelper/uno3.hxx>
30 #include <layout/core/box-base.hxx>
31 #include <toolkit/awt/vclxwindow.hxx>
32 
33 class Splitter;
34 
35 namespace layoutimpl
36 {
37 
38 class VCLXSplitter :public VCLXWindow
39                    ,public Box_Base
40 {
41 private:
42     VCLXSplitter( const VCLXSplitter& );            // never implemented
43     VCLXSplitter& operator=( const VCLXSplitter& ); // never implemented
44 
45 public:
46     VCLXSplitter( bool bHorizontal );
47 
48 protected:
49     ~VCLXSplitter();
50 
51     // XInterface
52     DECLARE_XINTERFACE()
53 
54     // XTypeProvider
55     DECLARE_XTYPEPROVIDER()
56 
57     // XComponent
58     void SAL_CALL dispose( );
59 
60     // ::com::sun::star::awt::XLayoutContainer
61     virtual void SAL_CALL addChild(
62         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains >& Child );
63 
64     virtual void SAL_CALL allocateArea( const ::com::sun::star::awt::Rectangle &rArea );
65 
66     virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize();
67 
68     // unimplemented:
hasHeightForWidth()69     virtual sal_Bool SAL_CALL hasHeightForWidth()
70     { return false; }
getHeightForWidth(sal_Int32)71     virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 /*nWidth*/ )
72     { return maRequisition.Height; }
73 
74     // VclWindowPeer
75     virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value );
76     virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName );
77 
78     // VCLXWindow
79     void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent );
80 
81 public:
82     // Maps page ids to child references
83     struct ChildData : public Box_Base::ChildData
84     {
85         sal_Bool mbShrink;
86         ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
87     };
88 
89     struct ChildProps : public Box_Base::ChildProps
90     {
91         ChildProps( VCLXSplitter::ChildData *pData );
92     };
93 
94 protected:
95 
96     ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
97     ChildProps *createChildProps( Box_Base::ChildData* pData );
98 
99     ChildData* getChild( int i );
100 
101     float mnHandleRatio;
102     bool mbHandlePressed;
103 
104     DECL_LINK( HandleMovedHdl, Splitter* );
105     bool mbHorizontal;
106     Splitter *mpSplitter;
107     void ensureSplitter();
108 };
109 
110 } // namespace layoutimpl
111 
112 #endif /* LAYOUT_AWT_VCLXSPLITTER_HXX */
113