1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_SFX2_INFOBAR_HXX
10 #define INCLUDED_SFX2_INFOBAR_HXX
14 #include <vcl/button.hxx>
15 #include <vcl/fixed.hxx>
17 #include <sfx2/dllapi.h>
18 #include <sfx2/childwin.hxx>
20 #include <boost/ptr_container/ptr_vector.hpp>
22 /** SfxChildWindow for positioning the InfoBar in the view.
24 class SFX2_DLLPUBLIC SfxInfoBarContainerChild
: public SfxChildWindow
27 SfxBindings
* m_pBindings
;
30 SfxInfoBarContainerChild( vcl::Window
* pParent
,
32 SfxBindings
* pBindings
,
33 SfxChildWinInfo
* pInfo
);
34 virtual ~SfxInfoBarContainerChild();
36 SFX_DECL_CHILDWINDOW_WITHID( SfxInfoBarContainerChild
);
41 /** Class representing a single InfoBar to be added in a SfxInfoBarContainerWindow.
43 class SfxInfoBarWindow
: public vcl::Window
47 VclPtr
<FixedText
> m_pMessage
;
48 VclPtr
<Button
> m_pCloseBtn
;
49 std::vector
< VclPtr
<PushButton
> > m_aActionBtns
;
52 SfxInfoBarWindow( vcl::Window
* parent
, const OUString
& sId
,
53 const OUString
& sMessage
);
54 virtual ~SfxInfoBarWindow( );
55 virtual void dispose() SAL_OVERRIDE
;
57 const OUString
& getId() const { return m_sId
; }
58 virtual void Paint( vcl::RenderContext
& rRenderContext
, const Rectangle
& ) SAL_OVERRIDE
;
59 virtual void Resize( ) SAL_OVERRIDE
;
61 /** Add button to Infobar.
62 * Infobar takes ownership of the button so the button is
63 * destroyed when the infobar gets destroyed.
65 void addButton(PushButton
* pButton
);
68 DECL_LINK( CloseHandler
, void* );
71 class SfxInfoBarContainerWindow
: public vcl::Window
74 SfxInfoBarContainerChild
* m_pChildWin
;
75 std::vector
< VclPtr
<SfxInfoBarWindow
> > m_pInfoBars
;
78 SfxInfoBarContainerWindow(SfxInfoBarContainerChild
* pChildWin
);
79 virtual ~SfxInfoBarContainerWindow( );
80 virtual void dispose() SAL_OVERRIDE
;
82 SfxInfoBarWindow
* appendInfoBar(const OUString
& sId
, const OUString
& sMessage
);
83 SfxInfoBarWindow
* getInfoBar(const OUString
& sId
);
84 void removeInfoBar(SfxInfoBarWindow
* pInfoBar
);
86 virtual void Resize() SAL_OVERRIDE
;
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */