RE: [gtk-list] Re: Runtime Linkage queries




Tim Janik wrote:
> i'm not sure what you mean with "placeholders" here. if you want the
> ability to free-hand position widgets on a certain window, you are best
> off with using certain container types only, e.g. a table or gtkfixed.

When you create a table (or box/bin) in Glade, it automatically adds special
'placeholder' widgets to all the cells in the table, which the user then
replaces with widgets from the palette. The 'placeholders' are simply
drawing areas with a background pixmap - a sort of grey mesh pattern.
Run glade, create a new window and add a table and you'll see what I mean!

I don't know how you could do this with generic code, unless the container
provides a lot more information about how it lays out widgets - e.g.
'one-dimensional' for boxes, 'two-dimensional' for tables. Probably more
trouble
than its worth. Fixed containers also need a lot of special code to allow
moving & resizing with the mouse.

So, I think your new child args will allow new containers to be used in
Glade, but I'll still keep some special code for standard GTK containers
like GtkTable & GtkFixed since that makes it easier for the user.


> nope, actually your idea about a new type is quite usefull. we just can't
> call it GTK_TYPE_RANGE, since there is already a widget named this way ;)
> maybe GTK_TYPE_VALUE_RANGE or something the like? this type could feature
> step incrementation and page size (and of course limits...).

Actually, if you want to add full support for arg ranges, then I don't
think we need any new types - just extensions of the ArgInfo struct and
a few extra gtk_object_add_arg_type() functions:

struct _GtkArgInfo
{
  char *name;
  GtkType type;
  GtkType class_type;
  guint arg_flags;
  guint arg_id;
  guint seq_id;

  union {
    gint min_int;
    guint min_uint;
    glong min_long;
    gulong min_ulong;
    gfloat min_float;
    gdouble min_double;
  }
  union {
    gint max_int;
    guint max_uint;
    glong max_long;
    gulong max_ulong;
    gfloat max_float;
    gdouble max_double;
  }
};


Current function:
  gtk_object_add_arg_type       ("GtkWidget::x", GTK_TYPE_INT,
				 GTK_ARG_READWRITE, ARG_X);

New functions:
  gtk_object_add_int_arg_type   ("GtkWidget::x",
				 GTK_ARG_READWRITE, ARG_X, min, max);
  gtk_object_add_uint_arg_type  ("GtkWidget::x",
			         GTK_ARG_READWRITE, ARG_X, min, max);
  gtk_object_add_long_arg_type  ("GtkWidget::x",
			         GTK_ARG_READWRITE, ARG_X, min, max);
  gtk_object_add_ulong_arg_type ("GtkWidget::x",
			         GTK_ARG_READWRITE, ARG_X, min, max);
  gtk_object_add_float_arg_type ("GtkWidget::x",
				 GTK_ARG_READWRITE, ARG_X, min, max);
  gtk_object_add_double_arg_type("GtkWidget::x",
				 GTK_ARG_READWRITE, ARG_X, min, max);

I think the step size & page increments should be calculated by the
application - it may not be using spinbuttons.

If an Int/Float Arg doesn't have a range it can use the standard function,
and its min and max values would be set to 0, so existing code won't break.


You'd also need functions to get the ranges of an Arg.

Current function:
  gtk_object_get_arg_type (const gchar *arg_name)

New functions:
  gtk_object_get_int_arg_range (const gchar *arg_name,
				gint *min, gint *max)

  gtk_object_get_float_arg_range (const gchar *arg_name,
				  gfloat *min, gfloat *max)
...

Or you could just make the ArgInfo struct public and have:
  gtk_object_get_arg_info (const gchar *arg_name)


Damon





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