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_SFX2_TITLEDOCKWIN_HXX
21 #define INCLUDED_SFX2_TITLEDOCKWIN_HXX
23 #include <sfx2/dllapi.h>
24 #include <sfx2/dockwin.hxx>
26 #include <vcl/toolbox.hxx>
27 #include <vcl/vclptr.hxx>
28 #include <tools/svborder.hxx>
32 class SFX2_DLLPUBLIC TitledDockingWindow
: public SfxDockingWindow
36 SfxBindings
* i_pBindings
, SfxChildWindow
* i_pChildWindow
,
37 vcl::Window
* i_pParent
, WinBits i_nStyle
= 0
40 virtual ~TitledDockingWindow();
41 virtual void dispose() SAL_OVERRIDE
;
43 /** sets a title to be displayed in the docking window
45 void SetTitle( const OUString
& i_rTitle
);
47 /** adds a drop down item to the toolbox. Usually, this is used to add some kind of menu to the toolbox.
50 the text to display for the item
52 the help ID for the new toolbox item
54 the callback to invoke when the drop item has been clicked
56 the ID of the newly created toolbox item
58 sal_uInt16
AddDropDownToolBoxItem( const OUString
& i_rItemText
, const OString
& i_nHelpId
, const Link
<ToolBox
*, void>& i_rCallback
)
60 return impl_addDropDownToolBoxItem( i_rItemText
, i_nHelpId
, i_rCallback
);
63 void SetEndDockingHdl( const Link
<>& i_rEndDockingHdl
) { m_aEndDockingHdl
= i_rEndDockingHdl
; }
64 const Link
<>& GetEndDockingHdl() const { return m_aEndDockingHdl
; }
66 /** resets the toolbox. Upon return, the only item in the toolbox is the closer.
73 /** returns the content window, which is to be used as parent window for any content to be displayed
74 in the docking window.
76 vcl::Window
& GetContentWindow() { return *m_aContentWindow
.get(); }
77 const vcl::Window
& GetContentWindow() const { return *m_aContentWindow
.get(); }
79 ToolBox
& GetToolBox() { return *m_aToolbox
.get(); }
80 const ToolBox
& GetToolBox() const { return *m_aToolbox
.get(); }
82 /** Return the border that is painted around the inner window as
85 SvBorder
GetDecorationBorder() const { return m_aBorder
; }
88 // Window overridables
89 virtual void Paint(vcl::RenderContext
& rRenderContext
, const Rectangle
& i_rArea
) SAL_OVERRIDE
;
90 virtual void Resize() SAL_OVERRIDE
;
91 virtual void StateChanged( StateChangedType i_nType
) SAL_OVERRIDE
;
92 virtual void DataChanged( const DataChangedEvent
& i_rDataChangedEvent
) SAL_OVERRIDE
;
93 virtual void SetText( const OUString
& i_rText
) SAL_OVERRIDE
;
95 // DockingWindow overridables
96 void EndDocking(const Rectangle
& rRect
, bool bFloatMode
) SAL_OVERRIDE
;
99 virtual void onLayoutDone();
101 virtual void ApplySettings(vcl::RenderContext
& rRenderContext
) SAL_OVERRIDE
;
103 /** internal version of ResetToolBox
105 void impl_resetToolBox();
107 /** internal version of AddDropDownToolBoxItem
109 sal_uInt16
impl_addDropDownToolBoxItem( const OUString
& i_rItemText
, const OString
& i_nHelpId
, const Link
<ToolBox
*, void>& i_rCallback
);
111 /** returns the current title.
113 If no title has been set via SetTitle, then the window text (Window::GetText) is returned.
115 OUString
impl_getTitle() const;
118 DECL_LINK_TYPED( OnToolboxItemSelected
, ToolBox
*, void );
120 void impl_construct();
122 void impl_scheduleLayout();
126 VclPtr
<ToolBox
> m_aToolbox
;
127 VclPtr
<Window
> m_aContentWindow
;
129 Link
<> m_aEndDockingHdl
;
131 /** The border that is painted around the inner window. The bevel
132 shadow lines are part of the border, so where the border is 0 no
133 such line is painted.
137 /** Remember that a layout is pending, i.e. Resize() has been called
138 since the last Paint().
140 bool m_bLayoutPending
;
142 /** Height of the title bar. Calculated in impl_layout().
144 int m_nTitleBarHeight
;
152 #endif // INCLUDED_SFX2_TITLEDOCKWIN_HXX
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */