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_SVTOOLS_SOURCE_TOOLPANEL_TOOLPANELDRAWER_HXX
21 #define INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TOOLPANELDRAWER_HXX
23 #include <vcl/window.hxx>
24 #include <vcl/virdev.hxx>
25 #include <vcl/vclptr.hxx>
29 class ToolPanelDrawer
;
31 /** serves a single purpose - let ZoomText read the drawers ...
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.
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.)
40 class DrawerVisualization
: public vcl::Window
43 DrawerVisualization(ToolPanelDrawer
& i_rParent
);
46 // Window overridables
47 virtual void Paint(vcl::RenderContext
& rRenderContext
, const Rectangle
& i_rBoundingBox
) SAL_OVERRIDE
;
50 ToolPanelDrawer
& m_rDrawer
;
53 class ToolPanelDrawer
: public vcl::Window
56 ToolPanelDrawer(vcl::Window
& i_rParent
, const OUString
& i_rTitle
);
57 virtual ~ToolPanelDrawer();
58 virtual void dispose() SAL_OVERRIDE
;
60 long GetPreferredHeightPixel() const;
61 void SetExpanded(const bool i_bExpanded
);
62 bool IsExpanded() const
67 void Paint(vcl::RenderContext
& rRenderContext
);
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
;
77 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>
78 GetComponentInterface( bool i_bCreate
) SAL_OVERRIDE
;
80 virtual void ApplySettings(vcl::RenderContext
& rRenderContext
) SAL_OVERRIDE
;
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;
91 // don't expose SetText. Our text is used as AccessibleName/Desc, and those are not expected to change.
92 using Window::SetText
;
96 ScopedVclPtr
<VirtualDevice
> m_pPaintDevice
;
97 VclPtr
<DrawerVisualization
> m_aVisualization
;
103 #endif // INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TOOLPANELDRAWER_HXX
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */