win32: Allow querying names for colors

This commit is contained in:
Benjamin Otte 2016-02-21 23:39:38 +01:00
parent 46d3611052
commit ecaca073f1
2 changed files with 28 additions and 0 deletions

View File

@ -501,6 +501,31 @@ static struct {
#undef RGB
};
const char *
gtk_win32_get_sys_color_name_for_id (gint id)
{
if (id >= 0 && id < G_N_ELEMENTS (win32_default_colors))
return win32_default_colors[id].name;
else
return NULL;
}
int
gtk_win32_get_sys_color_id_for_name (const char *name)
{
int i;
g_return_val_if_fail (name != NULL, -1);
for (i = 0; i < G_N_ELEMENTS (win32_default_colors); i++)
{
if (g_str_equal (name, win32_default_colors[i].name))
return i;
}
return -1;
}
void
gtk_win32_get_sys_color (gint id,
GdkRGBA *color)

View File

@ -168,6 +168,9 @@ void gtk_win32_get_theme_margins (const char
GtkBorder *out_margins);
int gtk_win32_get_sys_metric (gint id);
const char * gtk_win32_get_sys_color_name_for_id (gint id);
int gtk_win32_get_sys_color_id_for_name (const char *name);
void gtk_win32_get_sys_color (gint id,
GdkRGBA *color);