diff --git a/gtk/gtkwin32draw.c b/gtk/gtkwin32draw.c index 4a28f115fa..0625a41fe8 100644 --- a/gtk/gtkwin32draw.c +++ b/gtk/gtkwin32draw.c @@ -179,7 +179,126 @@ gtk_win32_get_theme_margins (const char *class_name, } } -struct { +static int +FIXME_IMPLEMENT (int id) +{ + g_warning ("win32 sys metric %d not implemented", id); + return 0; +} + +static struct { + const char *name; + int value; + int (* get_value) (int id); +} win32_default_metrics[] = { + { "cxscreen", 0, FIXME_IMPLEMENT }, + { "cyscreen", 0, FIXME_IMPLEMENT }, + { "cxvscroll", 16, NULL }, + { "cyhscroll", 16, NULL }, + { "cycaption", 16, NULL }, + { "cxborder", 1, NULL }, + { "cyborder", 1, NULL }, + { "cxdlgframe", 3, NULL }, + { "cydlgframe", 3, NULL }, + { "cyvthumb", 16, NULL }, + { "cxhthumb", 16, NULL }, + { "cxicon", 32, NULL }, + { "cyicon", 32, NULL }, + { "cxcursor", 32, NULL }, + { "cycursor", 32, NULL }, + { "cymenu", 19, NULL }, + { "cxfullscreen", 0, FIXME_IMPLEMENT }, + { "cyfullscreen", 0, FIXME_IMPLEMENT }, + { "cykanjiwindow", 0, NULL }, + { "mousepresent", 1, NULL }, + { "cyvscroll", 16, NULL }, + { "cxhscroll", 16, NULL }, + { "debug", 0, NULL }, + { "swapbutton", 0, NULL }, + { "reserved1", 0, NULL }, + { "reserved2", 0, NULL }, + { "reserved3", 0, NULL }, + { "reserved4", 0, NULL }, + { "cxmin", 112, NULL }, + { "cymin", 24, NULL }, + { "cxsize", 18, NULL }, + { "cysize", 15, NULL }, + { "cxframe", 4, NULL }, + { "cyframe", 4, NULL }, + { "cxmintrack", 112, NULL }, + { "cymintrack", 24, NULL }, + { "cxdoubleclk", 0, FIXME_IMPLEMENT }, + { "cydoubleclk", 0, FIXME_IMPLEMENT }, + { "cxiconspacing", 75, NULL }, + { "cyiconspacing", 75, NULL }, + { "menudropalignment", 0, NULL }, + { "penwindows", 0, NULL }, + { "dbcsenabled", 1, NULL }, + { "cmousebuttons", 3, NULL }, + { "secure", 0, NULL }, + { "cxedge", 2, NULL }, + { "cyedge", 2, NULL }, + { "cxminspacing", 160, NULL }, + { "cyminspacing", 21, NULL }, + { "cxsmicon", 16, NULL }, + { "cysmicon", 16, NULL }, + { "cysmcaption", 16, NULL }, + { "cxsmsize", 15, NULL }, + { "cysmsize", 15, NULL }, + { "cxmenusize", 18, NULL }, + { "cymenusize", 18, NULL }, + { "arrange", 8, NULL }, + { "cxminimized", 160, NULL }, + { "cyminimized", 21, NULL }, + { "cxmaxtrack", 0, FIXME_IMPLEMENT }, + { "cymaxtrack", 0, FIXME_IMPLEMENT }, + { "cxmaximized", 0, FIXME_IMPLEMENT }, + { "cymaximized", 0, FIXME_IMPLEMENT }, + { "network", 3, NULL }, + { NULL, 0, NULL }, + { NULL, 0, NULL }, + { NULL, 0, NULL }, + { "cleanboot", 0, NULL }, + { "cxdrag", 4, NULL }, + { "cydrag", 4, NULL }, + { "showsounds", 0, NULL }, + { "cxmenucheck", 13, NULL }, + { "cymenucheck", 13, NULL }, + { "slowmachine", 0, NULL }, + { "mideastenabled", 0, NULL }, + { "mousewheelpresent", 1, NULL }, + { "xvirtualscreen", 0, FIXME_IMPLEMENT }, + { "yvirtualscreen", 0, FIXME_IMPLEMENT }, + { "cxvirtualscreen", 0, FIXME_IMPLEMENT }, + { "cyvirtualscreen", 0, FIXME_IMPLEMENT }, + { "cmonitors", 0, FIXME_IMPLEMENT }, + { "samedisplayformat", 1, NULL }, + { "immenabled", 1, NULL }, + { "cxfocusborder", 1, NULL }, + { "cyfocusborder", 1, NULL }, + { NULL, 0, NULL }, + { "tabletpc", 0, NULL }, + { "mediacenter", 0, NULL }, + { "starter", 0, NULL }, + { "serverr2", 0, NULL }, + { "cmetrics", 90, NULL }, + { "mousehorizontalwheelpresent", 0, NULL }, + { "cxpaddedborder", 0, NULL } +}; + +int +gtk_win32_get_sys_metric (gint id) +{ + if (id >= 0 && id < G_N_ELEMENTS (win32_default_metrics)) + return 0; + + if (win32_default_metrics[id].get_value) + return win32_default_metrics[id].get_value (id); + + return win32_default_metrics[id].value; +} + +static struct { const char *name; GdkRGBA rgba; } win32_default_colors[] = { diff --git a/gtk/gtkwin32drawprivate.h b/gtk/gtkwin32drawprivate.h index b2f339ad9f..20851fc65f 100644 --- a/gtk/gtkwin32drawprivate.h +++ b/gtk/gtkwin32drawprivate.h @@ -59,6 +59,98 @@ enum { GTK_WIN32_SYS_COLOR_MENUBAR }; +enum { + GTK_WIN32_SYS_METRIC_CXSCREEN = 0, + GTK_WIN32_SYS_METRIC_CYSCREEN = 1, + GTK_WIN32_SYS_METRIC_CXVSCROLL = 2, + GTK_WIN32_SYS_METRIC_CYHSCROLL = 3, + GTK_WIN32_SYS_METRIC_CYCAPTION = 4, + GTK_WIN32_SYS_METRIC_CXBORDER = 5, + GTK_WIN32_SYS_METRIC_CYBORDER = 6, + GTK_WIN32_SYS_METRIC_CXDLGFRAME = 7, + GTK_WIN32_SYS_METRIC_CYDLGFRAME = 8, + GTK_WIN32_SYS_METRIC_CYVTHUMB = 9, + GTK_WIN32_SYS_METRIC_CXHTHUMB = 10, + GTK_WIN32_SYS_METRIC_CXICON = 11, + GTK_WIN32_SYS_METRIC_CYICON = 12, + GTK_WIN32_SYS_METRIC_CXCURSOR = 13, + GTK_WIN32_SYS_METRIC_CYCURSOR = 14, + GTK_WIN32_SYS_METRIC_CYMENU = 15, + GTK_WIN32_SYS_METRIC_CXFULLSCREEN = 16, + GTK_WIN32_SYS_METRIC_CYFULLSCREEN = 17, + GTK_WIN32_SYS_METRIC_CYKANJIWINDOW = 18, + GTK_WIN32_SYS_METRIC_MOUSEPRESENT = 19, + GTK_WIN32_SYS_METRIC_CYVSCROLL = 20, + GTK_WIN32_SYS_METRIC_CXHSCROLL = 21, + GTK_WIN32_SYS_METRIC_DEBUG = 22, + GTK_WIN32_SYS_METRIC_SWAPBUTTON = 23, + GTK_WIN32_SYS_METRIC_RESERVED1 = 24, + GTK_WIN32_SYS_METRIC_RESERVED2 = 25, + GTK_WIN32_SYS_METRIC_RESERVED3 = 26, + GTK_WIN32_SYS_METRIC_RESERVED4 = 27, + GTK_WIN32_SYS_METRIC_CXMIN = 28, + GTK_WIN32_SYS_METRIC_CYMIN = 29, + GTK_WIN32_SYS_METRIC_CXSIZE = 30, + GTK_WIN32_SYS_METRIC_CYSIZE = 31, + GTK_WIN32_SYS_METRIC_CXFRAME = 32, + GTK_WIN32_SYS_METRIC_CYFRAME = 33, + GTK_WIN32_SYS_METRIC_CXMINTRACK = 34, + GTK_WIN32_SYS_METRIC_CYMINTRACK = 35, + GTK_WIN32_SYS_METRIC_CXDOUBLECLK = 36, + GTK_WIN32_SYS_METRIC_CYDOUBLECLK = 37, + GTK_WIN32_SYS_METRIC_CXICONSPACING = 38, + GTK_WIN32_SYS_METRIC_CYICONSPACING = 39, + GTK_WIN32_SYS_METRIC_MENUDROPALIGNMENT = 40, + GTK_WIN32_SYS_METRIC_PENWINDOWS = 41, + GTK_WIN32_SYS_METRIC_DBCSENABLED = 42, + GTK_WIN32_SYS_METRIC_CMOUSEBUTTONS = 43, + GTK_WIN32_SYS_METRIC_SECURE = 44, + GTK_WIN32_SYS_METRIC_CXEDGE = 45, + GTK_WIN32_SYS_METRIC_CYEDGE = 46, + GTK_WIN32_SYS_METRIC_CXMINSPACING = 47, + GTK_WIN32_SYS_METRIC_CYMINSPACING = 48, + GTK_WIN32_SYS_METRIC_CXSMICON = 49, + GTK_WIN32_SYS_METRIC_CYSMICON = 50, + GTK_WIN32_SYS_METRIC_CYSMCAPTION = 51, + GTK_WIN32_SYS_METRIC_CXSMSIZE = 52, + GTK_WIN32_SYS_METRIC_CYSMSIZE = 53, + GTK_WIN32_SYS_METRIC_CXMENUSIZE = 54, + GTK_WIN32_SYS_METRIC_CYMENUSIZE = 55, + GTK_WIN32_SYS_METRIC_ARRANGE = 56, + GTK_WIN32_SYS_METRIC_CXMINIMIZED = 57, + GTK_WIN32_SYS_METRIC_CYMINIMIZED = 58, + GTK_WIN32_SYS_METRIC_CXMAXTRACK = 59, + GTK_WIN32_SYS_METRIC_CYMAXTRACK = 60, + GTK_WIN32_SYS_METRIC_CXMAXIMIZED = 61, + GTK_WIN32_SYS_METRIC_CYMAXIMIZED = 62, + GTK_WIN32_SYS_METRIC_NETWORK = 63, + GTK_WIN32_SYS_METRIC_CLEANBOOT = 67, + GTK_WIN32_SYS_METRIC_CXDRAG = 68, + GTK_WIN32_SYS_METRIC_CYDRAG = 69, + GTK_WIN32_SYS_METRIC_SHOWSOUNDS = 70, + GTK_WIN32_SYS_METRIC_CXMENUCHECK = 71, + GTK_WIN32_SYS_METRIC_CYMENUCHECK = 72, + GTK_WIN32_SYS_METRIC_SLOWMACHINE = 73, + GTK_WIN32_SYS_METRIC_MIDEASTENABLED = 74, + GTK_WIN32_SYS_METRIC_MOUSEWHEELPRESENT = 75, + GTK_WIN32_SYS_METRIC_XVIRTUALSCREEN = 76, + GTK_WIN32_SYS_METRIC_YVIRTUALSCREEN = 77, + GTK_WIN32_SYS_METRIC_CXVIRTUALSCREEN = 78, + GTK_WIN32_SYS_METRIC_CYVIRTUALSCREEN = 79, + GTK_WIN32_SYS_METRIC_CMONITORS = 80, + GTK_WIN32_SYS_METRIC_SAMEDISPLAYFORMAT = 81, + GTK_WIN32_SYS_METRIC_IMMENABLED = 82, + GTK_WIN32_SYS_METRIC_CXFOCUSBORDER = 83, + GTK_WIN32_SYS_METRIC_CYFOCUSBORDER = 84, + GTK_WIN32_SYS_METRIC_TABLETPC = 86, + GTK_WIN32_SYS_METRIC_MEDIACENTER = 87, + GTK_WIN32_SYS_METRIC_STARTER = 88, + GTK_WIN32_SYS_METRIC_SERVERR2 = 89, + GTK_WIN32_SYS_METRIC_CMETRICS = 90, + GTK_WIN32_SYS_METRIC_MOUSEHORIZONTALWHEELPRESENT = 91, + GTK_WIN32_SYS_METRIC_CXPADDEDBORDER = 92 +}; + void gtk_win32_draw_theme_background (cairo_t *cr, const char *class_name, int part, @@ -75,6 +167,7 @@ void gtk_win32_get_theme_margins (const char int state, GtkBorder *out_margins); +int gtk_win32_get_sys_metric (gint id); void gtk_win32_get_sys_color (gint id, GdkRGBA *color); diff --git a/gtk/gtkwin32theme.c b/gtk/gtkwin32theme.c index 282c414ac2..3861e507d4 100644 --- a/gtk/gtkwin32theme.c +++ b/gtk/gtkwin32theme.c @@ -495,7 +495,7 @@ gtk_win32_theme_get_size (GtkWin32Theme *theme, return GetSystemMetrics (id); #else - return -1; + return gtk_win32_get_sys_metric (id); #endif }