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 SFX_TITLEDOCKWIN_HXX
21 #define SFX_TITLEDOCKWIN_HXX
23 #include "sfx2/dllapi.h"
24 #include "sfx2/dockwin.hxx"
26 #include <vcl/toolbox.hxx>
27 #include <tools/svborder.hxx>
29 //......................................................................................................................
32 //......................................................................................................................
34 //==================================================================================================================
35 //= TitledDockingWindow
36 //==================================================================================================================
37 class SFX2_DLLPUBLIC TitledDockingWindow
: public SfxDockingWindow
41 SfxBindings
* i_pBindings
, SfxChildWindow
* i_pChildWindow
,
42 Window
* i_pParent
, WinBits i_nStyle
= 0
45 TitledDockingWindow( SfxBindings
* i_pBindings
, SfxChildWindow
* i_pChildWindow
,
46 Window
* i_pParent
, const ResId
& i_rResId
49 virtual ~TitledDockingWindow();
51 /** sets a title to be displayed in the docking window
53 void SetTitle( const String
& i_rTitle
);
55 /** adds a drop down item to the toolbox. Usually, this is used to add some kind of menu to the toolbox.
58 the text to display for the item
60 the help ID for the new toolbox item
62 the callback to invoke when the drop item has been clicked
64 the ID of the newly created toolbox item
66 sal_uInt16
AddDropDownToolBoxItem( const String
& i_rItemText
, const OString
& i_nHelpId
, const Link
& i_rCallback
)
68 return impl_addDropDownToolBoxItem( i_rItemText
, i_nHelpId
, i_rCallback
);
71 void SetEndDockingHdl( const Link
& i_rEndDockingHdl
) { m_aEndDockingHdl
= i_rEndDockingHdl
; }
72 const Link
& GetEndDockingHdl() const { return m_aEndDockingHdl
; }
74 /** resets the toolbox. Upon return, the only item in the toolbox is the closer.
81 /** returns the content window, which is to be used as parent window for any content to be displayed
82 in the docking window.
84 ::Window
& GetContentWindow() { return m_aContentWindow
; }
85 const ::Window
& GetContentWindow() const { return m_aContentWindow
; }
87 ToolBox
& GetToolBox() { return m_aToolbox
; }
88 const ToolBox
& GetToolBox() const { return m_aToolbox
; }
90 /** Return the border that is painted around the inner window as
93 SvBorder
GetDecorationBorder (void) const { return m_aBorder
; }
96 // Window overridables
97 virtual void Paint( const Rectangle
& i_rArea
);
98 virtual void Resize();
99 virtual void StateChanged( StateChangedType i_nType
);
100 virtual void DataChanged( const DataChangedEvent
& i_rDataChangedEvent
);
101 virtual void SetText( const OUString
& i_rText
);
103 // DockingWindow overridables
104 void EndDocking( const Rectangle
& rRect
, sal_Bool bFloatMode
);
107 virtual void onLayoutDone();
110 /** internal version of ResetToolBox
112 void impl_resetToolBox();
114 /** internal version of AddDropDownToolBoxItem
116 sal_uInt16
impl_addDropDownToolBoxItem( const String
& i_rItemText
, const OString
& i_nHelpId
, const Link
& i_rCallback
);
118 /** returns the current title.
120 If no title has been set via SetTitle, then the window text (Window::GetText) is returned.
122 String
impl_getTitle() const;
125 DECL_LINK( OnToolboxItemSelected
, ToolBox
* );
127 void impl_construct();
129 void impl_scheduleLayout();
134 Window m_aContentWindow
;
136 Link m_aEndDockingHdl
;
138 /** The border that is painted arround the inner window. The bevel
139 shadow lines are part of the border, so where the border is 0 no
140 such line is painted.
144 /** Remember that a layout is pending, i.e. Resize() has been called
145 since the last Paint().
147 bool m_bLayoutPending
;
149 /** Height of the title bar. Calculated in impl_layout().
151 int m_nTitleBarHeight
;
155 //......................................................................................................................
157 //......................................................................................................................
159 #endif // SFX_TITLEDOCKWIN_HXX
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */