Re: [gtk-list] Graphic Contexts

Ralf Corsepius <> writes:

> Hi,
> How is one supposed to get graphic contexts with multiple bits being set
> in values_mask ?
> AFAIS, gtk/gdk only provide functions to get graphic contexts with one
> single bit set for values_mask:
> Eg.:
> GdkGC*      gtk_gc_get (gint depth,
>                                               GdkColormap *colormap,
>                                               GdkGCValues *values,
>                                               GdkGCValuesMask
> values_mask);
> GdkGC*      gdk_gc_new_with_values (GdkWindow *window,
>                                               GdkGCValues *values,
>                                               GdkGCValuesMask
> values_mask);
> GdkValuesMask an enum, i.e. unlike X11, gtk/gdk does not seem not to
> allow setting multiple bits in values_mask simultaneously
> (Eg. when trying to set values_mask = GDK_GC_FOREGROUND |
> values_mask is not of type GdkGCValuesMask).
> This style of declaration also prevents using empty values_masks when
> trying to getting a GC with one of the functions above.
> => The only proper way to get GCs with multiple bits set in gtk seems to
> be to apply gtk_gc_get with one single bit set and then to subsequently
> to apply *gc_set_*() functions.
> Am I misunderstanding something here? Otherwise, this API seems somewhat
> suspectable or even broken to me.

Yes, you are missing something. In the GTK+ and GDK API, we 
follow a pretty standard C convention of representing a bit field with 
the type of the enumeration. (This has the advantage over using
an unsigned int that the real type of the field is apparent from
the prototype.)

You seem to be using C++, in which case you'll need an explicit



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]