Web lists-archives.com

Re: Another issue for the documentation




On Thu, Jul 30, 2015 at 01:36:47PM -0400, Igor Korot wrote:
> Marcus, et al,
> 
> On Thu, Jul 30, 2015 at 1:29 PM, Marcus Karlsson <mk@xxxxxxxxxx> wrote:
> > On Thu, Jul 30, 2015 at 04:09:03PM +0200, Marcus Karlsson wrote:
> >> On Thu, Jul 30, 2015 at 06:43:45AM -0400, Igor Korot wrote:
> >> > Emmanuele,
> >> >
> >> > On Thu, Jul 30, 2015 at 5:31 AM, Emmanuele Bassi <ebassi@xxxxxxxxx> wrote:
> >> > > Hi;
> >> > >
> >> > > On 30 July 2015 at 05:45, Igor Korot <ikorot01@xxxxxxxxx> wrote:
> >> > >> Hi,
> >> > >> The documentation states:
> >> > >>
> >> > >> [quote]
> >> > >>
> >> > >> gtk_button_set_alignment has been deprecated since version 3.14 and
> >> > >> should not be used in newly-written code.
> >> > >>
> >> > >> Access the child widget directly if you need to control its alignment.
> >> > >>
> >> > >> [/quote]
> >> > >>
> >> > >> Now, while the image can be retrieved with the gtk_button_get_image(),
> >> > >> there is only
> >> > >> function that retrieves the button text but not the label child.
> >> > >>
> >> > >> How do I retrieve the GtkLabel which is a child of GtkButton()?
> >> > >
> >> > > GtkButton is a GtkBin, so you can use gtk_bin_get_child() to retrieve
> >> > > the child of a GtkButton.
> >> >
> >> > OK,
> >> > And if I have both image and text I can loop thu the children and check the type
> >> > right?
> >>
> >> A GtkBin has just one child, so exactly what you want to do depends on
> >> the type of button you have. Gtk_button_set_alignment is more or less
> >> just an if-block for different type of child widgets.
> >
> > To be more specific if you have a button with both an image and a label
> > then the child widget will be a GtkAlignment which in turn will have a
> > GtkBox with the actual label and image as its child widget.
> >
> > Now if you just want to set the alignment you can do that directly, just
> > get the GtkAlignment and set it with gtk_widget_set_halign() and
> > gtk_widget_set_valign().
> 
> And I presume that if I have an image only I presume I can just get the image
> and set its alignment.
> Or in this case it will still be GtkAlignment?

No it will actually still be a GtkAlignment so you'll still want to set
the alignment there. But it doesn't really matter exactly what it is as
you can always set the alignment by accessing the child widget and set
it there.

		Marcus
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list