[Libreoffice-commits] core.git: 34 commits - include/vcl solenv/clang-format vcl/headless vcl/inc vcl/Library_vcl.mk vcl/source vcl/unx
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Nov 9 17:45:13 UTC 2018
include/vcl/button.hxx | 11
include/vcl/edit.hxx | 2
include/vcl/salnativewidgets.hxx | 13
solenv/clang-format/blacklist | 1
vcl/Library_vcl.mk | 1
vcl/headless/CustomWidgetDraw.cxx | 398 ++++++++++++++++++++++++++++++
vcl/headless/svpframe.cxx | 22 +
vcl/headless/svpgdi.cxx | 65 ++++
vcl/inc/WidgetDrawInterface.hxx | 103 +++++++
vcl/inc/WidgetThemeLibrary.hxx | 146 +++++++++++
vcl/inc/WidgetThemeLibraryTypes.hxx | 240 ++++++++++++++++++
vcl/inc/headless/CustomWidgetDraw.hxx | 56 ++++
vcl/inc/headless/svpgdi.hxx | 22 +
vcl/inc/salgdi.hxx | 8
vcl/inc/unx/gtk/gtkgdi.hxx | 4
vcl/source/control/button.cxx | 6
vcl/source/control/edit.cxx | 15 -
vcl/source/control/slider.cxx | 44 +--
vcl/source/gdi/salnativewidgets-none.cxx | 29 +-
vcl/source/window/builder.cxx | 3
vcl/source/window/menufloatingwindow.cxx | 17 +
vcl/source/window/paint.cxx | 77 +++++
vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 42 ++-
23 files changed, 1275 insertions(+), 50 deletions(-)
New commits:
commit 717cdaf4bc864e0b96bfba5f3bc557afe751f50f
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Nov 9 09:20:06 2018 +0100
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:37 2018 +0100
custom widgets: Fix various warnings.
Change-Id: I5d657fa4d6f63b93ad3775a5641d08c6e0f3a615
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 84479af7bae5..ccb804cf1b6a 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -93,7 +93,7 @@ struct ControlDrawParameters
int64_t nValue;
};
-typedef struct _WidgetThemeLibrary WidgetThemeLibrary;
+typedef struct WidgetThemeLibrary_t WidgetThemeLibrary;
typedef struct _rectangle
{
@@ -101,7 +101,7 @@ typedef struct _rectangle
long width, height;
} rectangle_t;
-struct _WidgetThemeLibrary
+struct WidgetThemeLibrary_t
{
uint32_t nSize;
diff --git a/vcl/inc/headless/CustomWidgetDraw.hxx b/vcl/inc/headless/CustomWidgetDraw.hxx
index d0ddcea430bc..caa809e62f28 100644
--- a/vcl/inc/headless/CustomWidgetDraw.hxx
+++ b/vcl/inc/headless/CustomWidgetDraw.hxx
@@ -28,7 +28,7 @@ private:
public:
CustomWidgetDraw(SvpSalGraphics& rGraphics);
- virtual ~CustomWidgetDraw();
+ ~CustomWidgetDraw() override;
bool isNativeControlSupported(ControlType eType, ControlPart ePart) override;
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index f8a643d7f662..b09f3223cdad 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -26,7 +26,7 @@
#include "salgdiimpl.hxx"
#include "sallayout.hxx"
#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <WidgetDrawInterface.hxx>
+#include "WidgetDrawInterface.hxx"
#include <config_cairo_canvas.h>
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index aa9bd5a8bc1c..ac79b1f0c510 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -144,7 +144,7 @@ void MenuFloatingWindow::ApplySettings(vcl::RenderContext& rRenderContext)
ImplGetFrame()->UpdateSettings(aSettings); // Update theme colors.
StyleSettings aStyle(aSettings.GetStyleSettings());
Color aHighlightTextColor = ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor;
- if (aHighlightTextColor != Color(COL_TRANSPARENT))
+ if (aHighlightTextColor != COL_TRANSPARENT)
{
aStyle.SetMenuHighlightTextColor(aHighlightTextColor);
}
commit e6dcc08c3d1ebc896a047257b589552be7d72c7d
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Nov 4 11:45:45 2018 -0500
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:36 2018 +0100
LOK: custom widgets: simplify and correct colors
Also remove macroni.
Change-Id: I0b2914e9f0e2aba9d8ca10338b515b598126e315
diff --git a/vcl/inc/WidgetThemeLibraryTypes.hxx b/vcl/inc/WidgetThemeLibraryTypes.hxx
index af7ff9738471..9b069d3dc066 100644
--- a/vcl/inc/WidgetThemeLibraryTypes.hxx
+++ b/vcl/inc/WidgetThemeLibraryTypes.hxx
@@ -235,39 +235,6 @@ enum class ButtonValue {
Mixed
};
-// Color types
-
-constexpr uint32_t RGB_COLORDATA(uint8_t r, uint8_t g, uint8_t b) {
- return uint32_t(b) | (uint32_t(g) << 8) | (uint32_t(r) << 16);
-}
-
-#define COLORDATA_RED( n ) ((uint8_t)((n)>>16))
-#define COLORDATA_GREEN( n ) ((uint8_t)(((uint16_t)(n)) >> 8))
-#define COLORDATA_BLUE( n ) ((uint8_t)(n))
-#define COLORDATA_RGB( n ) ((uint32_t)((n) & 0x00FFFFFF))
-
-#define COL_BLACK RGB_COLORDATA( 0x00, 0x00, 0x00 )
-#define COL_BLUE RGB_COLORDATA( 0x00, 0x00, 0x80 )
-#define COL_GREEN RGB_COLORDATA( 0x00, 0x80, 0x00 )
-#define COL_CYAN RGB_COLORDATA( 0x00, 0x80, 0x80 )
-#define COL_RED RGB_COLORDATA( 0x80, 0x00, 0x00 )
-#define COL_RED_FONTCOLOR RGB_COLORDATA( 0xCE, 0x18, 0x1E )
-#define COL_MAGENTA RGB_COLORDATA( 0x80, 0x00, 0x80 )
-#define COL_BROWN RGB_COLORDATA( 0x80, 0x80, 0x00 )
-#define COL_GRAY RGB_COLORDATA( 0x80, 0x80, 0x80 )
-#define COL_GRAY3 RGB_COLORDATA( 0xCC, 0xCC, 0xCC )
-#define COL_GRAY7 RGB_COLORDATA( 0x66, 0x66, 0x66 )
-#define COL_LIGHTGRAY RGB_COLORDATA( 0xC0, 0xC0, 0xC0 )
-#define COL_LIGHTBLUE RGB_COLORDATA( 0x00, 0x00, 0xFF )
-#define COL_LIGHTGREEN RGB_COLORDATA( 0x00, 0xFF, 0x00 )
-#define COL_LIGHTCYAN RGB_COLORDATA( 0x00, 0xFF, 0xFF )
-#define COL_LIGHTRED RGB_COLORDATA( 0xFF, 0x00, 0x00 )
-#define COL_LIGHTMAGENTA RGB_COLORDATA( 0xFF, 0x00, 0xFF )
-#define COL_LIGHTGRAYBLUE RGB_COLORDATA( 0xE0, 0xE0, 0xFF )
-#define COL_YELLOW RGB_COLORDATA( 0xFF, 0xFF, 0x00 )
-#define COL_YELLOW_HIGHLIGHT RGB_COLORDATA( 0xFF, 0xF2, 0x00 )
-#define COL_WHITE RGB_COLORDATA( 0xFF, 0xFF, 0xFF )
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit b5f97c9f5250907b689ad72cbeb292861aaf0c17
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Nov 4 11:01:00 2018 -0500
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:36 2018 +0100
LOK: custom widgets: reduce theme plugin API surface
Change-Id: I89dcf5a102be19fd1bc314a89538a121522f4a43
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index cadc41e85452..ca0af690a874 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -300,9 +300,26 @@ bool CustomWidgetDraw::getNativeControlRegion(
ControlState eState, const ImplControlValue& /*aValue*/, const OUString& /*aCaption*/,
tools::Rectangle& rNativeBoundingRegion, tools::Rectangle& rNativeContentRegion)
{
- return s_pWidgetImplementation
- && s_pWidgetImplementation->getRegion(eType, ePart, eState, rBoundingControlRegion,
- rNativeBoundingRegion, rNativeContentRegion);
+ // Translate to POD rectangle and back.
+ const rectangle_t aRegion
+ = { rBoundingControlRegion.getX(), rBoundingControlRegion.getY(),
+ rBoundingControlRegion.GetWidth(), rBoundingControlRegion.GetHeight() };
+ if (s_pWidgetImplementation)
+ {
+ rectangle_t aNativeBoundingRegion;
+ rectangle_t aNativeContentRegion;
+ s_pWidgetImplementation->getRegion(eType, ePart, eState, aRegion, aNativeBoundingRegion,
+ aNativeContentRegion);
+
+ rNativeBoundingRegion
+ = tools::Rectangle(aNativeBoundingRegion.x, aNativeBoundingRegion.y,
+ aNativeBoundingRegion.width, aNativeBoundingRegion.height);
+ rNativeContentRegion
+ = tools::Rectangle(aNativeBoundingRegion.x, aNativeBoundingRegion.y,
+ aNativeBoundingRegion.width, aNativeBoundingRegion.height);
+ }
+
+ return false;
}
bool CustomWidgetDraw::updateSettings(AllSettings& rSettings)
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 4af25f82478d..39f9176a8d64 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -24,6 +24,7 @@
#include <headless/svpbmp.hxx>
#include <headless/svpframe.hxx>
#include <headless/svpcairotextrender.hxx>
+#include <headless/CustomWidgetDraw.hxx>
#include <saldatabasic.hxx>
#include <sal/log.hxx>
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 9d916895d43b..84479af7bae5 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -11,11 +11,7 @@
#ifndef INCLUDED_VCL_INC_WIDGETTHEME_HXX
#define INCLUDED_VCL_INC_WIDGETTHEME_HXX
-/**
- * This file expects cairo.h and the definition of
- * the other types used here to be defined before
- * including it.
- */
+#include <cstdint>
namespace vcl
{
@@ -76,6 +72,7 @@ struct WidgetDrawStyle
struct ControlDrawParameters
{
+ typedef struct _cairo cairo_t;
ControlDrawParameters(cairo_t* i_pCairo, ControlPart i_ePart, ControlState i_eState)
: nSize(sizeof(ControlDrawParameters))
, pCairo(i_pCairo)
@@ -98,15 +95,20 @@ struct ControlDrawParameters
typedef struct _WidgetThemeLibrary WidgetThemeLibrary;
+typedef struct _rectangle
+{
+ long x, y;
+ long width, height;
+} rectangle_t;
+
struct _WidgetThemeLibrary
{
uint32_t nSize;
bool (*isNativeControlSupported)(ControlType eType, ControlPart ePart);
bool (*getRegion)(ControlType eType, ControlPart ePart, ControlState eState,
- const tools::Rectangle& rBoundingControlRegion,
- tools::Rectangle& rNativeBoundingRegion,
- tools::Rectangle& rNativeContentRegion);
+ const rectangle_t& rBoundingControlRegion, rectangle_t& rNativeBoundingRegion,
+ rectangle_t& rNativeContentRegion);
bool (*drawPushButton)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
bool (*drawRadiobutton)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
diff --git a/vcl/inc/WidgetThemeLibraryTypes.hxx b/vcl/inc/WidgetThemeLibraryTypes.hxx
index c8a492313356..af7ff9738471 100644
--- a/vcl/inc/WidgetThemeLibraryTypes.hxx
+++ b/vcl/inc/WidgetThemeLibraryTypes.hxx
@@ -12,7 +12,7 @@
#define INCLUDED_VCL_INC_WIDGETTHEMETYPES_HXX
#include <cstdint>
-#include <type_traits>
+#include <type_traits> // Used for enum operator
/**
* These types are all based on the supported variants
@@ -268,96 +268,6 @@ constexpr uint32_t RGB_COLORDATA(uint8_t r, uint8_t g, uint8_t b) {
#define COL_YELLOW_HIGHLIGHT RGB_COLORDATA( 0xFF, 0xF2, 0x00 )
#define COL_WHITE RGB_COLORDATA( 0xFF, 0xFF, 0xFF )
-#ifndef SAL_DLLPUBLIC_EXPORT
-# define SAL_DLLPUBLIC_EXPORT __attribute__ ((visibility("default")))
-#endif
-
-namespace tools
-{
-
-#define RECT_EMPTY ((short)-32767)
-
-class SAL_DLLPUBLIC_EXPORT Rectangle
-{
-public:
- Rectangle();
- Rectangle( long nLeft, long nTop,
- long nRight, long nBottom );
-
- long Left() const { return nLeft; }
- long Right() const { return nRight; }
- long Top() const { return nTop; }
- long Bottom() const { return nBottom; }
-
- long& Left() { return nLeft; }
- long& Right() { return nRight; }
- long& Top() { return nTop; }
- long& Bottom() { return nBottom; }
-
- /// Returns the difference between right and left, assuming the range is inclusive.
- inline long GetWidth() const;
- /// Returns the difference between bottom and top, assuming the range is inclusive.
- inline long GetHeight() const;
-
- long getX() const { return nLeft; }
- long getY() const { return nTop; }
-
-private:
- long nLeft;
- long nTop;
- long nRight;
- long nBottom;
-};
-}
-
-inline tools::Rectangle::Rectangle()
-{
- nLeft = nTop = 0;
- nRight = nBottom = RECT_EMPTY;
-}
-
-inline tools::Rectangle::Rectangle( long _nLeft, long _nTop,
- long _nRight, long _nBottom )
-{
- nLeft = _nLeft;
- nTop = _nTop;
- nRight = _nRight;
- nBottom = _nBottom;
-}
-
-inline long tools::Rectangle::GetWidth() const
-{
- long n;
- if ( nRight == RECT_EMPTY )
- n = 0;
- else
- {
- n = nRight - nLeft;
- if( n < 0 )
- n--;
- else
- n++;
- }
-
- return n;
-}
-
-inline long tools::Rectangle::GetHeight() const
-{
- long n;
- if ( nBottom == RECT_EMPTY )
- n = 0;
- else
- {
- n = nBottom - nTop;
- if ( n < 0 )
- n--;
- else
- n++;
- }
-
- return n;
-}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 21b1b0537c8e..8546387f8962 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -33,7 +33,6 @@
#include <sallayout.hxx>
#include "svpcairotextrender.hxx"
#include <impfontmetricdata.hxx>
-#include <headless/CustomWidgetDraw.hxx>
#include <cairo.h>
commit 53961bc1bebe1159936f177b7e70eb8fadb36cff
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Nov 3 17:57:44 2018 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:35 2018 +0100
LOK: custom widgets: reduce Color into an int to reduce API surface
Change-Id: Ib1afbb0b5647048f24d4ea6f9859b76328568dac
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index d1454911489f..cadc41e85452 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -318,55 +318,55 @@ bool CustomWidgetDraw::updateSettings(AllSettings& rSettings)
StyleSettings aStyleSet = rSettings.GetStyleSettings();
aStyleSet.SetFaceColor(aStyle.maFaceColor);
- aStyleSet.SetCheckedColor(Color(0xCC, 0xCC, 0xCC));
+ aStyleSet.SetCheckedColor(aStyle.maCheckedColor);
aStyleSet.SetLightColor(aStyle.maLightColor);
aStyleSet.SetLightBorderColor(aStyle.maLightBorderColor);
aStyleSet.SetShadowColor(aStyle.maShadowColor);
aStyleSet.SetDarkShadowColor(aStyle.maDarkShadowColor);
- aStyleSet.SetButtonTextColor(Color(COL_BLACK));
- aStyleSet.SetButtonRolloverTextColor(Color(COL_BLACK));
- aStyleSet.SetRadioCheckTextColor(Color(COL_BLACK));
- aStyleSet.SetGroupTextColor(Color(COL_BLACK));
- aStyleSet.SetLabelTextColor(Color(COL_BLACK));
+ aStyleSet.SetButtonTextColor(aStyle.maButtonTextColor);
+ aStyleSet.SetButtonRolloverTextColor(aStyle.maButtonRolloverTextColor);
+ aStyleSet.SetRadioCheckTextColor(aStyle.maRadioCheckTextColor);
+ aStyleSet.SetGroupTextColor(aStyle.maGroupTextColor);
+ aStyleSet.SetLabelTextColor(aStyle.maLabelTextColor);
aStyleSet.SetWindowColor(aStyle.maWindowColor);
aStyleSet.SetWindowTextColor(aStyle.maWindowTextColor);
aStyleSet.SetDialogColor(aStyle.maDialogColor);
aStyleSet.SetDialogTextColor(aStyle.maDialogTextColor);
- aStyleSet.SetWorkspaceColor(Color(0xDF, 0xDF, 0xDE));
- aStyleSet.SetMonoColor(Color(COL_BLACK));
- aStyleSet.SetFieldColor(Color(aStyle.maFaceColor));
- aStyleSet.SetFieldTextColor(Color(COL_BLACK));
- aStyleSet.SetFieldRolloverTextColor(Color(COL_BLACK));
- aStyleSet.SetActiveColor(Color(COL_BLUE));
- aStyleSet.SetActiveTextColor(Color(COL_WHITE));
- aStyleSet.SetActiveBorderColor(Color(COL_LIGHTGRAY));
- aStyleSet.SetDeactiveColor(Color(COL_GRAY));
- aStyleSet.SetDeactiveTextColor(Color(COL_LIGHTGRAY));
- aStyleSet.SetDeactiveBorderColor(Color(COL_LIGHTGRAY));
- aStyleSet.SetMenuColor(Color(COL_WHITE));
- aStyleSet.SetMenuBarColor(Color(COL_WHITE));
- aStyleSet.SetMenuBarRolloverColor(aStyle.maHighlightColor);
- aStyleSet.SetMenuBorderColor(Color(COL_LIGHTGRAY));
- aStyleSet.SetMenuTextColor(Color(COL_BLACK));
- aStyleSet.SetMenuBarTextColor(Color(COL_BLACK));
- aStyleSet.SetMenuBarRolloverTextColor(Color(COL_BLACK));
- aStyleSet.SetMenuBarHighlightTextColor(Color(COL_BLACK));
- aStyleSet.SetMenuHighlightColor(aStyle.maHighlightColor);
- aStyleSet.SetMenuHighlightTextColor(Color(COL_BLACK));
+ aStyleSet.SetWorkspaceColor(aStyle.maWorkspaceColor);
+ aStyleSet.SetMonoColor(aStyle.maMonoColor);
+ aStyleSet.SetFieldColor(Color(aStyle.maFieldColor));
+ aStyleSet.SetFieldTextColor(aStyle.maFieldTextColor);
+ aStyleSet.SetFieldRolloverTextColor(aStyle.maFieldRolloverTextColor);
+ aStyleSet.SetActiveColor(aStyle.maActiveColor);
+ aStyleSet.SetActiveTextColor(aStyle.maActiveTextColor);
+ aStyleSet.SetActiveBorderColor(aStyle.maActiveBorderColor);
+ aStyleSet.SetDeactiveColor(aStyle.maDeactiveColor);
+ aStyleSet.SetDeactiveTextColor(aStyle.maDeactiveTextColor);
+ aStyleSet.SetDeactiveBorderColor(aStyle.maDeactiveBorderColor);
+ aStyleSet.SetMenuColor(aStyle.maMenuColor);
+ aStyleSet.SetMenuBarColor(aStyle.maMenuBarColor);
+ aStyleSet.SetMenuBarRolloverColor(aStyle.maMenuBarRolloverColor);
+ aStyleSet.SetMenuBorderColor(aStyle.maMenuBorderColor);
+ aStyleSet.SetMenuTextColor(aStyle.maMenuTextColor);
+ aStyleSet.SetMenuBarTextColor(aStyle.maMenuBarTextColor);
+ aStyleSet.SetMenuBarRolloverTextColor(aStyle.maMenuBarRolloverTextColor);
+ aStyleSet.SetMenuBarHighlightTextColor(aStyle.maMenuBarHighlightTextColor);
+ aStyleSet.SetMenuHighlightColor(aStyle.maMenuHighlightColor);
+ aStyleSet.SetMenuHighlightTextColor(aStyle.maMenuHighlightTextColor);
aStyleSet.SetHighlightColor(aStyle.maHighlightColor);
aStyleSet.SetHighlightTextColor(aStyle.maHighlightTextColor);
aStyleSet.SetActiveTabColor(aStyle.maActiveTabColor);
aStyleSet.SetInactiveTabColor(aStyle.maInactiveTabColor);
- aStyleSet.SetTabTextColor(Color(COL_BLACK));
- aStyleSet.SetTabRolloverTextColor(Color(COL_BLACK));
- aStyleSet.SetTabHighlightTextColor(Color(COL_BLACK));
- aStyleSet.SetDisableColor(Color(COL_GRAY));
- aStyleSet.SetHelpColor(Color(0xFF, 0xFF, 0xE0));
- aStyleSet.SetHelpTextColor(Color(COL_BLACK));
- aStyleSet.SetLinkColor(Color(COL_BLUE));
- aStyleSet.SetVisitedLinkColor(Color(0x00, 0x00, 0xCC));
- aStyleSet.SetToolTextColor(Color(COL_BLACK));
- aStyleSet.SetFontColor(Color(COL_BLACK));
+ aStyleSet.SetTabTextColor(aStyle.maTabTextColor);
+ aStyleSet.SetTabRolloverTextColor(aStyle.maTabRolloverTextColor);
+ aStyleSet.SetTabHighlightTextColor(aStyle.maTabHighlightTextColor);
+ aStyleSet.SetDisableColor(aStyle.maDisableColor);
+ aStyleSet.SetHelpColor(aStyle.maHelpColor);
+ aStyleSet.SetHelpTextColor(aStyle.maHelpTextColor);
+ aStyleSet.SetLinkColor(aStyle.maLinkColor);
+ aStyleSet.SetVisitedLinkColor(aStyle.maVisitedLinkColor);
+ aStyleSet.SetToolTextColor(aStyle.maToolTextColor);
+ aStyleSet.SetFontColor(aStyle.maFontColor);
rSettings.SetStyleSettings(aStyleSet);
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 488781496cad..9d916895d43b 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -22,19 +22,56 @@ namespace vcl
struct WidgetDrawStyle
{
uint32_t nSize;
- Color maFaceColor;
- Color maLightColor;
- Color maLightBorderColor;
- Color maShadowColor;
- Color maDarkShadowColor;
- Color maHighlightColor;
- Color maHighlightTextColor;
- Color maActiveTabColor;
- Color maInactiveTabColor;
- Color maWindowColor;
- Color maWindowTextColor;
- Color maDialogColor;
- Color maDialogTextColor;
+ uint32_t maFaceColor;
+ uint32_t maCheckedColor;
+ uint32_t maLightColor;
+ uint32_t maLightBorderColor;
+ uint32_t maShadowColor;
+ uint32_t maDarkShadowColor;
+ uint32_t maButtonTextColor;
+ uint32_t maButtonRolloverTextColor;
+ uint32_t maRadioCheckTextColor;
+ uint32_t maGroupTextColor;
+ uint32_t maLabelTextColor;
+ uint32_t maWindowColor;
+ uint32_t maWindowTextColor;
+ uint32_t maDialogColor;
+ uint32_t maDialogTextColor;
+ uint32_t maWorkspaceColor;
+ uint32_t maMonoColor;
+ uint32_t maFieldColor;
+ uint32_t maFieldTextColor;
+ uint32_t maFieldRolloverTextColor;
+ uint32_t maActiveColor;
+ uint32_t maActiveTextColor;
+ uint32_t maActiveBorderColor;
+ uint32_t maDeactiveColor;
+ uint32_t maDeactiveTextColor;
+ uint32_t maDeactiveBorderColor;
+ uint32_t maMenuColor;
+ uint32_t maMenuBarColor;
+ uint32_t maMenuBarRolloverColor;
+ uint32_t maMenuBorderColor;
+ uint32_t maMenuTextColor;
+ uint32_t maMenuBarTextColor;
+ uint32_t maMenuBarRolloverTextColor;
+ uint32_t maMenuBarHighlightTextColor;
+ uint32_t maMenuHighlightColor;
+ uint32_t maMenuHighlightTextColor;
+ uint32_t maHighlightColor;
+ uint32_t maHighlightTextColor;
+ uint32_t maActiveTabColor;
+ uint32_t maInactiveTabColor;
+ uint32_t maTabTextColor;
+ uint32_t maTabRolloverTextColor;
+ uint32_t maTabHighlightTextColor;
+ uint32_t maDisableColor;
+ uint32_t maHelpColor;
+ uint32_t maHelpTextColor;
+ uint32_t maLinkColor;
+ uint32_t maVisitedLinkColor;
+ uint32_t maToolTextColor;
+ uint32_t maFontColor;
};
struct ControlDrawParameters
diff --git a/vcl/inc/WidgetThemeLibraryTypes.hxx b/vcl/inc/WidgetThemeLibraryTypes.hxx
index a5a32109142d..c8a492313356 100644
--- a/vcl/inc/WidgetThemeLibraryTypes.hxx
+++ b/vcl/inc/WidgetThemeLibraryTypes.hxx
@@ -236,16 +236,15 @@ enum class ButtonValue {
};
// Color types
-typedef uint32_t ColorData;
-constexpr ColorData RGB_COLORDATA(uint8_t r, uint8_t g, uint8_t b) {
+constexpr uint32_t RGB_COLORDATA(uint8_t r, uint8_t g, uint8_t b) {
return uint32_t(b) | (uint32_t(g) << 8) | (uint32_t(r) << 16);
}
#define COLORDATA_RED( n ) ((uint8_t)((n)>>16))
#define COLORDATA_GREEN( n ) ((uint8_t)(((uint16_t)(n)) >> 8))
#define COLORDATA_BLUE( n ) ((uint8_t)(n))
-#define COLORDATA_RGB( n ) ((ColorData)((n) & 0x00FFFFFF))
+#define COLORDATA_RGB( n ) ((uint32_t)((n) & 0x00FFFFFF))
#define COL_BLACK RGB_COLORDATA( 0x00, 0x00, 0x00 )
#define COL_BLUE RGB_COLORDATA( 0x00, 0x00, 0x80 )
@@ -273,46 +272,6 @@ constexpr ColorData RGB_COLORDATA(uint8_t r, uint8_t g, uint8_t b) {
# define SAL_DLLPUBLIC_EXPORT __attribute__ ((visibility("default")))
#endif
-class SAL_DLLPUBLIC_EXPORT Color final
-{
- ColorData mnColor;
-
-public:
- explicit Color(ColorData nColor = COL_BLACK)
- : mnColor(nColor)
- {}
- Color(uint8_t nRed, uint8_t nGreen, uint8_t nBlue)
- : mnColor(RGB_COLORDATA(nRed, nGreen, nBlue))
- {}
-
- bool operator<(const Color& b) const
- {
- return mnColor < b.GetColor();
- }
-
- void SetColor(ColorData nColor)
- {
- mnColor = nColor;
- }
- ColorData GetColor() const
- {
- return mnColor;
- }
- ColorData GetRGBColor() const
- {
- return COLORDATA_RGB(mnColor);
- }
-
- bool operator==(const Color& rColor) const
- {
- return mnColor == rColor.mnColor;
- }
- bool operator!=(const Color& rColor) const
- {
- return !(Color::operator==(rColor));
- }
-};
-
namespace tools
{
commit b5e8afda4728f360401c52f3c8c2c92bad9d2136
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Fri Nov 2 09:24:19 2018 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:35 2018 +0100
LOK: custom widgets: check size of API structures
Change-Id: Iff50f7aeb471870230e9e822657deed6aefad268
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index d7eb359311a8..d1454911489f 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -311,6 +311,7 @@ bool CustomWidgetDraw::updateSettings(AllSettings& rSettings)
return false;
WidgetDrawStyle aStyle;
+ aStyle.nSize = sizeof(WidgetDrawStyle);
if (s_pWidgetImplementation->updateSettings(aStyle))
{
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index cfd10522b30d..488781496cad 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -21,6 +21,7 @@ namespace vcl
{
struct WidgetDrawStyle
{
+ uint32_t nSize;
Color maFaceColor;
Color maLightColor;
Color maLightBorderColor;
@@ -39,7 +40,8 @@ struct WidgetDrawStyle
struct ControlDrawParameters
{
ControlDrawParameters(cairo_t* i_pCairo, ControlPart i_ePart, ControlState i_eState)
- : pCairo(i_pCairo)
+ : nSize(sizeof(ControlDrawParameters))
+ , pCairo(i_pCairo)
, ePart(i_ePart)
, eState(i_eState)
, eButtonValue(ButtonValue::DontKnow)
@@ -48,6 +50,7 @@ struct ControlDrawParameters
{
}
+ uint32_t nSize;
cairo_t* pCairo;
ControlPart ePart;
ControlState eState;
@@ -92,7 +95,7 @@ struct _WidgetThemeLibrary
bool (*drawListNet)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
bool (*drawListHeader)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- bool (*updateSettings)(WidgetDrawStyle& rSettings);
+ bool (*updateSettings)(WidgetDrawStyle& rStyle);
};
extern "C" vcl::WidgetThemeLibrary* CreateWidgetThemeLibrary();
commit e010d5c3f8d3d6118323f750362e13e757f89e60
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Nov 2 13:28:52 2018 +0100
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:34 2018 +0100
LOK: custom widgets: No need for SAL_DLLPUBLIC_RTTI here any more.
Change-Id: I7cae61e1fa9cf74b98627d557890fd41047421df
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 44708bd30ee1..cfd10522b30d 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -56,10 +56,6 @@ struct ControlDrawParameters
int64_t nValue;
};
-#ifndef SAL_DLLPUBLIC_RTTI
-#define SAL_DLLPUBLIC_RTTI
-#endif
-
typedef struct _WidgetThemeLibrary WidgetThemeLibrary;
struct _WidgetThemeLibrary
commit 1043db68e0e5d5b4559e99a81112456bdc0b4507
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Thu Nov 1 23:33:32 2018 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:34 2018 +0100
LOK: custom widgets: convert WidgetThemeLibrary to POD for ABI compatibility
Change-Id: Ibc425d8e630460547d66723ccabeaf4ac29d2719
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 8f08669254c6..44708bd30ee1 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -60,47 +60,43 @@ struct ControlDrawParameters
#define SAL_DLLPUBLIC_RTTI
#endif
-class SAL_DLLPUBLIC_RTTI WidgetThemeLibrary
+typedef struct _WidgetThemeLibrary WidgetThemeLibrary;
+
+struct _WidgetThemeLibrary
{
-public:
- WidgetThemeLibrary();
- virtual ~WidgetThemeLibrary();
+ uint32_t nSize;
- virtual bool isNativeControlSupported(ControlType eType, ControlPart ePart);
- virtual bool getRegion(ControlType eType, ControlPart ePart, ControlState eState,
- const tools::Rectangle& rBoundingControlRegion,
- tools::Rectangle& rNativeBoundingRegion,
- tools::Rectangle& rNativeContentRegion);
+ bool (*isNativeControlSupported)(ControlType eType, ControlPart ePart);
+ bool (*getRegion)(ControlType eType, ControlPart ePart, ControlState eState,
+ const tools::Rectangle& rBoundingControlRegion,
+ tools::Rectangle& rNativeBoundingRegion,
+ tools::Rectangle& rNativeContentRegion);
- virtual bool drawPushButton(ControlDrawParameters const& rParameters, long nWidth,
- long nHeight);
- virtual bool drawRadiobutton(ControlDrawParameters const& rParameters, long nWidth,
- long nHeight);
- virtual bool drawCheckbox(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawCombobox(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawEditbox(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawScrollbar(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawSpinButtons(ControlDrawParameters const& rParameters, long nWidth,
- long nHeight);
- virtual bool drawSpinbox(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawTabItem(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawTabPane(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawTabHeader(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawTabBody(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawSlider(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawFixedline(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawToolbar(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawProgress(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawWindowsBackground(ControlDrawParameters const& rParameters, long nWidth,
- long nHeight);
- virtual bool drawListbox(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawFrame(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawListNode(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawListNet(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawListHeader(ControlDrawParameters const& rParameters, long nWidth,
- long nHeight);
+ bool (*drawPushButton)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawRadiobutton)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawCheckbox)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawCombobox)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawEditbox)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawScrollbar)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawSpinButtons)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawSpinbox)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawTabItem)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawTabPane)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawTabHeader)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawTabBody)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawSlider)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawFixedline)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawToolbar)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawProgress)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawWindowsBackground)(ControlDrawParameters const& rParameters, long nWidth,
+ long nHeight);
+ bool (*drawListbox)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawFrame)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawListNode)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawListNet)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawListHeader)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool updateSettings(WidgetDrawStyle& rSettings);
+ bool (*updateSettings)(WidgetDrawStyle& rSettings);
};
extern "C" vcl::WidgetThemeLibrary* CreateWidgetThemeLibrary();
commit 25741af1d255128f27444daf3705afece685322d
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Thu Nov 1 23:04:12 2018 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:34 2018 +0100
LOK: custom themes: isolate LO internals headers from theme plugin
Change-Id: Ic189aecf092b9cffd800e410d2d6e88016c43052
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index eee7266b67b8..fe9aecae089e 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -17801,6 +17801,7 @@ vcl/inc/unx/x11_cursors/wsshow_curs.h
vcl/inc/unx/x11_cursors/wsshow_mask.h
vcl/inc/vcleventlisteners.hxx
vcl/inc/vclpluginapi.h
+vcl/inc/WidgetThemeLibraryTypes.hxx
vcl/inc/wall2.hxx
vcl/inc/win/DWriteTextRenderer.hxx
vcl/inc/win/ScopedHDC.hxx
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index 38d52dedcfa2..d7eb359311a8 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -8,14 +8,13 @@
*
*/
+#include <cairo.h>
#include <headless/CustomWidgetDraw.hxx>
-#include <vcl/salnativewidgets.hxx>
#include <sal/main.h>
#include <sal/config.h>
#include <rtl/bootstrap.hxx>
#include <tools/svlibrary.h>
#include <osl/module.hxx>
-#include <cairo.h>
#include <svdata.hxx>
namespace vcl
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 59692de60012..8f08669254c6 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -11,10 +11,11 @@
#ifndef INCLUDED_VCL_INC_WIDGETTHEME_HXX
#define INCLUDED_VCL_INC_WIDGETTHEME_HXX
-#include <cairo.h>
-#include <vcl/dllapi.h>
-#include <vcl/salnativewidgets.hxx>
-#include <tools/color.hxx>
+/**
+ * This file expects cairo.h and the definition of
+ * the other types used here to be defined before
+ * including it.
+ */
namespace vcl
{
@@ -52,9 +53,13 @@ struct ControlDrawParameters
ControlState eState;
ButtonValue eButtonValue;
bool bIsStock;
- sal_Int64 nValue;
+ int64_t nValue;
};
+#ifndef SAL_DLLPUBLIC_RTTI
+#define SAL_DLLPUBLIC_RTTI
+#endif
+
class SAL_DLLPUBLIC_RTTI WidgetThemeLibrary
{
public:
diff --git a/vcl/inc/WidgetThemeLibraryTypes.hxx b/vcl/inc/WidgetThemeLibraryTypes.hxx
new file mode 100644
index 000000000000..a5a32109142d
--- /dev/null
+++ b/vcl/inc/WidgetThemeLibraryTypes.hxx
@@ -0,0 +1,404 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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_INC_WIDGETTHEMETYPES_HXX
+#define INCLUDED_VCL_INC_WIDGETTHEMETYPES_HXX
+
+#include <cstdint>
+#include <type_traits>
+
+/**
+ * These types are all based on the supported variants
+ * vcl/salnativewidgets.hxx and must be kept in-sync.
+ **/
+
+/* Control Types:
+ *
+ * Specify the overall, whole control
+ * type (as opposed to parts of the
+ * control if it were composite).
+ */
+
+enum class ControlType {
+// for use in general purpose ImplControlValue
+ Generic = 0,
+// Normal PushButton/Command Button
+ Pushbutton = 1,
+// Normal single radio button
+ Radiobutton = 2,
+// Normal single checkbox
+ Checkbox = 10,
+// Combobox, i.e. a ListBox
+// that allows data entry by user
+ Combobox = 20,
+// Control that allows text entry
+ Editbox = 30,
+// Control that allows text entry, but without the usual border
+// Has to be handled separately, because this one cannot handle
+// ControlPart::HasBackgroundTexture, which is drawn in the edit box'es
+// border window.
+ EditboxNoBorder = 31,
+// Control that allows text entry
+// ( some systems distinguish between single and multi line edit boxes )
+ MultilineEditbox = 32,
+// Control that pops up a menu,
+// but does NOT allow data entry
+ Listbox = 35,
+// An edit field together with two little
+// buttons on the side (aka spin field)
+ Spinbox = 40,
+// Two standalone spin buttons
+// without an edit field
+ SpinButtons = 45,
+// A single tab
+ TabItem = 50,
+// The border around a tab area,
+// but without the tabs themselves.
+// May have a gap at the top for
+// the active tab
+ TabPane = 55,
+// The background to the tab area
+ TabHeader = 56,
+// Background of a Tab Pane
+ TabBody = 57,
+// Normal scrollbar, including
+// all parts like slider, buttons
+ Scrollbar = 60,
+ Slider = 65,
+// A separator line
+ Fixedline = 80,
+// A toolbar control with buttons and a grip
+ Toolbar = 100,
+// The menubar
+ Menubar = 120,
+// popup menu
+ MenuPopup = 121,
+ Progress = 131,
+// Progress bar for the intro window
+// (aka splash screen), in case some
+// wants native progress bar in the
+// application but not for the splash
+// screen (used in desktop/)
+ IntroProgress = 132,
+// tool tips
+ Tooltip = 140,
+// to draw the implemented theme
+ WindowBackground = 150,
+//to draw border of frames natively
+ Frame = 160,
+// for nodes in listviews
+// used in svtools/source/contnr/svtreebx.cxx
+ ListNode = 170,
+// nets between elements of listviews
+// with nodes
+ ListNet = 171,
+// for list headers
+ ListHeader = 172,
+};
+
+
+/* Control Parts:
+ *
+ * Uniquely identify a part of a control,
+ * for example the slider of a scroll bar.
+ */
+
+enum class ControlPart
+{
+ NONE = 0,
+ Entire = 1,
+ ListboxWindow = 5, // the static listbox window containing the list
+ Button = 100,
+ ButtonUp = 101,
+ ButtonDown = 102, // Also for ComboBoxes/ListBoxes
+ ButtonLeft = 103,
+ ButtonRight = 104,
+ AllButtons = 105,
+ SeparatorHorz = 106,
+ SeparatorVert = 107,
+ TrackHorzLeft = 200,
+ TrackVertUpper = 201,
+ TrackHorzRight = 202,
+ TrackVertLower = 203,
+ TrackHorzArea = 204,
+ TrackVertArea = 205,
+ Arrow = 220,
+ ThumbHorz = 210, // Also used as toolbar grip
+ ThumbVert = 211, // Also used as toolbar grip
+ MenuItem = 250,
+ MenuItemCheckMark = 251,
+ MenuItemRadioMark = 252,
+ Separator = 253,
+ SubmenuArrow = 254,
+
+/* #i77549#
+ HACK: for scrollbars in case of thumb rect, page up and page down rect we
+ abuse the HitTestNativeScrollbar interface. All theming engines but aqua
+ are actually able to draw the thumb according to our internal representation.
+ However aqua draws a little outside. The canonical way would be to enhance the
+ HitTestNativeScrollbar passing a ScrollbarValue additionally so all necessary
+ information is available in the call.
+ .
+ However since there is only this one small exception we will deviate a little and
+ instead pass the respective rect as control region to allow for a small correction.
+
+ So all places using HitTestNativeScrollbar on ControlPart::ThumbHorz, ControlPart::ThumbVert,
+ ControlPart::TrackHorzLeft, ControlPart::TrackHorzRight, ControlPart::TrackVertUpper, ControlPart::TrackVertLower
+ do not use the control rectangle as region but the actuall part rectangle, making
+ only small deviations feasible.
+*/
+
+/** The edit field part of a control, e.g. of the combo box.
+
+ Currently used just for combo boxes and just for GetNativeControlRegion().
+ It is valid only if GetNativeControlRegion() supports ControlPart::ButtonDown as
+ well.
+*/
+ SubEdit = 300,
+
+// For controls that require the entire background
+// to be drawn first, and then other pieces over top.
+// (GTK+ scrollbars for example). Control region passed
+// in to draw this part is expected to be the entire
+// area of the control.
+// A control may respond to one or both.
+ DrawBackgroundHorz = 1000,
+ DrawBackgroundVert = 1001,
+
+// GTK+ also draws tabs right->left since there is a
+// hardcoded 2 pixel overlap between adjacent tabs
+ TabsDrawRtl = 3000,
+
+// For themes that do not want to have the focus
+// rectangle part drawn by VCL but take care of the
+// whole inner control part by themselves
+// eg, listboxes or comboboxes or spinbuttons
+ HasBackgroundTexture = 4000,
+
+// For scrollbars that have 3 buttons (most KDE themes)
+ HasThreeButtons = 5000,
+
+ BackgroundWindow = 6000,
+ BackgroundDialog = 6001,
+
+//to draw natively the border of frames
+ Border = 7000,
+
+//to draw natively the focus rects
+ Focus = 8000
+};
+
+/* Control State:
+ *
+ * Specify how a particular part of the control
+ * is to be drawn. Constants are bitwise OR-ed
+ * together to compose a final drawing state.
+ * A _disabled_ state is assumed by the drawing
+ * functions until an ENABLED or HIDDEN is passed
+ * in the ControlState.
+ */
+enum class ControlState {
+ NONE = 0,
+ ENABLED = 0x0001,
+ FOCUSED = 0x0002,
+ PRESSED = 0x0004,
+ ROLLOVER = 0x0008,
+ DEFAULT = 0x0020,
+ SELECTED = 0x0040,
+ DOUBLEBUFFERING = 0x4000, ///< Set when the control is painted using double-buffering via VirtualDevice.
+ CACHING_ALLOWED = 0x8000, ///< Set when the control is completely visible (i.e. not clipped).
+};
+
+inline bool operator& (const ControlState& lhs, const ControlState& rhs)
+{
+ return static_cast<std::underlying_type<ControlState>::type>(lhs)
+ & static_cast<std::underlying_type<ControlState>::type>(rhs);
+}
+
+/* ButtonValue:
+ *
+ * Identifies the tri-state value options
+ * that buttons allow
+ */
+
+enum class ButtonValue {
+ DontKnow,
+ On,
+ Off,
+ Mixed
+};
+
+// Color types
+typedef uint32_t ColorData;
+
+constexpr ColorData RGB_COLORDATA(uint8_t r, uint8_t g, uint8_t b) {
+ return uint32_t(b) | (uint32_t(g) << 8) | (uint32_t(r) << 16);
+}
+
+#define COLORDATA_RED( n ) ((uint8_t)((n)>>16))
+#define COLORDATA_GREEN( n ) ((uint8_t)(((uint16_t)(n)) >> 8))
+#define COLORDATA_BLUE( n ) ((uint8_t)(n))
+#define COLORDATA_RGB( n ) ((ColorData)((n) & 0x00FFFFFF))
+
+#define COL_BLACK RGB_COLORDATA( 0x00, 0x00, 0x00 )
+#define COL_BLUE RGB_COLORDATA( 0x00, 0x00, 0x80 )
+#define COL_GREEN RGB_COLORDATA( 0x00, 0x80, 0x00 )
+#define COL_CYAN RGB_COLORDATA( 0x00, 0x80, 0x80 )
+#define COL_RED RGB_COLORDATA( 0x80, 0x00, 0x00 )
+#define COL_RED_FONTCOLOR RGB_COLORDATA( 0xCE, 0x18, 0x1E )
+#define COL_MAGENTA RGB_COLORDATA( 0x80, 0x00, 0x80 )
+#define COL_BROWN RGB_COLORDATA( 0x80, 0x80, 0x00 )
+#define COL_GRAY RGB_COLORDATA( 0x80, 0x80, 0x80 )
+#define COL_GRAY3 RGB_COLORDATA( 0xCC, 0xCC, 0xCC )
+#define COL_GRAY7 RGB_COLORDATA( 0x66, 0x66, 0x66 )
+#define COL_LIGHTGRAY RGB_COLORDATA( 0xC0, 0xC0, 0xC0 )
+#define COL_LIGHTBLUE RGB_COLORDATA( 0x00, 0x00, 0xFF )
+#define COL_LIGHTGREEN RGB_COLORDATA( 0x00, 0xFF, 0x00 )
+#define COL_LIGHTCYAN RGB_COLORDATA( 0x00, 0xFF, 0xFF )
+#define COL_LIGHTRED RGB_COLORDATA( 0xFF, 0x00, 0x00 )
+#define COL_LIGHTMAGENTA RGB_COLORDATA( 0xFF, 0x00, 0xFF )
+#define COL_LIGHTGRAYBLUE RGB_COLORDATA( 0xE0, 0xE0, 0xFF )
+#define COL_YELLOW RGB_COLORDATA( 0xFF, 0xFF, 0x00 )
+#define COL_YELLOW_HIGHLIGHT RGB_COLORDATA( 0xFF, 0xF2, 0x00 )
+#define COL_WHITE RGB_COLORDATA( 0xFF, 0xFF, 0xFF )
+
+#ifndef SAL_DLLPUBLIC_EXPORT
+# define SAL_DLLPUBLIC_EXPORT __attribute__ ((visibility("default")))
+#endif
+
+class SAL_DLLPUBLIC_EXPORT Color final
+{
+ ColorData mnColor;
+
+public:
+ explicit Color(ColorData nColor = COL_BLACK)
+ : mnColor(nColor)
+ {}
+ Color(uint8_t nRed, uint8_t nGreen, uint8_t nBlue)
+ : mnColor(RGB_COLORDATA(nRed, nGreen, nBlue))
+ {}
+
+ bool operator<(const Color& b) const
+ {
+ return mnColor < b.GetColor();
+ }
+
+ void SetColor(ColorData nColor)
+ {
+ mnColor = nColor;
+ }
+ ColorData GetColor() const
+ {
+ return mnColor;
+ }
+ ColorData GetRGBColor() const
+ {
+ return COLORDATA_RGB(mnColor);
+ }
+
+ bool operator==(const Color& rColor) const
+ {
+ return mnColor == rColor.mnColor;
+ }
+ bool operator!=(const Color& rColor) const
+ {
+ return !(Color::operator==(rColor));
+ }
+};
+
+namespace tools
+{
+
+#define RECT_EMPTY ((short)-32767)
+
+class SAL_DLLPUBLIC_EXPORT Rectangle
+{
+public:
+ Rectangle();
+ Rectangle( long nLeft, long nTop,
+ long nRight, long nBottom );
+
+ long Left() const { return nLeft; }
+ long Right() const { return nRight; }
+ long Top() const { return nTop; }
+ long Bottom() const { return nBottom; }
+
+ long& Left() { return nLeft; }
+ long& Right() { return nRight; }
+ long& Top() { return nTop; }
+ long& Bottom() { return nBottom; }
+
+ /// Returns the difference between right and left, assuming the range is inclusive.
+ inline long GetWidth() const;
+ /// Returns the difference between bottom and top, assuming the range is inclusive.
+ inline long GetHeight() const;
+
+ long getX() const { return nLeft; }
+ long getY() const { return nTop; }
+
+private:
+ long nLeft;
+ long nTop;
+ long nRight;
+ long nBottom;
+};
+}
+
+inline tools::Rectangle::Rectangle()
+{
+ nLeft = nTop = 0;
+ nRight = nBottom = RECT_EMPTY;
+}
+
+inline tools::Rectangle::Rectangle( long _nLeft, long _nTop,
+ long _nRight, long _nBottom )
+{
+ nLeft = _nLeft;
+ nTop = _nTop;
+ nRight = _nRight;
+ nBottom = _nBottom;
+}
+
+inline long tools::Rectangle::GetWidth() const
+{
+ long n;
+ if ( nRight == RECT_EMPTY )
+ n = 0;
+ else
+ {
+ n = nRight - nLeft;
+ if( n < 0 )
+ n--;
+ else
+ n++;
+ }
+
+ return n;
+}
+
+inline long tools::Rectangle::GetHeight() const
+{
+ long n;
+ if ( nBottom == RECT_EMPTY )
+ n = 0;
+ else
+ {
+ n = nBottom - nTop;
+ if ( n < 0 )
+ n--;
+ else
+ n++;
+ }
+
+ return n;
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/headless/CustomWidgetDraw.hxx b/vcl/inc/headless/CustomWidgetDraw.hxx
index 89082803abc3..d0ddcea430bc 100644
--- a/vcl/inc/headless/CustomWidgetDraw.hxx
+++ b/vcl/inc/headless/CustomWidgetDraw.hxx
@@ -12,7 +12,6 @@
#define INCLUDED_VCL_INC_CUSTOMWIDGETDRAW_HXX
#include <vcl/dllapi.h>
-#include <vcl/salnativewidgets.hxx>
#include <WidgetDrawInterface.hxx>
#include <WidgetThemeLibrary.hxx>
#include <headless/svpgdi.hxx>
commit 7484f1691cbe9513dabf084effe8a0366b737a80
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Tue Oct 30 18:46:07 2018 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:33 2018 +0100
lok: custom widgets: render editbox borders
Change-Id: I1962a4a1397363b1c15e49d57b0bbcc9c232ce30
diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index bc05f65bbf2a..63b65e324920 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -118,7 +118,7 @@ private:
SAL_DLLPRIVATE void ImplInsertText( const OUString& rStr, const Selection* pNewSelection = nullptr, bool bIsUserInput = false );
SAL_DLLPRIVATE static OUString ImplGetValidString( const OUString& rString );
SAL_DLLPRIVATE void ImplClearBackground(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRectangle, long nXStart, long nXEnd);
- SAL_DLLPRIVATE void ImplPaintBorder(vcl::RenderContext const & rRenderContext);
+ SAL_DLLPRIVATE void ImplPaintBorder(vcl::RenderContext& rRenderContext);
SAL_DLLPRIVATE void ImplShowCursor( bool bOnlyIfVisible = true );
SAL_DLLPRIVATE void ImplAlign();
SAL_DLLPRIVATE void ImplAlignAndPaint();
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index e92c2639b23d..dbc15519c4a9 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -55,6 +55,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
+#include <comphelper/lok.hxx>
#include <sot/exchange.hxx>
#include <sot/formats.hxx>
@@ -985,7 +986,7 @@ void Edit::ImplClearBackground(vcl::RenderContext& rRenderContext, const tools::
}
}
-void Edit::ImplPaintBorder(vcl::RenderContext const & rRenderContext)
+void Edit::ImplPaintBorder(vcl::RenderContext& rRenderContext)
{
// this is not needed when double-buffering
if (SupportsDoubleBuffering())
@@ -1042,7 +1043,17 @@ void Edit::ImplPaintBorder(vcl::RenderContext const & rRenderContext)
}
else
{
- pBorder->Paint(*pBorder, tools::Rectangle());
+ // For some mysterious reaon, in headless/svp rendering,
+ // pBorder has bad clipping region (shows as 1x1 at 0,0),
+ // and therefore doesn't render anything at all.
+ // In the case that we know we're in headless/svp, we
+ // render directly on the current context (the edit control).
+ // But if we (the editbox) are part of a more complex control
+ // (e.g. spinbox), we render not (i.e. we let pBorder pretend).
+ if (!mbIsSubEdit && comphelper::LibreOfficeKit::isActive())
+ pBorder->Paint(rRenderContext, tools::Rectangle());
+ else
+ pBorder->Paint(*pBorder, tools::Rectangle());
}
}
}
commit 5f0f59840d5a7d05ba19587099a3c587172d447d
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Oct 27 13:23:46 2018 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:33 2018 +0100
custom widgets: rework colors and cleanup
Use ColorData for custom widget themes to
make it more readable and consistent.
Renamed and split out colors to be more accurately
named and representative of how they are used.
Fixed a number of inconsistencies in how colors
were used across widgets.
Change-Id: I1cbb5f19223bd55107379b049beccaf1de4e26b2
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index c428213c6000..38d52dedcfa2 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -334,7 +334,7 @@ bool CustomWidgetDraw::updateSettings(AllSettings& rSettings)
aStyleSet.SetDialogTextColor(aStyle.maDialogTextColor);
aStyleSet.SetWorkspaceColor(Color(0xDF, 0xDF, 0xDE));
aStyleSet.SetMonoColor(Color(COL_BLACK));
- aStyleSet.SetFieldColor(Color(COL_WHITE));
+ aStyleSet.SetFieldColor(Color(aStyle.maFaceColor));
aStyleSet.SetFieldTextColor(Color(COL_BLACK));
aStyleSet.SetFieldRolloverTextColor(Color(COL_BLACK));
aStyleSet.SetActiveColor(Color(COL_BLUE));
@@ -349,10 +349,10 @@ bool CustomWidgetDraw::updateSettings(AllSettings& rSettings)
aStyleSet.SetMenuBorderColor(Color(COL_LIGHTGRAY));
aStyleSet.SetMenuTextColor(Color(COL_BLACK));
aStyleSet.SetMenuBarTextColor(Color(COL_BLACK));
- aStyleSet.SetMenuBarRolloverTextColor(Color(COL_WHITE));
- aStyleSet.SetMenuBarHighlightTextColor(Color(COL_WHITE));
+ aStyleSet.SetMenuBarRolloverTextColor(Color(COL_BLACK));
+ aStyleSet.SetMenuBarHighlightTextColor(Color(COL_BLACK));
aStyleSet.SetMenuHighlightColor(aStyle.maHighlightColor);
- aStyleSet.SetMenuHighlightTextColor(Color(COL_WHITE));
+ aStyleSet.SetMenuHighlightTextColor(Color(COL_BLACK));
aStyleSet.SetHighlightColor(aStyle.maHighlightColor);
aStyleSet.SetHighlightTextColor(aStyle.maHighlightTextColor);
aStyleSet.SetActiveTabColor(aStyle.maActiveTabColor);
commit dee7b2621a47c2f681c044f5ef771df0a02779a7
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Oct 27 10:53:43 2018 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:32 2018 +0100
LOK: custom widgets: don't clobber the custom colors
The old logic threw away the result of updateSettings
by applying the styles saved and modified after calling
it, which lost all the custom colors thereby breaking
custom-widgets and themeing altogether.
Change-Id: Ic3750f145b67cd6a379f3b628a10c213a31656e7
diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx
index 4958b9d9421d..f159a0cd6f86 100644
--- a/vcl/headless/svpframe.cxx
+++ b/vcl/headless/svpframe.cxx
@@ -439,13 +439,14 @@ void SvpSalFrame::UpdateSettings( AllSettings& rSettings )
}
bFreeGraphics = true;
}
+ rSettings.SetStyleSettings(aStyleSettings);
pGraphics->updateSettings(rSettings);
if (bFreeGraphics)
ReleaseGraphics(pGraphics);
}
-
- rSettings.SetStyleSettings( aStyleSettings );
+ else
+ rSettings.SetStyleSettings(aStyleSettings);
}
void SvpSalFrame::Beep()
commit 93ffc5cd079dda8eb77f625aa7119f9d6b614fab
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Oct 27 10:50:44 2018 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:32 2018 +0100
LOK: custom widgets: support custom menu colors
Change-Id: Icd6367fa40f9655cd58816461f0d2fca6f6932e2
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index bdae8cea8ade..c428213c6000 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -343,15 +343,15 @@ bool CustomWidgetDraw::updateSettings(AllSettings& rSettings)
aStyleSet.SetDeactiveColor(Color(COL_GRAY));
aStyleSet.SetDeactiveTextColor(Color(COL_LIGHTGRAY));
aStyleSet.SetDeactiveBorderColor(Color(COL_LIGHTGRAY));
- aStyleSet.SetMenuColor(Color(COL_LIGHTGRAY));
- aStyleSet.SetMenuBarColor(Color(COL_LIGHTGRAY));
- aStyleSet.SetMenuBarRolloverColor(Color(COL_BLUE));
+ aStyleSet.SetMenuColor(Color(COL_WHITE));
+ aStyleSet.SetMenuBarColor(Color(COL_WHITE));
+ aStyleSet.SetMenuBarRolloverColor(aStyle.maHighlightColor);
aStyleSet.SetMenuBorderColor(Color(COL_LIGHTGRAY));
aStyleSet.SetMenuTextColor(Color(COL_BLACK));
aStyleSet.SetMenuBarTextColor(Color(COL_BLACK));
aStyleSet.SetMenuBarRolloverTextColor(Color(COL_WHITE));
aStyleSet.SetMenuBarHighlightTextColor(Color(COL_WHITE));
- aStyleSet.SetMenuHighlightColor(Color(COL_BLUE));
+ aStyleSet.SetMenuHighlightColor(aStyle.maHighlightColor);
aStyleSet.SetMenuHighlightTextColor(Color(COL_WHITE));
aStyleSet.SetHighlightColor(aStyle.maHighlightColor);
aStyleSet.SetHighlightTextColor(aStyle.maHighlightTextColor);
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index 38bb20301bef..aa9bd5a8bc1c 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -23,6 +23,7 @@
#include <sal/log.hxx>
#include <salmenu.hxx>
+#include <salframe.hxx>
#include <svdata.hxx>
#include <vcl/decoview.hxx>
#include <vcl/settings.hxx>
@@ -136,8 +137,22 @@ void MenuFloatingWindow::ApplySettings(vcl::RenderContext& rRenderContext)
{
FloatingWindow::ApplySettings(rRenderContext);
- const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
+ if (IsNativeControlSupported(ControlType::MenuPopup, ControlPart::MenuItem) &&
+ IsNativeControlSupported(ControlType::MenuPopup, ControlPart::Entire))
+ {
+ AllSettings aSettings(GetSettings());
+ ImplGetFrame()->UpdateSettings(aSettings); // Update theme colors.
+ StyleSettings aStyle(aSettings.GetStyleSettings());
+ Color aHighlightTextColor = ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor;
+ if (aHighlightTextColor != Color(COL_TRANSPARENT))
+ {
+ aStyle.SetMenuHighlightTextColor(aHighlightTextColor);
+ }
+ aSettings.SetStyleSettings(aStyle);
+ OutputDevice::SetSettings(aSettings);
+ }
+ const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
SetPointFont(rRenderContext, rStyleSettings.GetMenuFont());
if (rRenderContext.IsNativeControlSupported(ControlType::MenuPopup, ControlPart::Entire))
commit 23a5a45ee4a8a097192e3c137910a1c81d3604a2
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Oct 14 20:06:13 2018 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:31 2018 +0100
custom widgets: correct focus colors and render button-up in listboxes
Change-Id: I70f46f94747f468a2bb79f8baa4576e4460bef31
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index 5698f0ac34d8..bdae8cea8ade 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -53,9 +53,8 @@ CustomWidgetDraw::~CustomWidgetDraw() {}
bool CustomWidgetDraw::isNativeControlSupported(ControlType eType, ControlPart ePart)
{
- if (!s_pWidgetImplementation)
- return false;
- return s_pWidgetImplementation->isNativeControlSupported(eType, ePart);
+ return s_pWidgetImplementation
+ && s_pWidgetImplementation->isNativeControlSupported(eType, ePart);
}
bool CustomWidgetDraw::hitTestNativeControl(ControlType /*eType*/, ControlPart /*ePart*/,
@@ -302,11 +301,9 @@ bool CustomWidgetDraw::getNativeControlRegion(
ControlState eState, const ImplControlValue& /*aValue*/, const OUString& /*aCaption*/,
tools::Rectangle& rNativeBoundingRegion, tools::Rectangle& rNativeContentRegion)
{
- if (!s_pWidgetImplementation)
- return false;
-
- return s_pWidgetImplementation->getRegion(eType, ePart, eState, rBoundingControlRegion,
- rNativeBoundingRegion, rNativeContentRegion);
+ return s_pWidgetImplementation
+ && s_pWidgetImplementation->getRegion(eType, ePart, eState, rBoundingControlRegion,
+ rNativeBoundingRegion, rNativeContentRegion);
}
bool CustomWidgetDraw::updateSettings(AllSettings& rSettings)
commit 86dcf8e1527d81d1da7f130a59068ef02a6f7cbd
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Sep 20 00:12:25 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:31 2018 +0100
custom widgets: comment unused params. to avoid compile warnings
Change-Id: I45b7ffdce2d470ed2f30b5408d8d861deb00514a
diff --git a/vcl/source/gdi/salnativewidgets-none.cxx b/vcl/source/gdi/salnativewidgets-none.cxx
index 5fa71d19eb0b..a7086023cad6 100644
--- a/vcl/source/gdi/salnativewidgets-none.cxx
+++ b/vcl/source/gdi/salnativewidgets-none.cxx
@@ -19,33 +19,33 @@
#include <salgdi.hxx>
-bool SalGraphics::IsNativeControlSupported(ControlType eType, ControlPart ePart)
+bool SalGraphics::IsNativeControlSupported(ControlType /*eType*/, ControlPart /*ePart*/)
{
return false;
}
-bool SalGraphics::hitTestNativeControl(ControlType eType, ControlPart ePart,
- const tools::Rectangle& rBoundingControlRegion,
- const Point& rPosition, bool& rIsInside)
+bool SalGraphics::hitTestNativeControl(ControlType /*eType*/, ControlPart /*ePart*/,
+ const tools::Rectangle& /*rBoundingControlRegion*/,
+ const Point& /*rPosition*/, bool& /*rIsInside*/)
{
return false;
}
-bool SalGraphics::drawNativeControl(ControlType eType, ControlPart ePart,
- const tools::Rectangle& rBoundingControlRegion,
- ControlState eState, const ImplControlValue& aValue,
- const OUString& aCaptions)
+bool SalGraphics::drawNativeControl(ControlType /*eType*/, ControlPart /*ePart*/,
+ const tools::Rectangle& /*rBoundingControlRegion*/,
+ ControlState /*eState*/, const ImplControlValue& /*aValue*/,
+ const OUString& /*aCaptions*/)
{
return false;
}
-bool SalGraphics::getNativeControlRegion(ControlType eType, ControlPart ePart,
- const tools::Rectangle& rBoundingControlRegion,
- ControlState eState,
- const ImplControlValue& aValue,
- const OUString& aCaption,
- tools::Rectangle& rNativeBoundingRegion,
- tools::Rectangle& rNativeContentRegion)
+bool SalGraphics::getNativeControlRegion(ControlType /*eType*/, ControlPart /*ePart*/,
+ const tools::Rectangle& /*rBoundingControlRegion*/,
+ ControlState /*eState*/,
+ const ImplControlValue& /*aValue*/,
+ const OUString& /*aCaption*/,
+ tools::Rectangle& /*rNativeBoundingRegion*/,
+ tools::Rectangle& /*rNativeContentRegion*/)
{
return false;
}
commit b838e7e800d7c05bbe168a0eb8efa625d8b539cf
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Sep 20 00:06:52 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:31 2018 +0100
custom widgets: setup style setting in the widget library
Some theme colors are set using the style settings, which are
implemented by each backend to correspond to the system theme.
For custom widgets these need to also be set by the library
itself. This commit adds the ground work and sets some of the
colors for windows backgrounds.
Change-Id: Ia65b1605b2b7bef7f01ff1feff2e7470479e626a
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index 5cf2ccf83f55..5698f0ac34d8 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -309,6 +309,76 @@ bool CustomWidgetDraw::getNativeControlRegion(
rNativeBoundingRegion, rNativeContentRegion);
}
+bool CustomWidgetDraw::updateSettings(AllSettings& rSettings)
+{
+ if (!s_pWidgetImplementation)
+ return false;
+
+ WidgetDrawStyle aStyle;
+
+ if (s_pWidgetImplementation->updateSettings(aStyle))
+ {
+ StyleSettings aStyleSet = rSettings.GetStyleSettings();
+
+ aStyleSet.SetFaceColor(aStyle.maFaceColor);
+ aStyleSet.SetCheckedColor(Color(0xCC, 0xCC, 0xCC));
+ aStyleSet.SetLightColor(aStyle.maLightColor);
+ aStyleSet.SetLightBorderColor(aStyle.maLightBorderColor);
+ aStyleSet.SetShadowColor(aStyle.maShadowColor);
+ aStyleSet.SetDarkShadowColor(aStyle.maDarkShadowColor);
+ aStyleSet.SetButtonTextColor(Color(COL_BLACK));
+ aStyleSet.SetButtonRolloverTextColor(Color(COL_BLACK));
+ aStyleSet.SetRadioCheckTextColor(Color(COL_BLACK));
+ aStyleSet.SetGroupTextColor(Color(COL_BLACK));
+ aStyleSet.SetLabelTextColor(Color(COL_BLACK));
+ aStyleSet.SetWindowColor(aStyle.maWindowColor);
+ aStyleSet.SetWindowTextColor(aStyle.maWindowTextColor);
+ aStyleSet.SetDialogColor(aStyle.maDialogColor);
+ aStyleSet.SetDialogTextColor(aStyle.maDialogTextColor);
+ aStyleSet.SetWorkspaceColor(Color(0xDF, 0xDF, 0xDE));
+ aStyleSet.SetMonoColor(Color(COL_BLACK));
+ aStyleSet.SetFieldColor(Color(COL_WHITE));
+ aStyleSet.SetFieldTextColor(Color(COL_BLACK));
+ aStyleSet.SetFieldRolloverTextColor(Color(COL_BLACK));
+ aStyleSet.SetActiveColor(Color(COL_BLUE));
+ aStyleSet.SetActiveTextColor(Color(COL_WHITE));
+ aStyleSet.SetActiveBorderColor(Color(COL_LIGHTGRAY));
+ aStyleSet.SetDeactiveColor(Color(COL_GRAY));
+ aStyleSet.SetDeactiveTextColor(Color(COL_LIGHTGRAY));
+ aStyleSet.SetDeactiveBorderColor(Color(COL_LIGHTGRAY));
+ aStyleSet.SetMenuColor(Color(COL_LIGHTGRAY));
+ aStyleSet.SetMenuBarColor(Color(COL_LIGHTGRAY));
+ aStyleSet.SetMenuBarRolloverColor(Color(COL_BLUE));
+ aStyleSet.SetMenuBorderColor(Color(COL_LIGHTGRAY));
+ aStyleSet.SetMenuTextColor(Color(COL_BLACK));
+ aStyleSet.SetMenuBarTextColor(Color(COL_BLACK));
+ aStyleSet.SetMenuBarRolloverTextColor(Color(COL_WHITE));
+ aStyleSet.SetMenuBarHighlightTextColor(Color(COL_WHITE));
+ aStyleSet.SetMenuHighlightColor(Color(COL_BLUE));
+ aStyleSet.SetMenuHighlightTextColor(Color(COL_WHITE));
+ aStyleSet.SetHighlightColor(aStyle.maHighlightColor);
+ aStyleSet.SetHighlightTextColor(aStyle.maHighlightTextColor);
+ aStyleSet.SetActiveTabColor(aStyle.maActiveTabColor);
+ aStyleSet.SetInactiveTabColor(aStyle.maInactiveTabColor);
+ aStyleSet.SetTabTextColor(Color(COL_BLACK));
+ aStyleSet.SetTabRolloverTextColor(Color(COL_BLACK));
+ aStyleSet.SetTabHighlightTextColor(Color(COL_BLACK));
+ aStyleSet.SetDisableColor(Color(COL_GRAY));
+ aStyleSet.SetHelpColor(Color(0xFF, 0xFF, 0xE0));
+ aStyleSet.SetHelpTextColor(Color(COL_BLACK));
+ aStyleSet.SetLinkColor(Color(COL_BLUE));
+ aStyleSet.SetVisitedLinkColor(Color(0x00, 0x00, 0xCC));
+ aStyleSet.SetToolTextColor(Color(COL_BLACK));
+ aStyleSet.SetFontColor(Color(COL_BLACK));
+
+ rSettings.SetStyleSettings(aStyleSet);
+
+ return true;
+ }
+
+ return false;
+}
+
} // end vcl namespace
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx
index 0e7b1bed139c..4958b9d9421d 100644
--- a/vcl/headless/svpframe.cxx
+++ b/vcl/headless/svpframe.cxx
@@ -426,6 +426,23 @@ void SvpSalFrame::UpdateSettings( AllSettings& rSettings )
aStdFont.SetFontSize(Size(0, 12));
aStyleSettings.SetMenuFont(aStdFont);
+
+ SvpSalGraphics* pGraphics = m_aGraphics.back();
+ bool bFreeGraphics = false;
+ if (!pGraphics)
+ {
+ pGraphics = dynamic_cast<SvpSalGraphics*>(AcquireGraphics());
+ if (!pGraphics)
+ {
+ SAL_WARN("vcl.gtk3", "Could not get graphics - unable to update settings");
+ return;
+ }
+ bFreeGraphics = true;
+ }
+ pGraphics->updateSettings(rSettings);
+
+ if (bFreeGraphics)
+ ReleaseGraphics(pGraphics);
}
rSettings.SetStyleSettings( aStyleSettings );
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 8941faef5c18..4af25f82478d 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -1949,6 +1949,13 @@ bool SvpSalGraphics::getNativeControlRegion(ControlType eType, ControlPart ePart
return false;
}
+void SvpSalGraphics::updateSettings(AllSettings& rSettings)
+{
+ if (hasWidgetDraw())
+ {
+ m_pWidgetDraw->updateSettings(rSettings);
+ }
+}
namespace
{
diff --git a/vcl/inc/WidgetDrawInterface.hxx b/vcl/inc/WidgetDrawInterface.hxx
index ce6c5d43babe..4d1ecce7a3fe 100644
--- a/vcl/inc/WidgetDrawInterface.hxx
+++ b/vcl/inc/WidgetDrawInterface.hxx
@@ -12,6 +12,8 @@
#define INCLUDED_VCL_INC_WIDGETDRAWINTERFACE_HXX
#include <vcl/dllapi.h>
+#include <vcl/salnativewidgets.hxx>
+#include <vcl/settings.hxx>
namespace vcl
{
@@ -91,6 +93,8 @@ public:
tools::Rectangle& rNativeBoundingRegion,
tools::Rectangle& rNativeContentRegion)
= 0;
+
+ virtual bool updateSettings(AllSettings& rSettings) = 0;
};
}
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 7d38112130c8..59692de60012 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -14,9 +14,27 @@
#include <cairo.h>
#include <vcl/dllapi.h>
#include <vcl/salnativewidgets.hxx>
+#include <tools/color.hxx>
namespace vcl
{
+struct WidgetDrawStyle
+{
+ Color maFaceColor;
+ Color maLightColor;
+ Color maLightBorderColor;
+ Color maShadowColor;
+ Color maDarkShadowColor;
+ Color maHighlightColor;
+ Color maHighlightTextColor;
+ Color maActiveTabColor;
+ Color maInactiveTabColor;
+ Color maWindowColor;
+ Color maWindowTextColor;
+ Color maDialogColor;
+ Color maDialogTextColor;
+};
+
struct ControlDrawParameters
{
ControlDrawParameters(cairo_t* i_pCairo, ControlPart i_ePart, ControlState i_eState)
@@ -76,6 +94,8 @@ public:
virtual bool drawListNet(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawListHeader(ControlDrawParameters const& rParameters, long nWidth,
long nHeight);
+
+ virtual bool updateSettings(WidgetDrawStyle& rSettings);
};
extern "C" vcl::WidgetThemeLibrary* CreateWidgetThemeLibrary();
diff --git a/vcl/inc/headless/CustomWidgetDraw.hxx b/vcl/inc/headless/CustomWidgetDraw.hxx
index ce749ac15b63..89082803abc3 100644
--- a/vcl/inc/headless/CustomWidgetDraw.hxx
+++ b/vcl/inc/headless/CustomWidgetDraw.hxx
@@ -16,6 +16,7 @@
#include <WidgetDrawInterface.hxx>
#include <WidgetThemeLibrary.hxx>
#include <headless/svpgdi.hxx>
+#include <vcl/settings.hxx>
#include <memory>
namespace vcl
@@ -45,6 +46,8 @@ public:
const ImplControlValue& aValue, const OUString& aCaption,
tools::Rectangle& rNativeBoundingRegion,
tools::Rectangle& rNativeContentRegion) override;
+
+ bool updateSettings(AllSettings& rSettings) override;
};
} // end vcl namespace
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index b8d20a548a6f..21b1b0537c8e 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -280,6 +280,8 @@ public:
tools::Rectangle& rNativeBoundingRegion,
tools::Rectangle& rNativeContentRegion) override;
+ virtual void updateSettings(AllSettings& rSettings);
+
#if ENABLE_CAIRO_CANVAS
virtual bool SupportsCairo() const override;
virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override;
diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index e5eaef3747c1..839ee9eaac45 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -120,6 +120,9 @@ public:
const OUString& rCaption,
tools::Rectangle &rNativeBoundingRegion,
tools::Rectangle &rNativeContentRegion ) override;
+
+ virtual void updateSettings(AllSettings& rSettings) override;
+
#if ENABLE_CAIRO_CANVAS
virtual bool SupportsCairo() const override;
@@ -130,7 +133,6 @@ public:
void WidgetQueueDraw() const;
- void updateSettings( AllSettings& rSettings );
static void refreshFontconfig( GtkSettings *pSettings );
static void signalSettingsNotify( GObject*, GParamSpec *pSpec, gpointer );
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 1a1e280b08a8..af2b5fd0e1a0 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -2876,8 +2876,14 @@ vcl::Font pango_to_vcl(const PangoFontDescription* font, const css::lang::Locale
return aFont;
}
-void GtkSalGraphics::updateSettings( AllSettings& rSettings )
+void GtkSalGraphics::updateSettings(AllSettings& rSettings)
{
+ if (m_pWidgetDraw)
+ {
+ m_pWidgetDraw->updateSettings(rSettings);
+ return;
+ }
+
GtkStyleContext* pStyle = gtk_widget_get_style_context( mpWindow );
GtkSettings* pSettings = gtk_widget_get_settings( mpWindow );
StyleSettings aStyleSet = rSettings.GetStyleSettings();
commit 7d879658886cd73b38b12e5e6081bac7eda145d1
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Sep 11 22:35:12 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:30 2018 +0100
custom widgets: draw fixed line widget
Change-Id: Icb8cfbe09caf5cbfcf1d3f461c297c052056250d
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index aa4732c1bd05..5cf2ccf83f55 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -236,7 +236,10 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
}
break;
case ControlType::Fixedline:
- break;
+ {
+ bOK = s_pWidgetImplementation->drawFixedline(aParameters, nWidth, nHeight);
+ }
+ break;
case ControlType::Toolbar:
{
bOK = s_pWidgetImplementation->drawToolbar(aParameters, nWidth, nHeight);
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 19249d498034..7d38112130c8 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -65,6 +65,7 @@ public:
virtual bool drawTabHeader(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawTabBody(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawSlider(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ virtual bool drawFixedline(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawToolbar(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawProgress(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawWindowsBackground(ControlDrawParameters const& rParameters, long nWidth,
commit 61dc61fd3612118718374a0bd5a6ceedfb2a4300
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Sep 11 17:35:08 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:30 2018 +0100
custom widgets: differentiate stock and non-stock buttons
Change-Id: I05f01058d7886dacec3b00dcf31313aea3939164
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index 37088f6aa968..aa4732c1bd05 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -96,6 +96,9 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
break;
case ControlType::Pushbutton:
{
+ const PushButtonValue* pPushButtonValue = static_cast<const PushButtonValue*>(&rValue);
+ if (pPushButtonValue)
+ aParameters.bIsStock = pPushButtonValue->mbIsStock;
bOK = s_pWidgetImplementation->drawPushButton(aParameters, nWidth, nHeight);
}
break;
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 53d5e5769ffa..19249d498034 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -24,6 +24,7 @@ struct ControlDrawParameters
, ePart(i_ePart)
, eState(i_eState)
, eButtonValue(ButtonValue::DontKnow)
+ , bIsStock(false)
, nValue(0)
{
}
@@ -32,6 +33,7 @@ struct ControlDrawParameters
ControlPart ePart;
ControlState eState;
ButtonValue eButtonValue;
+ bool bIsStock;
sal_Int64 nValue;
};
commit 137bb940521afd0a5c0591d9edac17f4156c53f9
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Sep 11 17:29:20 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:29 2018 +0100
vcl: mark stock buttons and transfer this to NWF on drawing
Stock buttons like OK/Cancel/Help need sometimes to be drawn
differently than just another button. For this we need to mark
such push buttons as "stock" when building them from a glade file
and transfer this information down to the NWF backend when drawing
the widget.
Change-Id: I131657f026a731208db47f4c8220622c8aabb464
diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx
index 38c094a2d9dc..76e16bf6dfb5 100644
--- a/include/vcl/button.hxx
+++ b/include/vcl/button.hxx
@@ -163,6 +163,16 @@ public:
virtual bool set_property(const OString &rKey, const OUString &rValue) override;
virtual void ShowFocus(const tools::Rectangle& rRect) override;
+ void setStock(bool bIsStock)
+ {
+ mbIsStock = bIsStock;
+ }
+
+ bool isStock()
+ {
+ return mbIsStock;
+ }
+
protected:
PushButtonDropdownStyle mnDDStyle;
bool mbIsActive;
@@ -199,6 +209,7 @@ private:
SymbolType meSymbol;
TriState meState;
bool mbPressed;
+ bool mbIsStock;
};
inline void PushButton::Check( bool bCheck )
diff --git a/include/vcl/salnativewidgets.hxx b/include/vcl/salnativewidgets.hxx
index f6132e5bb17e..9ccfa0319057 100644
--- a/include/vcl/salnativewidgets.hxx
+++ b/include/vcl/salnativewidgets.hxx
@@ -494,8 +494,12 @@ class VCL_DLLPUBLIC PushButtonValue : public ImplControlValue
{
public:
PushButtonValue()
- : ImplControlValue( ControlType::Pushbutton, 0 )
- , mbBevelButton( false ), mbSingleLine( true ) {}
+ : ImplControlValue( ControlType::Pushbutton, 0 )
+ , mbBevelButton(false)
+ , mbSingleLine(true)
+ , mbIsStock(false)
+ {}
+
virtual ~PushButtonValue() override;
virtual PushButtonValue* clone() const override;
@@ -504,8 +508,9 @@ public:
PushButtonValue & operator =(PushButtonValue const &) = delete; // due to ImplControlValue
PushButtonValue & operator =(PushButtonValue &&) = delete; // due to ImplControlValue
- bool mbBevelButton:1; // only used on OSX
- bool mbSingleLine:1; // only used on OSX
+ bool mbBevelButton:1; // only used on OSX
+ bool mbSingleLine:1; // only used on OSX
+ bool mbIsStock:1;
};
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 92d8b8227aaa..54600b8ea31d 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -634,6 +634,7 @@ void PushButton::ImplInitPushButtonData()
mnDDStyle = PushButtonDropdownStyle::NONE;
mbIsActive = false;
mbPressed = false;
+ mbIsStock = false;
}
namespace
@@ -1044,6 +1045,8 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext)
if (bNativeOK)
{
PushButtonValue aControlValue;
+ aControlValue.mbIsStock = isStock();
+
tools::Rectangle aCtrlRegion(aInRect);
ControlState nState = ControlState::NONE;
@@ -1697,7 +1700,8 @@ void PushButton::ShowFocus(const tools::Rectangle& rRect)
{
if (IsNativeControlSupported(ControlType::Pushbutton, ControlPart::Focus))
{
- ImplControlValue aControlValue;
+ PushButtonValue aControlValue;
+ aControlValue.mbIsStock = isStock();
tools::Rectangle aInRect(Point(), GetOutputSizePixel());
GetOutDev()->DrawNativeControl(ControlType::Pushbutton, ControlPart::Focus, aInRect,
ControlState::FOCUSED, aControlValue, OUString());
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 8c0e98154a37..c56ac2242304 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1128,6 +1128,9 @@ namespace
xWindow = VclPtr<PushButton>::Create(pParent, nBits);
xWindow->SetText(getStockText(sType));
}
+ PushButton* pPushButton = dynamic_cast<PushButton*>(xWindow.get());
+ if (pPushButton)
+ pPushButton->setStock(true);
}
if (!xWindow)
commit dc75cdaf5e31a7b38c49658e083cc7798e95b8db
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Sep 10 12:01:06 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:29 2018 +0100
custom widgets: editbox - draw focus rectangle
Change-Id: I5d038d165d5ff08a07d24906f6a7cc2d6176f1ac
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index 22d2678b57a1..37088f6aa968 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -16,6 +16,7 @@
#include <tools/svlibrary.h>
#include <osl/module.hxx>
#include <cairo.h>
+#include <svdata.hxx>
namespace vcl
{
@@ -37,6 +38,14 @@ CustomWidgetDraw::CustomWidgetDraw(SvpSalGraphics& rGraphics)
if (fCreateWidgetThemeLibraryFunction)
s_pWidgetImplementation = (*fCreateWidgetThemeLibraryFunction)();
+
+ // Init
+ if (s_pWidgetImplementation)
+ {
+ ImplSVData* pSVData = ImplGetSVData();
+ pSVData->maNWFData.mbNoFocusRects = true;
+ pSVData->maNWFData.mbNoFocusRectsForFlatButtons = true;
+ }
}
}
commit ef4e531b59b10efbd6a0c8adf60bb41aa4c91ae4
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Sep 3 15:15:43 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:28 2018 +0100
custom widgets: return early when the widget lib is not available
Change-Id: I1d740b4a3840f73015f34bd2143663a919db2956
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index ef1a0a053033..22d2678b57a1 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -44,6 +44,8 @@ CustomWidgetDraw::~CustomWidgetDraw() {}
bool CustomWidgetDraw::isNativeControlSupported(ControlType eType, ControlPart ePart)
{
+ if (!s_pWidgetImplementation)
+ return false;
return s_pWidgetImplementation->isNativeControlSupported(eType, ePart);
}
@@ -59,7 +61,7 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
ControlState eState, const ImplControlValue& rValue,
const OUString& /*aCaptions*/)
{
- if (s_pWidgetImplementation == nullptr)
+ if (!s_pWidgetImplementation)
return false;
bool bOldAA = m_rGraphics.getAntiAliasB2DDraw();
@@ -285,7 +287,7 @@ bool CustomWidgetDraw::getNativeControlRegion(
ControlState eState, const ImplControlValue& /*aValue*/, const OUString& /*aCaption*/,
tools::Rectangle& rNativeBoundingRegion, tools::Rectangle& rNativeContentRegion)
{
- if (s_pWidgetImplementation == nullptr)
+ if (!s_pWidgetImplementation)
return false;
return s_pWidgetImplementation->getRegion(eType, ePart, eState, rBoundingControlRegion,
commit eef2768482037d3eb161a5f3d7dd1bc46ccf5ff9
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri Aug 31 10:09:27 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:28 2018 +0100
custom widgets: enable anti-aliasing when drawing widgets
Change-Id: I050d8534cacdee63109158dbc150d9d13b43fe5e
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index ab4dec19b44e..ef1a0a053033 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -62,7 +62,10 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
if (s_pWidgetImplementation == nullptr)
return false;
- cairo_t* pCairoContext = m_rGraphics.getCairoContext(true);
+ bool bOldAA = m_rGraphics.getAntiAliasB2DDraw();
+ m_rGraphics.setAntiAliasB2DDraw(true);
+
+ cairo_t* pCairoContext = m_rGraphics.getCairoContext(false);
m_rGraphics.clipRegion(pCairoContext);
cairo_translate(pCairoContext, rControlRegion.Left(), rControlRegion.Top());
@@ -272,6 +275,8 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
m_rGraphics.releaseCairoContext(pCairoContext, true, aExtents);
+ m_rGraphics.setAntiAliasB2DDraw(bOldAA);
+
return bOK;
}
commit 8d1b99f2fe9d41462614ad5a33dbdcb612fc08b0
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Aug 30 23:34:09 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:28 2018 +0100
custom widgets: get the region from the lib. + custom tab width
This implements getting the region rectangle from the widget
library so it is possible to redefine the size of the widgets if
needed.
Additionally increase a tab width which are too small by default.
Change-Id: If662c44e02631715efd137ecbfc4a5770fa9f6ab
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index a512a62bb178..ab4dec19b44e 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -275,15 +275,16 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
return bOK;
}
-bool CustomWidgetDraw::getNativeControlRegion(ControlType /*eType*/, ControlPart /*ePart*/,
- const tools::Rectangle& /*rBoundingControlRegion*/,
- ControlState /*eState*/,
- const ImplControlValue& /*aValue*/,
- const OUString& /*aCaption*/,
- tools::Rectangle& /*rNativeBoundingRegion*/,
- tools::Rectangle& /*rNativeContentRegion*/)
+bool CustomWidgetDraw::getNativeControlRegion(
+ ControlType eType, ControlPart ePart, const tools::Rectangle& rBoundingControlRegion,
+ ControlState eState, const ImplControlValue& /*aValue*/, const OUString& /*aCaption*/,
+ tools::Rectangle& rNativeBoundingRegion, tools::Rectangle& rNativeContentRegion)
{
- return false;
+ if (s_pWidgetImplementation == nullptr)
+ return false;
+
+ return s_pWidgetImplementation->getRegion(eType, ePart, eState, rBoundingControlRegion,
+ rNativeBoundingRegion, rNativeContentRegion);
}
} // end vcl namespace
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 6d4ab9dde196..53d5e5769ffa 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -42,6 +42,10 @@ public:
virtual ~WidgetThemeLibrary();
virtual bool isNativeControlSupported(ControlType eType, ControlPart ePart);
+ virtual bool getRegion(ControlType eType, ControlPart ePart, ControlState eState,
+ const tools::Rectangle& rBoundingControlRegion,
+ tools::Rectangle& rNativeBoundingRegion,
+ tools::Rectangle& rNativeContentRegion);
virtual bool drawPushButton(ControlDrawParameters const& rParameters, long nWidth,
long nHeight);
commit cb09d6eee7574a1b3c6f74cbb5210a1f2964fe2c
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Aug 27 13:33:01 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:27 2018 +0100
custom widgets: add Toolbar widget
Change-Id: Ia4efe711c07213f2edf472602c5b2acc81876906
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index 81a51b074e10..a512a62bb178 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -221,7 +221,10 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
case ControlType::Fixedline:
break;
case ControlType::Toolbar:
- break;
+ {
+ bOK = s_pWidgetImplementation->drawToolbar(aParameters, nWidth, nHeight);
+ }
+ break;
case ControlType::Menubar:
break;
case ControlType::MenuPopup:
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 1db8d62a68f1..6d4ab9dde196 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -59,6 +59,7 @@ public:
virtual bool drawTabHeader(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawTabBody(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawSlider(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ virtual bool drawToolbar(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawProgress(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawWindowsBackground(ControlDrawParameters const& rParameters, long nWidth,
long nHeight);
commit 996a9f068de292930f5c99050c063cc1ab391fb2
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Aug 27 11:58:01 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:27 2018 +0100
custom widgets: add List widget - ListNode, ListWidget
also added ListNet as noop
Change-Id: I033f908a8fc9ce9ec4b3d202e1299f7c0a9cad6c
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index 7c2a0c225be9..81a51b074e10 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -247,11 +247,21 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
}
break;
case ControlType::ListNode:
- break;
+ {
+ aParameters.eButtonValue = rValue.getTristateVal();
+ bOK = s_pWidgetImplementation->drawListNode(aParameters, nWidth, nHeight);
+ }
+ break;
case ControlType::ListNet:
- break;
+ {
+ bOK = s_pWidgetImplementation->drawListNet(aParameters, nWidth, nHeight);
+ }
+ break;
case ControlType::ListHeader:
- break;
+ {
+ bOK = s_pWidgetImplementation->drawListHeader(aParameters, nWidth, nHeight);
+ }
+ break;
}
basegfx::B2DRange aExtents(rControlRegion.Left(), rControlRegion.Top(), rControlRegion.Right(),
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index ee3c86fc45ac..1db8d62a68f1 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -64,6 +64,10 @@ public:
long nHeight);
virtual bool drawListbox(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawFrame(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ virtual bool drawListNode(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ virtual bool drawListNet(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ virtual bool drawListHeader(ControlDrawParameters const& rParameters, long nWidth,
+ long nHeight);
};
extern "C" vcl::WidgetThemeLibrary* CreateWidgetThemeLibrary();
commit 8e3c4d162382a7951a0bbcdc0b221a2966ce60d6
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Aug 27 11:07:48 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:26 2018 +0100
custom widgets: add Progress widget
Change-Id: I573a6c28f5ddb538ca3b0abf15197695fc113802
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index eaf1c3cae53a..7c2a0c225be9 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -227,7 +227,11 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
case ControlType::MenuPopup:
break;
case ControlType::Progress:
- break;
+ {
+ aParameters.nValue = rValue.getNumericVal();
+ bOK = s_pWidgetImplementation->drawProgress(aParameters, nWidth, nHeight);
+ }
+ break;
case ControlType::IntroProgress:
break;
case ControlType::Tooltip:
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index c99b2799b02f..ee3c86fc45ac 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -59,6 +59,7 @@ public:
virtual bool drawTabHeader(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawTabBody(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawSlider(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ virtual bool drawProgress(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawWindowsBackground(ControlDrawParameters const& rParameters, long nWidth,
long nHeight);
virtual bool drawListbox(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
commit 84b836c575ad849d51e5a5d4ac58b64dc5b99443
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Aug 27 10:54:31 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:26 2018 +0100
vcl: simplify ControlDrawParameters construction, add nValue
Don't require eButtonValue as a constructor parameter as it mostly
isn't necessary and required.
In addition add nValue instance variable.
Change-Id: I927714f715fce1549d87cec633330a0dc313f569
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index e403d429bbb0..eaf1c3cae53a 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -72,7 +72,7 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
bool bOK = false;
- ControlDrawParameters aParameters{ pCairoContext, ePart, eState, ButtonValue::DontKnow };
+ ControlDrawParameters aParameters{ pCairoContext, ePart, eState };
switch (eType)
{
@@ -134,8 +134,7 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
ControlPart downBtnPart = pSpinVal->mnLowerPart;
ControlState downBtnState = pSpinVal->mnLowerState;
{
- ControlDrawParameters aParametersUp{ pCairoContext, upBtnPart, upBtnState,
- ButtonValue::DontKnow };
+ ControlDrawParameters aParametersUp{ pCairoContext, upBtnPart, upBtnState };
cairo_save(pCairoContext);
cairo_translate(pCairoContext,
pSpinVal->maUpperRect.Left() - rControlRegion.Left(),
@@ -148,8 +147,8 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
if (bOK)
{
- ControlDrawParameters aParametersDown{ pCairoContext, downBtnPart, downBtnState,
- ButtonValue::DontKnow };
+ ControlDrawParameters aParametersDown{ pCairoContext, downBtnPart,
+ downBtnState };
cairo_save(pCairoContext);
cairo_translate(pCairoContext,
pSpinVal->maLowerRect.Left() - rControlRegion.Left(),
@@ -207,8 +206,7 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
const SliderValue* pSliderValue = static_cast<const SliderValue*>(&rValue);
ControlDrawParameters aParametersButton{ pCairoContext, ControlPart::Button,
- eState | pSliderValue->mnThumbState,
- ButtonValue::DontKnow };
+ eState | pSliderValue->mnThumbState };
cairo_save(pCairoContext);
cairo_translate(pCairoContext,
pSliderValue->maThumbRect.Left() - rControlRegion.Left(),
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index b4e78c7e515d..c99b2799b02f 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -19,12 +19,12 @@ namespace vcl
{
struct ControlDrawParameters
{
- ControlDrawParameters(cairo_t* i_pCairo, ControlPart i_ePart, ControlState i_eState,
- ButtonValue i_eButtonValue)
+ ControlDrawParameters(cairo_t* i_pCairo, ControlPart i_ePart, ControlState i_eState)
: pCairo(i_pCairo)
, ePart(i_ePart)
, eState(i_eState)
- , eButtonValue(i_eButtonValue)
+ , eButtonValue(ButtonValue::DontKnow)
+ , nValue(0)
{
}
@@ -32,6 +32,7 @@ struct ControlDrawParameters
ControlPart ePart;
ControlState eState;
ButtonValue eButtonValue;
+ sal_Int64 nValue;
};
class SAL_DLLPUBLIC_RTTI WidgetThemeLibrary
commit 11e5d5177fbaf86590a690a6189eafab0f25083c
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Aug 27 00:14:34 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 9 18:42:25 2018 +0100
custom widgets: add Slider widget
Change-Id: Ie2192edfcfc49a1953059c5947b8ea7bb03a3c7d
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list