Bump version to 6.4-15
[LibreOffice.git] / include / sfx2 / infobar.hxx
blob80f4c0a0506c2b5ff713c06a99934c6c687809e6
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 // These must match the values in offapi/com/sun/star/frame/InfobarType.idl
22 enum class InfobarType {
23 INFO = 0,
24 SUCCESS = 1,
25 WARNING = 2,
26 DANGER = 3
29 class InfobarData
31 public:
32 OUString msId;
33 OUString msPrimaryMessage;
34 OUString msSecondaryMessage;
35 InfobarType maInfobarType;
36 bool mbShowCloseButton;
39 /** SfxChildWindow for positioning the InfoBar in the view.
41 class SFX2_DLLPUBLIC SfxInfoBarContainerChild final : public SfxChildWindow
43 private:
44 SfxBindings* const m_pBindings;
46 public:
47 SfxInfoBarContainerChild( vcl::Window* pParent,
48 sal_uInt16 nId,
49 SfxBindings* pBindings,
50 SfxChildWinInfo* pInfo );
51 virtual ~SfxInfoBarContainerChild() override;
53 SFX_DECL_CHILDWINDOW_WITHID( SfxInfoBarContainerChild );
55 void Update( );
58 /** Class representing a single InfoBar to be added in a SfxInfoBarContainerWindow.
60 class SFX2_DLLPUBLIC SfxInfoBarWindow final : public vcl::Window
62 private:
63 OUString const m_sId;
64 InfobarType m_eType;
65 VclPtr<FixedImage> m_pImage;
66 VclPtr<FixedText> m_pPrimaryMessage;
67 VclPtr<FixedText> m_pSecondaryMessage;
68 VclPtr<Button> m_pCloseBtn;
69 std::vector< VclPtr<PushButton> > m_aActionBtns;
71 void SetForeAndBackgroundColors( InfobarType eType );
73 public:
74 SfxInfoBarWindow( vcl::Window* parent, const OUString& sId,
75 const OUString& sPrimaryMessage,
76 const OUString& sSecondaryMessage,
77 InfobarType InfobarType,
78 bool bShowCloseButton, WinBits nMessageStyle);
79 virtual ~SfxInfoBarWindow( ) override;
80 virtual void dispose() override;
82 const OUString& getId() const { return m_sId; }
83 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override;
84 virtual void Resize( ) override;
85 void Update(const OUString& sPrimaryMessage, const OUString& sSecondaryMessage,
86 InfobarType eType);
87 basegfx::BColor m_aBackgroundColor;
88 basegfx::BColor m_aForegroundColor;
90 /** Add button to Infobar.
91 * Infobar takes ownership of the button so the button is
92 * destroyed when the infobar gets destroyed.
94 void addButton(PushButton* pButton);
96 private:
97 DECL_LINK( CloseHandler, Button*, void );
100 class SfxInfoBarContainerWindow final : public vcl::Window
102 private:
103 SfxInfoBarContainerChild* m_pChildWin;
104 std::vector< VclPtr<SfxInfoBarWindow> > m_pInfoBars;
106 public:
107 SfxInfoBarContainerWindow(SfxInfoBarContainerChild* pChildWin);
108 virtual ~SfxInfoBarContainerWindow( ) override;
109 virtual void dispose() override;
111 VclPtr<SfxInfoBarWindow> appendInfoBar(const OUString& sId,
112 const OUString& sPrimaryMessage,
113 const OUString& sSecondaryMessage,
114 InfobarType ibType,
115 WinBits nMessageStyle,
116 bool bShowCloseButton);
117 VclPtr<SfxInfoBarWindow> getInfoBar(const OUString& sId);
118 bool hasInfoBarWithID(const OUString& sId);
119 void removeInfoBar(VclPtr<SfxInfoBarWindow> const & pInfoBar);
121 virtual void Resize() override;
125 #endif
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */