Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_DECK_HXX
20 : #define INCLUDED_SFX2_SOURCE_SIDEBAR_DECK_HXX
21 :
22 : #include "Panel.hxx"
23 :
24 : #include <vcl/window.hxx>
25 : #include <vcl/image.hxx>
26 : #include <com/sun/star/ui/LayoutSize.hpp>
27 :
28 : class ScrollBar;
29 :
30 : namespace sfx2 { namespace sidebar {
31 :
32 : class DeckDescriptor;
33 : class DeckTitleBar;
34 :
35 : /** This is the parent window of the panels.
36 : It displays the deck title.
37 : */
38 : class Deck : public vcl::Window
39 : {
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;
46 :
47 3768 : const OUString& GetId() const
48 : {
49 3768 : return msId;
50 : }
51 : DeckTitleBar* GetTitleBar() const;
52 : Rectangle GetContentArea() const;
53 : void ResetPanels (const SharedPanelContainer& rPanels);
54 7533 : const SharedPanelContainer& GetPanels() const
55 : {
56 7533 : return maPanels;
57 : }
58 : void RequestLayout();
59 : vcl::Window* GetPanelParentWindow();
60 :
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.
64 : */
65 : void ShowPanel (const Panel& rPanel);
66 :
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;
71 :
72 : static void PrintWindowSubTree (vcl::Window* pRoot, int nIndentation);
73 :
74 16382 : sal_Int32 GetMinimalWidth() const { return mnMinimalWidth; }
75 :
76 6312 : class ScrollContainerWindow : public vcl::Window
77 : {
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;
84 : };
85 :
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;
96 :
97 : DECL_LINK(HandleVerticalScrollBarChange,void*);
98 : bool ProcessWheelEvent(CommandEvent* pCommandEvent);
99 : };
100 :
101 : } } // end of namespace sfx2::sidebar
102 :
103 : #endif
104 :
105 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|