summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-02-12 11:32:53 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-02-12 11:37:21 +0000
commit06e8c58acb6ba667f8fd8c5587a3b3037324971a (patch)
tree4a5808e1812b9ade9006bfe2e2a759430f4c5042
parent1e52ec3951f3e9d687bdff20a6378cb2f4819a90 (diff)
Related: rhbz#1287593 subissue 6, get suitable hyperlink colors for dark theme
Change-Id: Ieb5ed52fa8a9c26b3e839388a58cff295166eed9
-rw-r--r--vcl/inc/unx/gtk/gtkgdi.hxx2
-rw-r--r--vcl/source/control/fixedhyper.cxx5
-rw-r--r--vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx34
3 files changed, 22 insertions, 19 deletions
diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index 13ac19817b7a..2bb602982598 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -36,6 +36,7 @@
enum class GtkControlPart
{
Button,
+ LinkButton,
CheckButton,
CheckButtonCheck,
RadioButton,
@@ -100,6 +101,7 @@ public:
private:
GtkWidget *mpWindow;
static GtkStyleContext *mpButtonStyle;
+ static GtkStyleContext *mpLinkButtonStyle;
static GtkStyleContext *mpEntryStyle;
static GtkStyleContext *mpTextViewStyle;
static GtkStyleContext *mpVScrollbarStyle;
diff --git a/vcl/source/control/fixedhyper.cxx b/vcl/source/control/fixedhyper.cxx
index da53f9a18824..7f940dd203cb 100644
--- a/vcl/source/control/fixedhyper.cxx
+++ b/vcl/source/control/fixedhyper.cxx
@@ -18,6 +18,7 @@
*/
#include <vcl/fixedhyper.hxx>
+#include <vcl/svapp.hxx>
FixedHyperlink::FixedHyperlink(vcl::Window* pParent, WinBits nWinStyle)
: FixedText(pParent, nWinStyle)
@@ -35,8 +36,8 @@ void FixedHyperlink::Initialize()
// to underline
aFont.SetUnderline( LINESTYLE_SINGLE );
SetControlFont( aFont );
- // changes the color to light blue
- SetControlForeground( Color( COL_LIGHTBLUE ) );
+ // changes the color to link color
+ SetControlForeground( Application::GetSettings().GetStyleSettings().GetLinkColor() );
// calculates text len
m_nTextLen = GetCtrlTextWidth( GetText() );
}
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 33117b02f801..1cda45660fa7 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -22,6 +22,7 @@
#include <boost/optional.hpp>
GtkStyleContext* GtkSalGraphics::mpButtonStyle = nullptr;
+GtkStyleContext* GtkSalGraphics::mpLinkButtonStyle = nullptr;
GtkStyleContext* GtkSalGraphics::mpEntryStyle = nullptr;
GtkStyleContext* GtkSalGraphics::mpTextViewStyle = nullptr;
GtkStyleContext* GtkSalGraphics::mpVScrollbarStyle = nullptr;
@@ -821,6 +822,15 @@ static GtkStyleContext* createStyleContext(GtkControlPart ePart, GtkStyleContext
gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_BUTTON);
#endif
break;
+ case GtkControlPart::LinkButton:
+ gtk_widget_path_append_type(path, GTK_TYPE_BUTTON);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path, -1, "button");
+#else
+ gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_BUTTON);
+#endif
+ gtk_widget_path_iter_add_class(path, -1, "link");
+ break;
case GtkControlPart::CheckButton:
gtk_widget_path_append_type(path, GTK_TYPE_CHECK_BUTTON);
#if GTK_CHECK_VERSION(3, 19, 2)
@@ -1989,23 +1999,12 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
aStyleSet.SetMenuHighlightTextColor( aHighlightTextColor );
// hyperlink colors
- GdkColor *link_color = nullptr;
- gtk_style_context_get_style(pStyle,
- "link-color", &link_color,
- nullptr);
- if (link_color) {
- aStyleSet.SetLinkColor(getColorFromColor(*link_color));
- gdk_color_free(link_color);
- }
-
- link_color = nullptr;
- gtk_style_context_get_style(pStyle,
- "visited-link-color", &link_color,
- nullptr);
- if (link_color) {
- aStyleSet.SetVisitedLinkColor(getColorFromColor(*link_color));
- gdk_color_free(link_color);
- }
+ gtk_style_context_set_state(mpLinkButtonStyle, GTK_STATE_FLAG_LINK);
+ gtk_style_context_get_color(mpLinkButtonStyle, gtk_style_context_get_state(mpLinkButtonStyle), &text_color);
+ aStyleSet.SetLinkColor(getColor(text_color));
+ gtk_style_context_set_state(mpLinkButtonStyle, GTK_STATE_FLAG_VISITED);
+ gtk_style_context_get_color(mpLinkButtonStyle, gtk_style_context_get_state(mpLinkButtonStyle), &text_color);
+ aStyleSet.SetVisitedLinkColor(getColor(text_color));
#if GTK_CHECK_VERSION(3, 19, 2)
{
@@ -2344,6 +2343,7 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
getStyleContext(&mpTextViewStyle, gtk_text_view_new());
mpButtonStyle = createStyleContext(GtkControlPart::Button);
+ mpLinkButtonStyle = createStyleContext(GtkControlPart::LinkButton);
GtkWidget* pToolbar = gtk_toolbar_new();
mpToolbarStyle = gtk_widget_get_style_context(pToolbar);