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 : #ifndef INCLUDED_SFX2_INFOBAR_HXX
10 : #define INCLUDED_SFX2_INFOBAR_HXX
11 :
12 : #include <vector>
13 :
14 : #include <vcl/button.hxx>
15 : #include <vcl/fixed.hxx>
16 :
17 : #include <sfx2/dllapi.h>
18 : #include <sfx2/childwin.hxx>
19 :
20 : #include <boost/ptr_container/ptr_vector.hpp>
21 :
22 : /** SfxChildWindow for positioning the InfoBar in the view.
23 : */
24 : class SFX2_DLLPUBLIC SfxInfoBarContainerChild : public SfxChildWindow
25 : {
26 : private:
27 : SfxBindings* m_pBindings;
28 :
29 : public:
30 : SfxInfoBarContainerChild( vcl::Window* pParent,
31 : sal_uInt16 nId,
32 : SfxBindings* pBindings,
33 : SfxChildWinInfo* pInfo );
34 : virtual ~SfxInfoBarContainerChild();
35 :
36 : SFX_DECL_CHILDWINDOW_WITHID( SfxInfoBarContainerChild );
37 :
38 : void Update( );
39 : };
40 :
41 : /** Class representing a single InfoBar to be added in a SfxInfoBarContainerWindow.
42 : */
43 : class SfxInfoBarWindow : public vcl::Window
44 : {
45 : private:
46 : OUString m_sId;
47 : VclPtr<FixedText> m_pMessage;
48 : VclPtr<Button> m_pCloseBtn;
49 : std::vector< VclPtr<PushButton> > m_aActionBtns;
50 :
51 : public:
52 : SfxInfoBarWindow( vcl::Window* parent, const OUString& sId,
53 : const OUString& sMessage );
54 : virtual ~SfxInfoBarWindow( );
55 : virtual void dispose() SAL_OVERRIDE;
56 :
57 0 : const OUString& getId() const { return m_sId; }
58 : virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& ) SAL_OVERRIDE;
59 : virtual void Resize( ) SAL_OVERRIDE;
60 :
61 : /** Add button to Infobar.
62 : * Infobar takes ownership of the button so the button is
63 : * destroyed when the infobar gets destroyed.
64 : */
65 : void addButton(PushButton* pButton);
66 :
67 : private:
68 : DECL_LINK( CloseHandler, void* );
69 : };
70 :
71 : class SfxInfoBarContainerWindow : public vcl::Window
72 : {
73 : private:
74 : SfxInfoBarContainerChild* m_pChildWin;
75 : std::vector< VclPtr<SfxInfoBarWindow> > m_pInfoBars;
76 :
77 : public:
78 : SfxInfoBarContainerWindow(SfxInfoBarContainerChild* pChildWin);
79 : virtual ~SfxInfoBarContainerWindow( );
80 : virtual void dispose() SAL_OVERRIDE;
81 :
82 : SfxInfoBarWindow* appendInfoBar(const OUString& sId, const OUString& sMessage);
83 : SfxInfoBarWindow* getInfoBar(const OUString& sId);
84 : void removeInfoBar(SfxInfoBarWindow* pInfoBar);
85 :
86 : virtual void Resize() SAL_OVERRIDE;
87 : };
88 :
89 :
90 : #endif
91 :
92 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|