summaryrefslogtreecommitdiff
path: root/vcl/inc
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2020-08-24 17:18:03 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2020-08-25 14:16:24 +0200
commit2c9052802ea411dffbf5906c4914611fcbfbc6a5 (patch)
treee6770ee575093376968135484b373b8d85155927 /vcl/inc
parent041fd5a6b8c1f0002cfc693ef66daf28a86df371 (diff)
tdf#136094 Handle background color in drawNativeControl
Make gtk3's 'GtkSalGraphics::drawNativeControl' take into account a control's background color, if any is explicitly set: Set background/fill color (in 'Edit::ApplySettings') also for the case where the control is drawn "natively", but don't draw the background in the generic 'Window::Erase' method for the case of native drawing; instead handle it when drawing the control itself. This adds an additional parameter to pass the background color to the relevant '{d,D}rawNativeControl' methods (defaulting to 'COL_AUTO') and implements the required handling to apply the background color for the gtk3 case. qt5/kf5 will probably be handled in an upcoming commit as well. Windows as well as the "gen" VCL plugin were not affected by the issue, so remain unchanged and just ignore the new parameter. In a quick test on on macOS, the rendering of the controls in the sample doc was broken beyond just the missing background colors (s. screenshot attached to tdf#136094); the behavior there also remains unchanged by this patch, the new parameter is ignored for now. Change-Id: I01923a504fea2367ae96032104f09099e35f410e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101284 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl/inc')
-rw-r--r--vcl/inc/FileDefinitionWidgetDraw.hxx3
-rw-r--r--vcl/inc/WidgetDrawInterface.hxx6
-rw-r--r--vcl/inc/headless/CustomWidgetDraw.hxx3
-rw-r--r--vcl/inc/qt5/Qt5Graphics_Controls.hxx3
-rw-r--r--vcl/inc/quartz/salgdi.h2
-rw-r--r--vcl/inc/salgdi.hxx3
-rw-r--r--vcl/inc/unx/gtk/gtkgdi.hxx5
-rw-r--r--vcl/inc/win/salgdi.h2
8 files changed, 17 insertions, 10 deletions
diff --git a/vcl/inc/FileDefinitionWidgetDraw.hxx b/vcl/inc/FileDefinitionWidgetDraw.hxx
index c69d3fbbb19a..68f5d348901d 100644
--- a/vcl/inc/FileDefinitionWidgetDraw.hxx
+++ b/vcl/inc/FileDefinitionWidgetDraw.hxx
@@ -42,7 +42,8 @@ public:
bool drawNativeControl(ControlType eType, ControlPart ePart,
const tools::Rectangle& rBoundingControlRegion, ControlState eState,
- const ImplControlValue& aValue, const OUString& aCaptions) override;
+ const ImplControlValue& aValue, const OUString& aCaptions,
+ const Color& rBackgroundColor) override;
bool getNativeControlRegion(ControlType eType, ControlPart ePart,
const tools::Rectangle& rBoundingControlRegion, ControlState eState,
diff --git a/vcl/inc/WidgetDrawInterface.hxx b/vcl/inc/WidgetDrawInterface.hxx
index 2c882950b03a..78d5d7625491 100644
--- a/vcl/inc/WidgetDrawInterface.hxx
+++ b/vcl/inc/WidgetDrawInterface.hxx
@@ -58,12 +58,13 @@ public:
* @param [in] eState The general state of the control (enabled, focused, etc.).
* @param [in] aValue Addition control specific information.
* @param [in] aCaption A caption or title string (like button text etc.).
+ * @param [in] rBackgroundColor Background color for the control (may be COL_AUTO)
* @return true, if the control could be drawn.
*/
virtual inline bool drawNativeControl(ControlType eType, ControlPart ePart,
const tools::Rectangle& rBoundingControlRegion,
ControlState eState, const ImplControlValue& aValue,
- const OUString& aCaptions);
+ const OUString& aCaptions, const Color& rBackgroundColor);
/**
* Get the native control regions for the control part.
@@ -103,7 +104,8 @@ bool WidgetDrawInterface::hitTestNativeControl(ControlType, ControlPart, const t
}
bool WidgetDrawInterface::drawNativeControl(ControlType, ControlPart, const tools::Rectangle&,
- ControlState, const ImplControlValue&, const OUString&)
+ ControlState, const ImplControlValue&, const OUString&,
+ const Color& /*rBackgroundColor*/)
{
return false;
}
diff --git a/vcl/inc/headless/CustomWidgetDraw.hxx b/vcl/inc/headless/CustomWidgetDraw.hxx
index 1248aec5ca40..f30488ca8e17 100644
--- a/vcl/inc/headless/CustomWidgetDraw.hxx
+++ b/vcl/inc/headless/CustomWidgetDraw.hxx
@@ -37,7 +37,8 @@ public:
bool drawNativeControl(ControlType eType, ControlPart ePart,
const tools::Rectangle& rBoundingControlRegion, ControlState eState,
- const ImplControlValue& aValue, const OUString& aCaptions) override;
+ const ImplControlValue& aValue, const OUString& aCaptions,
+ const Color& rBackgroundColor) override;
bool getNativeControlRegion(ControlType eType, ControlPart ePart,
const tools::Rectangle& rBoundingControlRegion, ControlState eState,
diff --git a/vcl/inc/qt5/Qt5Graphics_Controls.hxx b/vcl/inc/qt5/Qt5Graphics_Controls.hxx
index 04503c7bdf17..325e5c351046 100644
--- a/vcl/inc/qt5/Qt5Graphics_Controls.hxx
+++ b/vcl/inc/qt5/Qt5Graphics_Controls.hxx
@@ -50,7 +50,8 @@ public:
bool& rIsInside) override;
bool drawNativeControl(ControlType nType, ControlPart nPart,
const tools::Rectangle& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, const OUString& aCaption) override;
+ const ImplControlValue& aValue, const OUString& aCaption,
+ const Color& rBackgroundColor) override;
bool getNativeControlRegion(ControlType nType, ControlPart nPart,
const tools::Rectangle& rControlRegion, ControlState nState,
const ImplControlValue& aValue, const OUString& aCaption,
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 5e0222be05df..a5c74c17705c 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -303,7 +303,7 @@ protected:
const Point& aPos, bool& rIsInside ) override;
virtual bool drawNativeControl( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion,
ControlState nState, const ImplControlValue& aValue,
- const OUString& aCaption ) override;
+ const OUString& aCaption, const Color& rBackgroundColor ) override;
virtual bool getNativeControlRegion( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, ControlState nState,
const ImplControlValue& aValue, const OUString& aCaption,
tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion ) override;
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index 6e772d24cf24..d2b92c65110f 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -362,7 +362,8 @@ public:
ControlState nState,
const ImplControlValue& aValue,
const OUString& aCaption,
- const OutputDevice *pOutDev );
+ const OutputDevice *pOutDev,
+ const Color& rBackgroundColor = COL_AUTO );
/**
* @see WidgetDrawInterface::getNativeControlRegion
diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index 5e259767152c..430bab56d739 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -105,7 +105,8 @@ protected:
virtual bool drawNativeControl( ControlType nType, ControlPart nPart,
const tools::Rectangle& rControlRegion,
ControlState nState, const ImplControlValue& aValue,
- const OUString& rCaption ) override;
+ const OUString& rCaption,
+ const Color& rBackgroundColor ) override;
virtual bool getNativeControlRegion( ControlType nType, ControlPart nPart,
const tools::Rectangle& rControlRegion,
ControlState nState,
@@ -274,7 +275,7 @@ protected:
const Point& aPos, bool& rIsInside ) override;
virtual bool drawNativeControl( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion,
ControlState nState, const ImplControlValue& aValue,
- const OUString& rCaption ) override;
+ const OUString& rCaption, const Color& rBackgroundColor ) override;
virtual bool getNativeControlRegion( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, ControlState nState,
const ImplControlValue& aValue, const OUString& rCaption,
tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion ) override;
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 4d1029167a85..5fe6645e7d2c 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -283,7 +283,7 @@ protected:
const Point& aPos, bool& rIsInside ) override;
virtual bool drawNativeControl( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion,
ControlState nState, const ImplControlValue& aValue,
- const OUString& aCaption ) override;
+ const OUString& aCaption, const Color& rBackgroundColor ) override;
virtual bool getNativeControlRegion( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, ControlState nState,
const ImplControlValue& aValue, const OUString& aCaption,
tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion ) override;