mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
more *_get_arg/*_set_arg implementations
-timj
This commit is contained in:
parent
8dc9cd53ff
commit
8d721e5b75
53
gtk/gtkbox.c
53
gtk/gtkbox.c
@ -17,9 +17,20 @@
|
||||
*/
|
||||
#include "gtkbox.h"
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_SPACING,
|
||||
ARG_HOMOGENEOUS
|
||||
};
|
||||
|
||||
static void gtk_box_class_init (GtkBoxClass *klass);
|
||||
static void gtk_box_init (GtkBox *box);
|
||||
static void gtk_box_get_arg (GtkBox *box,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_box_set_arg (GtkBox *box,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_box_destroy (GtkObject *object);
|
||||
static void gtk_box_map (GtkWidget *widget);
|
||||
static void gtk_box_unmap (GtkWidget *widget);
|
||||
@ -53,8 +64,8 @@ gtk_box_get_type ()
|
||||
sizeof (GtkBoxClass),
|
||||
(GtkClassInitFunc) gtk_box_class_init,
|
||||
(GtkObjectInitFunc) gtk_box_init,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
(GtkArgSetFunc) gtk_box_set_arg,
|
||||
(GtkArgGetFunc) gtk_box_get_arg,
|
||||
};
|
||||
|
||||
box_type = gtk_type_unique (gtk_container_get_type (), &box_info);
|
||||
@ -76,6 +87,9 @@ gtk_box_class_init (GtkBoxClass *class)
|
||||
|
||||
parent_class = gtk_type_class (gtk_container_get_type ());
|
||||
|
||||
gtk_object_add_arg_type ("GtkBox::spacing", GTK_TYPE_INT, ARG_SPACING);
|
||||
gtk_object_add_arg_type ("GtkBox::homogeneous", GTK_TYPE_BOOL, ARG_HOMOGENEOUS);
|
||||
|
||||
object_class->destroy = gtk_box_destroy;
|
||||
|
||||
widget_class->map = gtk_box_map;
|
||||
@ -98,6 +112,41 @@ gtk_box_init (GtkBox *box)
|
||||
box->homogeneous = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_set_arg (GtkBox *box,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
switch (arg_id)
|
||||
{
|
||||
case ARG_SPACING:
|
||||
gtk_box_set_spacing (box, GTK_VALUE_INT (*arg));
|
||||
break;
|
||||
case ARG_HOMOGENEOUS:
|
||||
gtk_box_set_homogeneous (box, GTK_VALUE_BOOL (*arg));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_get_arg (GtkBox *box,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
switch (arg_id)
|
||||
{
|
||||
case ARG_SPACING:
|
||||
GTK_VALUE_INT (*arg) = box->spacing;
|
||||
break;
|
||||
case ARG_HOMOGENEOUS:
|
||||
GTK_VALUE_BOOL (*arg) = box->homogeneous;
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gtk_box_pack_start (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
|
@ -19,8 +19,20 @@
|
||||
#include "gtklabel.h"
|
||||
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_LABEL,
|
||||
ARG_JUSTIFY
|
||||
};
|
||||
|
||||
static void gtk_label_class_init (GtkLabelClass *klass);
|
||||
static void gtk_label_init (GtkLabel *label);
|
||||
static void gtk_label_set_arg (GtkLabel *label,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_label_get_arg (GtkLabel *label,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_label_destroy (GtkObject *object);
|
||||
static void gtk_label_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
@ -45,8 +57,8 @@ gtk_label_get_type ()
|
||||
sizeof (GtkLabelClass),
|
||||
(GtkClassInitFunc) gtk_label_class_init,
|
||||
(GtkObjectInitFunc) gtk_label_init,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
(GtkArgSetFunc) gtk_label_set_arg,
|
||||
(GtkArgGetFunc) gtk_label_get_arg,
|
||||
};
|
||||
|
||||
label_type = gtk_type_unique (gtk_misc_get_type (), &label_info);
|
||||
@ -66,12 +78,48 @@ gtk_label_class_init (GtkLabelClass *class)
|
||||
|
||||
parent_class = gtk_type_class (gtk_misc_get_type ());
|
||||
|
||||
gtk_object_add_arg_type ("GtkLabel::label", GTK_TYPE_STRING, ARG_LABEL);
|
||||
gtk_object_add_arg_type ("GtkLabel::justify", GTK_TYPE_ENUM, ARG_JUSTIFY);
|
||||
|
||||
object_class->destroy = gtk_label_destroy;
|
||||
|
||||
widget_class->size_request = gtk_label_size_request;
|
||||
widget_class->expose_event = gtk_label_expose;
|
||||
}
|
||||
|
||||
static void gtk_label_set_arg (GtkLabel *label,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
switch (arg_id)
|
||||
{
|
||||
case ARG_LABEL:
|
||||
gtk_label_set (label, GTK_VALUE_STRING (*arg));
|
||||
break;
|
||||
case ARG_JUSTIFY:
|
||||
gtk_label_set_justify (label, GTK_VALUE_ENUM (*arg));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void gtk_label_get_arg (GtkLabel *label,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
switch (arg_id)
|
||||
{
|
||||
case ARG_LABEL:
|
||||
GTK_VALUE_STRING (*arg) = g_strdup (label->label);
|
||||
break;
|
||||
case ARG_JUSTIFY:
|
||||
GTK_VALUE_ENUM (*arg) = label->jtype;
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_label_init (GtkLabel *label)
|
||||
{
|
||||
|
@ -59,6 +59,9 @@ static void gtk_object_init (GtkObject *object);
|
||||
static void gtk_object_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_object_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_real_object_destroy (GtkObject *object);
|
||||
static void gtk_object_data_init (void);
|
||||
static GtkObjectData* gtk_object_data_new (void);
|
||||
@ -104,7 +107,7 @@ gtk_object_init_type ()
|
||||
(GtkClassInitFunc) gtk_object_class_init,
|
||||
(GtkObjectInitFunc) gtk_object_init,
|
||||
gtk_object_set_arg,
|
||||
NULL,
|
||||
gtk_object_get_arg,
|
||||
};
|
||||
|
||||
object_type = gtk_type_unique (0, &object_info);
|
||||
@ -191,8 +194,23 @@ gtk_object_set_arg (GtkObject *object,
|
||||
(GtkSignalFunc) GTK_VALUE_SIGNAL (*arg).f,
|
||||
GTK_VALUE_SIGNAL (*arg).d);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_object_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
switch (arg_id)
|
||||
{
|
||||
case ARG_USER_DATA:
|
||||
GTK_VALUE_POINTER (*arg) = gtk_object_get_user_data (object);
|
||||
break;
|
||||
case ARG_SIGNAL:
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,6 +60,9 @@ static void gtk_window_init (GtkWindow *window);
|
||||
static void gtk_window_set_arg (GtkWindow *window,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_window_get_arg (GtkWindow *window,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_window_destroy (GtkObject *object);
|
||||
static void gtk_window_show (GtkWidget *widget);
|
||||
static void gtk_window_hide (GtkWidget *widget);
|
||||
@ -123,7 +126,7 @@ gtk_window_get_type ()
|
||||
(GtkClassInitFunc) gtk_window_class_init,
|
||||
(GtkObjectInitFunc) gtk_window_init,
|
||||
(GtkArgSetFunc) gtk_window_set_arg,
|
||||
(GtkArgGetFunc) NULL,
|
||||
(GtkArgGetFunc) gtk_window_get_arg,
|
||||
};
|
||||
|
||||
window_type = gtk_type_unique (gtk_bin_get_type (), &window_info);
|
||||
@ -228,7 +231,7 @@ gtk_window_set_arg (GtkWindow *window,
|
||||
switch (arg_id)
|
||||
{
|
||||
case ARG_TYPE:
|
||||
window->type = GTK_VALUE_ENUM(*arg);
|
||||
window->type = GTK_VALUE_ENUM (*arg);
|
||||
break;
|
||||
case ARG_TITLE:
|
||||
gtk_window_set_title (window, GTK_VALUE_STRING(*arg));
|
||||
@ -245,6 +248,34 @@ gtk_window_set_arg (GtkWindow *window,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_window_get_arg (GtkWindow *window,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
switch (arg_id)
|
||||
{
|
||||
case ARG_TYPE:
|
||||
GTK_VALUE_ENUM(*arg) = window->type;
|
||||
break;
|
||||
case ARG_TITLE:
|
||||
GTK_VALUE_STRING(*arg) = g_strdup (window->title);
|
||||
break;
|
||||
case ARG_AUTO_SHRINK:
|
||||
GTK_VALUE_BOOL(*arg) = window->auto_shrink;
|
||||
break;
|
||||
case ARG_ALLOW_SHRINK:
|
||||
GTK_VALUE_BOOL(*arg) = window->allow_shrink;
|
||||
break;
|
||||
case ARG_ALLOW_GROW:
|
||||
GTK_VALUE_BOOL(*arg) = window->allow_grow;
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
gtk_window_new (GtkWindowType type)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user