Re: [gtk-list] Re: Method to query toggle button state?



Jimmie Mayfield <mayfield@sackheads.org> wrote,

> On Fri, Feb 19, 1999 at 08:50:13PM -0600, Havoc Pennington wrote:
> > 
> > On Fri, 19 Feb 1999, Jimmie Mayfield wrote:
> > > 
> > > Are there any plans to add a gtk_toggle_button_get_toggle_state() for
> > > toggle buttons and/or radio buttons?  Such a function would (obviously)
> > > return the toggle state of the specified button to the caller.  The
> > > current library design seems to require that the programmer create a callback
> > > function to catch click events.
> > > 
> > 
> > Most people use GTK_TOGGLE_BUTTON(widget)->active, I think.
> 
> That was precisely the point of my post.  IME, it's not a good design
> for programs to have to access internal widget members directly.  In OO,
> you could say this is defeating the object's encapsulation.  But however 
> you choose to describe it, programs that do stuff like this are dependent on 
> the internal design of the object and that is a "bad thing" (tm).
> 
> I still think an inline function or MACRO provided by GTK would be the best 
> way to do this.

Actually, even a macro has its disadvantages.  Writing a
GTK+ binding for a high-level language (one where C structs
cannot be accessed directly, but C functions can be called
via a foreign function interface), the lack of query
functions is rather annoying.  I myself was wondering
whether they are omitted by purpose or just because nobody
bothered to implement them.  In case of the latter, I would
be willing to supply patches.

Manuel



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