diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2018-07-25 15:41:14 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-11-08 09:14:28 +0100 |
commit | 7af710953ca8e1b3a1615e3aaa7e02e7697e4599 (patch) | |
tree | ff2f095c220551da872f57436a48e9230fbad8a0 /vcl/unx/gtk3 | |
parent | 89f49fadb8c5cf82cc06f44a8de671290eec53a0 (diff) |
custom widgets: Custom Widget Themes
Change-Id: I7ec57d18fe99f906aeb6dbb40d0d30c2ac8b51c4
Diffstat (limited to 'vcl/unx/gtk3')
-rw-r--r-- | vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx index f37ed7cb93dd..bd70ea6e86a8 100644 --- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx @@ -19,6 +19,8 @@ #include <vcl/decoview.hxx> #include <vcl/settings.hxx> #include <unx/fontmanager.hxx> +#include <headless/CustomWidgetDraw.hxx> + #include "cairo_gtk3_cairo.hxx" #if defined(GDK_WINDOWING_WAYLAND) # include <gdk/gdkwayland.h> @@ -2174,8 +2176,19 @@ static gfloat getArrowSize(GtkStyleContext* context) bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, ControlState nState, const ImplControlValue& rValue, - const OUString& ) + const OUString& aCaptions) { + if (m_pWidgetDraw) + { + bool bReturn = m_pWidgetDraw->drawNativeControl(nType, nPart, rControlRegion, + nState, rValue, aCaptions); + + if (bReturn && !rControlRegion.IsEmpty()) + mpFrame->damaged(rControlRegion.Left(), rControlRegion.Top(), rControlRegion.GetWidth(), rControlRegion.GetHeight()); + + return bReturn; + } + RenderType renderType = nPart == ControlPart::Focus ? RenderType::Focus : RenderType::BackgroundAndFrame; GtkStyleContext *context = nullptr; const gchar *styleClass = nullptr; @@ -2606,10 +2619,17 @@ tools::Rectangle AdjustRectForTextBordersPadding(GtkStyleContext* pStyle, long n return aEditRect; } -bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, ControlState, - const ImplControlValue& rValue, const OUString&, +bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, ControlState eState, + const ImplControlValue& rValue, const OUString& aCaption, tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion ) { + if (hasWidgetDraw()) + { + return m_pWidgetDraw->getNativeControlRegion(nType, nPart, rControlRegion, + eState, rValue, aCaption, + rNativeBoundingRegion, rNativeContentRegion); + } + /* TODO: all this functions needs improvements */ tools::Rectangle aEditRect = rControlRegion; gint indicator_size, indicator_spacing, point; @@ -3168,6 +3188,11 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart ) { + if (m_pWidgetDraw) + { + return m_pWidgetDraw->isNativeControlSupported(nType, nPart); + } + switch(nType) { case ControlType::Pushbutton: @@ -3344,6 +3369,9 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow ) mpFrame( pFrame ), mpWindow( pWindow ) { + /* Set Custom Widget Draw*/ + m_pWidgetDraw.reset(new vcl::CustomWidgetDraw(*this)); + if (style_loaded) return; |