xref: /trunk/main/vcl/inc/vcl/fixed.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_FIXED_HXX
25 #define _SV_FIXED_HXX
26 
27 #include <vcl/sv.h>
28 #include <vcl/dllapi.h>
29 #include <vcl/bitmap.hxx>
30 #include <vcl/image.hxx>
31 #include <vcl/ctrl.hxx>
32 
33 class UserDrawEvent;
34 
35 // -------------
36 // - FixedText -
37 // -------------
38 
39 class VCL_DLLPUBLIC FixedText : public Control
40 {
41 //#if 0 // _SOLAR__PRIVATE
42 private:
43     using Control::ImplInitSettings;
44     using Window::ImplInit;
45     SAL_DLLPRIVATE void    ImplInit( Window* pParent, WinBits nStyle );
46     SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
47     SAL_DLLPRIVATE void    ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
48     SAL_DLLPRIVATE void    ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
49                               const Point& rPos, const Size& rSize, bool bFillLayout = false ) const;
50 public:
51     SAL_DLLPRIVATE static sal_uInt16   ImplGetTextStyle( WinBits nWinBits );
52 //#endif
53 protected:
54     virtual void    FillLayoutData() const;
55     virtual const Font&
56                     GetCanonicalFont( const StyleSettings& _rStyle ) const;
57     virtual const Color&
58                     GetCanonicalTextColor( const StyleSettings& _rStyle ) const;
59 
60 public:
61     explicit        FixedText( Window* pParent, WinBits nStyle = 0 );
62     explicit        FixedText( Window* pParent, const ResId& );
63     explicit        FixedText( Window* pParent, const ResId&, bool bDisableAccessibleLabelForRelation );
64 
65     virtual void    Paint( const Rectangle& rRect );
66     virtual void    Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
67     virtual void    Resize();
68     virtual void    StateChanged( StateChangedType nType );
69     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
70 
71     static Size     CalcMinimumTextSize( Control const* pControl, long nMaxWidth = 0 );
72     Size            CalcMinimumSize( long nMaxWidth = 0 ) const;
73     virtual Size    GetOptimalSize(WindowSizeType eType) const;
74 };
75 
76 // -------------
77 // - FixedLine -
78 // -------------
79 
80 class VCL_DLLPUBLIC FixedLine : public Control
81 {
82 private:
83     using Control::ImplInitSettings;
84     using Window::ImplInit;
85     SAL_DLLPRIVATE void    ImplInit( Window* pParent, WinBits nStyle );
86     SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
87     SAL_DLLPRIVATE void    ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
88     SAL_DLLPRIVATE void    ImplDraw( bool bLayout = false );
89 
90 protected:
91     virtual void	FillLayoutData() const;
92     virtual const Font&
93                     GetCanonicalFont( const StyleSettings& _rStyle ) const;
94     virtual const Color&
95                     GetCanonicalTextColor( const StyleSettings& _rStyle ) const;
96 
97 public:
98     explicit        FixedLine( Window* pParent, WinBits nStyle = WB_HORZ );
99     explicit        FixedLine( Window* pParent, const ResId& );
100 
101     virtual void    Paint( const Rectangle& rRect );
102     virtual void    Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
103     virtual void    Resize();
104     virtual void    StateChanged( StateChangedType nType );
105     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
106 
107     virtual Size    GetOptimalSize(WindowSizeType eType) const;
108 };
109 
110 // ---------------
111 // - FixedBitmap -
112 // ---------------
113 
114 class VCL_DLLPUBLIC FixedBitmap : public Control
115 {
116 private:
117     Bitmap          maBitmap;
118     Bitmap          maBitmapHC;
119 
120     using Control::ImplInitSettings;
121     using Window::ImplInit;
122     SAL_DLLPRIVATE void    ImplInit( Window* pParent, WinBits nStyle );
123     SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
124     SAL_DLLPRIVATE void    ImplInitSettings();
125     SAL_DLLPRIVATE void    ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
126                               const Point& rPos, const Size& rSize );
127 
128 protected:
129     SAL_DLLPRIVATE void    ImplLoadRes( const ResId& rResId );
130 
131 public:
132     explicit        FixedBitmap( Window* pParent, WinBits nStyle = 0 );
133     explicit        FixedBitmap( Window* pParent, const ResId& );
134     virtual         ~FixedBitmap();
135 
136     virtual void    Paint( const Rectangle& rRect );
137     virtual void    Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
138     virtual void    Resize();
139     virtual void    StateChanged( StateChangedType nType );
140     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
141 
142     void            SetBitmap( const Bitmap& rBitmap );
143     using OutputDevice::GetBitmap;
GetBitmap() const144     const Bitmap&   GetBitmap() const { return maBitmap; }
145     sal_Bool            SetModeBitmap( const Bitmap& rBitmap, BmpColorMode eMode = BMP_COLOR_NORMAL );
146     const Bitmap&   GetModeBitmap( BmpColorMode eMode = BMP_COLOR_NORMAL ) const;
147 };
148 
149 // --------------
150 // - FixedImage -
151 // --------------
152 
153 class VCL_DLLPUBLIC FixedImage : public Control
154 {
155 private:
156     Image           maImage;
157     Image           maImageHC;
158     sal_Bool            mbInUserDraw;
159 
160 private:
161     using Control::ImplInitSettings;
162     using Window::ImplInit;
163     SAL_DLLPRIVATE void    ImplInit( Window* pParent, WinBits nStyle );
164     SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
165     SAL_DLLPRIVATE void    ImplInitSettings();
166 
167 protected:
168     SAL_DLLPRIVATE void    ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
169                               const Point& rPos, const Size& rSize );
170     SAL_DLLPRIVATE void    ImplLoadRes( const ResId& rResId );
171 
172 public:
173     explicit        FixedImage( Window* pParent, WinBits nStyle = 0 );
174     explicit        FixedImage( Window* pParent, const ResId& );
175     virtual         ~FixedImage();
176 
177     virtual void    Paint( const Rectangle& rRect );
178     virtual void    Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
179     virtual void    Resize();
180     virtual void    StateChanged( StateChangedType nType );
181     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
182     virtual void    UserDraw( const UserDrawEvent& rUDEvt );
183     virtual Size    GetOptimalSize(WindowSizeType eType) const;
184 
185     void            SetImage( const Image& rImage );
GetImage() const186     const Image&    GetImage() const { return maImage; }
187 
188     sal_Bool            SetModeImage( const Image& rImage, BmpColorMode eMode = BMP_COLOR_NORMAL );
189     const Image&    GetModeImage( BmpColorMode eMode = BMP_COLOR_NORMAL ) const;
190 
191     Point           CalcImagePos( const Point& rPos,
192                                   const Size& rObjSize, const Size& rWinSize );
193 };
194 
195 #endif  // _SV_FIXED_HXX
196 
197