Re: [gtkmm] Setting properties of Gtk::Table children.



Murray Cumming <murrayc murrayc com> writes:

> On Mon, 2004-04-19 at 18:03, Roger Leigh wrote:
>> Gtk::Table_Helpers::Child lets you access the properties of child
>> widgets of a Gtk::Table.  However, there are only get_ methods.
>
> Yes, and these are accessors for the GtkTableChild struct fields. They
> are not properties, because GtkTableChild is not a GObject.

Sorry, I got the wrong idea here.  The docs mentioned this:

Public Member Functions
_GtkTableChild* 	gobj ()
const _GtkTableChild* 	gobj () const

so I thought it was just a special "view" on a child widget within the
table container, rather than a separate entity.  However, these
properties are specific to a GtkContainer AFAICT.

>>   The Gtk
>> docs show these properties
>> 
>> "bottom-attach", "left-attach", "right-attach", "top-attach",
>> "x-options", "x-padding" "y-options", "y-padding".
>> as being read/write.
>
> I have no idea what a "child property" is here. It might be something to
> do with the GtkTableChild struct, or it might be some setting for all
> children, or it might be a property that a widget only has when it is
> inside this container. I will ask on gtk-list gnome org

I'm certain it's properties that belong to the widget when it's packed
inside the container.  If you pack a widget into a table in Glade,
it's these properties you can edit on the "Packing" tab in the
Properties dialogue, and these vary depending on which container you
use.  These properties are not installed into the packed widget--they
are associated with the widget using

struct _GtkTableChild
{
  GtkWidget *widget;
  guint16 left_attach;
  guint16 right_attach;
  guint16 top_attach;
  guint16 bottom_attach;
  guint16 xpadding;
  guint16 ypadding;
  guint xexpand : 1;
  guint yexpand : 1;
  guint xshrink : 1;
  guint yshrink : 1;
  guint xfill : 1;
  guint yfill : 1;
};

Perhaps Gtk::Table_Helpers::Child could wrap
gtk_container_child_set_property() to allow these to be changed?  This
should (AFAICT) work the same for all containers derived from
GtkContainer.

>>   Is there a way to tweak the attach options with
>> Gtkmm (I'd like to move the widgets in a table to allow the user to
>> customise their positioning).  Is there any way to do this?
>
> This might be something that needs new gtkmm API. In the meantime, you
> can access the underlying GtkTableChild instance with gobj(), if we can
> figure out what you can do and how to do it.

For now, I can use the GtkTable and GtkWidget directly with
gtk_container_child_set_property, as you suggested.


Murray Cumming <murrayc murrayc com> writes:

> You could try changing the property with
> gtk_container_child_set_property():
> http://developer.gimp.org/api/2.0/gtk/GtkContainer.html#gtk-container-child-set-property
> 
> I will try to add this for gtkmm 2.6:
> http://bugzilla.gnome.org/show_bug.cgi?id=140515

Many thanks!

-- 
Roger Leigh

                Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.



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