diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-06-04 11:34:28 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-06-06 09:57:53 +0200 |
commit | a30a5d1b8af18d19526f1980df41857f455cc8ef (patch) | |
tree | e8add75abca3c336cbc46936a7d19028ba4251aa /include/vcl | |
parent | 7665246ac8addc002f74e3a9b22d1baeda448af3 (diff) |
weld AboutDialog
use a native GtkAboutDialog on that platform and refactor the current cui about
dialog body to form the body of a vcl AboutDialog
use add_button to add the buttons to whichever is preferred of the headerbar
or action-area
Change-Id: I67e0b36dcb8d3fa08ec4f0397b0f6185b0778675
Reviewed-on: https://gerrit.libreoffice.org/73439
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include/vcl')
-rw-r--r-- | include/vcl/aboutdialog.hxx | 60 | ||||
-rw-r--r-- | include/vcl/dialog.hxx | 2 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 17 |
3 files changed, 78 insertions, 1 deletions
diff --git a/include/vcl/aboutdialog.hxx b/include/vcl/aboutdialog.hxx new file mode 100644 index 000000000000..4126f9519a1b --- /dev/null +++ b/include/vcl/aboutdialog.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_VCL_ABOUT_DIALOG_HXX +#define INCLUDED_VCL_ABOUT_DIALOG_HXX + +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> +#include <vcl/fixedhyper.hxx> +#include <vcl/dialog.hxx> +#include <vcl/layout.hxx> +#include <vcl/vclmedit.hxx> + +class AboutDialog : public Dialog +{ +private: + BitmapEx m_aBackgroundBitmap; + + std::unique_ptr<VclBuilder> m_xBuilder; + VclPtr<VclContainer> m_xContents; + VclPtr<VclMultiLineEdit> m_xVersion; + VclPtr<FixedHyperlink> m_xBuildIdLink; + VclPtr<FixedText> m_xDescriptionText; + VclPtr<FixedText> m_xCopyrightText; + VclPtr<FixedImage> m_xLogoImage; + VclPtr<FixedText> m_xLogoReplacement; + + void StyleControls(); + +protected: + virtual void Paint(vcl::RenderContext& rRenderContext, + const ::tools::Rectangle& rRect) override; + virtual bool set_property(const OString& rKey, const OUString& rValue) override; + virtual void set_content_area(VclBox* pBox) override; + +public: + explicit AboutDialog(vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG, + InitFlag eFlag = InitFlag::Default); + virtual ~AboutDialog() override; + virtual void dispose() override; + + void SetLogo(const Image& rLogoBitmap); + void SetBackground(const Image& rBackgroundBitmap); + void SetVersion(const OUString& rVersion) { m_xVersion->SetText(rVersion); } + void SetCopyright(const OUString& rCopyright) { m_xCopyrightText->SetText(rCopyright); } + void SetWebsiteLink(const OUString& rURL) { m_xBuildIdLink->SetURL(rURL); } + void SetWebsiteLabel(const OUString& rLabel) { m_xBuildIdLink->SetText(rLabel); } + + OUString GetWebsiteLabel() const { return m_xBuildIdLink->GetText(); } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx index 3748dbd943d5..32b06be57db9 100644 --- a/include/vcl/dialog.hxx +++ b/include/vcl/dialog.hxx @@ -96,7 +96,7 @@ protected: protected: friend class VclBuilder; void set_action_area(VclButtonBox* pBox); - void set_content_area(VclBox* pBox); + virtual void set_content_area(VclBox* pBox); public: explicit Dialog( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG, InitFlag eFlag = InitFlag::Default ); diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 19c808b2b9d5..768750142eb5 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -129,6 +129,8 @@ public: virtual void set_vexpand(bool bExpand) = 0; virtual bool get_vexpand() const = 0; + virtual void set_secondary(bool bSecondary) = 0; + virtual void set_margin_top(int nMargin) = 0; virtual void set_margin_bottom(int nMargin) = 0; @@ -433,6 +435,18 @@ public: virtual Container* weld_message_area() = 0; }; +class VCL_DLLPUBLIC AboutDialog : virtual public Dialog +{ +public: + virtual void set_version(const OUString& rVersion) = 0; + virtual void set_copyright(const OUString& rCopyright) = 0; + virtual void set_website(const OUString& rURL) = 0; + virtual void set_website_label(const OUString& rLabel) = 0; + virtual OUString get_website_label() const = 0; + virtual void set_logo(VirtualDevice* pDevice) = 0; + virtual void set_background(VirtualDevice* pDevice) = 0; +}; + struct VCL_DLLPUBLIC ComboBoxEntry { OUString sString; @@ -1730,6 +1744,9 @@ public: bool bTakeOwnership = true) = 0; virtual std::unique_ptr<Dialog> weld_dialog(const OString& id, bool bTakeOwnership = true) = 0; + virtual std::unique_ptr<AboutDialog> weld_about_dialog(const OString& id, + bool bTakeOwnership = true) + = 0; virtual std::unique_ptr<Window> weld_window(const OString& id, bool bTakeOwnership = true) = 0; virtual std::unique_ptr<Widget> weld_widget(const OString& id, bool bTakeOwnership = false) = 0; virtual std::unique_ptr<Container> weld_container(const OString& id, |