Re: is it possible to have a widget act as insensitive but look as it is sensitive?
- From: Tristan Van Berkom <tristan van berkom gmail com>
- To: Yiannis <odysseus lost gmail com>
- Cc: gtk-app-devel-list gnome org, gtk-list gnome org
- Subject: Re: is it possible to have a widget act as insensitive but look as it is sensitive?
- Date: Fri, 30 Dec 2005 16:09:16 -0500
Yiannis wrote:
Sorry for posting back but my code failed.... :)
[...]
Try doing:
static GdkColor *insensitive_colour = NULL;
static GdkColor *normal_colour = NULL;
/* ... When initializing ... */
label = gtk_label_new ("");
insensitive_colour = gdk_color_copy (&(GTK_WIDGET (label)->style->fg[GTK_STATE_INSENSITIVE]));
normal_colour = gdk_color_copy (&(GTK_WIDGET (label)->style->fg[GTK_STATE_NORMAL]));
gtk_widget_destroy (label);
/* ... When setting sensitive state,
* or inside a "notify::sensitive" handler ...
*/
gtk_widget_modify_fg (GTK_WIDGET (widget),
GTK_STATE_NORMAL,
sensitive ? normal_colour : insensitive_colour);
You could use the widget of choice of course to initialize your
colours, it was a togglebutton you wanted ?
anyway, this code should work :)
Cheers,
-Tristan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]