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_SVTOOLS_SOURCE_TOOLPANEL_TOOLPANELDRAWER_HXX
21 : #define INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TOOLPANELDRAWER_HXX
22 :
23 : #include <vcl/window.hxx>
24 : #include <vcl/virdev.hxx>
25 : #include <vcl/vclptr.hxx>
26 :
27 : namespace svt
28 : {
29 : class ToolPanelDrawer;
30 :
31 : /** serves a single purpose - let ZoomText read the drawers ...
32 :
33 : Strange enough, ZoomText does not read the drawers when they get the focus (in none of the combinations
34 : of AccessibleRoles I tried), except when it does have an AccessibleChild with the role LABEL. To "inject"
35 : such a child into the A11Y hierarchy, we use this window here.
36 :
37 : (We could also inject the A11Y component on the A11Y level only, but this would mean additional code. With
38 : this approach here, VCL/toolkit will take care of creating and maintaining the A11Y component for us.)
39 : */
40 0 : class DrawerVisualization : public vcl::Window
41 : {
42 : public:
43 : explicit DrawerVisualization(ToolPanelDrawer& i_rParent);
44 :
45 : protected:
46 : // Window overridables
47 : virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& i_rBoundingBox) SAL_OVERRIDE;
48 :
49 : private:
50 : ToolPanelDrawer& m_rDrawer;
51 : };
52 :
53 : class ToolPanelDrawer : public vcl::Window
54 : {
55 : public:
56 : ToolPanelDrawer(vcl::Window& i_rParent, const OUString& i_rTitle);
57 : virtual ~ToolPanelDrawer();
58 : virtual void dispose() SAL_OVERRIDE;
59 :
60 : long GetPreferredHeightPixel() const;
61 : void SetExpanded(const bool i_bExpanded);
62 0 : bool IsExpanded() const
63 : {
64 0 : return m_bExpanded;
65 : }
66 :
67 : void Paint(vcl::RenderContext& rRenderContext);
68 :
69 : protected:
70 : // Window overridables
71 : virtual void GetFocus() SAL_OVERRIDE;
72 : virtual void LoseFocus() SAL_OVERRIDE;
73 : virtual void Resize() SAL_OVERRIDE;
74 : virtual void DataChanged( const DataChangedEvent& i_rEvent ) SAL_OVERRIDE;
75 : virtual void MouseButtonDown( const MouseEvent& i_rMouseEvent ) SAL_OVERRIDE;
76 :
77 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
78 : GetComponentInterface( bool i_bCreate ) SAL_OVERRIDE;
79 :
80 : virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
81 :
82 : private:
83 : Rectangle impl_calcTextBoundingBox() const;
84 : Rectangle impl_calcTitleBarBox( const Rectangle& i_rTextBox ) const;
85 : void impl_paintBackground( const Rectangle& i_rTitleBarBox );
86 : DrawTextFlags impl_getTextStyle() const;
87 : void impl_paintFocusIndicator( const Rectangle& i_rTextBox );
88 : Rectangle impl_paintExpansionIndicator( const Rectangle& i_rTextBox );
89 : Image impl_getExpansionIndicator() const;
90 :
91 : // don't expose SetText. Our text is used as AccessibleName/Desc, and those are not expected to change.
92 : using Window::SetText;
93 : using Window::Paint;
94 :
95 : private:
96 : ScopedVclPtr<VirtualDevice> m_pPaintDevice;
97 : VclPtr<DrawerVisualization> m_aVisualization;
98 : bool m_bFocused : 1;
99 : bool m_bExpanded : 1;
100 : };
101 : } // namespace svt
102 :
103 : #endif // INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TOOLPANELDRAWER_HXX
104 :
105 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|