Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / include / sfx2 / infobar.hxx
blob1e5a31ea87d9c49df7f5b85ef98634c6321960a8
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/.
8 */
9 #ifndef INCLUDED_SFX2_INFOBAR_HXX
10 #define INCLUDED_SFX2_INFOBAR_HXX
12 #include <vector>
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
25 private:
26 SfxBindings* m_pBindings;
28 public:
29 SfxInfoBarContainerChild( vcl::Window* pParent,
30 sal_uInt16 nId,
31 SfxBindings* pBindings,
32 SfxChildWinInfo* pInfo );
33 virtual ~SfxInfoBarContainerChild();
35 SFX_DECL_CHILDWINDOW_WITHID( SfxInfoBarContainerChild );
37 void Update( );
40 /** Class representing a single InfoBar to be added in a SfxInfoBarContainerWindow.
42 class SfxInfoBarWindow : public vcl::Window
44 private:
45 OUString m_sId;
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;
52 public:
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);
72 private:
73 DECL_LINK_TYPED( CloseHandler, Button*, void );
76 class SfxInfoBarContainerWindow : public vcl::Window
78 private:
79 SfxInfoBarContainerChild* m_pChildWin;
80 std::vector< VclPtr<SfxInfoBarWindow> > m_pInfoBars;
82 public:
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;
100 #endif
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */