Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / vcl / fixed.hxx
blobdf7deaf9408cafb705043c79d8764cb5e12a099f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
30 class UserDrawEvent;
33 class VCL_DLLPUBLIC FixedText : public Control
35 private:
36 sal_Int32 m_nMaxWidthChars;
37 sal_Int32 m_nMinWidthChars;
38 VclPtr<vcl::Window> m_pMnemonicWindow;
40 using Control::ImplInitSettings;
41 using Window::ImplInit;
42 SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
43 SAL_DLLPRIVATE static WinBits ImplInitStyle( WinBits nStyle );
44 SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
45 const Point& rPos, const Size& rSize, bool bFillLayout = false ) const;
46 public:
47 SAL_DLLPRIVATE static DrawTextFlags ImplGetTextStyle( WinBits nWinBits );
48 protected:
49 virtual void FillLayoutData() const override;
50 virtual const vcl::Font&
51 GetCanonicalFont( const StyleSettings& _rStyle ) const override;
52 virtual const Color&
53 GetCanonicalTextColor( const StyleSettings& _rStyle ) const override;
55 virtual vcl::Window* getAccessibleRelationLabelFor() const override;
57 public:
58 explicit FixedText( vcl::Window* pParent, WinBits nStyle = 0 );
59 virtual ~FixedText() override;
60 virtual void dispose() override;
62 virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
64 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
65 virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags ) override;
66 virtual void Resize() override;
67 virtual void StateChanged( StateChangedType nType ) override;
68 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
70 void setMaxWidthChars(sal_Int32 nWidth);
71 void setMinWidthChars(sal_Int32 nWidth);
72 static Size CalcMinimumTextSize(Control const* pControl, long nMaxWidth = 0x7fffffff);
73 static Size getTextDimensions(Control const *pControl, const OUString &rTxt, long nMaxWidth);
74 Size CalcMinimumSize(long nMaxWidth = 0x7fffffff) const;
75 virtual Size GetOptimalSize() const override;
76 virtual bool set_property(const OString &rKey, const OUString &rValue) override;
77 void set_mnemonic_widget(vcl::Window *pWindow);
78 vcl::Window* get_mnemonic_widget() const { return m_pMnemonicWindow; }
81 class VCL_DLLPUBLIC SelectableFixedText : public Edit
83 public:
84 explicit SelectableFixedText( vcl::Window* pParent, WinBits nStyle );
86 virtual void LoseFocus() override;
87 virtual void ApplySettings(vcl::RenderContext&) override;
91 class VCL_DLLPUBLIC FixedLine : public Control
93 private:
94 using Control::ImplInitSettings;
95 using Window::ImplInit;
96 SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
97 SAL_DLLPRIVATE static WinBits ImplInitStyle( WinBits nStyle );
98 SAL_DLLPRIVATE void ImplDraw(vcl::RenderContext& rRenderContext);
100 protected:
101 virtual void FillLayoutData() const override;
102 virtual const vcl::Font&
103 GetCanonicalFont( const StyleSettings& _rStyle ) const override;
104 virtual const Color&
105 GetCanonicalTextColor( const StyleSettings& _rStyle ) const override;
107 public:
108 explicit FixedLine( vcl::Window* pParent, WinBits nStyle = WB_HORZ );
110 virtual void ApplySettings(vcl::RenderContext&) override;
112 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
113 virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags ) override;
114 virtual void Resize() override;
115 virtual void StateChanged( StateChangedType nType ) override;
116 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
118 virtual Size GetOptimalSize() const override;
121 class VCL_DLLPUBLIC FixedBitmap : public Control
123 private:
124 Bitmap maBitmap;
126 using Control::ImplInitSettings;
127 using Window::ImplInit;
128 SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
129 SAL_DLLPRIVATE static WinBits ImplInitStyle( WinBits nStyle );
130 SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, const Point& rPos, const Size& rSize );
132 public:
133 explicit FixedBitmap( vcl::Window* pParent, WinBits nStyle = 0 );
135 virtual void ApplySettings(vcl::RenderContext&) override;
137 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
138 virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags ) override;
139 virtual void Resize() override;
140 virtual void StateChanged( StateChangedType nType ) override;
141 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
143 void SetBitmap( const Bitmap& rBitmap );
144 using OutputDevice::GetBitmap;
148 class VCL_DLLPUBLIC FixedImage : public Control
150 private:
151 Image maImage;
153 private:
154 using Control::ImplInitSettings;
155 using Window::ImplInit;
156 SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
157 SAL_DLLPRIVATE static WinBits ImplInitStyle( WinBits nStyle );
159 protected:
160 SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
161 const Point& rPos, const Size& rSize );
162 public:
163 explicit FixedImage( vcl::Window* pParent, WinBits nStyle = 0 );
165 virtual void ApplySettings(vcl::RenderContext&) override;
167 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
168 virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags ) override;
169 virtual void Resize() override;
170 virtual void StateChanged( StateChangedType nType ) override;
171 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
172 virtual Size GetOptimalSize() const override;
174 void SetImage( const Image& rImage );
175 const Image& GetImage() const { return maImage; }
177 bool SetModeImage( const Image& rImage );
178 const Image& GetModeImage( ) const { return maImage;}
179 virtual bool set_property(const OString &rKey, const OUString &rValue) override;
181 static Image loadThemeImage(const OUString &rFileName);
184 #endif // INCLUDED_VCL_FIXED_HXX
186 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */