Re: #54720 -button children should optionally move



Soeren Sandmann <sandmann daimi au dk> writes:

> Owen Taylor <otaylor redhat com> writes:
> 
> > I took a look at this patch and ended up rewriting it quite a bit.
> > 
> >  * I simplified a lot of the logic in GtkButton and GtkToggleButton to centralize
> >    all the state maintanence in one place for each widget.
> > 
> >  * I removed the movement for the child of check/radio buttons with 
> >    draw_indicator == TRUE. This just looked very weird to me, and windows
> >    does not do this.
> 
> My intention was that themes normally should set child_displacements
> for check/radio buttons to 0.  I can imagine (pretty weird,
> admittedly) themes that want to draw a radiobutton like a
> togglebutton. It is not something I feel strongly about, though.

If you wanted to support drawing a radiobutton like a togglebutton,
you'd need to add a style property GtkToggleButton::ignore_draw_indicator
or something; just making the child go up and down isn't good enough,
since the theme won't be called to draw the border, etc.

And for toggle buttons with draw_indicator == TRUE, they will move
now.

> > Remaining possible questions about this patch:
> > 
> >  * Should we have separate child_displacement_x/child_displacement_y 
> >    properties? Does it ever make sense for them to be separate
> 
> If a theme wants to make the light come in from left, it might also
> want to make the children also move just to the right, not down or up.

Well, I'd have to mock this up to see how it looked, but lacking
the time to do this, I'll trust you on this one.
 
> >  * Should we increase the amount of space requested for the button
> >    based on the amount of displacement? Currently, things don't
> >    work very will if the displacement is more than 1.
> 
> I think I tried that, but decided it didn't look good if the extra
> space was put entirely below the label.  If extra space should be
> requested, it should be evenly distributed above and below the label.

I'll leave it as is for now, until someone complains and shows up
with a patch. I dont' think the space allocation is right even for
a 1,1 displacement, since the descenders overlap the border.

> >  * Should _gtk_button_set_depressed() be exported? If someone wanted
> >    to write a like-toggle-button widget right now, they wouldn't 
> >    be able to. On the other hand, making it public is inviting
> >    confusion and abuse.
> 
> I think it should be exported.  The comment is pretty clear about when
> it should be used and not used.

Ah, nothing like agreement when you ask for opinions ;-)  

Regards,
                                        Owen




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