1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_FIXED_HXX
21 #define INCLUDED_VCL_FIXED_HXX
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>
36 class VCL_DLLPUBLIC FixedText
: public Control
39 sal_Int32 m_nMaxWidthChars
;
40 sal_Int32 m_nMinWidthChars
;
41 Window
*m_pMnemonicWindow
;
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;
51 SAL_DLLPRIVATE
static sal_uInt16
ImplGetTextStyle( WinBits nWinBits
);
53 virtual void FillLayoutData() const SAL_OVERRIDE
;
55 GetCanonicalFont( const StyleSettings
& _rStyle
) const SAL_OVERRIDE
;
57 GetCanonicalTextColor( const StyleSettings
& _rStyle
) const SAL_OVERRIDE
;
59 virtual Window
* getAccessibleRelationLabelFor() const SAL_OVERRIDE
;
62 explicit FixedText( Window
* pParent
, WinBits nStyle
= 0 );
63 explicit FixedText( Window
* pParent
, const ResId
& rResId
);
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
;
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 Window
* get_mnemonic_widget() const { return m_pMnemonicWindow
; }
85 class VCL_DLLPUBLIC SelectableFixedText
: public Edit
88 explicit SelectableFixedText( Window
* pParent
, WinBits nStyle
= 0 );
90 virtual void LoseFocus() SAL_OVERRIDE
;
97 class VCL_DLLPUBLIC FixedLine
: public Control
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 );
108 virtual void FillLayoutData() const SAL_OVERRIDE
;
110 GetCanonicalFont( const StyleSettings
& _rStyle
) const SAL_OVERRIDE
;
112 GetCanonicalTextColor( const StyleSettings
& _rStyle
) const SAL_OVERRIDE
;
115 explicit FixedLine( Window
* pParent
, WinBits nStyle
= WB_HORZ
);
116 explicit FixedLine( Window
* pParent
, const ResId
& );
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
;
124 virtual Size
GetOptimalSize() const SAL_OVERRIDE
;
131 class VCL_DLLPUBLIC FixedBitmap
: public Control
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
);
145 SAL_DLLPRIVATE
void ImplLoadRes( const ResId
& rResId
);
148 explicit FixedBitmap( Window
* pParent
, WinBits nStyle
= 0 );
149 explicit FixedBitmap( Window
* pParent
, const ResId
& );
150 virtual ~FixedBitmap();
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
;
158 void SetBitmap( const Bitmap
& rBitmap
);
159 using OutputDevice::GetBitmap
;
160 const Bitmap
& GetBitmap() const { return maBitmap
; }
167 class VCL_DLLPUBLIC FixedImage
: public Control
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();
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
);
186 explicit FixedImage( Window
* pParent
, WinBits nStyle
= 0 );
187 explicit FixedImage( Window
* pParent
, const ResId
& );
188 virtual ~FixedImage();
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
;
198 void SetImage( const Image
& rImage
);
199 const Image
& GetImage() const { return maImage
; }
201 bool SetModeImage( const Image
& rImage
);
202 const Image
& GetModeImage( ) const;
203 virtual bool set_property(const OString
&rKey
, const OString
&rValue
) SAL_OVERRIDE
;
205 static Image
loadThemeImage(const OString
&rFileName
);
208 #endif // INCLUDED_VCL_FIXED_HXX
210 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */