Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / include / sfx2 / sidebar / Deck.hxx
blob278bb4f49a01b3bdeb1c559641633bcf42ba40ef
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 <sfx2/sidebar/Panel.hxx>
24 #include <vcl/window.hxx>
26 class ScrollBar;
28 namespace sfx2 { namespace sidebar {
30 class DeckDescriptor;
31 class DeckTitleBar;
32 class DeckNotifyIdle;
34 /** This is the parent window of the panels.
35 It displays the deck title.
37 class Deck final : public vcl::Window
39 public:
40 Deck(const DeckDescriptor& rDeckDescriptor,
41 vcl::Window* pParentWindow,
42 const std::function<void()>& rCloserAction);
43 virtual ~Deck() override;
44 virtual void dispose() override;
46 const OUString& GetId() const { return msId; }
48 VclPtr<DeckTitleBar> const & GetTitleBar() const;
49 tools::Rectangle GetContentArea() const;
50 void ResetPanels (const SharedPanelContainer& rPanels);
51 const SharedPanelContainer& GetPanels() const { return maPanels; }
53 Panel* GetPanel(OUString const & panelId);
55 void RequestLayout();
56 vcl::Window* GetPanelParentWindow();
58 /** Try to make the panel completely visible.
59 When the whole panel does not fit then make its top visible
60 and it off at the bottom.
62 void ShowPanel (const Panel& rPanel);
64 virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
65 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rUpdateArea) override;
66 virtual void DataChanged (const DataChangedEvent& rEvent) override;
67 virtual bool EventNotify(NotifyEvent& rEvent) override;
68 virtual void Resize() override;
70 static void PrintWindowSubTree (vcl::Window* pRoot, int nIndentation);
72 sal_Int32 GetMinimalWidth() const { return mnMinimalWidth; }
74 class ScrollContainerWindow final : public vcl::Window
76 public:
77 ScrollContainerWindow(vcl::Window* pParentWindow);
78 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rUpdateArea) override;
79 void SetSeparators(const ::std::vector<sal_Int32>& rSeparators);
80 private:
81 std::vector<sal_Int32> maSeparators;
84 private:
85 void RequestLayoutInternal();
87 private:
88 const OUString msId;
89 sal_Int32 mnMinimalWidth;
90 sal_Int32 mnMinimalHeight;
91 SharedPanelContainer maPanels;
92 std::unique_ptr<DeckNotifyIdle> mpIdleNotify;
93 VclPtr<DeckTitleBar> mpTitleBar;
94 VclPtr<vcl::Window> mpScrollClipWindow;
95 VclPtr<ScrollContainerWindow> mpScrollContainer;
96 VclPtr<vcl::Window> mpFiller;
97 VclPtr<ScrollBar> mpVerticalScrollBar;
99 DECL_LINK(HandleVerticalScrollBarChange, ScrollBar*, void);
100 bool ProcessWheelEvent(CommandEvent const * pCommandEvent);
104 } } // end of namespace sfx2::sidebar
106 #endif
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */