Branch libreoffice-5-0-4
[LibreOffice.git] / sfx2 / source / sidebar / Deck.hxx
blob9efaadc94fed5cc3cb59a0fb82c955c82a243b84
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 .
19 #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_DECK_HXX
20 #define INCLUDED_SFX2_SOURCE_SIDEBAR_DECK_HXX
22 #include "Panel.hxx"
24 #include <vcl/window.hxx>
25 #include <vcl/image.hxx>
26 #include <com/sun/star/ui/LayoutSize.hpp>
28 class ScrollBar;
30 namespace sfx2 { namespace sidebar {
32 class DeckDescriptor;
33 class DeckTitleBar;
35 /** This is the parent window of the panels.
36 It displays the deck title.
38 class Deck : public vcl::Window
40 public:
41 Deck(const DeckDescriptor& rDeckDescriptor,
42 vcl::Window* pParentWindow,
43 const std::function<void()>& rCloserAction);
44 virtual ~Deck();
45 virtual void dispose() SAL_OVERRIDE;
47 const OUString& GetId() const
49 return msId;
51 DeckTitleBar* GetTitleBar() const;
52 Rectangle GetContentArea() const;
53 void ResetPanels (const SharedPanelContainer& rPanels);
54 const SharedPanelContainer& GetPanels() const
56 return maPanels;
58 void RequestLayout();
59 vcl::Window* GetPanelParentWindow();
61 /** Try to make the panel completely visible.
62 When the whole panel does not fit then make its top visible
63 and it off at the bottom.
65 void ShowPanel (const Panel& rPanel);
67 virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
68 virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea) SAL_OVERRIDE;
69 virtual void DataChanged (const DataChangedEvent& rEvent) SAL_OVERRIDE;
70 virtual bool Notify(NotifyEvent& rEvent) SAL_OVERRIDE;
72 static void PrintWindowSubTree (vcl::Window* pRoot, int nIndentation);
74 sal_Int32 GetMinimalWidth() const { return mnMinimalWidth; }
76 class ScrollContainerWindow : public vcl::Window
78 public:
79 ScrollContainerWindow(vcl::Window* pParentWindow);
80 virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea) SAL_OVERRIDE;
81 void SetSeparators(const ::std::vector<sal_Int32>& rSeparators);
82 private:
83 std::vector<sal_Int32> maSeparators;
86 private:
87 const OUString msId;
88 Image maIcon;
89 sal_Int32 mnMinimalWidth;
90 SharedPanelContainer maPanels;
91 VclPtr<DeckTitleBar> mpTitleBar;
92 VclPtr<vcl::Window> mpScrollClipWindow;
93 VclPtr<ScrollContainerWindow> mpScrollContainer;
94 VclPtr<vcl::Window> mpFiller;
95 VclPtr<ScrollBar> mpVerticalScrollBar;
97 DECL_LINK(HandleVerticalScrollBarChange,void*);
98 bool ProcessWheelEvent(CommandEvent* pCommandEvent);
101 } } // end of namespace sfx2::sidebar
103 #endif
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */