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>
16 #include <basegfx/color/bcolor.hxx>
18 #include <sfx2/dllapi.h>
19 #include <sfx2/childwin.hxx>
21 /** SfxChildWindow for positioning the InfoBar in the view.
23 class SFX2_DLLPUBLIC SfxInfoBarContainerChild
: public SfxChildWindow
26 SfxBindings
* m_pBindings
;
29 SfxInfoBarContainerChild( vcl::Window
* pParent
,
31 SfxBindings
* pBindings
,
32 SfxChildWinInfo
* pInfo
);
33 virtual ~SfxInfoBarContainerChild();
35 SFX_DECL_CHILDWINDOW_WITHID( SfxInfoBarContainerChild
);
40 /** Class representing a single InfoBar to be added in a SfxInfoBarContainerWindow.
42 class SfxInfoBarWindow
: public vcl::Window
46 VclPtr
<FixedText
> m_pMessage
;
47 VclPtr
<Button
> m_pCloseBtn
;
48 std::vector
< VclPtr
<PushButton
> > m_aActionBtns
;
49 basegfx::BColor m_aBackgroundColor
;
50 basegfx::BColor m_aForegroundColor
;
53 SfxInfoBarWindow( vcl::Window
* parent
, const OUString
& sId
,
54 const OUString
& sMessage
,
55 const basegfx::BColor
* pBackgroundColor
,
56 const basegfx::BColor
* pForegroundColor
,
57 const basegfx::BColor
* pMessageColor
,
58 WinBits nMessageStyle
);
59 virtual ~SfxInfoBarWindow( );
60 virtual void dispose() override
;
62 const OUString
& getId() const { return m_sId
; }
63 virtual void Paint( vcl::RenderContext
& rRenderContext
, const Rectangle
& ) override
;
64 virtual void Resize( ) override
;
66 /** Add button to Infobar.
67 * Infobar takes ownership of the button so the button is
68 * destroyed when the infobar gets destroyed.
70 void addButton(PushButton
* pButton
);
73 DECL_LINK_TYPED( CloseHandler
, Button
*, void );
76 class SfxInfoBarContainerWindow
: public vcl::Window
79 SfxInfoBarContainerChild
* m_pChildWin
;
80 std::vector
< VclPtr
<SfxInfoBarWindow
> > m_pInfoBars
;
83 SfxInfoBarContainerWindow(SfxInfoBarContainerChild
* pChildWin
);
84 virtual ~SfxInfoBarContainerWindow( );
85 virtual void dispose() override
;
87 SfxInfoBarWindow
* appendInfoBar(const OUString
& sId
,
88 const OUString
& sMessage
,
89 const basegfx::BColor
* pBackgroundColor
,
90 const basegfx::BColor
* pForegroundColor
,
91 const basegfx::BColor
* pMessageColor
,
92 WinBits nMessageStyle
);
93 SfxInfoBarWindow
* getInfoBar(const OUString
& sId
);
94 void removeInfoBar(SfxInfoBarWindow
* pInfoBar
);
96 virtual void Resize() override
;
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */