xref: /aoo41x/main/vcl/inc/vcl/fixed.hxx (revision e1beba7d)
10d63794cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
30d63794cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
40d63794cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
50d63794cSAndrew Rist  * distributed with this work for additional information
60d63794cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
70d63794cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
80d63794cSAndrew Rist  * "License"); you may not use this file except in compliance
90d63794cSAndrew Rist  * with the License.  You may obtain a copy of the License at
100d63794cSAndrew Rist  *
110d63794cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
120d63794cSAndrew Rist  *
130d63794cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
140d63794cSAndrew Rist  * software distributed under the License is distributed on an
150d63794cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
160d63794cSAndrew Rist  * KIND, either express or implied.  See the License for the
170d63794cSAndrew Rist  * specific language governing permissions and limitations
180d63794cSAndrew Rist  * under the License.
190d63794cSAndrew Rist  *
200d63794cSAndrew Rist  *************************************************************/
210d63794cSAndrew Rist 
220d63794cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SV_FIXED_HXX
25cdf0e10cSrcweir #define _SV_FIXED_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vcl/sv.h>
28cdf0e10cSrcweir #include <vcl/dllapi.h>
29cdf0e10cSrcweir #include <vcl/bitmap.hxx>
30cdf0e10cSrcweir #include <vcl/image.hxx>
31cdf0e10cSrcweir #include <vcl/ctrl.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir class UserDrawEvent;
34cdf0e10cSrcweir 
35cdf0e10cSrcweir // -------------
36cdf0e10cSrcweir // - FixedText -
37cdf0e10cSrcweir // -------------
38cdf0e10cSrcweir 
39cdf0e10cSrcweir class VCL_DLLPUBLIC FixedText : public Control
40cdf0e10cSrcweir {
41cdf0e10cSrcweir //#if 0 // _SOLAR__PRIVATE
42cdf0e10cSrcweir private:
43cdf0e10cSrcweir     using Control::ImplInitSettings;
44cdf0e10cSrcweir     using Window::ImplInit;
45cdf0e10cSrcweir     SAL_DLLPRIVATE void    ImplInit( Window* pParent, WinBits nStyle );
46cdf0e10cSrcweir     SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
47cdf0e10cSrcweir     SAL_DLLPRIVATE void    ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
48cdf0e10cSrcweir     SAL_DLLPRIVATE void    ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
49cdf0e10cSrcweir                               const Point& rPos, const Size& rSize, bool bFillLayout = false ) const;
50cdf0e10cSrcweir public:
51cdf0e10cSrcweir     SAL_DLLPRIVATE static sal_uInt16   ImplGetTextStyle( WinBits nWinBits );
52cdf0e10cSrcweir //#endif
53cdf0e10cSrcweir protected:
54cdf0e10cSrcweir     virtual void    FillLayoutData() const;
55cdf0e10cSrcweir     virtual const Font&
56cdf0e10cSrcweir                     GetCanonicalFont( const StyleSettings& _rStyle ) const;
57cdf0e10cSrcweir     virtual const Color&
58cdf0e10cSrcweir                     GetCanonicalTextColor( const StyleSettings& _rStyle ) const;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir public:
61*e1beba7dSHerbert Dürr     explicit        FixedText( Window* pParent, WinBits nStyle = 0 );
62*e1beba7dSHerbert Dürr     explicit        FixedText( Window* pParent, const ResId& );
63*e1beba7dSHerbert Dürr     explicit        FixedText( Window* pParent, const ResId&, bool bDisableAccessibleLabelForRelation );
64cdf0e10cSrcweir 
65cdf0e10cSrcweir     virtual void    Paint( const Rectangle& rRect );
66cdf0e10cSrcweir     virtual void    Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
67cdf0e10cSrcweir     virtual void    Resize();
68cdf0e10cSrcweir     virtual void    StateChanged( StateChangedType nType );
69cdf0e10cSrcweir     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     static Size     CalcMinimumTextSize( Control const* pControl, long nMaxWidth = 0 );
72cdf0e10cSrcweir     Size            CalcMinimumSize( long nMaxWidth = 0 ) const;
73cdf0e10cSrcweir     virtual Size    GetOptimalSize(WindowSizeType eType) const;
74cdf0e10cSrcweir };
75cdf0e10cSrcweir 
76cdf0e10cSrcweir // -------------
77cdf0e10cSrcweir // - FixedLine -
78cdf0e10cSrcweir // -------------
79cdf0e10cSrcweir 
80cdf0e10cSrcweir class VCL_DLLPUBLIC FixedLine : public Control
81cdf0e10cSrcweir {
82cdf0e10cSrcweir private:
83cdf0e10cSrcweir     using Control::ImplInitSettings;
84cdf0e10cSrcweir     using Window::ImplInit;
85cdf0e10cSrcweir     SAL_DLLPRIVATE void    ImplInit( Window* pParent, WinBits nStyle );
86cdf0e10cSrcweir     SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
87cdf0e10cSrcweir     SAL_DLLPRIVATE void    ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
88cdf0e10cSrcweir     SAL_DLLPRIVATE void    ImplDraw( bool bLayout = false );
89cdf0e10cSrcweir 
90cdf0e10cSrcweir protected:
91cdf0e10cSrcweir     virtual void	FillLayoutData() const;
92cdf0e10cSrcweir     virtual const Font&
93cdf0e10cSrcweir                     GetCanonicalFont( const StyleSettings& _rStyle ) const;
94cdf0e10cSrcweir     virtual const Color&
95cdf0e10cSrcweir                     GetCanonicalTextColor( const StyleSettings& _rStyle ) const;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir public:
98*e1beba7dSHerbert Dürr     explicit        FixedLine( Window* pParent, WinBits nStyle = WB_HORZ );
99*e1beba7dSHerbert Dürr     explicit        FixedLine( Window* pParent, const ResId& );
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     virtual void    Paint( const Rectangle& rRect );
102cdf0e10cSrcweir     virtual void    Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
103cdf0e10cSrcweir     virtual void    Resize();
104cdf0e10cSrcweir     virtual void    StateChanged( StateChangedType nType );
105cdf0e10cSrcweir     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     virtual Size    GetOptimalSize(WindowSizeType eType) const;
108cdf0e10cSrcweir };
109cdf0e10cSrcweir 
110cdf0e10cSrcweir // ---------------
111cdf0e10cSrcweir // - FixedBitmap -
112cdf0e10cSrcweir // ---------------
113cdf0e10cSrcweir 
114cdf0e10cSrcweir class VCL_DLLPUBLIC FixedBitmap : public Control
115cdf0e10cSrcweir {
116cdf0e10cSrcweir private:
117cdf0e10cSrcweir     Bitmap          maBitmap;
118cdf0e10cSrcweir     Bitmap          maBitmapHC;
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     using Control::ImplInitSettings;
121cdf0e10cSrcweir     using Window::ImplInit;
122cdf0e10cSrcweir     SAL_DLLPRIVATE void    ImplInit( Window* pParent, WinBits nStyle );
123cdf0e10cSrcweir     SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
124cdf0e10cSrcweir     SAL_DLLPRIVATE void    ImplInitSettings();
125cdf0e10cSrcweir     SAL_DLLPRIVATE void    ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
126cdf0e10cSrcweir                               const Point& rPos, const Size& rSize );
127cdf0e10cSrcweir 
128cdf0e10cSrcweir protected:
129cdf0e10cSrcweir     SAL_DLLPRIVATE void    ImplLoadRes( const ResId& rResId );
130cdf0e10cSrcweir 
131cdf0e10cSrcweir public:
132*e1beba7dSHerbert Dürr     explicit        FixedBitmap( Window* pParent, WinBits nStyle = 0 );
133*e1beba7dSHerbert Dürr     explicit        FixedBitmap( Window* pParent, const ResId& );
134*e1beba7dSHerbert Dürr     virtual         ~FixedBitmap();
135cdf0e10cSrcweir 
136cdf0e10cSrcweir     virtual void    Paint( const Rectangle& rRect );
137cdf0e10cSrcweir     virtual void    Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
138cdf0e10cSrcweir     virtual void    Resize();
139cdf0e10cSrcweir     virtual void    StateChanged( StateChangedType nType );
140cdf0e10cSrcweir     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
141cdf0e10cSrcweir 
142cdf0e10cSrcweir     void            SetBitmap( const Bitmap& rBitmap );
143cdf0e10cSrcweir     using OutputDevice::GetBitmap;
GetBitmap() const144cdf0e10cSrcweir     const Bitmap&   GetBitmap() const { return maBitmap; }
145cdf0e10cSrcweir     sal_Bool            SetModeBitmap( const Bitmap& rBitmap, BmpColorMode eMode = BMP_COLOR_NORMAL );
146cdf0e10cSrcweir     const Bitmap&   GetModeBitmap( BmpColorMode eMode = BMP_COLOR_NORMAL ) const;
147cdf0e10cSrcweir };
148cdf0e10cSrcweir 
149cdf0e10cSrcweir // --------------
150cdf0e10cSrcweir // - FixedImage -
151cdf0e10cSrcweir // --------------
152cdf0e10cSrcweir 
153cdf0e10cSrcweir class VCL_DLLPUBLIC FixedImage : public Control
154cdf0e10cSrcweir {
155cdf0e10cSrcweir private:
156cdf0e10cSrcweir     Image           maImage;
157cdf0e10cSrcweir     Image           maImageHC;
158cdf0e10cSrcweir     sal_Bool            mbInUserDraw;
159cdf0e10cSrcweir 
160cdf0e10cSrcweir private:
161cdf0e10cSrcweir     using Control::ImplInitSettings;
162cdf0e10cSrcweir     using Window::ImplInit;
163cdf0e10cSrcweir     SAL_DLLPRIVATE void    ImplInit( Window* pParent, WinBits nStyle );
164cdf0e10cSrcweir     SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
165cdf0e10cSrcweir     SAL_DLLPRIVATE void    ImplInitSettings();
166cdf0e10cSrcweir 
167cdf0e10cSrcweir protected:
168cdf0e10cSrcweir     SAL_DLLPRIVATE void    ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
169cdf0e10cSrcweir                               const Point& rPos, const Size& rSize );
170cdf0e10cSrcweir     SAL_DLLPRIVATE void    ImplLoadRes( const ResId& rResId );
171cdf0e10cSrcweir 
172cdf0e10cSrcweir public:
173*e1beba7dSHerbert Dürr     explicit        FixedImage( Window* pParent, WinBits nStyle = 0 );
174*e1beba7dSHerbert Dürr     explicit        FixedImage( Window* pParent, const ResId& );
175*e1beba7dSHerbert Dürr     virtual         ~FixedImage();
176cdf0e10cSrcweir 
177cdf0e10cSrcweir     virtual void    Paint( const Rectangle& rRect );
178cdf0e10cSrcweir     virtual void    Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
179cdf0e10cSrcweir     virtual void    Resize();
180cdf0e10cSrcweir     virtual void    StateChanged( StateChangedType nType );
181cdf0e10cSrcweir     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
182cdf0e10cSrcweir     virtual void    UserDraw( const UserDrawEvent& rUDEvt );
183cdf0e10cSrcweir     virtual Size    GetOptimalSize(WindowSizeType eType) const;
184cdf0e10cSrcweir 
185cdf0e10cSrcweir     void            SetImage( const Image& rImage );
GetImage() const186cdf0e10cSrcweir     const Image&    GetImage() const { return maImage; }
187cdf0e10cSrcweir 
188cdf0e10cSrcweir     sal_Bool            SetModeImage( const Image& rImage, BmpColorMode eMode = BMP_COLOR_NORMAL );
189cdf0e10cSrcweir     const Image&    GetModeImage( BmpColorMode eMode = BMP_COLOR_NORMAL ) const;
190cdf0e10cSrcweir 
191cdf0e10cSrcweir     Point           CalcImagePos( const Point& rPos,
192cdf0e10cSrcweir                                   const Size& rObjSize, const Size& rWinSize );
193cdf0e10cSrcweir };
194cdf0e10cSrcweir 
195cdf0e10cSrcweir #endif  // _SV_FIXED_HXX
196*e1beba7dSHerbert Dürr 
197