mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 19:00:08 +00:00
main part for GtkArgSetFunc/GtkArgGetFunc implementation.
-timj
This commit is contained in:
parent
18681dc653
commit
dd77b5db5a
@ -47,7 +47,8 @@ gtk_adjustment_get_type ()
|
||||
sizeof (GtkAdjustmentClass),
|
||||
(GtkClassInitFunc) gtk_adjustment_class_init,
|
||||
(GtkObjectInitFunc) gtk_adjustment_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
adjustment_type = gtk_type_unique (gtk_data_get_type (), &adjustment_info);
|
||||
|
@ -40,7 +40,8 @@ gtk_alignment_get_type ()
|
||||
sizeof (GtkAlignmentClass),
|
||||
(GtkClassInitFunc) gtk_alignment_class_init,
|
||||
(GtkObjectInitFunc) gtk_alignment_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
alignment_type = gtk_type_unique (gtk_bin_get_type (), &alignment_info);
|
||||
|
@ -41,7 +41,8 @@ gtk_arrow_get_type ()
|
||||
sizeof (GtkArrowClass),
|
||||
(GtkClassInitFunc) gtk_arrow_class_init,
|
||||
(GtkObjectInitFunc) gtk_arrow_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
arrow_type = gtk_type_unique (gtk_misc_get_type (), &arrow_info);
|
||||
|
@ -50,7 +50,8 @@ gtk_aspect_frame_get_type ()
|
||||
sizeof (GtkAspectFrameClass),
|
||||
(GtkClassInitFunc) gtk_aspect_frame_class_init,
|
||||
(GtkObjectInitFunc) gtk_aspect_frame_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
aspect_frame_type = gtk_type_unique (gtk_frame_get_type (), &aspect_frame_info);
|
||||
|
@ -42,7 +42,8 @@ gtk_button_box_get_type ()
|
||||
sizeof (GtkButtonBoxClass),
|
||||
(GtkClassInitFunc) gtk_button_box_class_init,
|
||||
(GtkObjectInitFunc) gtk_button_box_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
button_box_type = gtk_type_unique (gtk_box_get_type (), &button_box_info);
|
||||
|
@ -53,7 +53,8 @@ gtk_bin_get_type ()
|
||||
sizeof (GtkBinClass),
|
||||
(GtkClassInitFunc) gtk_bin_class_init,
|
||||
(GtkObjectInitFunc) gtk_bin_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
bin_type = gtk_type_unique (gtk_container_get_type (), &bin_info);
|
||||
|
@ -53,7 +53,8 @@ gtk_box_get_type ()
|
||||
sizeof (GtkBoxClass),
|
||||
(GtkClassInitFunc) gtk_box_class_init,
|
||||
(GtkObjectInitFunc) gtk_box_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
box_type = gtk_type_unique (gtk_container_get_type (), &box_info);
|
||||
|
@ -36,12 +36,18 @@ enum {
|
||||
LEAVE,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_LABEL
|
||||
};
|
||||
|
||||
|
||||
|
||||
static void gtk_button_class_init (GtkButtonClass *klass);
|
||||
static void gtk_button_init (GtkButton *button);
|
||||
static void gtk_button_arg (GtkButton *button,
|
||||
GtkArg *arg);
|
||||
static void gtk_button_set_arg (GtkButton *button,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_button_destroy (GtkObject *object);
|
||||
static void gtk_button_map (GtkWidget *widget);
|
||||
static void gtk_button_unmap (GtkWidget *widget);
|
||||
@ -101,7 +107,8 @@ gtk_button_get_type ()
|
||||
sizeof (GtkButtonClass),
|
||||
(GtkClassInitFunc) gtk_button_class_init,
|
||||
(GtkObjectInitFunc) gtk_button_init,
|
||||
(GtkArgFunc) gtk_button_arg,
|
||||
(GtkArgSetFunc) gtk_button_set_arg,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
button_type = gtk_type_unique (gtk_container_get_type (), &button_info);
|
||||
@ -123,7 +130,7 @@ gtk_button_class_init (GtkButtonClass *klass)
|
||||
|
||||
parent_class = gtk_type_class (gtk_container_get_type ());
|
||||
|
||||
gtk_object_add_arg_type ("GtkButton::label", GTK_TYPE_STRING);
|
||||
gtk_object_add_arg_type ("GtkButton::label", GTK_TYPE_STRING, ARG_LABEL);
|
||||
|
||||
button_signals[PRESSED] =
|
||||
gtk_signal_new ("pressed",
|
||||
@ -204,23 +211,28 @@ gtk_button_init (GtkButton *button)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_button_arg (GtkButton *button,
|
||||
GtkArg *arg)
|
||||
gtk_button_set_arg (GtkButton *button,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
if (strcmp (arg->name, "label") == 0)
|
||||
GtkWidget *label;
|
||||
|
||||
switch (arg_id)
|
||||
{
|
||||
GtkWidget *label;
|
||||
|
||||
case ARG_LABEL:
|
||||
gtk_container_disable_resize (GTK_CONTAINER (button));
|
||||
|
||||
|
||||
if (button->child)
|
||||
gtk_widget_destroy (button->child);
|
||||
|
||||
|
||||
label = gtk_label_new (GTK_VALUE_STRING(*arg));
|
||||
gtk_widget_show (label);
|
||||
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (button), label);
|
||||
gtk_container_enable_resize (GTK_CONTAINER (button));
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,8 @@ gtk_check_button_get_type ()
|
||||
sizeof (GtkCheckButtonClass),
|
||||
(GtkClassInitFunc) gtk_check_button_class_init,
|
||||
(GtkObjectInitFunc) gtk_check_button_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
check_button_type = gtk_type_unique (gtk_toggle_button_get_type (), &check_button_info);
|
||||
|
@ -60,7 +60,8 @@ gtk_check_menu_item_get_type ()
|
||||
sizeof (GtkCheckMenuItemClass),
|
||||
(GtkClassInitFunc) gtk_check_menu_item_class_init,
|
||||
(GtkObjectInitFunc) gtk_check_menu_item_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
check_menu_item_type = gtk_type_unique (gtk_menu_item_get_type (), &check_menu_item_info);
|
||||
|
@ -252,7 +252,8 @@ gtk_clist_get_type ()
|
||||
sizeof (GtkCListClass),
|
||||
(GtkClassInitFunc) gtk_clist_class_init,
|
||||
(GtkObjectInitFunc) gtk_clist_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
clist_type = gtk_type_unique (gtk_container_get_type (), &clist_info);
|
||||
|
@ -82,7 +82,8 @@ gtk_combo_box_get_type ()
|
||||
sizeof (GtkComboBoxClass),
|
||||
(GtkClassInitFunc) gtk_combo_box_class_init,
|
||||
(GtkObjectInitFunc) gtk_combo_box_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
combo_box_type = gtk_type_unique (gtk_entry_get_type (), &combo_box_info);
|
||||
|
@ -28,6 +28,13 @@ enum {
|
||||
FOCUS,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_BORDER_WIDTH,
|
||||
ARG_AUTO_RESIZE,
|
||||
ARG_BLOCK_RESIZE,
|
||||
ARG_CHILD
|
||||
};
|
||||
|
||||
|
||||
typedef void (*GtkContainerSignal1) (GtkObject *object,
|
||||
@ -64,8 +71,9 @@ static void gtk_container_marshal_signal_4 (GtkObject *object,
|
||||
|
||||
static void gtk_container_class_init (GtkContainerClass *klass);
|
||||
static void gtk_container_init (GtkContainer *container);
|
||||
static void gtk_container_arg (GtkContainer *container,
|
||||
GtkArg *arg);
|
||||
static void gtk_container_set_arg (GtkContainer *container,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static gint gtk_real_container_need_resize (GtkContainer *container);
|
||||
static gint gtk_real_container_focus (GtkContainer *container,
|
||||
GtkDirectionType direction);
|
||||
@ -105,7 +113,8 @@ gtk_container_get_type ()
|
||||
sizeof (GtkContainerClass),
|
||||
(GtkClassInitFunc) gtk_container_class_init,
|
||||
(GtkObjectInitFunc) gtk_container_init,
|
||||
(GtkArgFunc) gtk_container_arg,
|
||||
(GtkArgSetFunc) gtk_container_set_arg,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
container_type = gtk_type_unique (gtk_widget_get_type (), &container_info);
|
||||
@ -123,10 +132,10 @@ gtk_container_class_init (GtkContainerClass *class)
|
||||
object_class = (GtkObjectClass*) class;
|
||||
widget_class = (GtkWidgetClass*) class;
|
||||
|
||||
gtk_object_add_arg_type ("GtkContainer::border_width", GTK_TYPE_LONG);
|
||||
gtk_object_add_arg_type ("GtkContainer::auto_resize", GTK_TYPE_BOOL);
|
||||
gtk_object_add_arg_type ("GtkContainer::block_resize", GTK_TYPE_BOOL);
|
||||
gtk_object_add_arg_type ("GtkContainer::child", GTK_TYPE_WIDGET);
|
||||
gtk_object_add_arg_type ("GtkContainer::border_width", GTK_TYPE_LONG, ARG_BORDER_WIDTH);
|
||||
gtk_object_add_arg_type ("GtkContainer::auto_resize", GTK_TYPE_BOOL, ARG_AUTO_RESIZE);
|
||||
gtk_object_add_arg_type ("GtkContainer::block_resize", GTK_TYPE_BOOL, ARG_BLOCK_RESIZE);
|
||||
gtk_object_add_arg_type ("GtkContainer::child", GTK_TYPE_WIDGET, ARG_CHILD);
|
||||
|
||||
container_signals[ADD] =
|
||||
gtk_signal_new ("add",
|
||||
@ -193,30 +202,32 @@ gtk_container_init (GtkContainer *container)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_container_arg (GtkContainer *container,
|
||||
GtkArg *arg)
|
||||
gtk_container_set_arg (GtkContainer *container,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
if (strcmp (arg->name, "border_width") == 0)
|
||||
switch (arg_id)
|
||||
{
|
||||
case ARG_BORDER_WIDTH:
|
||||
gtk_container_border_width (container, GTK_VALUE_LONG (*arg));
|
||||
}
|
||||
else if (strcmp (arg->name, "auto_resize") == 0)
|
||||
{
|
||||
break;
|
||||
case ARG_AUTO_RESIZE:
|
||||
if (GTK_VALUE_BOOL (*arg))
|
||||
gtk_container_enable_resize (container);
|
||||
else
|
||||
gtk_container_disable_resize (container);
|
||||
}
|
||||
else if (strcmp (arg->name, "block_resize") == 0)
|
||||
{
|
||||
break;
|
||||
case ARG_BLOCK_RESIZE:
|
||||
if (GTK_VALUE_BOOL (*arg))
|
||||
gtk_container_block_resize (container);
|
||||
else
|
||||
gtk_container_unblock_resize (container);
|
||||
}
|
||||
else if (strcmp (arg->name, "child") == 0)
|
||||
{
|
||||
break;
|
||||
case ARG_CHILD:
|
||||
gtk_container_add (container, GTK_WIDGET (GTK_VALUE_OBJECT (*arg)));
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,8 @@ gtk_curve_get_type (void)
|
||||
sizeof (GtkCurveClass),
|
||||
(GtkClassInitFunc) gtk_curve_class_init,
|
||||
(GtkObjectInitFunc) gtk_curve_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
curve_type = gtk_type_unique (gtk_drawing_area_get_type (), &curve_info);
|
||||
|
@ -45,7 +45,8 @@ gtk_data_get_type ()
|
||||
sizeof (GtkDataClass),
|
||||
(GtkClassInitFunc) gtk_data_class_init,
|
||||
(GtkObjectInitFunc) NULL,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
data_type = gtk_type_unique (gtk_object_get_type (), &data_info);
|
||||
|
@ -40,7 +40,8 @@ gtk_dialog_get_type ()
|
||||
sizeof (GtkDialogClass),
|
||||
(GtkClassInitFunc) gtk_dialog_class_init,
|
||||
(GtkObjectInitFunc) gtk_dialog_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
dialog_type = gtk_type_unique (gtk_window_get_type (), &dialog_info);
|
||||
|
@ -39,7 +39,8 @@ gtk_drawing_area_get_type ()
|
||||
sizeof (GtkDrawingAreaClass),
|
||||
(GtkClassInitFunc) gtk_drawing_area_class_init,
|
||||
(GtkObjectInitFunc) gtk_drawing_area_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
drawing_area_type = gtk_type_unique (gtk_widget_get_type (), &drawing_area_info);
|
||||
|
@ -227,7 +227,8 @@ gtk_entry_get_type ()
|
||||
sizeof (GtkEntryClass),
|
||||
(GtkClassInitFunc) gtk_entry_class_init,
|
||||
(GtkObjectInitFunc) gtk_entry_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
entry_type = gtk_type_unique (gtk_widget_get_type (), &entry_info);
|
||||
|
@ -46,7 +46,8 @@ gtk_event_box_get_type ()
|
||||
sizeof (GtkEventBoxClass),
|
||||
(GtkClassInitFunc) gtk_event_box_class_init,
|
||||
(GtkObjectInitFunc) gtk_event_box_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
event_box_type = gtk_type_unique (gtk_bin_get_type (), &event_box_info);
|
||||
|
@ -308,7 +308,8 @@ gtk_file_selection_get_type ()
|
||||
sizeof (GtkFileSelectionClass),
|
||||
(GtkClassInitFunc) gtk_file_selection_class_init,
|
||||
(GtkObjectInitFunc) gtk_file_selection_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
file_selection_type = gtk_type_unique (gtk_window_get_type (), &filesel_info);
|
||||
|
@ -61,7 +61,8 @@ gtk_fixed_get_type ()
|
||||
sizeof (GtkFixedClass),
|
||||
(GtkClassInitFunc) gtk_fixed_class_init,
|
||||
(GtkObjectInitFunc) gtk_fixed_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
fixed_type = gtk_type_unique (gtk_container_get_type (), &fixed_info);
|
||||
|
@ -51,7 +51,8 @@ gtk_frame_get_type ()
|
||||
sizeof (GtkFrameClass),
|
||||
(GtkClassInitFunc) gtk_frame_class_init,
|
||||
(GtkObjectInitFunc) gtk_frame_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
frame_type = gtk_type_unique (gtk_bin_get_type (), &frame_info);
|
||||
|
@ -210,7 +210,8 @@ gtk_gamma_curve_get_type (void)
|
||||
sizeof (GtkGammaCurveClass),
|
||||
(GtkClassInitFunc) gtk_gamma_curve_class_init,
|
||||
(GtkObjectInitFunc) gtk_gamma_curve_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
gamma_curve_type =
|
||||
|
@ -61,7 +61,8 @@ gtk_handle_box_get_type ()
|
||||
sizeof (GtkHandleBoxClass),
|
||||
(GtkClassInitFunc) gtk_handle_box_class_init,
|
||||
(GtkObjectInitFunc) gtk_handle_box_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
handle_box_type = gtk_type_unique (gtk_event_box_get_type (), &handle_box_info);
|
||||
|
@ -43,7 +43,8 @@ gtk_hbutton_box_get_type ()
|
||||
sizeof (GtkHButtonBoxClass),
|
||||
(GtkClassInitFunc) gtk_hbutton_box_class_init,
|
||||
(GtkObjectInitFunc) gtk_hbutton_box_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
hbutton_box_type = gtk_type_unique (gtk_button_box_get_type (), &hbutton_box_info);
|
||||
|
@ -40,7 +40,8 @@ gtk_hbox_get_type ()
|
||||
sizeof (GtkHBoxClass),
|
||||
(GtkClassInitFunc) gtk_hbox_class_init,
|
||||
(GtkObjectInitFunc) gtk_hbox_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
hbox_type = gtk_type_unique (gtk_box_get_type (), &hbox_info);
|
||||
|
@ -49,7 +49,8 @@ gtk_hpaned_get_type ()
|
||||
sizeof (GtkHPanedClass),
|
||||
(GtkClassInitFunc) gtk_hpaned_class_init,
|
||||
(GtkObjectInitFunc) gtk_hpaned_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
hpaned_type = gtk_type_unique (gtk_paned_get_type (), &hpaned_info);
|
||||
|
@ -51,7 +51,8 @@ gtk_hruler_get_type ()
|
||||
sizeof (GtkHRulerClass),
|
||||
(GtkClassInitFunc) gtk_hruler_class_init,
|
||||
(GtkObjectInitFunc) gtk_hruler_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
hruler_type = gtk_type_unique (gtk_ruler_get_type (), &hruler_info);
|
||||
|
@ -58,7 +58,8 @@ gtk_hscale_get_type ()
|
||||
sizeof (GtkHScaleClass),
|
||||
(GtkClassInitFunc) gtk_hscale_class_init,
|
||||
(GtkObjectInitFunc) gtk_hscale_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
hscale_type = gtk_type_unique (gtk_scale_get_type (), &hscale_info);
|
||||
|
@ -54,7 +54,8 @@ gtk_hscrollbar_get_type ()
|
||||
sizeof (GtkHScrollbarClass),
|
||||
(GtkClassInitFunc) gtk_hscrollbar_class_init,
|
||||
(GtkObjectInitFunc) gtk_hscrollbar_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
hscrollbar_type = gtk_type_unique (gtk_scrollbar_get_type (), &hscrollbar_info);
|
||||
|
@ -38,7 +38,8 @@ gtk_hseparator_get_type ()
|
||||
sizeof (GtkHSeparatorClass),
|
||||
(GtkClassInitFunc) gtk_hseparator_class_init,
|
||||
(GtkObjectInitFunc) gtk_hseparator_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
hseparator_type = gtk_type_unique (gtk_separator_get_type (), &hseparator_info);
|
||||
|
@ -39,7 +39,8 @@ gtk_image_get_type ()
|
||||
sizeof (GtkImageClass),
|
||||
(GtkClassInitFunc) gtk_image_class_init,
|
||||
(GtkObjectInitFunc) gtk_image_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
image_type = gtk_type_unique (gtk_misc_get_type (), &image_info);
|
||||
|
@ -140,7 +140,8 @@ gtk_input_dialog_get_type ()
|
||||
sizeof (GtkInputDialogClass),
|
||||
(GtkClassInitFunc) gtk_input_dialog_class_init,
|
||||
(GtkObjectInitFunc) gtk_input_dialog_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
input_dialog_type = gtk_type_unique (gtk_dialog_get_type (),
|
||||
|
@ -51,7 +51,8 @@ gtk_item_get_type ()
|
||||
sizeof (GtkItemClass),
|
||||
(GtkClassInitFunc) gtk_item_class_init,
|
||||
(GtkObjectInitFunc) gtk_item_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
item_type = gtk_type_unique (gtk_bin_get_type (), &item_info);
|
||||
|
@ -45,7 +45,8 @@ gtk_label_get_type ()
|
||||
sizeof (GtkLabelClass),
|
||||
(GtkClassInitFunc) gtk_label_class_init,
|
||||
(GtkObjectInitFunc) gtk_label_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
label_type = gtk_type_unique (gtk_misc_get_type (), &label_info);
|
||||
|
@ -91,7 +91,8 @@ gtk_list_get_type ()
|
||||
sizeof (GtkListClass),
|
||||
(GtkClassInitFunc) gtk_list_class_init,
|
||||
(GtkObjectInitFunc) gtk_list_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
list_type = gtk_type_unique (gtk_container_get_type (), &list_info);
|
||||
|
@ -59,7 +59,8 @@ gtk_list_item_get_type ()
|
||||
sizeof (GtkListItemClass),
|
||||
(GtkClassInitFunc) gtk_list_item_class_init,
|
||||
(GtkObjectInitFunc) gtk_list_item_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
list_item_type = gtk_type_unique (gtk_item_get_type (), &list_item_info);
|
||||
|
@ -65,7 +65,8 @@ gtk_menu_get_type ()
|
||||
sizeof (GtkMenuClass),
|
||||
(GtkClassInitFunc) gtk_menu_class_init,
|
||||
(GtkObjectInitFunc) gtk_menu_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
menu_type = gtk_type_unique (gtk_menu_shell_get_type (), &menu_info);
|
||||
|
@ -51,7 +51,8 @@ gtk_menu_bar_get_type ()
|
||||
sizeof (GtkMenuBarClass),
|
||||
(GtkClassInitFunc) gtk_menu_bar_class_init,
|
||||
(GtkObjectInitFunc) gtk_menu_bar_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
menu_bar_type = gtk_type_unique (gtk_menu_shell_get_type (), &menu_bar_info);
|
||||
|
@ -86,7 +86,8 @@ gtk_menu_item_get_type ()
|
||||
sizeof (GtkMenuItemClass),
|
||||
(GtkClassInitFunc) gtk_menu_item_class_init,
|
||||
(GtkObjectInitFunc) gtk_menu_item_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
menu_item_type = gtk_type_unique (gtk_item_get_type (), &menu_item_info);
|
||||
|
@ -74,7 +74,8 @@ gtk_menu_shell_get_type ()
|
||||
sizeof (GtkMenuShellClass),
|
||||
(GtkClassInitFunc) gtk_menu_shell_class_init,
|
||||
(GtkObjectInitFunc) gtk_menu_shell_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
menu_shell_type = gtk_type_unique (gtk_container_get_type (), &menu_shell_info);
|
||||
|
@ -38,7 +38,8 @@ gtk_misc_get_type ()
|
||||
sizeof (GtkMiscClass),
|
||||
(GtkClassInitFunc) gtk_misc_class_init,
|
||||
(GtkObjectInitFunc) gtk_misc_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
misc_type = gtk_type_unique (gtk_widget_get_type (), &misc_info);
|
||||
|
@ -95,7 +95,8 @@ gtk_notebook_get_type ()
|
||||
sizeof (GtkNotebookClass),
|
||||
(GtkClassInitFunc) gtk_notebook_class_init,
|
||||
(GtkObjectInitFunc) gtk_notebook_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
notebook_type = gtk_type_unique (gtk_container_get_type (), ¬ebook_info);
|
||||
|
112
gtk/gtkobject.c
112
gtk/gtkobject.c
@ -28,6 +28,11 @@ enum {
|
||||
DESTROY,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_USER_DATA,
|
||||
ARG_SIGNAL
|
||||
};
|
||||
|
||||
|
||||
typedef struct _GtkObjectData GtkObjectData;
|
||||
@ -44,13 +49,16 @@ struct _GtkArgInfo
|
||||
{
|
||||
char *name;
|
||||
GtkType type;
|
||||
GtkType class_type;
|
||||
guint arg_id;
|
||||
};
|
||||
|
||||
|
||||
static void gtk_object_class_init (GtkObjectClass *klass);
|
||||
static void gtk_object_init (GtkObject *object);
|
||||
static void gtk_object_arg (GtkObject *object,
|
||||
GtkArg *arg);
|
||||
static void gtk_object_set_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);
|
||||
@ -95,7 +103,8 @@ gtk_object_init_type ()
|
||||
sizeof (GtkObjectClass),
|
||||
(GtkClassInitFunc) gtk_object_class_init,
|
||||
(GtkObjectInitFunc) gtk_object_init,
|
||||
(GtkArgFunc) gtk_object_arg,
|
||||
gtk_object_set_arg,
|
||||
NULL,
|
||||
};
|
||||
|
||||
object_type = gtk_type_unique (0, &object_info);
|
||||
@ -122,8 +131,8 @@ gtk_object_class_init (GtkObjectClass *class)
|
||||
class->signals = NULL;
|
||||
class->nsignals = 0;
|
||||
|
||||
gtk_object_add_arg_type ("GtkObject::user_data", GTK_TYPE_POINTER);
|
||||
gtk_object_add_arg_type ("GtkObject::signal", GTK_TYPE_SIGNAL);
|
||||
gtk_object_add_arg_type ("GtkObject::user_data", GTK_TYPE_POINTER, ARG_USER_DATA);
|
||||
gtk_object_add_arg_type ("GtkObject::signal", GTK_TYPE_SIGNAL, ARG_SIGNAL);
|
||||
|
||||
object_signals[DESTROY] =
|
||||
gtk_signal_new ("destroy",
|
||||
@ -163,24 +172,27 @@ gtk_object_init (GtkObject *object)
|
||||
*****************************************/
|
||||
|
||||
static void
|
||||
gtk_object_arg (GtkObject *object,
|
||||
GtkArg *arg)
|
||||
gtk_object_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
if (strcmp (arg->name, "user_data") == 0)
|
||||
switch (arg_id)
|
||||
{
|
||||
case ARG_USER_DATA:
|
||||
gtk_object_set_user_data (object, GTK_VALUE_POINTER (*arg));
|
||||
}
|
||||
else if (strncmp (arg->name, "signal", 6) == 0)
|
||||
{
|
||||
if ((arg->name[6] != ':') || (arg->name[7] != ':'))
|
||||
break;
|
||||
case ARG_SIGNAL:
|
||||
if ((arg->name[11 + 6] != ':') || (arg->name[11 + 7] != ':'))
|
||||
{
|
||||
g_print ("invalid signal argument: \"%s\"\n", arg->name);
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_signal_connect (object, arg->name + 8,
|
||||
gtk_signal_connect (object, arg->name + 11 + 8,
|
||||
(GtkSignalFunc) GTK_VALUE_SIGNAL (*arg).f,
|
||||
GTK_VALUE_SIGNAL (*arg).d);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
@ -344,29 +356,40 @@ gtk_object_setv (GtkObject *obj,
|
||||
gint nargs,
|
||||
GtkArg *args)
|
||||
{
|
||||
guint class_type;
|
||||
char class_name[1024];
|
||||
char *arg_name;
|
||||
int i;
|
||||
|
||||
g_return_if_fail (obj != NULL);
|
||||
|
||||
if (!arg_info_ht)
|
||||
return;
|
||||
|
||||
for (i = 0; i < nargs; i++)
|
||||
{
|
||||
arg_name = strchr (args[i].name, ':');
|
||||
if (!arg_name || (arg_name[0] != ':') || (arg_name[1] != ':'))
|
||||
GtkArgInfo *info;
|
||||
gchar *lookup_name;
|
||||
gchar *d;
|
||||
|
||||
lookup_name = g_strdup (args[i].name);
|
||||
d = strchr (lookup_name, ':');
|
||||
if (d && d[1] == ':')
|
||||
{
|
||||
g_print ("invalid arg name: \"%s\"\n", args[i].name);
|
||||
d = strchr (d + 2, ':');
|
||||
if (d)
|
||||
*d = 0;
|
||||
|
||||
info = g_hash_table_lookup (arg_info_ht, lookup_name);
|
||||
}
|
||||
else
|
||||
info = NULL;
|
||||
|
||||
if (!info)
|
||||
{
|
||||
g_warning ("invalid arg name: \"%s\"\n", lookup_name);
|
||||
continue;
|
||||
}
|
||||
g_free (lookup_name);
|
||||
|
||||
strncpy (class_name, args[i].name, (long) (arg_name - args[i].name));
|
||||
class_name[(long) (arg_name - args[i].name)] = '\0';
|
||||
|
||||
args[i].name = arg_name + 2;
|
||||
|
||||
class_type = gtk_type_from_name (class_name);
|
||||
gtk_type_set_arg (obj, class_type, &args[i]);
|
||||
gtk_type_set_arg (obj, info->class_type, &args[i], info->arg_id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -380,13 +403,38 @@ gtk_object_setv (GtkObject *obj,
|
||||
|
||||
void
|
||||
gtk_object_add_arg_type (const char *arg_name,
|
||||
GtkType arg_type)
|
||||
GtkType arg_type,
|
||||
guint arg_id)
|
||||
{
|
||||
GtkArgInfo *info;
|
||||
gchar class_part[1024];
|
||||
gchar *arg_part;
|
||||
GtkType class_type;
|
||||
|
||||
g_return_if_fail (arg_id > 0);
|
||||
|
||||
arg_part = strchr (arg_name, ':');
|
||||
if (!arg_part || (arg_part[0] != ':') || (arg_part[1] != ':'))
|
||||
{
|
||||
g_warning ("invalid arg name: \"%s\"\n", arg_name);
|
||||
return;
|
||||
}
|
||||
|
||||
strncpy (class_part, arg_name, (glong) (arg_part - arg_name));
|
||||
class_part[(glong) (arg_part - arg_name)] = '\0';
|
||||
|
||||
class_type = gtk_type_from_name (class_part);
|
||||
if (!class_type)
|
||||
{
|
||||
g_warning ("invalid class name in arg: \"%s\"\n", arg_name);
|
||||
return;
|
||||
}
|
||||
|
||||
info = g_new (GtkArgInfo, 1);
|
||||
info->name = g_strdup(arg_name);
|
||||
info->name = g_strdup (arg_name);
|
||||
info->type = arg_type;
|
||||
info->class_type = class_type;
|
||||
info->arg_id = arg_id;
|
||||
|
||||
if (!arg_info_ht)
|
||||
arg_info_ht = g_hash_table_new (g_string_hash, g_string_equal);
|
||||
@ -415,7 +463,7 @@ gtk_object_get_arg_type (const char *arg_name)
|
||||
t = strchr (arg_name, ':');
|
||||
if (!t || (t[0] != ':') || (t[1] != ':'))
|
||||
{
|
||||
g_print ("invalid arg name: \"%s\"\n", arg_name);
|
||||
g_warning ("invalid arg name: \"%s\"\n", arg_name);
|
||||
return GTK_TYPE_INVALID;
|
||||
}
|
||||
|
||||
@ -801,7 +849,7 @@ gtk_object_data_id_alloc ()
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* gtk_object_data_id_alloc:
|
||||
* gtk_object_collect_args:
|
||||
*
|
||||
* arguments:
|
||||
*
|
||||
@ -836,7 +884,7 @@ gtk_object_collect_args (gint *nargs,
|
||||
switch (GTK_FUNDAMENTAL_TYPE (type))
|
||||
{
|
||||
case GTK_TYPE_INVALID:
|
||||
g_print ("invalid arg name: \"%s\" %x\n", name, type);
|
||||
g_warning ("invalid arg name: \"%s\" %x\n", name, type);
|
||||
(void) va_arg (args1, long);
|
||||
continue;
|
||||
case GTK_TYPE_NONE:
|
||||
|
@ -186,7 +186,8 @@ void gtk_object_setv (GtkObject *obj,
|
||||
GtkArg *args);
|
||||
|
||||
void gtk_object_add_arg_type (const char *arg_name,
|
||||
GtkType arg_type);
|
||||
GtkType arg_type,
|
||||
guint arg_id);
|
||||
|
||||
GtkType gtk_object_get_arg_type (const char *arg_name);
|
||||
|
||||
|
@ -75,7 +75,8 @@ gtk_option_menu_get_type ()
|
||||
sizeof (GtkOptionMenuClass),
|
||||
(GtkClassInitFunc) gtk_option_menu_class_init,
|
||||
(GtkObjectInitFunc) gtk_option_menu_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
option_menu_type = gtk_type_unique (gtk_button_get_type (), &option_menu_info);
|
||||
|
@ -53,7 +53,8 @@ gtk_paned_get_type ()
|
||||
sizeof (GtkPanedClass),
|
||||
(GtkClassInitFunc) gtk_paned_class_init,
|
||||
(GtkObjectInitFunc) gtk_paned_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
paned_type = gtk_type_unique (gtk_container_get_type (), &paned_info);
|
||||
|
@ -41,7 +41,8 @@ gtk_pixmap_get_type ()
|
||||
sizeof (GtkPixmapClass),
|
||||
(GtkClassInitFunc) gtk_pixmap_class_init,
|
||||
(GtkObjectInitFunc) gtk_pixmap_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
pixmap_type = gtk_type_unique (gtk_misc_get_type (), &pixmap_info);
|
||||
|
@ -140,7 +140,8 @@ gtk_preview_get_type ()
|
||||
sizeof (GtkPreviewClass),
|
||||
(GtkClassInitFunc) gtk_preview_class_init,
|
||||
(GtkObjectInitFunc) gtk_preview_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
preview_type = gtk_type_unique (gtk_widget_get_type (), &preview_info);
|
||||
|
@ -47,7 +47,8 @@ gtk_progress_bar_get_type ()
|
||||
sizeof (GtkProgressBarClass),
|
||||
(GtkClassInitFunc) gtk_progress_bar_class_init,
|
||||
(GtkObjectInitFunc) gtk_progress_bar_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
progress_bar_type = gtk_type_unique (gtk_widget_get_type (), &progress_bar_info);
|
||||
|
@ -48,7 +48,8 @@ gtk_radio_button_get_type ()
|
||||
sizeof (GtkRadioButtonClass),
|
||||
(GtkClassInitFunc) gtk_radio_button_class_init,
|
||||
(GtkObjectInitFunc) gtk_radio_button_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
radio_button_type = gtk_type_unique (gtk_check_button_get_type (), &radio_button_info);
|
||||
|
@ -40,7 +40,8 @@ gtk_radio_menu_item_get_type ()
|
||||
sizeof (GtkRadioMenuItemClass),
|
||||
(GtkClassInitFunc) gtk_radio_menu_item_class_init,
|
||||
(GtkObjectInitFunc) gtk_radio_menu_item_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
radio_menu_item_type = gtk_type_unique (gtk_check_menu_item_get_type (), &radio_menu_item_info);
|
||||
|
@ -90,7 +90,8 @@ gtk_range_get_type ()
|
||||
sizeof (GtkRangeClass),
|
||||
(GtkClassInitFunc) gtk_range_class_init,
|
||||
(GtkObjectInitFunc) gtk_range_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
range_type = gtk_type_unique (gtk_widget_get_type (), &range_info);
|
||||
|
@ -51,7 +51,8 @@ gtk_ruler_get_type ()
|
||||
sizeof (GtkRulerClass),
|
||||
(GtkClassInitFunc) gtk_ruler_class_init,
|
||||
(GtkObjectInitFunc) gtk_ruler_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
ruler_type = gtk_type_unique (gtk_widget_get_type (), &ruler_info);
|
||||
|
@ -46,7 +46,8 @@ gtk_scale_get_type ()
|
||||
sizeof (GtkScaleClass),
|
||||
(GtkClassInitFunc) gtk_scale_class_init,
|
||||
(GtkObjectInitFunc) gtk_scale_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
scale_type = gtk_type_unique (gtk_range_get_type (), &scale_info);
|
||||
|
@ -34,7 +34,8 @@ gtk_scrollbar_get_type ()
|
||||
sizeof (GtkScrollbarClass),
|
||||
(GtkClassInitFunc) gtk_scrollbar_class_init,
|
||||
(GtkObjectInitFunc) gtk_scrollbar_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
scrollbar_type = gtk_type_unique (gtk_range_get_type (), &scrollbar_info);
|
||||
|
@ -63,7 +63,8 @@ gtk_scrolled_window_get_type ()
|
||||
sizeof (GtkScrolledWindowClass),
|
||||
(GtkClassInitFunc) gtk_scrolled_window_class_init,
|
||||
(GtkObjectInitFunc) gtk_scrolled_window_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
scrolled_window_type = gtk_type_unique (gtk_container_get_type (), &scrolled_window_info);
|
||||
|
@ -36,7 +36,8 @@ gtk_separator_get_type ()
|
||||
sizeof (GtkSeparatorClass),
|
||||
(GtkClassInitFunc) gtk_separator_class_init,
|
||||
(GtkObjectInitFunc) gtk_separator_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
separator_type = gtk_type_unique (gtk_widget_get_type (), &separator_info);
|
||||
|
@ -66,7 +66,8 @@ gtk_table_get_type ()
|
||||
sizeof (GtkTableClass),
|
||||
(GtkClassInitFunc) gtk_table_class_init,
|
||||
(GtkObjectInitFunc) gtk_table_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
table_type = gtk_type_unique (gtk_container_get_type (), &table_info);
|
||||
|
@ -325,7 +325,8 @@ gtk_text_get_type ()
|
||||
sizeof (GtkTextClass),
|
||||
(GtkClassInitFunc) gtk_text_class_init,
|
||||
(GtkObjectInitFunc) gtk_text_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
text_type = gtk_type_unique (gtk_widget_get_type (), &text_info);
|
||||
|
@ -58,7 +58,8 @@ gtk_toggle_button_get_type ()
|
||||
sizeof (GtkToggleButtonClass),
|
||||
(GtkClassInitFunc) gtk_toggle_button_class_init,
|
||||
(GtkObjectInitFunc) gtk_toggle_button_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
toggle_button_type = gtk_type_unique (gtk_button_get_type (), &toggle_button_info);
|
||||
|
@ -104,7 +104,8 @@ gtk_toolbar_get_type (void)
|
||||
sizeof (GtkToolbarClass),
|
||||
(GtkClassInitFunc) gtk_toolbar_class_init,
|
||||
(GtkObjectInitFunc) gtk_toolbar_init,
|
||||
(GtkArgFunc) NULL
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
toolbar_type = gtk_type_unique (gtk_container_get_type (), &toolbar_info);
|
||||
|
@ -88,7 +88,8 @@ gtk_tree_get_type ()
|
||||
sizeof (GtkTreeClass),
|
||||
(GtkClassInitFunc) gtk_tree_class_init,
|
||||
(GtkObjectInitFunc) gtk_tree_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
tree_type = gtk_type_unique (gtk_container_get_type (), &tree_info);
|
||||
|
@ -99,7 +99,8 @@ gtk_tree_item_get_type ()
|
||||
sizeof (GtkTreeItemClass),
|
||||
(GtkClassInitFunc) gtk_tree_item_class_init,
|
||||
(GtkObjectInitFunc) gtk_tree_item_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
tree_item_type = gtk_type_unique (gtk_item_get_type (), &tree_item_info);
|
||||
|
@ -271,8 +271,9 @@ gtk_type_is_a (GtkType type,
|
||||
|
||||
void
|
||||
gtk_type_set_arg (GtkObject *object,
|
||||
GtkType type,
|
||||
GtkArg *arg)
|
||||
GtkType type,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
GtkTypeNode *node;
|
||||
|
||||
@ -281,8 +282,8 @@ gtk_type_set_arg (GtkObject *object,
|
||||
|
||||
node = g_hash_table_lookup (type_hash_table, &type);
|
||||
|
||||
if (node->type_info.arg_func)
|
||||
(* node->type_info.arg_func) (object, arg);
|
||||
if (node && node->type_info.arg_set_func)
|
||||
(* node->type_info.arg_set_func) (object, arg, arg_id);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -390,7 +391,8 @@ gtk_type_register_builtin (char *name,
|
||||
info.object_size = info.class_size = 0;
|
||||
info.class_init_func = NULL;
|
||||
info.object_init_func = NULL;
|
||||
info.arg_func = NULL;
|
||||
info.arg_set_func = NULL;
|
||||
info.arg_get_func = NULL;
|
||||
|
||||
return gtk_type_unique (parent, &info);
|
||||
}
|
||||
|
@ -77,7 +77,8 @@ typedef struct _GtkTypeInfo GtkTypeInfo;
|
||||
|
||||
typedef void (*GtkClassInitFunc) (gpointer klass);
|
||||
typedef void (*GtkObjectInitFunc) (gpointer object);
|
||||
typedef void (*GtkArgFunc) (GtkObject *object, GtkArg *arg);
|
||||
typedef void (*GtkArgGetFunc) (GtkObject *object, GtkArg *arg, guint arg_id);
|
||||
typedef void (*GtkArgSetFunc) (GtkObject *object, GtkArg *arg, guint arg_id);
|
||||
typedef gint (*GtkFunction) (gpointer data);
|
||||
typedef void (*GtkRemoveFunction) (gpointer data);
|
||||
typedef void (*GtkCallbackMarshal) (GtkObject *object,
|
||||
@ -89,7 +90,7 @@ typedef void (*GtkDestroyNotify) (gpointer data);
|
||||
struct _GtkArg
|
||||
{
|
||||
GtkType type;
|
||||
char *name;
|
||||
gchar *name;
|
||||
|
||||
union {
|
||||
gchar char_data;
|
||||
@ -166,7 +167,8 @@ struct _GtkTypeInfo
|
||||
guint class_size;
|
||||
GtkClassInitFunc class_init_func;
|
||||
GtkObjectInitFunc object_init_func;
|
||||
GtkArgFunc arg_func;
|
||||
GtkArgSetFunc arg_set_func;
|
||||
GtkArgGetFunc arg_get_func;
|
||||
};
|
||||
|
||||
|
||||
@ -185,7 +187,8 @@ gint gtk_type_is_a (GtkType type,
|
||||
GtkType is_a_type);
|
||||
void gtk_type_set_arg (GtkObject *object,
|
||||
GtkType type,
|
||||
GtkArg *arg);
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -42,7 +42,8 @@ gtk_vbutton_box_get_type ()
|
||||
sizeof (GtkVButtonBoxClass),
|
||||
(GtkClassInitFunc) gtk_vbutton_box_class_init,
|
||||
(GtkObjectInitFunc) gtk_vbutton_box_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
vbutton_box_type = gtk_type_unique (gtk_button_box_get_type (), &vbutton_box_info);
|
||||
|
@ -40,7 +40,8 @@ gtk_vbox_get_type ()
|
||||
sizeof (GtkVBoxClass),
|
||||
(GtkClassInitFunc) gtk_vbox_class_init,
|
||||
(GtkObjectInitFunc) gtk_vbox_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
vbox_type = gtk_type_unique (gtk_box_get_type (), &vbox_info);
|
||||
|
@ -56,7 +56,8 @@ gtk_viewport_get_type ()
|
||||
sizeof (GtkViewportClass),
|
||||
(GtkClassInitFunc) gtk_viewport_class_init,
|
||||
(GtkObjectInitFunc) gtk_viewport_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
viewport_type = gtk_type_unique (gtk_bin_get_type (), &viewport_info);
|
||||
|
@ -49,7 +49,8 @@ gtk_vpaned_get_type ()
|
||||
sizeof (GtkVPanedClass),
|
||||
(GtkClassInitFunc) gtk_vpaned_class_init,
|
||||
(GtkObjectInitFunc) gtk_vpaned_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
vpaned_type = gtk_type_unique (gtk_paned_get_type (), &vpaned_info);
|
||||
|
@ -51,7 +51,8 @@ gtk_vruler_get_type ()
|
||||
sizeof (GtkVRulerClass),
|
||||
(GtkClassInitFunc) gtk_vruler_class_init,
|
||||
(GtkObjectInitFunc) gtk_vruler_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
vruler_type = gtk_type_unique (gtk_ruler_get_type (), &vruler_info);
|
||||
|
@ -59,7 +59,8 @@ gtk_vscale_get_type ()
|
||||
sizeof (GtkVScaleClass),
|
||||
(GtkClassInitFunc) gtk_vscale_class_init,
|
||||
(GtkObjectInitFunc) gtk_vscale_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
vscale_type = gtk_type_unique (gtk_scale_get_type (), &vscale_info);
|
||||
|
@ -53,7 +53,8 @@ gtk_vscrollbar_get_type ()
|
||||
sizeof (GtkVScrollbarClass),
|
||||
(GtkClassInitFunc) gtk_vscrollbar_class_init,
|
||||
(GtkObjectInitFunc) gtk_vscrollbar_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
vscrollbar_type = gtk_type_unique (gtk_scrollbar_get_type (), &vscrollbar_info);
|
||||
|
@ -38,7 +38,8 @@ gtk_vseparator_get_type ()
|
||||
sizeof (GtkVSeparatorClass),
|
||||
(GtkClassInitFunc) gtk_vseparator_class_init,
|
||||
(GtkObjectInitFunc) gtk_vseparator_init,
|
||||
(GtkArgFunc) NULL,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
vseparator_type = gtk_type_unique (gtk_separator_get_type (), &vseparator_info);
|
||||
|
108
gtk/gtkwidget.c
108
gtk/gtkwidget.c
@ -80,6 +80,21 @@ enum {
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_X,
|
||||
ARG_Y,
|
||||
ARG_WIDTH,
|
||||
ARG_HEIGHT,
|
||||
ARG_VISIBLE,
|
||||
ARG_SENSITIVE,
|
||||
ARG_EVENTS,
|
||||
ARG_EXTENSION_EVENTS,
|
||||
ARG_NAME,
|
||||
ARG_STYLE,
|
||||
ARG_PARENT
|
||||
};
|
||||
|
||||
|
||||
typedef void (*GtkWidgetSignal1) (GtkObject *object,
|
||||
gpointer arg1,
|
||||
@ -116,8 +131,9 @@ static void gtk_widget_marshal_signal_4 (GtkObject *object,
|
||||
|
||||
static void gtk_widget_class_init (GtkWidgetClass *klass);
|
||||
static void gtk_widget_init (GtkWidget *widget);
|
||||
static void gtk_widget_arg (GtkWidget *widget,
|
||||
GtkArg *arg);
|
||||
static void gtk_widget_set_arg (GtkWidget *widget,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_real_widget_destroy (GtkObject *object);
|
||||
static void gtk_real_widget_show (GtkWidget *widget);
|
||||
static void gtk_real_widget_hide (GtkWidget *widget);
|
||||
@ -205,7 +221,8 @@ gtk_widget_get_type ()
|
||||
sizeof (GtkWidgetClass),
|
||||
(GtkClassInitFunc) gtk_widget_class_init,
|
||||
(GtkObjectInitFunc) gtk_widget_init,
|
||||
(GtkArgFunc) gtk_widget_arg,
|
||||
(GtkArgSetFunc) gtk_widget_set_arg,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
widget_type = gtk_type_unique (gtk_object_get_type (), &widget_info);
|
||||
@ -231,17 +248,17 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
|
||||
parent_class = gtk_type_class (gtk_object_get_type ());
|
||||
|
||||
gtk_object_add_arg_type ("GtkWidget::x", GTK_TYPE_INT);
|
||||
gtk_object_add_arg_type ("GtkWidget::y", GTK_TYPE_INT);
|
||||
gtk_object_add_arg_type ("GtkWidget::width", GTK_TYPE_INT);
|
||||
gtk_object_add_arg_type ("GtkWidget::height", GTK_TYPE_INT);
|
||||
gtk_object_add_arg_type ("GtkWidget::visible", GTK_TYPE_BOOL);
|
||||
gtk_object_add_arg_type ("GtkWidget::sensitive", GTK_TYPE_BOOL);
|
||||
gtk_object_add_arg_type ("GtkWidget::events", GTK_TYPE_GDK_EVENT_MASK);
|
||||
gtk_object_add_arg_type ("GtkWidget::extension_events", GTK_TYPE_GDK_EVENT_MASK);
|
||||
gtk_object_add_arg_type ("GtkWidget::name", GTK_TYPE_STRING);
|
||||
gtk_object_add_arg_type ("GtkWidget::style", GTK_TYPE_STYLE);
|
||||
gtk_object_add_arg_type ("GtkWidget::parent", GTK_TYPE_CONTAINER);
|
||||
gtk_object_add_arg_type ("GtkWidget::x", GTK_TYPE_INT, ARG_X);
|
||||
gtk_object_add_arg_type ("GtkWidget::y", GTK_TYPE_INT, ARG_Y);
|
||||
gtk_object_add_arg_type ("GtkWidget::width", GTK_TYPE_INT, ARG_WIDTH);
|
||||
gtk_object_add_arg_type ("GtkWidget::height", GTK_TYPE_INT, ARG_HEIGHT);
|
||||
gtk_object_add_arg_type ("GtkWidget::visible", GTK_TYPE_BOOL, ARG_VISIBLE);
|
||||
gtk_object_add_arg_type ("GtkWidget::sensitive", GTK_TYPE_BOOL, ARG_SENSITIVE);
|
||||
gtk_object_add_arg_type ("GtkWidget::events", GTK_TYPE_GDK_EVENT_MASK, ARG_EVENTS);
|
||||
gtk_object_add_arg_type ("GtkWidget::extension_events", GTK_TYPE_GDK_EVENT_MASK, ARG_EXTENSION_EVENTS);
|
||||
gtk_object_add_arg_type ("GtkWidget::name", GTK_TYPE_STRING, ARG_NAME);
|
||||
gtk_object_add_arg_type ("GtkWidget::style", GTK_TYPE_STYLE, ARG_STYLE);
|
||||
gtk_object_add_arg_type ("GtkWidget::parent", GTK_TYPE_CONTAINER, ARG_PARENT);
|
||||
|
||||
widget_signals[SHOW] =
|
||||
gtk_signal_new ("show",
|
||||
@ -651,7 +668,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* gtk_widget_arg:
|
||||
* gtk_widget_set_arg:
|
||||
*
|
||||
* arguments:
|
||||
*
|
||||
@ -659,55 +676,50 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
*****************************************/
|
||||
|
||||
static void
|
||||
gtk_widget_arg (GtkWidget *widget,
|
||||
GtkArg *arg)
|
||||
gtk_widget_set_arg (GtkWidget *widget,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
if (strcmp (arg->name, "x") == 0)
|
||||
switch (arg_id)
|
||||
{
|
||||
case ARG_X:
|
||||
gtk_widget_set_uposition (widget, GTK_VALUE_INT(*arg), -2);
|
||||
}
|
||||
else if (strcmp (arg->name, "y") == 0)
|
||||
{
|
||||
break;
|
||||
case ARG_Y:
|
||||
gtk_widget_set_uposition (widget, -2, GTK_VALUE_INT(*arg));
|
||||
}
|
||||
else if (strcmp (arg->name, "width") == 0)
|
||||
{
|
||||
break;
|
||||
case ARG_WIDTH:
|
||||
gtk_widget_set_usize (widget, GTK_VALUE_INT(*arg), -1);
|
||||
}
|
||||
else if (strcmp (arg->name, "height") == 0)
|
||||
{
|
||||
break;
|
||||
case ARG_HEIGHT:
|
||||
gtk_widget_set_usize (widget, -1, GTK_VALUE_INT(*arg));
|
||||
}
|
||||
else if (strcmp (arg->name, "visible") == 0)
|
||||
{
|
||||
break;
|
||||
case ARG_VISIBLE:
|
||||
if (GTK_VALUE_BOOL(*arg))
|
||||
gtk_widget_show (widget);
|
||||
else
|
||||
gtk_widget_hide (widget);
|
||||
}
|
||||
else if (strcmp (arg->name, "sensitive") == 0)
|
||||
{
|
||||
break;
|
||||
case ARG_SENSITIVE:
|
||||
gtk_widget_set_sensitive (widget, GTK_VALUE_BOOL(*arg));
|
||||
}
|
||||
else if (strcmp (arg->name, "events") == 0)
|
||||
{
|
||||
break;
|
||||
case ARG_EVENTS:
|
||||
gtk_widget_set_events (widget, GTK_VALUE_FLAGS(*arg));
|
||||
}
|
||||
else if (strcmp (arg->name, "extension_events") == 0)
|
||||
{
|
||||
break;
|
||||
case ARG_EXTENSION_EVENTS:
|
||||
gtk_widget_set_extension_events (widget, GTK_VALUE_FLAGS(*arg));
|
||||
}
|
||||
else if (strcmp (arg->name, "name") == 0)
|
||||
{
|
||||
break;
|
||||
case ARG_NAME:
|
||||
gtk_widget_set_name (widget, GTK_VALUE_STRING(*arg));
|
||||
}
|
||||
else if (strcmp (arg->name, "style") == 0)
|
||||
{
|
||||
break;
|
||||
case ARG_STYLE:
|
||||
gtk_widget_set_style (widget, (GtkStyle*)GTK_VALUE_BOXED(*arg));
|
||||
}
|
||||
else if (strcmp (arg->name, "parent") == 0)
|
||||
{
|
||||
break;
|
||||
case ARG_PARENT:
|
||||
gtk_container_add (GTK_CONTAINER (GTK_VALUE_OBJECT(*arg)), widget);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,14 @@ enum {
|
||||
SET_FOCUS,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_TYPE,
|
||||
ARG_TITLE,
|
||||
ARG_AUTO_SHRINK,
|
||||
ARG_ALLOW_SHRINK,
|
||||
ARG_ALLOW_GROW
|
||||
};
|
||||
|
||||
typedef gint (*GtkWindowSignal1) (GtkObject *object,
|
||||
gpointer arg1,
|
||||
@ -50,8 +57,9 @@ static void gtk_window_marshal_signal_2 (GtkObject *object,
|
||||
GtkArg *args);
|
||||
static void gtk_window_class_init (GtkWindowClass *klass);
|
||||
static void gtk_window_init (GtkWindow *window);
|
||||
static void gtk_window_arg (GtkWindow *window,
|
||||
GtkArg *arg);
|
||||
static void gtk_window_set_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);
|
||||
@ -114,7 +122,8 @@ gtk_window_get_type ()
|
||||
sizeof (GtkWindowClass),
|
||||
(GtkClassInitFunc) gtk_window_class_init,
|
||||
(GtkObjectInitFunc) gtk_window_init,
|
||||
(GtkArgFunc) gtk_window_arg,
|
||||
(GtkArgSetFunc) gtk_window_set_arg,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
window_type = gtk_type_unique (gtk_bin_get_type (), &window_info);
|
||||
@ -136,11 +145,11 @@ gtk_window_class_init (GtkWindowClass *klass)
|
||||
|
||||
parent_class = gtk_type_class (gtk_bin_get_type ());
|
||||
|
||||
gtk_object_add_arg_type ("GtkWindow::type", GTK_TYPE_WINDOW_TYPE);
|
||||
gtk_object_add_arg_type ("GtkWindow::title", GTK_TYPE_STRING);
|
||||
gtk_object_add_arg_type ("GtkWindow::auto_shrink", GTK_TYPE_BOOL);
|
||||
gtk_object_add_arg_type ("GtkWindow::allow_shrink", GTK_TYPE_BOOL);
|
||||
gtk_object_add_arg_type ("GtkWindow::allow_grow", GTK_TYPE_BOOL);
|
||||
gtk_object_add_arg_type ("GtkWindow::type", GTK_TYPE_WINDOW_TYPE, ARG_TYPE);
|
||||
gtk_object_add_arg_type ("GtkWindow::title", GTK_TYPE_STRING, ARG_TITLE);
|
||||
gtk_object_add_arg_type ("GtkWindow::auto_shrink", GTK_TYPE_BOOL, ARG_AUTO_SHRINK);
|
||||
gtk_object_add_arg_type ("GtkWindow::allow_shrink", GTK_TYPE_BOOL, ARG_ALLOW_SHRINK);
|
||||
gtk_object_add_arg_type ("GtkWindow::allow_grow", GTK_TYPE_BOOL, ARG_ALLOW_GROW);
|
||||
|
||||
window_signals[MOVE_RESIZE] =
|
||||
gtk_signal_new ("move_resize",
|
||||
@ -212,28 +221,29 @@ gtk_window_init (GtkWindow *window)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_window_arg (GtkWindow *window,
|
||||
GtkArg *arg)
|
||||
gtk_window_set_arg (GtkWindow *window,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
if (strcmp (arg->name, "type") == 0)
|
||||
switch (arg_id)
|
||||
{
|
||||
case ARG_TYPE:
|
||||
window->type = GTK_VALUE_ENUM(*arg);
|
||||
}
|
||||
else if (strcmp (arg->name, "title") == 0)
|
||||
{
|
||||
break;
|
||||
case ARG_TITLE:
|
||||
gtk_window_set_title (window, GTK_VALUE_STRING(*arg));
|
||||
}
|
||||
else if (strcmp (arg->name, "auto_shrink") == 0)
|
||||
{
|
||||
break;
|
||||
case ARG_AUTO_SHRINK:
|
||||
window->auto_shrink = (GTK_VALUE_BOOL(*arg) != FALSE);
|
||||
}
|
||||
else if (strcmp (arg->name, "allow_shrink") == 0)
|
||||
{
|
||||
break;
|
||||
case ARG_ALLOW_SHRINK:
|
||||
window->allow_shrink = (GTK_VALUE_BOOL(*arg) != FALSE);
|
||||
}
|
||||
else if (strcmp (arg->name, "allow_grow") == 0)
|
||||
{
|
||||
break;
|
||||
case ARG_ALLOW_GROW:
|
||||
window->allow_grow = (GTK_VALUE_BOOL(*arg) != FALSE);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user