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 : VclPtr<vcl::Window> m_pMnemonicWindow;
42 :
43 : using Control::ImplInitSettings;
44 : using Window::ImplInit;
45 : SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
46 : SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
47 : SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
48 : const Point& rPos, const Size& rSize, bool bFillLayout = false ) const;
49 : public:
50 : SAL_DLLPRIVATE static DrawTextFlags ImplGetTextStyle( WinBits nWinBits );
51 : protected:
52 : virtual void FillLayoutData() const SAL_OVERRIDE;
53 : virtual const vcl::Font&
54 : GetCanonicalFont( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
55 : virtual const Color&
56 : GetCanonicalTextColor( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
57 :
58 : virtual vcl::Window* getAccessibleRelationLabelFor() const SAL_OVERRIDE;
59 :
60 : public:
61 : explicit FixedText( vcl::Window* pParent, WinBits nStyle = 0 );
62 : explicit FixedText( vcl::Window* pParent, const ResId& rResId );
63 : virtual ~FixedText();
64 : virtual void dispose() SAL_OVERRIDE;
65 :
66 : virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
67 :
68 : virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
69 : virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags ) SAL_OVERRIDE;
70 : virtual void Resize() SAL_OVERRIDE;
71 : virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
72 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
73 :
74 : void setMaxWidthChars(sal_Int32 nWidth);
75 : sal_Int32 getMaxWidthChars() const { return m_nMaxWidthChars; }
76 : void setMinWidthChars(sal_Int32 nWidth);
77 : sal_Int32 getMinWidthChars() const { return m_nMinWidthChars; }
78 : static Size CalcMinimumTextSize(Control const* pControl, long nMaxWidth = 0x7fffffff);
79 : static Size getTextDimensions(Control const *pControl, const OUString &rTxt, long nMaxWidth);
80 : Size CalcMinimumSize(long nMaxWidth = 0x7fffffff) const;
81 : virtual Size GetOptimalSize() const SAL_OVERRIDE;
82 : virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
83 : void set_mnemonic_widget(vcl::Window *pWindow);
84 10 : vcl::Window* get_mnemonic_widget() const { return m_pMnemonicWindow; }
85 : };
86 :
87 0 : class VCL_DLLPUBLIC SelectableFixedText : public Edit
88 : {
89 : public:
90 : explicit SelectableFixedText( vcl::Window* pParent, WinBits nStyle = 0 );
91 :
92 : virtual void LoseFocus() SAL_OVERRIDE;
93 : virtual void ApplySettings(vcl::RenderContext&) SAL_OVERRIDE;
94 : };
95 :
96 :
97 : // - FixedLine -
98 :
99 :
100 301 : class VCL_DLLPUBLIC FixedLine : public Control
101 : {
102 : private:
103 : using Control::ImplInitSettings;
104 : using Window::ImplInit;
105 : SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
106 : SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
107 : SAL_DLLPRIVATE void ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout = false);
108 :
109 : protected:
110 : virtual void FillLayoutData() const SAL_OVERRIDE;
111 : virtual const vcl::Font&
112 : GetCanonicalFont( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
113 : virtual const Color&
114 : GetCanonicalTextColor( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
115 :
116 : public:
117 : explicit FixedLine( vcl::Window* pParent, WinBits nStyle = WB_HORZ );
118 : explicit FixedLine( vcl::Window* pParent, const ResId& );
119 :
120 : virtual void ApplySettings(vcl::RenderContext&) SAL_OVERRIDE;
121 :
122 : virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
123 : virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags ) SAL_OVERRIDE;
124 : virtual void Resize() SAL_OVERRIDE;
125 : virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
126 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
127 :
128 : virtual Size GetOptimalSize() const SAL_OVERRIDE;
129 : };
130 :
131 : // - FixedBitmap -
132 0 : class VCL_DLLPUBLIC FixedBitmap : public Control
133 : {
134 : private:
135 : Bitmap maBitmap;
136 :
137 : using Control::ImplInitSettings;
138 : using Window::ImplInit;
139 : SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
140 : SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
141 : SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
142 : const Point& rPos, const Size& rSize );
143 :
144 : public:
145 : explicit FixedBitmap( vcl::Window* pParent, WinBits nStyle = 0 );
146 :
147 : virtual void ApplySettings(vcl::RenderContext&) SAL_OVERRIDE;
148 :
149 : virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
150 : virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags ) SAL_OVERRIDE;
151 : virtual void Resize() SAL_OVERRIDE;
152 : virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
153 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
154 :
155 : void SetBitmap( const Bitmap& rBitmap );
156 : using OutputDevice::GetBitmap;
157 : const Bitmap& GetBitmap() const { return maBitmap; }
158 : };
159 :
160 :
161 : // - FixedImage -
162 :
163 :
164 9721 : class VCL_DLLPUBLIC FixedImage : public Control
165 : {
166 : private:
167 : Image maImage;
168 : bool mbInUserDraw;
169 :
170 : private:
171 : using Control::ImplInitSettings;
172 : using Window::ImplInit;
173 : SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
174 : SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
175 :
176 : protected:
177 : SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
178 : const Point& rPos, const Size& rSize );
179 : SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
180 :
181 : public:
182 : explicit FixedImage( vcl::Window* pParent, WinBits nStyle = 0 );
183 : explicit FixedImage( vcl::Window* pParent, const ResId& );
184 :
185 : virtual void ApplySettings(vcl::RenderContext&) SAL_OVERRIDE;
186 :
187 : virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
188 : virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags ) SAL_OVERRIDE;
189 : virtual void Resize() SAL_OVERRIDE;
190 : virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
191 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
192 : virtual Size GetOptimalSize() const SAL_OVERRIDE;
193 :
194 : void SetImage( const Image& rImage );
195 10 : const Image& GetImage() const { return maImage; }
196 :
197 : bool SetModeImage( const Image& rImage );
198 307 : const Image& GetModeImage( ) const { return maImage;}
199 : virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
200 :
201 : static Image loadThemeImage(const OString &rFileName);
202 : };
203 :
204 : #endif // INCLUDED_VCL_FIXED_HXX
205 :
206 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|