Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / include / sfx2 / titledockwin.hxx
blob4b21a8e9b6eb27394af48cc200575b3c72827792
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_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>
30 namespace sfx2
32 class SFX2_DLLPUBLIC TitledDockingWindow : public SfxDockingWindow
34 public:
35 TitledDockingWindow(
36 SfxBindings* i_pBindings, SfxChildWindow* i_pChildWindow,
37 vcl::Window* i_pParent, WinBits i_nStyle = 0
40 virtual ~TitledDockingWindow();
41 virtual void dispose() override;
43 /** sets a title to be displayed in the docking window
45 void SetTitle( const OUString& i_rTitle );
47 /** returns the content window, which is to be used as parent window for any content to be displayed
48 in the docking window.
50 vcl::Window& GetContentWindow() { return *m_aContentWindow.get(); }
51 const vcl::Window& GetContentWindow() const { return *m_aContentWindow.get(); }
53 /** Return the border that is painted around the inner window as
54 decoration.
56 const SvBorder& GetDecorationBorder() const { return m_aBorder; }
58 protected:
59 // Window overridables
60 virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& i_rArea) override;
61 virtual void Resize() override;
62 virtual void StateChanged( StateChangedType i_nType ) override;
63 virtual void DataChanged( const DataChangedEvent& i_rDataChangedEvent ) override;
64 virtual void SetText( const OUString& i_rText ) override;
66 // DockingWindow overridables
67 void EndDocking(const Rectangle& rRect, bool bFloatMode) override;
69 virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
70 protected:
71 /** internal version of ResetToolBox
73 void impl_resetToolBox();
75 /** returns the current title.
77 If no title has been set via SetTitle, then the window text (Window::GetText) is returned.
79 OUString impl_getTitle() const;
81 private:
82 DECL_LINK_TYPED( OnToolboxItemSelected, ToolBox*, void );
84 void impl_construct();
85 void impl_layout();
86 void impl_scheduleLayout();
88 private:
89 OUString m_sTitle;
90 VclPtr<ToolBox> m_aToolbox;
91 VclPtr<Window> m_aContentWindow;
93 Link<TitledDockingWindow*,void> m_aEndDockingHdl;
95 /** The border that is painted around the inner window. The bevel
96 shadow lines are part of the border, so where the border is 0 no
97 such line is painted.
99 SvBorder m_aBorder;
101 /** Remember that a layout is pending, i.e. Resize() has been called
102 since the last Paint().
104 bool m_bLayoutPending;
106 /** Height of the title bar. Calculated in impl_layout().
108 int m_nTitleBarHeight;
113 } // namespace sfx2
116 #endif // INCLUDED_SFX2_TITLEDOCKWIN_HXX
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */