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 .
22 #if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
23 #error "don't use this in new code"
26 #include <vcl/dllapi.h>
27 #include <vcl/toolkit/edit.hxx>
28 #include <vcl/ctrl.hxx>
29 #include <vcl/image.hxx>
31 class UNLESS_MERGELIBS(VCL_DLLPUBLIC
) FixedText
: public Control
34 sal_Int32 m_nMaxWidthChars
;
35 sal_Int32 m_nMinWidthChars
;
36 VclPtr
<vcl::Window
> m_pMnemonicWindow
;
38 using Control::ImplInitSettings
;
39 using Window::ImplInit
;
40 SAL_DLLPRIVATE
void ImplInit( vcl::Window
* pParent
, WinBits nStyle
);
41 SAL_DLLPRIVATE
static WinBits
ImplInitStyle( WinBits nStyle
);
42 SAL_DLLPRIVATE
void ImplDraw( OutputDevice
* pDev
, SystemTextColorFlags nSystemTextColorFlags
,
43 const Point
& rPos
, const Size
& rSize
, bool bFillLayout
= false ) const;
45 SAL_DLLPRIVATE
static DrawTextFlags
ImplGetTextStyle( WinBits nWinBits
);
47 virtual void FillLayoutData() const override
;
48 virtual const vcl::Font
&
49 GetCanonicalFont( const StyleSettings
& _rStyle
) const override
;
51 GetCanonicalTextColor( const StyleSettings
& _rStyle
) const override
;
53 virtual vcl::Window
* getAccessibleRelationLabelFor() const override
;
56 explicit FixedText(vcl::Window
* pParent
, WinBits nStyle
= 0, WindowType eType
= WindowType::FIXEDTEXT
);
57 virtual ~FixedText() override
;
58 virtual void dispose() override
;
60 virtual void ApplySettings(vcl::RenderContext
& rRenderContext
) override
;
62 virtual void Paint( vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
63 virtual void Draw( OutputDevice
* pDev
, const Point
& rPos
, SystemTextColorFlags nFlags
) override
;
64 virtual void Resize() override
;
65 virtual void StateChanged( StateChangedType nType
) override
;
66 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
68 void setMaxWidthChars(sal_Int32 nWidth
);
69 void setMinWidthChars(sal_Int32 nWidth
);
70 static Size
CalcMinimumTextSize(Control
const* pControl
, tools::Long nMaxWidth
= 0x7fffffff);
71 static Size
getTextDimensions(Control
const *pControl
, const OUString
&rTxt
, tools::Long nMaxWidth
);
72 Size
CalcMinimumSize(tools::Long nMaxWidth
= 0x7fffffff) const;
73 virtual Size
GetOptimalSize() const override
;
74 virtual bool set_property(const OUString
&rKey
, const OUString
&rValue
) override
;
75 void set_mnemonic_widget(vcl::Window
*pWindow
);
76 vcl::Window
* get_mnemonic_widget() const { return m_pMnemonicWindow
; }
79 class SelectableFixedText final
: public Edit
82 explicit SelectableFixedText( vcl::Window
* pParent
, WinBits nStyle
);
84 virtual void LoseFocus() override
;
85 virtual void ApplySettings(vcl::RenderContext
&) override
;
86 virtual void DumpAsPropertyTree(tools::JsonWriter
& rJsonWriter
) override
;
89 class UNLESS_MERGELIBS(VCL_DLLPUBLIC
) FixedLine final
: public Control
92 using Control::ImplInitSettings
;
93 using Window::ImplInit
;
94 SAL_DLLPRIVATE
void ImplInit( vcl::Window
* pParent
, WinBits nStyle
);
95 SAL_DLLPRIVATE
static WinBits
ImplInitStyle( WinBits nStyle
);
96 SAL_DLLPRIVATE
void ImplDraw(vcl::RenderContext
& rRenderContext
);
98 virtual void FillLayoutData() const override
;
99 virtual const vcl::Font
&
100 GetCanonicalFont( const StyleSettings
& _rStyle
) const override
;
102 GetCanonicalTextColor( const StyleSettings
& _rStyle
) const override
;
105 explicit FixedLine( vcl::Window
* pParent
, WinBits nStyle
= WB_HORZ
);
107 virtual void ApplySettings(vcl::RenderContext
&) override
;
109 virtual void Paint( vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
110 virtual void Draw( OutputDevice
* pDev
, const Point
& rPos
, SystemTextColorFlags nFlags
) override
;
111 virtual void Resize() override
;
112 virtual void StateChanged( StateChangedType nType
) override
;
113 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
115 virtual Size
GetOptimalSize() const override
;
116 virtual void DumpAsPropertyTree(tools::JsonWriter
& rJsonWriter
) override
;
119 class VCL_DLLPUBLIC FixedBitmap final
: public Control
124 using Control::ImplInitSettings
;
125 using Window::ImplInit
;
126 SAL_DLLPRIVATE
void ImplInit( vcl::Window
* pParent
, WinBits nStyle
);
127 SAL_DLLPRIVATE
static WinBits
ImplInitStyle( WinBits nStyle
);
128 SAL_DLLPRIVATE
void ImplDraw( OutputDevice
* pDev
, const Point
& rPos
, const Size
& rSize
);
131 explicit FixedBitmap( vcl::Window
* pParent
, WinBits nStyle
= 0 );
133 SAL_DLLPRIVATE
virtual void ApplySettings(vcl::RenderContext
&) override
;
135 SAL_DLLPRIVATE
virtual void Paint( vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
136 SAL_DLLPRIVATE
virtual void Draw( OutputDevice
* pDev
, const Point
& rPos
, SystemTextColorFlags nFlags
) override
;
137 SAL_DLLPRIVATE
virtual void Resize() override
;
138 SAL_DLLPRIVATE
virtual void StateChanged( StateChangedType nType
) override
;
139 SAL_DLLPRIVATE
virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
141 void SetBitmap( const BitmapEx
& rBitmap
);
144 class VCL_DLLPUBLIC FixedImage
: public Control
150 using Control::ImplInitSettings
;
151 using Window::ImplInit
;
152 SAL_DLLPRIVATE
void ImplInit( vcl::Window
* pParent
, WinBits nStyle
);
153 SAL_DLLPRIVATE
static WinBits
ImplInitStyle( WinBits nStyle
);
156 SAL_DLLPRIVATE
void ImplDraw( OutputDevice
* pDev
,
157 const Point
& rPos
, const Size
& rSize
);
159 explicit FixedImage( vcl::Window
* pParent
, WinBits nStyle
= 0 );
161 SAL_DLLPRIVATE
virtual void ApplySettings(vcl::RenderContext
&) override
;
163 SAL_DLLPRIVATE
virtual void Paint( vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
164 SAL_DLLPRIVATE
virtual void Draw( OutputDevice
* pDev
, const Point
& rPos
, SystemTextColorFlags nFlags
) override
;
165 SAL_DLLPRIVATE
virtual void Resize() override
;
166 SAL_DLLPRIVATE
virtual void StateChanged( StateChangedType nType
) override
;
167 SAL_DLLPRIVATE
virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
168 SAL_DLLPRIVATE
virtual Size
GetOptimalSize() const override
;
170 void SetImage( const Image
& rImage
);
171 const Image
& GetImage() const { return maImage
; }
173 const Image
& GetModeImage( ) const { return maImage
;}
174 SAL_DLLPRIVATE
virtual bool set_property(const OUString
&rKey
, const OUString
&rValue
) override
;
176 SAL_DLLPRIVATE
void DumpAsPropertyTree(tools::JsonWriter
& rJsonWriter
) override
;
179 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */