diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-05-22 10:38:34 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-24 14:24:06 +0200 |
commit | eeaf6dee2d278eaa037d95a756ad0ffab3314bc2 (patch) | |
tree | a997fee717ad079fb59ff0901d418938ab7585f7 /include/svx/charmap.hxx | |
parent | c10928e703366341ab912c42e8959a087a7fa9ff (diff) |
rework custom widget welding to enable inheritence
Change-Id: I0d391b3fe9d2d610ae41e2a03cd2e195a866e103
Reviewed-on: https://gerrit.libreoffice.org/54681
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include/svx/charmap.hxx')
-rw-r--r-- | include/svx/charmap.hxx | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/include/svx/charmap.hxx b/include/svx/charmap.hxx index 3df37695eb75..2446c0607cbb 100644 --- a/include/svx/charmap.hxx +++ b/include/svx/charmap.hxx @@ -35,6 +35,7 @@ #include <vcl/outdev.hxx> #include <vcl/metric.hxx> #include <vcl/vclptr.hxx> +#include <vcl/customweld.hxx> #include <vcl/weld.hxx> #include <vcl/window.hxx> #include <vcl/textview.hxx> @@ -56,19 +57,15 @@ namespace svx class SvxShowCharSetAcc; } -class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxShowCharSet +class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxShowCharSet : public weld::CustomWidgetController { protected: VclPtr<VirtualDevice> mxVirDev; - std::unique_ptr<weld::DrawingArea> mxDrawingArea; - std::unique_ptr<weld::ScrolledWindow> mxScrollArea; vcl::Font maFont; - Size maSize; + std::unique_ptr<weld::ScrolledWindow> mxScrollArea; public: - SvxShowCharSet(weld::Builder& rBuilder, const OString& rDrawingId, - const OString& rScrollId, const VclPtr<VirtualDevice>& rVirDev); - - virtual ~SvxShowCharSet(); + SvxShowCharSet(weld::ScrolledWindow* pScrollArea, const VclPtr<VirtualDevice>& rVirDev); + virtual ~SvxShowCharSet() override; virtual void RecalculateFont(vcl::RenderContext& rRenderContext); @@ -106,25 +103,22 @@ public: void Show() { mxScrollArea->show(); } void Hide() { mxScrollArea->hide(); } - bool HasFocus() const { return mxDrawingArea->has_focus(); } - void GrabFocus() { mxDrawingArea->grab_focus(); } - bool IsEnabled() const { return mxDrawingArea->get_sensitive(); } - bool IsVisible() const { return mxDrawingArea->get_visible(); } - const Size& GetSize() const { return maSize; } - uno::Reference<css::accessibility::XAccessible> getAccessibleParent() { return mxDrawingArea->get_accessible_parent(); } + uno::Reference<css::accessibility::XAccessible> getAccessibleParent() { return GetDrawingArea()->get_accessible_parent(); } private: - DECL_LINK(DoPaint, weld::DrawingArea::draw_args, void); - DECL_LINK(DoResize, const Size& rSize, void); - DECL_LINK(DoMouseButtonDown, const MouseEvent& rMEvt, void); - DECL_LINK(DoMouseMove, const MouseEvent& rMEvt, void); - DECL_LINK(DoMouseButtonUp, const MouseEvent& rMEvt, void); - DECL_LINK(DoKeyDown, const KeyEvent& rKEvt, bool); - DECL_LINK(DoGetFocus, weld::Widget&, void); - DECL_LINK(DoLoseFocus, weld::Widget&, void); - - css::uno::Reference<css::accessibility::XAccessible> CreateAccessible(); + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; + virtual void Resize() override; + virtual void MouseButtonDown(const MouseEvent& rMEvt) override; + virtual void MouseMove(const MouseEvent& rMEvt) override; + virtual void MouseButtonUp(const MouseEvent& rMEvt) override; + virtual void GetFocus() override; + virtual void LoseFocus() override; + virtual bool KeyInput(const KeyEvent&) override; + + virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; + virtual FactoryFunction GetUITestFactory() const override; protected: typedef std::map<sal_Int32, std::shared_ptr<svx::SvxShowCharSetItem> > ItemsMap; |