Re: Dumb question about GTK--
- From: Owen Taylor <owt1 cornell edu>
- To: Tero Pulkkinen <terop students cc tut fi>
- Cc: gtk-list redhat com
- Subject: Re: Dumb question about GTK--
- Date: 25 Mar 1998 10:36:33 -0500
Tero Pulkkinen <terop@students.cc.tut.fi> writes:
> Hmm, this is odd, why isnt gtk's set_events using GdkEventMask structure
> in set_events() argument instead of the current integer?? It would
> make this typesafe, unlike what it is currently... (maybe that should
> be fixed?) Using the enum would let people know from the interface how
> to use it - currently its kinda odd...
>
> I think one thing that should be done is to check all integer arguments
> in gtk and check that there isnt anything that could be enums or other
> more restricted types! Integers in public interface where they dont
> represent integer value are really bad..
>
> or then, maybe there's something I've missed :)
I think you have. In C using enumerations for mask fields is fine (and
I prefer it that way because it shows in the header what type:
needed). But AFAIK, in C++,
set_events (GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK)
would be invalid if the argument was of type GdkEventMask.
[ That is, in C++, a enumeration variable can only be assigned one of
the values of the enumeration. ]
(But you're the C++ expert) So I think that's why guint's are used for
mask fields in many places. (Though it isn't consistent right now)
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]