diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-11-03 17:57:44 -0400 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-11-09 18:42:35 +0100 |
commit | 53961bc1bebe1159936f177b7e70eb8fadb36cff (patch) | |
tree | 8b694930a7240af90f0784769bc2f95a3ba84e5d /vcl | |
parent | b5e8afda4728f360401c52f3c8c2c92bad9d2136 (diff) |
LOK: custom widgets: reduce Color into an int to reduce API surface
Change-Id: Ib1afbb0b5647048f24d4ea6f9859b76328568dac
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/headless/CustomWidgetDraw.cxx | 74 | ||||
-rw-r--r-- | vcl/inc/WidgetThemeLibrary.hxx | 63 | ||||
-rw-r--r-- | vcl/inc/WidgetThemeLibraryTypes.hxx | 45 |
3 files changed, 89 insertions, 93 deletions
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 { |