Mercurial > dwindows
comparison gtk/dw.c @ 1847:ff80ad40a5d6
Initial attempt at allowing DW_CLR_DEFAULT clear color style overrides on GTK2/3.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 28 Dec 2012 01:24:39 +0000 |
parents | ca6ef85fffc5 |
children | 4790589f52a9 |
comparison
equal
deleted
inserted
replaced
1846:905f8632005b | 1847:ff80ad40a5d6 |
---|---|
3356 GdkColor backcolor = _get_gdkcolor(back); | 3356 GdkColor backcolor = _get_gdkcolor(back); |
3357 #if GTK_MAJOR_VERSION < 2 | 3357 #if GTK_MAJOR_VERSION < 2 |
3358 GtkStyle *style = gtk_style_copy(gtk_widget_get_style(handle)); | 3358 GtkStyle *style = gtk_style_copy(gtk_widget_get_style(handle)); |
3359 #endif | 3359 #endif |
3360 | 3360 |
3361 if(fore != DW_CLR_DEFAULT) | |
3362 { | |
3363 #if GTK_MAJOR_VERSION > 1 | 3361 #if GTK_MAJOR_VERSION > 1 |
3364 gtk_widget_modify_text(handle, 0, &forecolor); | 3362 gtk_widget_modify_text(handle, 0, fore != DW_CLR_DEFAULT ? &forecolor : NULL); |
3365 gtk_widget_modify_text(handle, 1, &forecolor); | 3363 gtk_widget_modify_text(handle, 1, fore != DW_CLR_DEFAULT ? &forecolor : NULL); |
3366 gtk_widget_modify_fg(handle, 0, &forecolor); | 3364 gtk_widget_modify_fg(handle, 0, fore != DW_CLR_DEFAULT ? &forecolor : NULL); |
3367 gtk_widget_modify_fg(handle, 1, &forecolor); | 3365 gtk_widget_modify_fg(handle, 1, fore != DW_CLR_DEFAULT ? &forecolor : NULL); |
3368 #else | 3366 #else |
3369 if(style) | 3367 if(fore != DW_CLR_DEFAULT && style) |
3370 style->text[0] = style->text[1] = style->fg[0] = style->fg[1] = forecolor; | 3368 style->text[0] = style->text[1] = style->fg[0] = style->fg[1] = forecolor; |
3371 #endif | 3369 #endif |
3372 } | |
3373 if(back != DW_CLR_DEFAULT) | |
3374 { | |
3375 #if GTK_MAJOR_VERSION > 1 | 3370 #if GTK_MAJOR_VERSION > 1 |
3376 gtk_widget_modify_base(handle, 0, &backcolor); | 3371 gtk_widget_modify_base(handle, 0, back != DW_CLR_DEFAULT ? &backcolor : NULL); |
3377 gtk_widget_modify_base(handle, 1, &backcolor); | 3372 gtk_widget_modify_base(handle, 1, back != DW_CLR_DEFAULT ? &backcolor : NULL); |
3378 gtk_widget_modify_bg(handle, 0, &backcolor); | 3373 gtk_widget_modify_bg(handle, 0, back != DW_CLR_DEFAULT ? &backcolor : NULL); |
3379 gtk_widget_modify_bg(handle, 1, &backcolor); | 3374 gtk_widget_modify_bg(handle, 1, back != DW_CLR_DEFAULT ? &backcolor : NULL); |
3380 #else | 3375 #else |
3381 if(style) | 3376 if(back != DW_CLR_DEFAULT && style) |
3382 style->base[0] = style->base[1] = style->bg[0] = style->bg[1] = backcolor; | 3377 style->base[0] = style->base[1] = style->bg[0] = style->bg[1] = backcolor; |
3383 #endif | 3378 #endif |
3384 } | |
3385 | 3379 |
3386 _save_gdk_colors(handle, forecolor, backcolor); | 3380 _save_gdk_colors(handle, forecolor, backcolor); |
3387 | 3381 |
3388 if(GTK_IS_CLIST(handle)) | 3382 if(GTK_IS_CLIST(handle)) |
3389 { | 3383 { |
3390 int z, rowcount = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_rowcount")); | 3384 int z, rowcount = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_rowcount")); |
3391 | 3385 |
3392 for(z=0;z<rowcount;z++) | 3386 for(z=0;z<rowcount;z++) |
3393 { | 3387 { |
3394 gtk_clist_set_foreground(GTK_CLIST(handle), z, &forecolor); | 3388 gtk_clist_set_foreground(GTK_CLIST(handle), z, fore != DW_CLR_DEFAULT ? &forecolor : NULL); |
3395 gtk_clist_set_background(GTK_CLIST(handle), z, &backcolor); | 3389 gtk_clist_set_background(GTK_CLIST(handle), z, back != DW_CLR_DEFAULT ? &backcolor : NULL); |
3396 } | 3390 } |
3397 } | 3391 } |
3398 | 3392 |
3399 #if GTK_MAJOR_VERSION < 2 | 3393 #if GTK_MAJOR_VERSION < 2 |
3400 if(style) | 3394 if(style) |