Re: [gtk-list] Re: Spin button question



Lars Hamann wrote:
> On Thu, Jun 03, 1999 at 11:15:21AM +0100, Steve Hosgood wrote:
> 
> > If the current spinbutton does its own arrow-drawing and handling for "efficiency
> > reasons" as Havoc suggests, should that really be allowable in the allegedly-O-O
> > environment of GTK+?
> >
> > If the "efficiency reasons" really are that important, does it indicate that there's
> > something wrong in the O-O implementation somewhere that makes it so inefficient?
> 
> Well, gtk allows only one inheritance. So the question is which
> inheritance is useful or more important. I don't want to loose the
> possibility to use something like GTK_ENTRY (spinbutton). Spinbutton
> would become a container or even worse a hbox if the arrows would be
> changed to widgets. That way you would focus the inheritance on layout
> instead of widget functionality.
>

That's a very good point.

I suppose I originally *expected* to find gtkspinbutton to be (effectively) a hbox. I
didn't consider that the inability to say GTK_ENTRY(spinbutton) would be a problem.

Indeed, I'm not sure I do now! Would it not be more reasonable to expect a function
(method?) gtk_spinbutton_get_entry(spinbutton) to return the pointer to the gtkentry
widget, and by analogy, for methods called gtk_spinbutton_get_uparrow(spinbutton) and
gtk_spinbutton_get_downarrow(spinbutton) to do the Right Thing for the other components?

Spinbutton is (after all) a composite widget. Who is to say which one of its
components is the inherited one, and which the add-ons? OK, so spinbutton is a bad
example here - it is pretty obvious that the job of a spinbutton is to be a method
of data entry, so inheriting from gtkentry is reasonable. But what (for example)
about things like gtkfileselection? What would a reasonable inheritance model be for
*that*?

> BTW gtk{h,v}scrollbar and gtknotebook handle the arrows very similar.
> 
> > I don't know, but I'd guess that if indeed spinbutton does its own arrow handling, then
> > won't those arrows fail to change in appearance if a custom theme changes the appearance
> > of the other arrows in the widget set?
> 
> No. Spinbutton uses gtk_paint_arrow to draw the arrows. So basically all
> you have to do is to change style->draw_arrow to change the appearance.
> 

Thank you. I should have found that from the source-code, but I don't really
know enough about the fine points yet.

--

Steve                                       | Steve's law of House Rewiring:
S.Hosgood@swansea.ac.uk                     | "No matter how many power sockets
Phone: +44 1792 297292 + ask for Steve      |  you fit in a room, you will run
Fax:   +44 1792 295811                      |  out within the first week of use
--------------------------------------------+  even if you took Steve's law of
http://iiit.swan.ac.uk/~iisteve/steve.html  |  House Rewiring into account"




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