diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-09-08 09:30:35 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-09-21 20:10:06 +0200 |
commit | af90b8089405d6f042207f5639e750f08798ae92 (patch) | |
tree | 0af8401f534cbce9a11e64c1819ef84413ddd912 /include/sfx2 | |
parent | 416c11d189a18a08c28135b8aa5e0f12cd51dcd6 (diff) |
weld infobars
note: "pushed" status listener case dropped. Doesn't seem to be an expectation
for it to something in infobars, and there doesn't seem to be a working case
anyway.
Change-Id: I7869cc05de9918f0dd70e28b0087205db6c9506c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101945
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include/sfx2')
-rw-r--r-- | include/sfx2/infobar.hxx | 57 | ||||
-rw-r--r-- | include/sfx2/objsh.hxx | 4 | ||||
-rw-r--r-- | include/sfx2/sfxbasecontroller.hxx | 4 | ||||
-rw-r--r-- | include/sfx2/viewfrm.hxx | 12 |
4 files changed, 47 insertions, 30 deletions
diff --git a/include/sfx2/infobar.hxx b/include/sfx2/infobar.hxx index 40a1b1ff9fbf..a03c833b957d 100644 --- a/include/sfx2/infobar.hxx +++ b/include/sfx2/infobar.hxx @@ -15,11 +15,7 @@ #include <sfx2/childwin.hxx> #include <sfx2/dllapi.h> - -class FixedImage; -class FixedText; -class Button; -class PushButton; +#include <vcl/InterimItemWindow.hxx> // These must match the values in offapi/com/sun/star/frame/InfobarType.idl enum class InfobarType @@ -57,44 +53,59 @@ public: void Update(); }; +class ExtraButton; + /** Class representing a single InfoBar to be added in a SfxInfoBarContainerWindow. */ -class SFX2_DLLPUBLIC SfxInfoBarWindow final : public vcl::Window +class SFX2_DLLPUBLIC SfxInfoBarWindow final : public InterimItemWindow { private: OUString m_sId; InfobarType m_eType; - VclPtr<FixedImage> m_pImage; - VclPtr<FixedText> m_pPrimaryMessage; - VclPtr<FixedText> m_pSecondaryMessage; - VclPtr<Button> m_pCloseBtn; - std::vector<VclPtr<PushButton>> m_aActionBtns; + Size m_aSize; + Size m_aMessageSize; + Size m_aOrigMessageSize; + bool m_bLayingOut; + std::unique_ptr<weld::Image> m_xImage; + std::unique_ptr<weld::Label> m_xPrimaryMessage; + std::unique_ptr<weld::TextView> m_xSecondaryMessage; + std::unique_ptr<weld::Container> m_xButtonBox; + std::unique_ptr<weld::Toolbar> m_xCloseBtn; + std::vector<std::unique_ptr<ExtraButton>> m_aActionBtns; + + DECL_LINK(SizeAllocHdl, const Size&, void); void SetForeAndBackgroundColors(InfobarType eType); + void SetCloseButtonImage(); public: SfxInfoBarWindow(vcl::Window* parent, const OUString& sId, const OUString& sPrimaryMessage, const OUString& sSecondaryMessage, InfobarType InfobarType, - WinBits nMessageStyle, bool bShowCloseButton); + bool bShowCloseButton); + Size DoLayout(); + virtual void Layout() override; virtual ~SfxInfoBarWindow() override; virtual void dispose() override; const OUString& getId() const { return m_sId; } - virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; - virtual void Resize() override; void Update(const OUString& sPrimaryMessage, const OUString& sSecondaryMessage, InfobarType eType); basegfx::BColor m_aBackgroundColor; basegfx::BColor m_aForegroundColor; /** Add button to Infobar. - * Infobar takes ownership of the button so the button is - * destroyed when the infobar gets destroyed. - */ - void addButton(PushButton* pButton); + * Infobar takes ownership of the button so the button is + * destroyed when the infobar gets destroyed. + * + * The optional "pCommand" is used by extensions, via XInfobarProvider, to + * dispatch pCommand on click. + */ + weld::Button& addButton(const OUString* pCommand = nullptr); + + void SetCommandHandler(weld::Button& rBtn, const OUString& aCommand); private: - DECL_LINK(CloseHandler, Button*, void); + DECL_LINK(CloseHandler, const OString&, void); }; class SfxInfoBarContainerWindow final : public vcl::Window @@ -102,6 +113,10 @@ class SfxInfoBarContainerWindow final : public vcl::Window private: SfxInfoBarContainerChild* m_pChildWin; std::vector<VclPtr<SfxInfoBarWindow>> m_pInfoBars; + Idle m_aLayoutIdle; + bool m_bResizing; + + DECL_LINK(DoUpdateLayout, Timer*, void); public: SfxInfoBarContainerWindow(SfxInfoBarContainerChild* pChildWin); @@ -110,12 +125,14 @@ public: VclPtr<SfxInfoBarWindow> appendInfoBar(const OUString& sId, const OUString& sPrimaryMessage, const OUString& sSecondaryMessage, InfobarType ibType, - WinBits nMessageStyle, bool bShowCloseButton); + bool bShowCloseButton); VclPtr<SfxInfoBarWindow> getInfoBar(const OUString& sId); bool hasInfoBarWithID(const OUString& sId); void removeInfoBar(VclPtr<SfxInfoBarWindow> const& pInfoBar); static bool isInfobarEnabled(const OUString& sId); + void TriggerUpdateLayout(); + virtual void Resize() override; }; diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index 8da1f2bb7f82..e60139348c26 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -41,6 +41,7 @@ #include <functional> #include <sfx2/AccessibilityIssue.hxx> +namespace weld {class Button; } class SbxValue; class SbxArray; class BasicManager; @@ -58,7 +59,6 @@ class GDIMetaFile; class INetURLObject; class IndexBitSet; class JobSetup; -class Button; class OutputDevice; class Color; class Fraction; @@ -368,7 +368,7 @@ public: const OUString& aComment); SignatureState GetScriptingSignatureState(); void SignScriptingContent(weld::Window* pDialogParent); - DECL_LINK(SignDocumentHandler, Button*, void); + DECL_LINK(SignDocumentHandler, weld::Button&, void); virtual std::shared_ptr<SfxDocumentInfoDialog> CreateDocumentInfoDialog(weld::Window* pParent, const SfxItemSet& rItemSet); diff --git a/include/sfx2/sfxbasecontroller.hxx b/include/sfx2/sfxbasecontroller.hxx index 7fd536a14ef7..2adae2ec6cdc 100644 --- a/include/sfx2/sfxbasecontroller.hxx +++ b/include/sfx2/sfxbasecontroller.hxx @@ -50,10 +50,10 @@ namespace com::sun::star::frame { struct DispatchDescriptor; } namespace com::sun::star::ui { class XContextMenuInterceptor; } namespace com::sun::star::ui { class XSidebarProvider; } namespace com::sun::star::util { struct URL; } +namespace weld { class Button; } struct IMPL_SfxBaseController_DataContainer ; // impl. struct to hold member of class SfxBaseController -class Button; class NotifyEvent; class SfxViewFrame; class SfxViewShell; @@ -207,7 +207,7 @@ private: SAL_DLLPRIVATE SfxViewFrame& GetViewFrame_Impl() const; SAL_DLLPRIVATE void ShowInfoBars( ); - DECL_LINK( CheckOutHandler, Button*, void ); + DECL_LINK( CheckOutHandler, weld::Button&, void ); std::unique_ptr<IMPL_SfxBaseController_DataContainer> m_pData ; diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx index 07d1360c57c7..aedd362f8781 100644 --- a/include/sfx2/viewfrm.hxx +++ b/include/sfx2/viewfrm.hxx @@ -30,7 +30,7 @@ #include <svl/poolitem.hxx> #include <vcl/svapp.hxx> -class Button; +namespace weld { class Button; } class SvBorder; class SfxDispatcher; class SfxBindings; @@ -59,11 +59,11 @@ private: protected: virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; - DECL_LINK(GetInvolvedHandler, Button*, void); - DECL_LINK(DonationHandler, Button*, void); - DECL_LINK(WhatsNewHandler, Button*, void); - DECL_LINK(SwitchReadOnlyHandler, Button*, void); - DECL_LINK(SignDocumentHandler, Button*, void); + DECL_LINK(GetInvolvedHandler, weld::Button&, void); + DECL_LINK(DonationHandler, weld::Button&, void); + DECL_LINK(WhatsNewHandler, weld::Button&, void); + DECL_LINK(SwitchReadOnlyHandler, weld::Button&, void); + DECL_LINK(SignDocumentHandler, weld::Button&, void); SAL_DLLPRIVATE void KillDispatcher_Impl(); virtual ~SfxViewFrame() override; |