diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-03-08 12:17:56 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-03-11 21:34:45 +0100 |
commit | cf4b65c75c07142be0fcab5835188a28e839b749 (patch) | |
tree | 41b2bd5cd5d419f33db3839c93b9e674a193c2c1 /include | |
parent | e0e307675cc2b962d0dcb557f4af4a34a729da66 (diff) |
weld color picker
Change-Id: I487b9a0cc13b2b60a0f1e28667773b5d3b5c66cc
Reviewed-on: https://gerrit.libreoffice.org/51001
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')
-rw-r--r-- | include/svx/hexcolorcontrol.hxx | 20 | ||||
-rw-r--r-- | include/vcl/layout.hxx | 41 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 21 |
3 files changed, 74 insertions, 8 deletions
diff --git a/include/svx/hexcolorcontrol.hxx b/include/svx/hexcolorcontrol.hxx index 22d7cf2df540..a39bb5941626 100644 --- a/include/svx/hexcolorcontrol.hxx +++ b/include/svx/hexcolorcontrol.hxx @@ -26,6 +26,7 @@ #include <vcl/edit.hxx> #include <vcl/svapp.hxx> #include <vcl/builderfactory.hxx> +#include <vcl/weld.hxx> #include <sot/exchange.hxx> #include <sax/tools/converter.hxx> #include <svx/svxdllapi.h> @@ -46,6 +47,25 @@ private: static bool ImplProcessKeyInput( const KeyEvent& rKEv ); }; +namespace weld { + +class SVX_DLLPUBLIC HexColorControl +{ +private: + std::unique_ptr<weld::Entry> m_xEntry; + + DECL_LINK(ImplProcessInputHdl, OUString&, bool); +public: + HexColorControl(weld::Entry* pEdit); + + void connect_changed(const Link<Entry&, void>& rLink) { m_xEntry->connect_changed(rLink); } + + void SetColor( ::Color nColor ); + ::Color GetColor(); +}; + +} + #endif // INCLUDED_SVX_HEXCOLOR_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index f20bc18cac8a..d1488ba77e77 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -613,14 +613,39 @@ public: class VCL_DLLPUBLIC VclDrawingArea : public vcl::Window { private: - Link<vcl::RenderContext&, void> m_aPaintHdl; + Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void> m_aPaintHdl; Link<const Size&, void> m_aResizeHdl; + Link<const Point&, void> m_aMousePressHdl; + Link<const Point&, void> m_aMouseMotionHdl; + Link<const Point&, void> m_aMouseReleaseHdl; + + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override + { + m_aPaintHdl.Call(std::pair<vcl::RenderContext&, const tools::Rectangle&>(rRenderContext, rRect)); + } + virtual void Resize() override + { + m_aResizeHdl.Call(GetOutputSizePixel()); + } + virtual void MouseMove(const MouseEvent& rMEvt) override + { + m_aMouseMotionHdl.Call(rMEvt.GetPosPixel()); + } + virtual void MouseButtonDown(const MouseEvent& rMEvt) override + { + m_aMousePressHdl.Call(rMEvt.GetPosPixel()); + } + virtual void MouseButtonUp(const MouseEvent& rMEvt) override + { + m_aMouseReleaseHdl.Call(rMEvt.GetPosPixel()); + } + public: VclDrawingArea(vcl::Window *pParent, WinBits nStyle) : vcl::Window(pParent, nStyle) { } - void SetPaintHdl(const Link<vcl::RenderContext&, void>& rLink) + void SetPaintHdl(const Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void>& rLink) { m_aPaintHdl = rLink; } @@ -628,13 +653,17 @@ public: { m_aResizeHdl = rLink; } - virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/) override + void SetMousePressHdl(const Link<const Point&, void>& rLink) { - m_aPaintHdl.Call(rRenderContext); + m_aMousePressHdl = rLink; } - virtual void Resize() override + void SetMouseMoveHdl(const Link<const Point&, void>& rLink) { - m_aResizeHdl.Call(GetOutputSizePixel()); + m_aMouseMotionHdl = rLink; + } + void SetMouseReleaseHdl(const Link<const Point&, void>& rLink) + { + m_aMouseReleaseHdl = rLink; } }; diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 7a82cfb2c6df..86a61b75f194 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -54,6 +54,9 @@ public: virtual void set_grid_top_attach(int nAttach) = 0; virtual int get_grid_top_attach() const = 0; + virtual void set_margin_top(int nMargin) = 0; + virtual void set_margin_bottom(int nMargin) = 0; + virtual Container* weld_parent() const = 0; virtual ~Widget() {} @@ -307,6 +310,7 @@ public: virtual void set_text(const OUString& rText) = 0; virtual OUString get_text() const = 0; virtual void set_width_chars(int nChars) = 0; + virtual void set_max_length(int nChars) = 0; virtual void select_region(int nStartPos, int nEndPos) = 0; virtual void set_position(int nCursorPos) = 0; @@ -493,14 +497,27 @@ public: class VCL_DLLPUBLIC DrawingArea : virtual public Widget { +public: + typedef std::pair<vcl::RenderContext&, const tools::Rectangle&> draw_args; + protected: - Link<vcl::RenderContext&, void> m_aDrawHdl; + Link<draw_args, void> m_aDrawHdl; Link<const Size&, void> m_aSizeAllocateHdl; + Link<const Point&, void> m_aMousePressHdl; + Link<const Point&, void> m_aMouseMotionHdl; + Link<const Point&, void> m_aMouseReleaseHdl; public: - void connect_draw(const Link<vcl::RenderContext&, void>& rLink) { m_aDrawHdl = rLink; } + void connect_draw(const Link<draw_args, void>& rLink) { m_aDrawHdl = rLink; } void connect_size_allocate(const Link<const Size&, void>& rLink) { m_aSizeAllocateHdl = rLink; } + void connect_mouse_press(const Link<const Point&, void>& rLink) { m_aMousePressHdl = rLink; } + void connect_mouse_move(const Link<const Point&, void>& rLink) { m_aMouseMotionHdl = rLink; } + void connect_mouse_release(const Link<const Point&, void>& rLink) + { + m_aMouseReleaseHdl = rLink; + } virtual void queue_draw() = 0; + virtual void queue_draw_area(int x, int y, int width, int height) = 0; }; class VCL_DLLPUBLIC Builder |