diff options
author | Alexander Larsson <alexl@redhat.com> | 2011-11-16 12:19:20 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2011-11-17 12:30:08 +0100 |
commit | bc38cf1ff88a28ceb7e37a4c052c7ee282426c61 (patch) | |
tree | 069c5c73f56eb70b6e807a4f4094214b7b0f5320 /gtk/gtkwin32theme.c | |
parent | abe6598a13ed1b86db0f315f08b27dad9172c864 (diff) | |
download | gtk+-bc38cf1ff88a28ceb7e37a4c052c7ee282426c61.tar.gz |
win32-theme: Support -gtk-win32-size CSS value
Diffstat (limited to 'gtk/gtkwin32theme.c')
-rw-r--r-- | gtk/gtkwin32theme.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/gtk/gtkwin32theme.c b/gtk/gtkwin32theme.c index 71f7ad2321..78ac896313 100644 --- a/gtk/gtkwin32theme.c +++ b/gtk/gtkwin32theme.c @@ -365,3 +365,74 @@ _gtk_win32_theme_part_render (GtkWin32ThemePart *part, return cairo_pattern_create_rgb (color.red, color.green, color.blue); #endif } + +int +_gtk_win32_theme_int_parse (GtkCssParser *parser, + GFile *base, + int *value) +{ + char *class; + int arg; + + if (_gtk_css_parser_try (parser, + "-gtk-win32-size", + TRUE)) + { + if (!_gtk_css_parser_try (parser, "(", TRUE)) + { + _gtk_css_parser_error (parser, + "Expected '(' after '-gtk-win32-size'"); + return 0; + } + + class = _gtk_css_parser_try_name (parser, TRUE); + if (class == NULL) + { + _gtk_css_parser_error (parser, + "Expected name as first argument to '-gtk-win32-size'"); + return 0; + } + + if (! _gtk_css_parser_try (parser, ",", TRUE)) + { + g_free (class); + _gtk_css_parser_error (parser, + "Expected ','"); + return 0; + } + + if (!_gtk_css_parser_try_int (parser, &arg)) + { + g_free (class); + _gtk_css_parser_error (parser, "Expected a valid integer value"); + return 0; + } + + if (!_gtk_css_parser_try (parser, ")", TRUE)) + { + _gtk_css_parser_error (parser, + "Expected ')'"); + return 0; + } + +#ifdef G_OS_WIN32 + if (use_xp_theme && get_theme_sys_metric != NULL) + { + HTHEME theme = lookup_htheme_by_classname (class); + + /* If theme is NULL it will just return the GetSystemMetrics value */ + *value = get_theme_sys_metric (theme, arg); + } + else + *value = GetSystemMetrics (arg); +#else + *value = 1; +#endif + + g_free (class); + + return 1; + } + + return -1; +} |