xref: /trunk/main/vcl/inc/vcl/morebtn.hxx (revision e1beba7d)
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 _SV_MOREBTN_HXX
25 #define _SV_MOREBTN_HXX
26 
27 #include <vcl/sv.h>
28 #include <vcl/dllapi.h>
29 #include <vcl/mapmod.hxx>
30 #include <vcl/button.hxx>
31 
32 struct ImplMoreButtonData;
33 
34 // --------------
35 // - MoreButton -
36 // --------------
37 
38 class VCL_DLLPUBLIC MoreButton : public PushButton
39 {
40 private:
41     ImplMoreButtonData* mpMBData;
42     sal_uLong               mnDelta;
43     MapUnit             meUnit;
44     sal_Bool                mbState;
45 
46     // Copy assignment is forbidden and not implemented.
47 	SAL_DLLPRIVATE      MoreButton( const MoreButton & );
48 	SAL_DLLPRIVATE      MoreButton& operator=( const MoreButton & );
49     SAL_DLLPRIVATE void ShowState();
50 
51 protected:
52     using Window::ImplInit;
53     SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
54 	SAL_DLLPRIVATE void	ImplLoadRes( const ResId& rResId );
55 
56 public:
57     explicit            MoreButton( Window* pParent, WinBits nStyle = 0 );
58     explicit            MoreButton( Window* pParent, const ResId& );
59     virtual             ~MoreButton();
60 
61     void                Click();
62 
63     void                AddWindow( Window* pWindow );
64     void                RemoveWindow( Window* pWindow );
65 
SetDelta(sal_uLong nNewDelta)66     void                SetDelta( sal_uLong nNewDelta ) { mnDelta = nNewDelta; }
GetDelta() const67     sal_uLong               GetDelta() const { return mnDelta; }
68 
SetMapUnit(MapUnit eNewUnit=MAP_PIXEL)69     void                SetMapUnit( MapUnit eNewUnit = MAP_PIXEL ) { meUnit = eNewUnit; }
GetMapUnit() const70     MapUnit             GetMapUnit() const { return meUnit; }
71 
72     using PushButton::SetState;
73     void                SetState( sal_Bool bNewState = sal_True );
GetState() const74     sal_Bool                GetState() const { return mbState; }
75 
76     void                SetText( const XubString& rNewText );
77     XubString           GetText() const;
78 
79     void                SetMoreText( const XubString& rNewText );
80     void                SetLessText( const XubString& rNewText );
81     XubString           GetMoreText() const;
82     XubString           GetLessText() const;
83 };
84 
SetState(sal_Bool bNewState)85 inline void MoreButton::SetState( sal_Bool bNewState )
86 {
87     if ( mbState != bNewState )
88         Click();
89 }
90 
91 #endif  // _SV_MOREBTN_HXX
92 
93