Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_VCL_FIXED_HXX
21 : #define INCLUDED_VCL_FIXED_HXX
22 :
23 : #include <tools/solar.h>
24 : #include <vcl/dllapi.h>
25 : #include <vcl/bitmap.hxx>
26 : #include <vcl/ctrl.hxx>
27 : #include <vcl/edit.hxx>
28 : #include <vcl/image.hxx>
29 :
30 : class UserDrawEvent;
31 :
32 :
33 : // - FixedText -
34 :
35 :
36 : class VCL_DLLPUBLIC FixedText : public Control
37 : {
38 : private:
39 : sal_Int32 m_nMaxWidthChars;
40 : sal_Int32 m_nMinWidthChars;
41 : Window *m_pMnemonicWindow;
42 :
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( bool bFont, bool bForeground, 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 : protected:
53 : virtual void FillLayoutData() const SAL_OVERRIDE;
54 : virtual const Font&
55 : GetCanonicalFont( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
56 : virtual const Color&
57 : GetCanonicalTextColor( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
58 :
59 : virtual Window* getAccessibleRelationLabelFor() const SAL_OVERRIDE;
60 :
61 : public:
62 : explicit FixedText( Window* pParent, WinBits nStyle = 0 );
63 : explicit FixedText( Window* pParent, const ResId& rResId );
64 : virtual ~FixedText();
65 :
66 : virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
67 : virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
68 : virtual void Resize() SAL_OVERRIDE;
69 : virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
70 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
71 :
72 : void setMaxWidthChars(sal_Int32 nWidth);
73 : sal_Int32 getMaxWidthChars() const { return m_nMaxWidthChars; }
74 : void setMinWidthChars(sal_Int32 nWidth);
75 : sal_Int32 getMinWidthChars() const { return m_nMinWidthChars; }
76 : static Size CalcMinimumTextSize(Control const* pControl, long nMaxWidth = 0x7fffffff);
77 : static Size getTextDimensions(Control const *pControl, const OUString &rTxt, long nMaxWidth);
78 : Size CalcMinimumSize(long nMaxWidth = 0x7fffffff) const;
79 : virtual Size GetOptimalSize() const SAL_OVERRIDE;
80 : virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
81 : void set_mnemonic_widget(Window *pWindow);
82 0 : Window* get_mnemonic_widget() const { return m_pMnemonicWindow; }
83 : };
84 :
85 0 : class VCL_DLLPUBLIC SelectableFixedText : public Edit
86 : {
87 : public:
88 : explicit SelectableFixedText( Window* pParent, WinBits nStyle = 0 );
89 :
90 : virtual void LoseFocus() SAL_OVERRIDE;
91 : };
92 :
93 :
94 : // - FixedLine -
95 :
96 :
97 0 : class VCL_DLLPUBLIC FixedLine : public Control
98 : {
99 : private:
100 : using Control::ImplInitSettings;
101 : using Window::ImplInit;
102 : SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
103 : SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
104 : SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
105 : SAL_DLLPRIVATE void ImplDraw( bool bLayout = false );
106 :
107 : protected:
108 : virtual void FillLayoutData() const SAL_OVERRIDE;
109 : virtual const Font&
110 : GetCanonicalFont( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
111 : virtual const Color&
112 : GetCanonicalTextColor( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
113 :
114 : public:
115 : explicit FixedLine( Window* pParent, WinBits nStyle = WB_HORZ );
116 : explicit FixedLine( Window* pParent, const ResId& );
117 :
118 : virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
119 : virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
120 : virtual void Resize() SAL_OVERRIDE;
121 : virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
122 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
123 :
124 : virtual Size GetOptimalSize() const SAL_OVERRIDE;
125 : };
126 :
127 :
128 : // - FixedBitmap -
129 :
130 :
131 : class VCL_DLLPUBLIC FixedBitmap : public Control
132 : {
133 : private:
134 : Bitmap maBitmap;
135 :
136 : using Control::ImplInitSettings;
137 : using Window::ImplInit;
138 : SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
139 : SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
140 : SAL_DLLPRIVATE void ImplInitSettings();
141 : SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
142 : const Point& rPos, const Size& rSize );
143 :
144 : protected:
145 : SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
146 :
147 : public:
148 : explicit FixedBitmap( Window* pParent, WinBits nStyle = 0 );
149 : explicit FixedBitmap( Window* pParent, const ResId& );
150 : virtual ~FixedBitmap();
151 :
152 : virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
153 : virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
154 : virtual void Resize() SAL_OVERRIDE;
155 : virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
156 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
157 :
158 : void SetBitmap( const Bitmap& rBitmap );
159 : using OutputDevice::GetBitmap;
160 0 : const Bitmap& GetBitmap() const { return maBitmap; }
161 : };
162 :
163 :
164 : // - FixedImage -
165 :
166 :
167 : class VCL_DLLPUBLIC FixedImage : public Control
168 : {
169 : private:
170 : Image maImage;
171 : bool mbInUserDraw;
172 :
173 : private:
174 : using Control::ImplInitSettings;
175 : using Window::ImplInit;
176 : SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
177 : SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
178 : SAL_DLLPRIVATE void ImplInitSettings();
179 :
180 : protected:
181 : SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
182 : const Point& rPos, const Size& rSize );
183 : SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
184 :
185 : public:
186 : explicit FixedImage( Window* pParent, WinBits nStyle = 0 );
187 : explicit FixedImage( Window* pParent, const ResId& );
188 : virtual ~FixedImage();
189 :
190 : virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
191 : virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
192 : virtual void Resize() SAL_OVERRIDE;
193 : virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
194 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
195 : virtual void UserDraw( const UserDrawEvent& rUDEvt );
196 : virtual Size GetOptimalSize() const SAL_OVERRIDE;
197 :
198 : void SetImage( const Image& rImage );
199 0 : const Image& GetImage() const { return maImage; }
200 :
201 : bool SetModeImage( const Image& rImage );
202 : const Image& GetModeImage( ) const;
203 : virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
204 :
205 : static Image loadThemeImage(const OString &rFileName);
206 : };
207 :
208 : #endif // INCLUDED_VCL_FIXED_HXX
209 :
210 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|