forked from AuroraMiddleware/gtk
Remove leaks.
2001-03-30 Alexander Larsson <alexl@redhat.com> * gtk/gtkbutton.c (gtk_button_get_property): * gtk/gtklabel.c: Remove leaks. * gtk/gtkcontainer.c: * gtk/gtkhscale.c: * gtk/gtkhscrollbar.c: * gtk/gtklayout.c: * gtk/gtkmisc.c: * gtk/gtkprogress.c: * gtk/gtkprogressbar.c: * gtk/gtkrange.c: * gtk/gtktable.c: * gtk/gtkviewport.c: * gtk/gtkvscale.c: * gtk/gtkvscrollbar.c: * gtk/gtkwidget.c: Property patches, based on patches from John Margaglione and Lee Mallabone.
This commit is contained in:
parent
c80b705470
commit
aa209a95fa
21
ChangeLog
21
ChangeLog
@ -1,3 +1,24 @@
|
||||
2001-03-30 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkbutton.c (gtk_button_get_property):
|
||||
* gtk/gtklabel.c:
|
||||
Remove leaks.
|
||||
|
||||
* gtk/gtkcontainer.c:
|
||||
* gtk/gtkhscale.c:
|
||||
* gtk/gtkhscrollbar.c:
|
||||
* gtk/gtklayout.c:
|
||||
* gtk/gtkmisc.c:
|
||||
* gtk/gtkprogress.c:
|
||||
* gtk/gtkprogressbar.c:
|
||||
* gtk/gtkrange.c:
|
||||
* gtk/gtktable.c:
|
||||
* gtk/gtkviewport.c:
|
||||
* gtk/gtkvscale.c:
|
||||
* gtk/gtkvscrollbar.c:
|
||||
* gtk/gtkwidget.c:
|
||||
Property patches, based on patches from John Margaglione and Lee Mallabone.
|
||||
|
||||
Thu Mar 29 21:20:38 2001 Mike Kestner <mkestner@ameritech.net>
|
||||
|
||||
* gtk/gtkspinbutton.c : added value_changed signal which proxies for the
|
||||
|
@ -1,3 +1,24 @@
|
||||
2001-03-30 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkbutton.c (gtk_button_get_property):
|
||||
* gtk/gtklabel.c:
|
||||
Remove leaks.
|
||||
|
||||
* gtk/gtkcontainer.c:
|
||||
* gtk/gtkhscale.c:
|
||||
* gtk/gtkhscrollbar.c:
|
||||
* gtk/gtklayout.c:
|
||||
* gtk/gtkmisc.c:
|
||||
* gtk/gtkprogress.c:
|
||||
* gtk/gtkprogressbar.c:
|
||||
* gtk/gtkrange.c:
|
||||
* gtk/gtktable.c:
|
||||
* gtk/gtkviewport.c:
|
||||
* gtk/gtkvscale.c:
|
||||
* gtk/gtkvscrollbar.c:
|
||||
* gtk/gtkwidget.c:
|
||||
Property patches, based on patches from John Margaglione and Lee Mallabone.
|
||||
|
||||
Thu Mar 29 21:20:38 2001 Mike Kestner <mkestner@ameritech.net>
|
||||
|
||||
* gtk/gtkspinbutton.c : added value_changed signal which proxies for the
|
||||
|
@ -1,3 +1,24 @@
|
||||
2001-03-30 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkbutton.c (gtk_button_get_property):
|
||||
* gtk/gtklabel.c:
|
||||
Remove leaks.
|
||||
|
||||
* gtk/gtkcontainer.c:
|
||||
* gtk/gtkhscale.c:
|
||||
* gtk/gtkhscrollbar.c:
|
||||
* gtk/gtklayout.c:
|
||||
* gtk/gtkmisc.c:
|
||||
* gtk/gtkprogress.c:
|
||||
* gtk/gtkprogressbar.c:
|
||||
* gtk/gtkrange.c:
|
||||
* gtk/gtktable.c:
|
||||
* gtk/gtkviewport.c:
|
||||
* gtk/gtkvscale.c:
|
||||
* gtk/gtkvscrollbar.c:
|
||||
* gtk/gtkwidget.c:
|
||||
Property patches, based on patches from John Margaglione and Lee Mallabone.
|
||||
|
||||
Thu Mar 29 21:20:38 2001 Mike Kestner <mkestner@ameritech.net>
|
||||
|
||||
* gtk/gtkspinbutton.c : added value_changed signal which proxies for the
|
||||
|
@ -1,3 +1,24 @@
|
||||
2001-03-30 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkbutton.c (gtk_button_get_property):
|
||||
* gtk/gtklabel.c:
|
||||
Remove leaks.
|
||||
|
||||
* gtk/gtkcontainer.c:
|
||||
* gtk/gtkhscale.c:
|
||||
* gtk/gtkhscrollbar.c:
|
||||
* gtk/gtklayout.c:
|
||||
* gtk/gtkmisc.c:
|
||||
* gtk/gtkprogress.c:
|
||||
* gtk/gtkprogressbar.c:
|
||||
* gtk/gtkrange.c:
|
||||
* gtk/gtktable.c:
|
||||
* gtk/gtkviewport.c:
|
||||
* gtk/gtkvscale.c:
|
||||
* gtk/gtkvscrollbar.c:
|
||||
* gtk/gtkwidget.c:
|
||||
Property patches, based on patches from John Margaglione and Lee Mallabone.
|
||||
|
||||
Thu Mar 29 21:20:38 2001 Mike Kestner <mkestner@ameritech.net>
|
||||
|
||||
* gtk/gtkspinbutton.c : added value_changed signal which proxies for the
|
||||
|
@ -1,3 +1,24 @@
|
||||
2001-03-30 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkbutton.c (gtk_button_get_property):
|
||||
* gtk/gtklabel.c:
|
||||
Remove leaks.
|
||||
|
||||
* gtk/gtkcontainer.c:
|
||||
* gtk/gtkhscale.c:
|
||||
* gtk/gtkhscrollbar.c:
|
||||
* gtk/gtklayout.c:
|
||||
* gtk/gtkmisc.c:
|
||||
* gtk/gtkprogress.c:
|
||||
* gtk/gtkprogressbar.c:
|
||||
* gtk/gtkrange.c:
|
||||
* gtk/gtktable.c:
|
||||
* gtk/gtkviewport.c:
|
||||
* gtk/gtkvscale.c:
|
||||
* gtk/gtkvscrollbar.c:
|
||||
* gtk/gtkwidget.c:
|
||||
Property patches, based on patches from John Margaglione and Lee Mallabone.
|
||||
|
||||
Thu Mar 29 21:20:38 2001 Mike Kestner <mkestner@ameritech.net>
|
||||
|
||||
* gtk/gtkspinbutton.c : added value_changed signal which proxies for the
|
||||
|
@ -1,3 +1,24 @@
|
||||
2001-03-30 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkbutton.c (gtk_button_get_property):
|
||||
* gtk/gtklabel.c:
|
||||
Remove leaks.
|
||||
|
||||
* gtk/gtkcontainer.c:
|
||||
* gtk/gtkhscale.c:
|
||||
* gtk/gtkhscrollbar.c:
|
||||
* gtk/gtklayout.c:
|
||||
* gtk/gtkmisc.c:
|
||||
* gtk/gtkprogress.c:
|
||||
* gtk/gtkprogressbar.c:
|
||||
* gtk/gtkrange.c:
|
||||
* gtk/gtktable.c:
|
||||
* gtk/gtkviewport.c:
|
||||
* gtk/gtkvscale.c:
|
||||
* gtk/gtkvscrollbar.c:
|
||||
* gtk/gtkwidget.c:
|
||||
Property patches, based on patches from John Margaglione and Lee Mallabone.
|
||||
|
||||
Thu Mar 29 21:20:38 2001 Mike Kestner <mkestner@ameritech.net>
|
||||
|
||||
* gtk/gtkspinbutton.c : added value_changed signal which proxies for the
|
||||
|
@ -1,3 +1,24 @@
|
||||
2001-03-30 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkbutton.c (gtk_button_get_property):
|
||||
* gtk/gtklabel.c:
|
||||
Remove leaks.
|
||||
|
||||
* gtk/gtkcontainer.c:
|
||||
* gtk/gtkhscale.c:
|
||||
* gtk/gtkhscrollbar.c:
|
||||
* gtk/gtklayout.c:
|
||||
* gtk/gtkmisc.c:
|
||||
* gtk/gtkprogress.c:
|
||||
* gtk/gtkprogressbar.c:
|
||||
* gtk/gtkrange.c:
|
||||
* gtk/gtktable.c:
|
||||
* gtk/gtkviewport.c:
|
||||
* gtk/gtkvscale.c:
|
||||
* gtk/gtkvscrollbar.c:
|
||||
* gtk/gtkwidget.c:
|
||||
Property patches, based on patches from John Margaglione and Lee Mallabone.
|
||||
|
||||
Thu Mar 29 21:20:38 2001 Mike Kestner <mkestner@ameritech.net>
|
||||
|
||||
* gtk/gtkspinbutton.c : added value_changed signal which proxies for the
|
||||
|
@ -306,12 +306,12 @@ gtk_button_get_property (GObject *object,
|
||||
{
|
||||
case PROP_LABEL:
|
||||
if (GTK_BIN (button)->child && GTK_IS_LABEL (GTK_BIN (button)->child))
|
||||
g_value_set_string(value, g_strdup (GTK_LABEL (GTK_BIN (button)->child)->label));
|
||||
g_value_set_string (value, GTK_LABEL (GTK_BIN (button)->child)->label);
|
||||
else
|
||||
g_value_set_string(value, NULL);
|
||||
g_value_set_string (value, NULL);
|
||||
break;
|
||||
case PROP_RELIEF:
|
||||
g_value_set_enum(value, gtk_button_get_relief (button));
|
||||
g_value_set_enum (value, gtk_button_get_relief (button));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "gtksignal.h"
|
||||
#include "gtkmain.h"
|
||||
#include "gtkwindow.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
enum {
|
||||
ADD,
|
||||
@ -44,11 +45,11 @@ enum {
|
||||
};
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_BORDER_WIDTH,
|
||||
ARG_RESIZE_MODE,
|
||||
ARG_CHILD,
|
||||
ARG_REALLOCATE_REDRAWS
|
||||
PROP_0,
|
||||
PROP_BORDER_WIDTH,
|
||||
PROP_RESIZE_MODE,
|
||||
PROP_CHILD,
|
||||
PROP_REALLOCATE_REDRAWS
|
||||
};
|
||||
|
||||
typedef struct _GtkChildArgInfo GtkChildArgInfo;
|
||||
@ -66,12 +67,14 @@ static void gtk_container_base_class_init (GtkContainerClass *klass);
|
||||
static void gtk_container_class_init (GtkContainerClass *klass);
|
||||
static void gtk_container_init (GtkContainer *container);
|
||||
static void gtk_container_destroy (GtkObject *object);
|
||||
static void gtk_container_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_container_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_container_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_container_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_container_add_unimplemented (GtkContainer *container,
|
||||
GtkWidget *widget);
|
||||
static void gtk_container_remove_unimplemented (GtkContainer *container,
|
||||
@ -154,9 +157,11 @@ gtk_container_base_class_init (GtkContainerClass *class)
|
||||
static void
|
||||
gtk_container_class_init (GtkContainerClass *class)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
|
||||
gobject_class = G_OBJECT_CLASS (class);
|
||||
object_class = (GtkObjectClass*) class;
|
||||
widget_class = (GtkWidgetClass*) class;
|
||||
|
||||
@ -168,9 +173,40 @@ gtk_container_class_init (GtkContainerClass *class)
|
||||
vadjustment_key_id = g_quark_from_static_string (vadjustment_key);
|
||||
hadjustment_key_id = g_quark_from_static_string (hadjustment_key);
|
||||
|
||||
gobject_class->set_property = gtk_container_set_property;
|
||||
gobject_class->get_property = gtk_container_get_property;
|
||||
|
||||
object_class->get_arg = gtk_container_get_arg;
|
||||
object_class->set_arg = gtk_container_set_arg;
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_RESIZE_MODE,
|
||||
g_param_spec_enum ("resize_mode",
|
||||
_("Resize mode"),
|
||||
_("Specify how resize events are handled"),
|
||||
GTK_TYPE_RESIZE_MODE,
|
||||
GTK_RESIZE_PARENT,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_BORDER_WIDTH,
|
||||
g_param_spec_uint ("border_width",
|
||||
_("Border width"),
|
||||
_("The width of the empty border outside the containers children."),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_CHILD,
|
||||
g_param_spec_object ("child",
|
||||
_("Child"),
|
||||
_("Can be used to add a new child to the container."),
|
||||
GTK_TYPE_WIDGET,
|
||||
G_PARAM_WRITABLE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_REALLOCATE_REDRAWS,
|
||||
g_param_spec_boolean ("reallocate_redraws",
|
||||
_("Reallocate redraws"),
|
||||
_("Whether redraws should be reallocated"),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
object_class->destroy = gtk_container_destroy;
|
||||
|
||||
widget_class->show_all = gtk_container_show_all;
|
||||
@ -186,11 +222,6 @@ gtk_container_class_init (GtkContainerClass *class)
|
||||
class->child_type = NULL;
|
||||
class->composite_name = gtk_container_child_default_composite_name;
|
||||
|
||||
gtk_object_add_arg_type ("GtkContainer::border_width", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_BORDER_WIDTH);
|
||||
gtk_object_add_arg_type ("GtkContainer::resize_mode", GTK_TYPE_RESIZE_MODE, GTK_ARG_READWRITE, ARG_RESIZE_MODE);
|
||||
gtk_object_add_arg_type ("GtkContainer::child", GTK_TYPE_WIDGET, GTK_ARG_WRITABLE, ARG_CHILD);
|
||||
gtk_object_add_arg_type ("GtkContainer::reallocate_redraws", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_REALLOCATE_REDRAWS);
|
||||
|
||||
container_signals[ADD] =
|
||||
gtk_signal_new ("add",
|
||||
GTK_RUN_FIRST,
|
||||
@ -641,55 +672,59 @@ gtk_container_destroy (GtkObject *object)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_container_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_container_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkContainer *container;
|
||||
|
||||
container = GTK_CONTAINER (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_BORDER_WIDTH:
|
||||
gtk_container_set_border_width (container, GTK_VALUE_UINT (*arg));
|
||||
case PROP_BORDER_WIDTH:
|
||||
gtk_container_set_border_width (container, g_value_get_uint (value));
|
||||
break;
|
||||
case ARG_RESIZE_MODE:
|
||||
gtk_container_set_resize_mode (container, GTK_VALUE_ENUM (*arg));
|
||||
case PROP_RESIZE_MODE:
|
||||
gtk_container_set_resize_mode (container, g_value_get_enum (value));
|
||||
break;
|
||||
case ARG_REALLOCATE_REDRAWS:
|
||||
gtk_container_set_reallocate_redraws (container, GTK_VALUE_BOOL (*arg));
|
||||
case PROP_REALLOCATE_REDRAWS:
|
||||
gtk_container_set_reallocate_redraws (container,
|
||||
g_value_get_boolean (value));
|
||||
break;
|
||||
case ARG_CHILD:
|
||||
gtk_container_add (container, GTK_WIDGET (GTK_VALUE_OBJECT (*arg)));
|
||||
case PROP_CHILD:
|
||||
gtk_container_add (container, GTK_WIDGET (g_value_get_object (value)));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_container_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_container_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkContainer *container;
|
||||
|
||||
container = GTK_CONTAINER (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_BORDER_WIDTH:
|
||||
GTK_VALUE_UINT (*arg) = container->border_width;
|
||||
case PROP_BORDER_WIDTH:
|
||||
g_value_set_uint (value, container->border_width);
|
||||
break;
|
||||
case ARG_RESIZE_MODE:
|
||||
GTK_VALUE_ENUM (*arg) = container->resize_mode;
|
||||
case PROP_RESIZE_MODE:
|
||||
g_value_set_enum (value, container->resize_mode);
|
||||
break;
|
||||
case ARG_REALLOCATE_REDRAWS:
|
||||
GTK_VALUE_BOOL (*arg) = container->reallocate_redraws;
|
||||
case PROP_REALLOCATE_REDRAWS:
|
||||
g_value_set_boolean (value, container->reallocate_redraws);
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -718,6 +753,7 @@ gtk_container_set_border_width (GtkContainer *container,
|
||||
if (container->border_width != border_width)
|
||||
{
|
||||
container->border_width = border_width;
|
||||
g_object_notify (G_OBJECT (container), "border_width");
|
||||
|
||||
if (GTK_WIDGET_REALIZED (container))
|
||||
gtk_widget_queue_resize (GTK_WIDGET (container));
|
||||
@ -827,7 +863,10 @@ gtk_container_set_resize_mode (GtkContainer *container,
|
||||
|
||||
if (GTK_WIDGET_TOPLEVEL (container) &&
|
||||
resize_mode == GTK_RESIZE_PARENT)
|
||||
resize_mode = GTK_RESIZE_QUEUE;
|
||||
{
|
||||
resize_mode = GTK_RESIZE_QUEUE;
|
||||
g_object_notify (G_OBJECT (container), "resize_mode");
|
||||
}
|
||||
|
||||
if (container->resize_mode != resize_mode)
|
||||
{
|
||||
@ -840,6 +879,7 @@ gtk_container_set_resize_mode (GtkContainer *container,
|
||||
gtk_container_clear_resize_widgets (container);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (container));
|
||||
}
|
||||
g_object_notify (G_OBJECT (container), "resize_mode");
|
||||
}
|
||||
}
|
||||
|
||||
@ -853,6 +893,8 @@ gtk_container_set_reallocate_redraws (GtkContainer *container,
|
||||
if (needs_redraws != container->reallocate_redraws)
|
||||
{
|
||||
container->reallocate_redraws = needs_redraws;
|
||||
g_object_notify (G_OBJECT (container), "reallocate_redraws");
|
||||
|
||||
if (container->reallocate_redraws)
|
||||
gtk_widget_queue_draw (GTK_WIDGET (container));
|
||||
}
|
||||
|
@ -28,23 +28,26 @@
|
||||
#include "gtkhscale.h"
|
||||
#include "gtksignal.h"
|
||||
#include "gdk/gdkkeysyms.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
#define SCALE_CLASS(w) GTK_SCALE_GET_CLASS (w)
|
||||
#define RANGE_CLASS(w) GTK_RANGE_GET_CLASS (w)
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_ADJUSTMENT
|
||||
PROP_0,
|
||||
PROP_ADJUSTMENT
|
||||
};
|
||||
|
||||
static void gtk_hscale_class_init (GtkHScaleClass *klass);
|
||||
static void gtk_hscale_init (GtkHScale *hscale);
|
||||
static void gtk_hscale_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_hscale_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_hscale_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_hscale_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_hscale_realize (GtkWidget *widget);
|
||||
static void gtk_hscale_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
@ -97,23 +100,20 @@ gtk_hscale_get_type (void)
|
||||
static void
|
||||
gtk_hscale_class_init (GtkHScaleClass *class)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
GtkRangeClass *range_class;
|
||||
GtkScaleClass *scale_class;
|
||||
|
||||
gobject_class = (GObjectClass*) class;
|
||||
object_class = (GtkObjectClass*) class;
|
||||
widget_class = (GtkWidgetClass*) class;
|
||||
range_class = (GtkRangeClass*) class;
|
||||
scale_class = (GtkScaleClass*) class;
|
||||
|
||||
gtk_object_add_arg_type ("GtkHScale::adjustment",
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_ADJUSTMENT);
|
||||
|
||||
object_class->set_arg = gtk_hscale_set_arg;
|
||||
object_class->get_arg = gtk_hscale_get_arg;
|
||||
gobject_class->set_property = gtk_hscale_set_property;
|
||||
gobject_class->get_property = gtk_hscale_get_property;
|
||||
|
||||
widget_class->realize = gtk_hscale_realize;
|
||||
widget_class->size_request = gtk_hscale_size_request;
|
||||
@ -127,43 +127,56 @@ gtk_hscale_class_init (GtkHScaleClass *class)
|
||||
range_class->clear_background = gtk_hscale_clear_background;
|
||||
|
||||
scale_class->draw_value = gtk_hscale_draw_value;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ADJUSTMENT,
|
||||
g_param_spec_object ("adjustment",
|
||||
_("Adjustment"),
|
||||
_("The GtkAdjustment that determines the values to use for this HScale."),
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_hscale_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_hscale_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkHScale *hscale;
|
||||
|
||||
hscale = GTK_HSCALE (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_ADJUSTMENT:
|
||||
gtk_range_set_adjustment (GTK_RANGE (hscale), GTK_VALUE_POINTER (*arg));
|
||||
case PROP_ADJUSTMENT:
|
||||
gtk_range_set_adjustment (GTK_RANGE (hscale), g_value_get_object (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_hscale_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_hscale_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkHScale *hscale;
|
||||
|
||||
hscale = GTK_HSCALE (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_ADJUSTMENT:
|
||||
GTK_VALUE_POINTER (*arg) = GTK_RANGE (hscale);
|
||||
case PROP_ADJUSTMENT:
|
||||
g_value_set_object (value,
|
||||
G_OBJECT (gtk_range_get_adjustment (GTK_RANGE (hscale))));
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "gtkhscrollbar.h"
|
||||
#include "gtksignal.h"
|
||||
#include "gdk/gdkkeysyms.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
#define EPSILON 0.01
|
||||
@ -34,18 +35,20 @@
|
||||
#define RANGE_CLASS(w) GTK_RANGE_GET_CLASS (w)
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_ADJUSTMENT
|
||||
PROP_0,
|
||||
PROP_ADJUSTMENT
|
||||
};
|
||||
|
||||
static void gtk_hscrollbar_class_init (GtkHScrollbarClass *klass);
|
||||
static void gtk_hscrollbar_init (GtkHScrollbar *hscrollbar);
|
||||
static void gtk_hscrollbar_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_hscrollbar_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_hscrollbar_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_hscrollbar_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_hscrollbar_realize (GtkWidget *widget);
|
||||
static void gtk_hscrollbar_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
@ -87,21 +90,18 @@ gtk_hscrollbar_get_type (void)
|
||||
static void
|
||||
gtk_hscrollbar_class_init (GtkHScrollbarClass *class)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
GtkRangeClass *range_class;
|
||||
|
||||
gobject_class = (GObjectClass*) class;
|
||||
object_class = (GtkObjectClass*) class;
|
||||
widget_class = (GtkWidgetClass*) class;
|
||||
range_class = (GtkRangeClass*) class;
|
||||
|
||||
gtk_object_add_arg_type ("GtkHScrollbar::adjustment",
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_ADJUSTMENT);
|
||||
|
||||
object_class->set_arg = gtk_hscrollbar_set_arg;
|
||||
object_class->get_arg = gtk_hscrollbar_get_arg;
|
||||
gobject_class->set_property = gtk_hscrollbar_set_property;
|
||||
gobject_class->get_property = gtk_hscrollbar_get_property;
|
||||
|
||||
widget_class->realize = gtk_hscrollbar_realize;
|
||||
widget_class->size_allocate = gtk_hscrollbar_size_allocate;
|
||||
@ -112,43 +112,56 @@ gtk_hscrollbar_class_init (GtkHScrollbarClass *class)
|
||||
range_class->trough_click = _gtk_range_default_htrough_click;
|
||||
range_class->trough_keys = gtk_hscrollbar_trough_keys;
|
||||
range_class->motion = _gtk_range_default_hmotion;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ADJUSTMENT,
|
||||
g_param_spec_object ("adjustment",
|
||||
_("Adjustment"),
|
||||
_("The GtkAdjustment that determines the values to use for this scrollbar."),
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_hscrollbar_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_hscrollbar_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkHScrollbar *hscrollbar;
|
||||
|
||||
hscrollbar = GTK_HSCROLLBAR (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_ADJUSTMENT:
|
||||
gtk_range_set_adjustment (GTK_RANGE (hscrollbar), GTK_VALUE_POINTER (*arg));
|
||||
case PROP_ADJUSTMENT:
|
||||
gtk_range_set_adjustment (GTK_RANGE (hscrollbar),
|
||||
g_value_get_object (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_hscrollbar_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_hscrollbar_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkHScrollbar *hscrollbar;
|
||||
|
||||
hscrollbar = GTK_HSCROLLBAR (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_ADJUSTMENT:
|
||||
GTK_VALUE_POINTER (*arg) = GTK_RANGE (hscrollbar);
|
||||
case PROP_ADJUSTMENT:
|
||||
g_value_set_object (value, G_OBJECT (hscrollbar));
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ gtk_label_get_property (GObject *object,
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_LABEL:
|
||||
g_value_set_string (value, g_strdup (label->label));
|
||||
g_value_set_string (value, label->label);
|
||||
break;
|
||||
case PROP_ATTRIBUTES:
|
||||
g_value_set_boxed (value, label->attrs);
|
||||
|
131
gtk/gtklayout.c
131
gtk/gtklayout.c
@ -33,6 +33,7 @@
|
||||
#include "gtklayout.h"
|
||||
#include "gtksignal.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
typedef struct _GtkLayoutChild GtkLayoutChild;
|
||||
|
||||
@ -42,7 +43,23 @@ struct _GtkLayoutChild {
|
||||
gint y;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_HADJUSTMENT,
|
||||
PROP_VADJUSTMENT,
|
||||
PROP_WIDTH,
|
||||
PROP_HEIGHT
|
||||
};
|
||||
|
||||
static void gtk_layout_class_init (GtkLayoutClass *class);
|
||||
static void gtk_layout_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_layout_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_layout_init (GtkLayout *layout);
|
||||
|
||||
static void gtk_layout_finalize (GObject *object);
|
||||
@ -186,6 +203,7 @@ gtk_layout_set_hadjustment (GtkLayout *layout,
|
||||
g_return_if_fail (GTK_IS_LAYOUT (layout));
|
||||
|
||||
gtk_layout_set_adjustments (layout, adjustment, layout->vadjustment);
|
||||
g_object_notify (G_OBJECT (layout), "hadjustment");
|
||||
}
|
||||
|
||||
|
||||
@ -197,6 +215,7 @@ gtk_layout_set_vadjustment (GtkLayout *layout,
|
||||
g_return_if_fail (GTK_IS_LAYOUT (layout));
|
||||
|
||||
gtk_layout_set_adjustments (layout, layout->hadjustment, adjustment);
|
||||
g_object_notify (G_OBJECT (layout), "vadjustment");
|
||||
}
|
||||
|
||||
|
||||
@ -303,8 +322,16 @@ gtk_layout_set_size (GtkLayout *layout,
|
||||
|
||||
widget = GTK_WIDGET (layout);
|
||||
|
||||
layout->width = width;
|
||||
layout->height = height;
|
||||
if (width != layout->width)
|
||||
{
|
||||
layout->width = width;
|
||||
g_object_notify (G_OBJECT (layout), "width");
|
||||
}
|
||||
if (height != layout->height)
|
||||
{
|
||||
layout->height = height;
|
||||
g_object_notify (G_OBJECT (layout), "height");
|
||||
}
|
||||
|
||||
gtk_layout_set_adjustment_upper (layout->hadjustment, layout->width);
|
||||
gtk_layout_set_adjustment_upper (layout->vadjustment, layout->height);
|
||||
@ -368,19 +395,56 @@ gtk_layout_get_type (void)
|
||||
static void
|
||||
gtk_layout_class_init (GtkLayoutClass *class)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
|
||||
GObjectClass *gobject_class;
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
GtkContainerClass *container_class;
|
||||
|
||||
gobject_class = (GObjectClass*) class;
|
||||
object_class = (GtkObjectClass*) class;
|
||||
widget_class = (GtkWidgetClass*) class;
|
||||
container_class = (GtkContainerClass*) class;
|
||||
|
||||
parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
|
||||
|
||||
gobject_class->set_property = gtk_layout_set_property;
|
||||
gobject_class->get_property = gtk_layout_get_property;
|
||||
gobject_class->finalize = gtk_layout_finalize;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_HADJUSTMENT,
|
||||
g_param_spec_object ("hadjustment",
|
||||
_("Horizontal adjustment"),
|
||||
_("The GtkAdjustment for the horizontal position."),
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_VADJUSTMENT,
|
||||
g_param_spec_object ("vadjustment",
|
||||
_("Vertical adjustment"),
|
||||
_("The GtkAdjustment for the vertical position."),
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_WIDTH,
|
||||
g_param_spec_uint ("width",
|
||||
_("Width"),
|
||||
_("The width of the layout."),
|
||||
0,
|
||||
G_MAXINT,
|
||||
100,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_HEIGHT,
|
||||
g_param_spec_uint ("height",
|
||||
_("Height"),
|
||||
_("The height of the layout."),
|
||||
0,
|
||||
G_MAXINT,
|
||||
100,
|
||||
G_PARAM_READWRITE));
|
||||
widget_class->realize = gtk_layout_realize;
|
||||
widget_class->unrealize = gtk_layout_unrealize;
|
||||
widget_class->map = gtk_layout_map;
|
||||
@ -402,6 +466,67 @@ gtk_layout_class_init (GtkLayoutClass *class)
|
||||
GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_layout_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkLayout *layout = GTK_LAYOUT (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_HADJUSTMENT:
|
||||
g_value_set_object (value, G_OBJECT (layout->hadjustment));
|
||||
break;
|
||||
case PROP_VADJUSTMENT:
|
||||
g_value_set_object (value, G_OBJECT (layout->vadjustment));
|
||||
break;
|
||||
case PROP_WIDTH:
|
||||
g_value_set_uint (value, layout->width);
|
||||
break;
|
||||
case PROP_HEIGHT:
|
||||
g_value_set_uint (value, layout->height);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_layout_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkLayout *layout = GTK_LAYOUT (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_HADJUSTMENT:
|
||||
gtk_layout_set_hadjustment (layout,
|
||||
(GtkAdjustment*) g_value_get_object (value));
|
||||
break;
|
||||
case PROP_VADJUSTMENT:
|
||||
gtk_layout_set_vadjustment (layout,
|
||||
(GtkAdjustment*) g_value_get_object (value));
|
||||
break;
|
||||
case PROP_WIDTH:
|
||||
gtk_layout_set_size (layout, g_value_get_uint (value),
|
||||
layout->height);
|
||||
break;
|
||||
case PROP_HEIGHT:
|
||||
gtk_layout_set_size (layout, layout->width,
|
||||
g_value_get_uint (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_layout_init (GtkLayout *layout)
|
||||
{
|
||||
|
141
gtk/gtkmisc.c
141
gtk/gtkmisc.c
@ -26,25 +26,28 @@
|
||||
|
||||
#include "gtkcontainer.h"
|
||||
#include "gtkmisc.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_XALIGN,
|
||||
ARG_YALIGN,
|
||||
ARG_XPAD,
|
||||
ARG_YPAD
|
||||
PROP_0,
|
||||
PROP_XALIGN,
|
||||
PROP_YALIGN,
|
||||
PROP_XPAD,
|
||||
PROP_YPAD
|
||||
};
|
||||
|
||||
static void gtk_misc_class_init (GtkMiscClass *klass);
|
||||
static void gtk_misc_init (GtkMisc *misc);
|
||||
static void gtk_misc_realize (GtkWidget *widget);
|
||||
static void gtk_misc_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_misc_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_misc_set_property(GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_misc_get_property(GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
|
||||
GtkType
|
||||
@ -75,21 +78,58 @@ gtk_misc_get_type (void)
|
||||
static void
|
||||
gtk_misc_class_init (GtkMiscClass *class)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
|
||||
gobject_class = G_OBJECT_CLASS (class);
|
||||
object_class = (GtkObjectClass*) class;
|
||||
widget_class = (GtkWidgetClass*) class;
|
||||
|
||||
gtk_object_add_arg_type ("GtkMisc::xalign", GTK_TYPE_FLOAT, GTK_ARG_READWRITE, ARG_XALIGN);
|
||||
gtk_object_add_arg_type ("GtkMisc::yalign", GTK_TYPE_FLOAT, GTK_ARG_READWRITE, ARG_YALIGN);
|
||||
gtk_object_add_arg_type ("GtkMisc::xpad", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_XPAD);
|
||||
gtk_object_add_arg_type ("GtkMisc::ypad", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_YPAD);
|
||||
|
||||
object_class->set_arg = gtk_misc_set_arg;
|
||||
object_class->get_arg = gtk_misc_get_arg;
|
||||
gobject_class->set_property = gtk_misc_set_property;
|
||||
gobject_class->get_property = gtk_misc_get_property;
|
||||
|
||||
widget_class->realize = gtk_misc_realize;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_XALIGN,
|
||||
g_param_spec_float ("xalign",
|
||||
_("X align"),
|
||||
_("The horizontal alignment, from 0 (left) to 1 (right)"),
|
||||
0.0,
|
||||
1.0,
|
||||
0.5,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_YALIGN,
|
||||
g_param_spec_float ("yalign",
|
||||
_("Y align"),
|
||||
_("The vertical alignment, from 0 (top) to 1 (bottom)"),
|
||||
0.0,
|
||||
1.0,
|
||||
0.5,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_XPAD,
|
||||
g_param_spec_int ("xpad",
|
||||
_("X pad"),
|
||||
_("The amount of space to add on the left and right of the widget, in pixels"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_YPAD,
|
||||
g_param_spec_int ("ypad",
|
||||
_("Y pad"),
|
||||
_("The amount of space to add on the top and bottom of the widget, in pixels"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -102,58 +142,61 @@ gtk_misc_init (GtkMisc *misc)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_misc_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_misc_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkMisc *misc;
|
||||
|
||||
misc = GTK_MISC (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_XALIGN:
|
||||
gtk_misc_set_alignment (misc, GTK_VALUE_FLOAT (*arg), misc->yalign);
|
||||
case PROP_XALIGN:
|
||||
gtk_misc_set_alignment (misc, g_value_get_float (value), misc->yalign);
|
||||
break;
|
||||
case ARG_YALIGN:
|
||||
gtk_misc_set_alignment (misc, misc->xalign, GTK_VALUE_FLOAT (*arg));
|
||||
case PROP_YALIGN:
|
||||
gtk_misc_set_alignment (misc, misc->xalign, g_value_get_float (value));
|
||||
break;
|
||||
case ARG_XPAD:
|
||||
gtk_misc_set_padding (misc, GTK_VALUE_INT (*arg), misc->ypad);
|
||||
case PROP_XPAD:
|
||||
gtk_misc_set_padding (misc, g_value_get_int (value), misc->ypad);
|
||||
break;
|
||||
case ARG_YPAD:
|
||||
gtk_misc_set_padding (misc, misc->xpad, GTK_VALUE_INT (*arg));
|
||||
case PROP_YPAD:
|
||||
gtk_misc_set_padding (misc, misc->xpad, g_value_get_int (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_misc_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_misc_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkMisc *misc;
|
||||
|
||||
misc = GTK_MISC (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_XALIGN:
|
||||
GTK_VALUE_FLOAT (*arg) = misc->xalign;
|
||||
case PROP_XALIGN:
|
||||
g_value_set_float (value, misc->xalign);
|
||||
break;
|
||||
case ARG_YALIGN:
|
||||
GTK_VALUE_FLOAT (*arg) = misc->yalign;
|
||||
case PROP_YALIGN:
|
||||
g_value_set_float (value, misc->yalign);
|
||||
break;
|
||||
case ARG_XPAD:
|
||||
GTK_VALUE_INT (*arg) = misc->xpad;
|
||||
case PROP_XPAD:
|
||||
g_value_set_int (value, misc->xpad);
|
||||
break;
|
||||
case ARG_YPAD:
|
||||
GTK_VALUE_INT (*arg) = misc->ypad;
|
||||
case PROP_YPAD:
|
||||
g_value_set_int (value, misc->ypad);
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -190,6 +233,12 @@ gtk_misc_set_alignment (GtkMisc *misc,
|
||||
widget = GTK_WIDGET (misc);
|
||||
gtk_widget_queue_clear (widget);
|
||||
}
|
||||
|
||||
if (xalign != misc->xalign)
|
||||
g_object_notify (G_OBJECT (misc), "xalign");
|
||||
|
||||
if (yalign != misc->yalign)
|
||||
g_object_notify (G_OBJECT (misc), "yalign");
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,6 +271,12 @@ gtk_misc_set_padding (GtkMisc *misc,
|
||||
|
||||
if (GTK_WIDGET_DRAWABLE (misc))
|
||||
gtk_widget_queue_resize (GTK_WIDGET (misc));
|
||||
|
||||
if (xpad != misc->xpad)
|
||||
g_object_notify (G_OBJECT (misc), "xpad");
|
||||
|
||||
if (ypad != misc->ypad)
|
||||
g_object_notify (G_OBJECT (misc), "ypad");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,26 +29,29 @@
|
||||
#include <string.h>
|
||||
#include "gtkprogress.h"
|
||||
#include "gtksignal.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
#define EPSILON 1e-5
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_ACTIVITY_MODE,
|
||||
ARG_SHOW_TEXT,
|
||||
ARG_TEXT_XALIGN,
|
||||
ARG_TEXT_YALIGN
|
||||
PROP_0,
|
||||
PROP_ACTIVITY_MODE,
|
||||
PROP_SHOW_TEXT,
|
||||
PROP_TEXT_XALIGN,
|
||||
PROP_TEXT_YALIGN
|
||||
};
|
||||
|
||||
|
||||
static void gtk_progress_class_init (GtkProgressClass *klass);
|
||||
static void gtk_progress_init (GtkProgress *progress);
|
||||
static void gtk_progress_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_progress_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_progress_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_progress_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_progress_destroy (GtkObject *object);
|
||||
static void gtk_progress_finalize (GObject *object);
|
||||
static void gtk_progress_realize (GtkWidget *widget);
|
||||
@ -100,8 +103,8 @@ gtk_progress_class_init (GtkProgressClass *class)
|
||||
|
||||
gobject_class->finalize = gtk_progress_finalize;
|
||||
|
||||
object_class->set_arg = gtk_progress_set_arg;
|
||||
object_class->get_arg = gtk_progress_get_arg;
|
||||
gobject_class->set_property = gtk_progress_set_property;
|
||||
gobject_class->get_property = gtk_progress_get_property;
|
||||
object_class->destroy = gtk_progress_destroy;
|
||||
|
||||
widget_class->realize = gtk_progress_realize;
|
||||
@ -113,77 +116,102 @@ gtk_progress_class_init (GtkProgressClass *class)
|
||||
class->update = NULL;
|
||||
class->act_mode_enter = NULL;
|
||||
|
||||
gtk_object_add_arg_type ("GtkProgress::activity_mode",
|
||||
GTK_TYPE_BOOL,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_ACTIVITY_MODE);
|
||||
gtk_object_add_arg_type ("GtkProgress::show_text",
|
||||
GTK_TYPE_BOOL,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_SHOW_TEXT);
|
||||
gtk_object_add_arg_type ("GtkProgress::text_xalign",
|
||||
GTK_TYPE_FLOAT,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_TEXT_XALIGN);
|
||||
gtk_object_add_arg_type ("GtkProgress::text_yalign",
|
||||
GTK_TYPE_FLOAT,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_TEXT_YALIGN);
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ACTIVITY_MODE,
|
||||
g_param_spec_boolean ("activity_mode",
|
||||
_("Activity mode"),
|
||||
_("If true the GtkProgress is in activity mode, meaning that is signals something is happening, but not how much of the activity is finished. This is used when you're doing something that you don't know how long it will take."),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SHOW_TEXT,
|
||||
g_param_spec_boolean ("show_text",
|
||||
_("Show text"),
|
||||
_("Whether the progress is shown as text"),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_TEXT_XALIGN,
|
||||
g_param_spec_float ("text_xalign",
|
||||
_("Text x alignment"),
|
||||
_("A number between 0.0 and 1.0 specifying the horizontal alignment of the text in the progresswidget"),
|
||||
0.0,
|
||||
1.0,
|
||||
0.5,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_TEXT_YALIGN,
|
||||
g_param_spec_float ("text_yalign",
|
||||
_("Text y alignment"),
|
||||
_("A number between 0.0 and 1.0 specifying the vertical alignment of the text in the progress widget"),
|
||||
0.0,
|
||||
1.0,
|
||||
0.5,
|
||||
G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_progress_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_progress_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkProgress *progress;
|
||||
|
||||
progress = GTK_PROGRESS (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_ACTIVITY_MODE:
|
||||
gtk_progress_set_activity_mode (progress, GTK_VALUE_BOOL (*arg));
|
||||
case PROP_ACTIVITY_MODE:
|
||||
gtk_progress_set_activity_mode (progress, g_value_get_boolean (value));
|
||||
break;
|
||||
case ARG_SHOW_TEXT:
|
||||
gtk_progress_set_show_text (progress, GTK_VALUE_BOOL (*arg));
|
||||
case PROP_SHOW_TEXT:
|
||||
gtk_progress_set_show_text (progress, g_value_get_boolean (value));
|
||||
break;
|
||||
case ARG_TEXT_XALIGN:
|
||||
gtk_progress_set_text_alignment (progress, GTK_VALUE_FLOAT (*arg), progress->y_align);
|
||||
case PROP_TEXT_XALIGN:
|
||||
gtk_progress_set_text_alignment (progress,
|
||||
g_value_get_float (value),
|
||||
progress->y_align);
|
||||
break;
|
||||
case ARG_TEXT_YALIGN:
|
||||
gtk_progress_set_text_alignment (progress, progress->x_align, GTK_VALUE_FLOAT (*arg));
|
||||
case PROP_TEXT_YALIGN:
|
||||
gtk_progress_set_text_alignment (progress,
|
||||
progress->x_align,
|
||||
g_value_get_float (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_progress_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_progress_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkProgress *progress;
|
||||
|
||||
progress = GTK_PROGRESS (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_ACTIVITY_MODE:
|
||||
GTK_VALUE_BOOL (*arg) = (progress->activity_mode != FALSE);
|
||||
case PROP_ACTIVITY_MODE:
|
||||
g_value_set_boolean (value, (progress->activity_mode != FALSE));
|
||||
break;
|
||||
case ARG_SHOW_TEXT:
|
||||
GTK_VALUE_BOOL (*arg) = (progress->show_text != FALSE);
|
||||
case PROP_SHOW_TEXT:
|
||||
g_value_set_boolean (value, (progress->show_text != FALSE));
|
||||
break;
|
||||
case ARG_TEXT_XALIGN:
|
||||
GTK_VALUE_FLOAT (*arg) = progress->x_align;
|
||||
case PROP_TEXT_XALIGN:
|
||||
g_value_set_float (value, progress->x_align);
|
||||
break;
|
||||
case ARG_TEXT_YALIGN:
|
||||
GTK_VALUE_FLOAT (*arg) = progress->y_align;
|
||||
case PROP_TEXT_YALIGN:
|
||||
g_value_set_float (value, progress->y_align);
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -602,6 +630,8 @@ gtk_progress_set_show_text (GtkProgress *progress,
|
||||
|
||||
if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (progress)))
|
||||
gtk_widget_queue_resize (GTK_WIDGET (progress));
|
||||
|
||||
g_object_notify (G_OBJECT (progress), "show_text");
|
||||
}
|
||||
}
|
||||
|
||||
@ -617,8 +647,17 @@ gtk_progress_set_text_alignment (GtkProgress *progress,
|
||||
|
||||
if (progress->x_align != x_align || progress->y_align != y_align)
|
||||
{
|
||||
progress->x_align = x_align;
|
||||
progress->y_align = y_align;
|
||||
if (progress->x_align != x_align)
|
||||
{
|
||||
progress->x_align = x_align;
|
||||
g_object_notify (G_OBJECT (progress), "text_xalign");
|
||||
}
|
||||
|
||||
if (progress->y_align != y_align)
|
||||
{
|
||||
progress->y_align = y_align;
|
||||
g_object_notify (G_OBJECT (progress), "text_yalign");
|
||||
}
|
||||
|
||||
if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (progress)))
|
||||
gtk_widget_queue_resize (GTK_WIDGET (progress));
|
||||
@ -691,5 +730,7 @@ gtk_progress_set_activity_mode (GtkProgress *progress,
|
||||
|
||||
if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (progress)))
|
||||
gtk_widget_queue_resize (GTK_WIDGET (progress));
|
||||
|
||||
g_object_notify (G_OBJECT (progress), "activity_mode");
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
#include "gtkprogressbar.h"
|
||||
#include "gtksignal.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
#define MIN_HORIZONTAL_BAR_WIDTH 150
|
||||
@ -46,30 +47,32 @@
|
||||
#define TEXT_SPACING 2
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
PROP_0,
|
||||
|
||||
/* Supported args */
|
||||
ARG_FRACTION,
|
||||
ARG_PULSE_STEP,
|
||||
ARG_ORIENTATION,
|
||||
ARG_TEXT,
|
||||
PROP_FRACTION,
|
||||
PROP_PULSE_STEP,
|
||||
PROP_ORIENTATION,
|
||||
PROP_TEXT,
|
||||
|
||||
/* Deprecated args */
|
||||
ARG_ADJUSTMENT,
|
||||
ARG_BAR_STYLE,
|
||||
ARG_ACTIVITY_STEP,
|
||||
ARG_ACTIVITY_BLOCKS,
|
||||
ARG_DISCRETE_BLOCKS
|
||||
PROP_ADJUSTMENT,
|
||||
PROP_BAR_STYLE,
|
||||
PROP_ACTIVITY_STEP,
|
||||
PROP_ACTIVITY_BLOCKS,
|
||||
PROP_DISCRETE_BLOCKS
|
||||
};
|
||||
|
||||
static void gtk_progress_bar_class_init (GtkProgressBarClass *klass);
|
||||
static void gtk_progress_bar_init (GtkProgressBar *pbar);
|
||||
static void gtk_progress_bar_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_progress_bar_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_progress_bar_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_progress_bar_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_progress_bar_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void gtk_progress_bar_real_update (GtkProgress *progress);
|
||||
@ -105,59 +108,107 @@ gtk_progress_bar_get_type (void)
|
||||
static void
|
||||
gtk_progress_bar_class_init (GtkProgressBarClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GObjectClass *gobject_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
GtkProgressClass *progress_class;
|
||||
|
||||
object_class = (GtkObjectClass *) class;
|
||||
gobject_class = G_OBJECT_CLASS (class);
|
||||
widget_class = (GtkWidgetClass *) class;
|
||||
progress_class = (GtkProgressClass *) class;
|
||||
|
||||
gtk_object_add_arg_type ("GtkProgressBar::adjustment",
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_ADJUSTMENT);
|
||||
gtk_object_add_arg_type ("GtkProgressBar::orientation",
|
||||
GTK_TYPE_PROGRESS_BAR_ORIENTATION,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_ORIENTATION);
|
||||
gtk_object_add_arg_type ("GtkProgressBar::bar_style",
|
||||
GTK_TYPE_PROGRESS_BAR_STYLE,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_BAR_STYLE);
|
||||
gtk_object_add_arg_type ("GtkProgressBar::activity_step",
|
||||
GTK_TYPE_UINT,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_ACTIVITY_STEP);
|
||||
gtk_object_add_arg_type ("GtkProgressBar::activity_blocks",
|
||||
GTK_TYPE_UINT,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_ACTIVITY_BLOCKS);
|
||||
gtk_object_add_arg_type ("GtkProgressBar::discrete_blocks",
|
||||
GTK_TYPE_UINT,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_DISCRETE_BLOCKS);
|
||||
gtk_object_add_arg_type ("GtkProgressBar::fraction",
|
||||
GTK_TYPE_DOUBLE,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_FRACTION);
|
||||
gtk_object_add_arg_type ("GtkProgressBar::pulse_step",
|
||||
GTK_TYPE_DOUBLE,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_PULSE_STEP);
|
||||
gtk_object_add_arg_type ("GtkProgressBar::text",
|
||||
GTK_TYPE_STRING,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_TEXT);
|
||||
|
||||
object_class->set_arg = gtk_progress_bar_set_arg;
|
||||
object_class->get_arg = gtk_progress_bar_get_arg;
|
||||
gobject_class->set_property = gtk_progress_bar_set_property;
|
||||
gobject_class->get_property = gtk_progress_bar_get_property;
|
||||
|
||||
widget_class->size_request = gtk_progress_bar_size_request;
|
||||
|
||||
progress_class->paint = gtk_progress_bar_paint;
|
||||
progress_class->update = gtk_progress_bar_real_update;
|
||||
progress_class->act_mode_enter = gtk_progress_bar_act_mode_enter;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ADJUSTMENT,
|
||||
g_param_spec_object ("adjustment",
|
||||
_("Adjustment"),
|
||||
_("The GtkAdjustment connected to the progress bar (Deprecated)"),
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ORIENTATION,
|
||||
g_param_spec_enum ("orientation",
|
||||
_("Orientation"),
|
||||
_("Orientation and growth of the progress bar"),
|
||||
GTK_TYPE_PROGRESS_BAR_ORIENTATION,
|
||||
GTK_PROGRESS_LEFT_TO_RIGHT,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_BAR_STYLE,
|
||||
g_param_spec_enum ("bar_style",
|
||||
_("Bar style"),
|
||||
_("Specifies the visual style of the bar in percentage mode (Deprecated)"),
|
||||
GTK_TYPE_PROGRESS_BAR_STYLE,
|
||||
GTK_PROGRESS_CONTINUOUS,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ACTIVITY_STEP,
|
||||
g_param_spec_uint ("activity_step",
|
||||
_("Activity Step"),
|
||||
_("The increment used for each iteration in activity mode (Deprecated)"),
|
||||
-G_MAXUINT,
|
||||
G_MAXUINT,
|
||||
3,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ACTIVITY_BLOCKS,
|
||||
g_param_spec_uint ("activity_blocks",
|
||||
_("Activity Blocks"),
|
||||
_("The number of blocks which can fit in the progress bar area in activity mode (Deprecated)"),
|
||||
2,
|
||||
G_MAXUINT,
|
||||
5,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_DISCRETE_BLOCKS,
|
||||
g_param_spec_uint ("discrete_blocks",
|
||||
_("Discrete Blocks"),
|
||||
_("The number of discrete blocks in a progress bar (when shown in the discrete style"),
|
||||
2,
|
||||
G_MAXUINT,
|
||||
10,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_FRACTION,
|
||||
g_param_spec_double ("fraction",
|
||||
_("Fraction"),
|
||||
_("The fraction of total work that has been completed"),
|
||||
0.0,
|
||||
1.0,
|
||||
0.0,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_PULSE_STEP,
|
||||
g_param_spec_double ("pulse_step",
|
||||
_("Pulse Step"),
|
||||
_("The fraction of total progress to move the bouncing block when pulsed"),
|
||||
0.0,
|
||||
1.0,
|
||||
0.1,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_TEXT,
|
||||
g_param_spec_string ("text",
|
||||
_("Text"),
|
||||
_("Text to be displayed in the progress bar"),
|
||||
"%P %%",
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
@ -175,88 +226,92 @@ gtk_progress_bar_init (GtkProgressBar *pbar)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_progress_bar_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_progress_bar_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkProgressBar *pbar;
|
||||
|
||||
pbar = GTK_PROGRESS_BAR (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_ADJUSTMENT:
|
||||
gtk_progress_set_adjustment (GTK_PROGRESS (pbar), GTK_VALUE_POINTER (*arg));
|
||||
case PROP_ADJUSTMENT:
|
||||
gtk_progress_set_adjustment (GTK_PROGRESS (pbar),
|
||||
GTK_ADJUSTMENT (g_value_get_object (value)));
|
||||
break;
|
||||
case ARG_ORIENTATION:
|
||||
gtk_progress_bar_set_orientation (pbar, GTK_VALUE_ENUM (*arg));
|
||||
case PROP_ORIENTATION:
|
||||
gtk_progress_bar_set_orientation (pbar, g_value_get_enum (value));
|
||||
break;
|
||||
case ARG_BAR_STYLE:
|
||||
gtk_progress_bar_set_bar_style (pbar, GTK_VALUE_ENUM (*arg));
|
||||
case PROP_BAR_STYLE:
|
||||
gtk_progress_bar_set_bar_style (pbar, g_value_get_enum (value));
|
||||
break;
|
||||
case ARG_ACTIVITY_STEP:
|
||||
gtk_progress_bar_set_activity_step (pbar, GTK_VALUE_UINT (*arg));
|
||||
case PROP_ACTIVITY_STEP:
|
||||
gtk_progress_bar_set_activity_step (pbar, g_value_get_uint (value));
|
||||
break;
|
||||
case ARG_ACTIVITY_BLOCKS:
|
||||
gtk_progress_bar_set_activity_blocks (pbar, GTK_VALUE_UINT (*arg));
|
||||
case PROP_ACTIVITY_BLOCKS:
|
||||
gtk_progress_bar_set_activity_blocks (pbar, g_value_get_uint (value));
|
||||
break;
|
||||
case ARG_DISCRETE_BLOCKS:
|
||||
gtk_progress_bar_set_discrete_blocks (pbar, GTK_VALUE_UINT (*arg));
|
||||
case PROP_DISCRETE_BLOCKS:
|
||||
gtk_progress_bar_set_discrete_blocks (pbar, g_value_get_uint (value));
|
||||
break;
|
||||
case ARG_FRACTION:
|
||||
gtk_progress_bar_set_fraction (pbar, GTK_VALUE_DOUBLE (*arg));
|
||||
case PROP_FRACTION:
|
||||
gtk_progress_bar_set_fraction (pbar, g_value_get_double (value));
|
||||
break;
|
||||
case ARG_PULSE_STEP:
|
||||
gtk_progress_bar_set_pulse_step (pbar, GTK_VALUE_DOUBLE (*arg));
|
||||
case PROP_PULSE_STEP:
|
||||
gtk_progress_bar_set_pulse_step (pbar, g_value_get_double (value));
|
||||
break;
|
||||
case ARG_TEXT:
|
||||
gtk_progress_bar_set_text (pbar, GTK_VALUE_STRING (*arg));
|
||||
case PROP_TEXT:
|
||||
gtk_progress_bar_set_text (pbar, g_value_get_string (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_progress_bar_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_progress_bar_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkProgressBar *pbar;
|
||||
|
||||
pbar = GTK_PROGRESS_BAR (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_ADJUSTMENT:
|
||||
GTK_VALUE_POINTER (*arg) = GTK_PROGRESS (pbar)->adjustment;
|
||||
case PROP_ADJUSTMENT:
|
||||
g_value_set_object (value, G_OBJECT (GTK_PROGRESS (pbar)->adjustment));
|
||||
break;
|
||||
case ARG_ORIENTATION:
|
||||
GTK_VALUE_ENUM (*arg) = pbar->orientation;
|
||||
case PROP_ORIENTATION:
|
||||
g_value_set_enum (value, pbar->orientation);
|
||||
break;
|
||||
case ARG_BAR_STYLE:
|
||||
GTK_VALUE_ENUM (*arg) = pbar->bar_style;
|
||||
case PROP_BAR_STYLE:
|
||||
g_value_set_enum (value, pbar->bar_style);
|
||||
break;
|
||||
case ARG_ACTIVITY_STEP:
|
||||
GTK_VALUE_UINT (*arg) = pbar->activity_step;
|
||||
case PROP_ACTIVITY_STEP:
|
||||
g_value_set_uint (value, pbar->activity_step);
|
||||
break;
|
||||
case ARG_ACTIVITY_BLOCKS:
|
||||
GTK_VALUE_UINT (*arg) = pbar->activity_blocks;
|
||||
case PROP_ACTIVITY_BLOCKS:
|
||||
g_value_set_uint (value, pbar->activity_blocks);
|
||||
break;
|
||||
case ARG_DISCRETE_BLOCKS:
|
||||
GTK_VALUE_UINT (*arg) = pbar->blocks;
|
||||
case PROP_DISCRETE_BLOCKS:
|
||||
g_value_set_uint (value, pbar->blocks);
|
||||
break;
|
||||
case ARG_FRACTION:
|
||||
GTK_VALUE_DOUBLE (*arg) = gtk_progress_get_current_percentage (GTK_PROGRESS (pbar));
|
||||
case PROP_FRACTION:
|
||||
g_value_set_double (value, gtk_progress_get_current_percentage (GTK_PROGRESS (pbar)));
|
||||
break;
|
||||
case ARG_PULSE_STEP:
|
||||
GTK_VALUE_DOUBLE (*arg) = pbar->pulse_fraction;
|
||||
case PROP_PULSE_STEP:
|
||||
g_value_set_double (value, pbar->pulse_fraction);
|
||||
break;
|
||||
case ARG_TEXT:
|
||||
GTK_VALUE_STRING (*arg) = g_strdup (gtk_progress_bar_get_text (pbar));
|
||||
case PROP_TEXT:
|
||||
g_value_set_string (value, gtk_progress_bar_get_text (pbar));
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -930,9 +985,9 @@ gtk_progress_bar_set_orientation (GtkProgressBar *pbar,
|
||||
|
||||
if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (pbar)))
|
||||
gtk_widget_queue_resize (GTK_WIDGET (pbar));
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (pbar), "orientation");
|
||||
g_object_notify (G_OBJECT (pbar), "orientation");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1018,6 +1073,8 @@ gtk_progress_bar_set_bar_style (GtkProgressBar *pbar,
|
||||
|
||||
if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (pbar)))
|
||||
gtk_widget_queue_resize (GTK_WIDGET (pbar));
|
||||
|
||||
g_object_notify (G_OBJECT (pbar), "bar_style");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1035,6 +1092,8 @@ gtk_progress_bar_set_discrete_blocks (GtkProgressBar *pbar,
|
||||
|
||||
if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (pbar)))
|
||||
gtk_widget_queue_resize (GTK_WIDGET (pbar));
|
||||
|
||||
g_object_notify (G_OBJECT (pbar), "discrete_blocks");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1046,7 +1105,10 @@ gtk_progress_bar_set_activity_step (GtkProgressBar *pbar,
|
||||
g_return_if_fail (GTK_IS_PROGRESS_BAR (pbar));
|
||||
|
||||
if (pbar->activity_step != step)
|
||||
pbar->activity_step = step;
|
||||
{
|
||||
pbar->activity_step = step;
|
||||
g_object_notify (G_OBJECT (pbar), "activity_step");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -1058,5 +1120,8 @@ gtk_progress_bar_set_activity_blocks (GtkProgressBar *pbar,
|
||||
g_return_if_fail (blocks > 1);
|
||||
|
||||
if (pbar->activity_blocks != blocks)
|
||||
pbar->activity_blocks = blocks;
|
||||
{
|
||||
pbar->activity_blocks = blocks;
|
||||
g_object_notify (G_OBJECT (pbar), "activity_blocks");
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "gtkmain.h"
|
||||
#include "gtkrange.h"
|
||||
#include "gtksignal.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
#define SCROLL_TIMER_LENGTH 20
|
||||
#define SCROLL_INITIAL_DELAY 250 /* must hold button this long before ... */
|
||||
@ -37,18 +38,20 @@
|
||||
#define RANGE_CLASS(w) GTK_RANGE_GET_CLASS (w)
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_UPDATE_POLICY
|
||||
PROP_0,
|
||||
PROP_UPDATE_POLICY
|
||||
};
|
||||
|
||||
static void gtk_range_class_init (GtkRangeClass *klass);
|
||||
static void gtk_range_init (GtkRange *range);
|
||||
static void gtk_range_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_range_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_range_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_range_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_range_destroy (GtkObject *object);
|
||||
static void gtk_range_unrealize (GtkWidget *widget);
|
||||
static gint gtk_range_expose (GtkWidget *widget,
|
||||
@ -122,16 +125,18 @@ gtk_range_get_type (void)
|
||||
static void
|
||||
gtk_range_class_init (GtkRangeClass *class)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
|
||||
gobject_class = G_OBJECT_CLASS (class);
|
||||
object_class = (GtkObjectClass*) class;
|
||||
widget_class = (GtkWidgetClass*) class;
|
||||
|
||||
parent_class = gtk_type_class (GTK_TYPE_WIDGET);
|
||||
|
||||
object_class->set_arg = gtk_range_set_arg;
|
||||
object_class->get_arg = gtk_range_get_arg;
|
||||
gobject_class->set_property = gtk_range_set_property;
|
||||
gobject_class->get_property = gtk_range_get_property;
|
||||
object_class->destroy = gtk_range_destroy;
|
||||
|
||||
widget_class->unrealize = gtk_range_unrealize;
|
||||
@ -164,47 +169,54 @@ gtk_range_class_init (GtkRangeClass *class)
|
||||
class->motion = NULL;
|
||||
class->timer = gtk_real_range_timer;
|
||||
|
||||
gtk_object_add_arg_type ("GtkRange::update_policy",
|
||||
GTK_TYPE_UPDATE_TYPE,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_UPDATE_POLICY);
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_UPDATE_POLICY,
|
||||
g_param_spec_enum ("update_policy",
|
||||
_("Update policy"),
|
||||
_("How the range should be updated on the screen"),
|
||||
GTK_TYPE_UPDATE_TYPE,
|
||||
GTK_UPDATE_CONTINUOUS,
|
||||
G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_range_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkRange *range;
|
||||
|
||||
range = GTK_RANGE (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_UPDATE_POLICY:
|
||||
gtk_range_set_update_policy (range, GTK_VALUE_ENUM (*arg));
|
||||
case PROP_UPDATE_POLICY:
|
||||
gtk_range_set_update_policy (range, g_value_get_enum (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_range_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkRange *range;
|
||||
|
||||
range = GTK_RANGE (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_UPDATE_POLICY:
|
||||
GTK_VALUE_ENUM (*arg) = range->policy;
|
||||
case PROP_UPDATE_POLICY:
|
||||
g_value_set_enum (value, range->policy);
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -254,7 +266,11 @@ gtk_range_set_update_policy (GtkRange *range,
|
||||
g_return_if_fail (range != NULL);
|
||||
g_return_if_fail (GTK_IS_RANGE (range));
|
||||
|
||||
range->policy = policy;
|
||||
if (range->policy != policy)
|
||||
{
|
||||
range->policy = policy;
|
||||
g_object_notify (G_OBJECT (range), "update_policy");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
154
gtk/gtktable.c
154
gtk/gtktable.c
@ -25,15 +25,16 @@
|
||||
*/
|
||||
|
||||
#include "gtktable.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
ARG_N_ROWS,
|
||||
ARG_N_COLUMNS,
|
||||
ARG_COLUMN_SPACING,
|
||||
ARG_ROW_SPACING,
|
||||
ARG_HOMOGENEOUS
|
||||
PROP_0,
|
||||
PROP_N_ROWS,
|
||||
PROP_N_COLUMNS,
|
||||
PROP_COLUMN_SPACING,
|
||||
PROP_ROW_SPACING,
|
||||
PROP_HOMOGENEOUS
|
||||
};
|
||||
|
||||
enum
|
||||
@ -67,12 +68,14 @@ static void gtk_table_forall (GtkContainer *container,
|
||||
gboolean include_internals,
|
||||
GtkCallback callback,
|
||||
gpointer callback_data);
|
||||
static void gtk_table_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_table_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_table_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_table_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_table_set_child_arg (GtkContainer *container,
|
||||
GtkWidget *child,
|
||||
GtkArg *arg,
|
||||
@ -138,8 +141,8 @@ gtk_table_class_init (GtkTableClass *class)
|
||||
|
||||
gobject_class->finalize = gtk_table_finalize;
|
||||
|
||||
object_class->get_arg = gtk_table_get_arg;
|
||||
object_class->set_arg = gtk_table_set_arg;
|
||||
gobject_class->get_property = gtk_table_get_property;
|
||||
gobject_class->set_property = gtk_table_set_property;
|
||||
|
||||
widget_class->map = gtk_table_map;
|
||||
widget_class->unmap = gtk_table_unmap;
|
||||
@ -153,11 +156,55 @@ gtk_table_class_init (GtkTableClass *class)
|
||||
container_class->set_child_arg = gtk_table_set_child_arg;
|
||||
container_class->get_child_arg = gtk_table_get_child_arg;
|
||||
|
||||
gtk_object_add_arg_type ("GtkTable::n_rows", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_N_ROWS);
|
||||
gtk_object_add_arg_type ("GtkTable::n_columns", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_N_COLUMNS);
|
||||
gtk_object_add_arg_type ("GtkTable::row_spacing", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_ROW_SPACING);
|
||||
gtk_object_add_arg_type ("GtkTable::column_spacing", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_COLUMN_SPACING);
|
||||
gtk_object_add_arg_type ("GtkTable::homogeneous", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HOMOGENEOUS);
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_N_ROWS,
|
||||
g_param_spec_uint ("n_rows",
|
||||
_("Rows"),
|
||||
_("The number of rows in the table"),
|
||||
0,
|
||||
G_MAXUINT,
|
||||
0,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_N_COLUMNS,
|
||||
g_param_spec_uint ("n_columns",
|
||||
_("Columns"),
|
||||
_("The number of columns in the table"),
|
||||
0,
|
||||
G_MAXUINT,
|
||||
0,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ROW_SPACING,
|
||||
g_param_spec_uint ("row_spacing",
|
||||
_("Row spacing"),
|
||||
_("The amount of space between two consecutive rows"),
|
||||
0,
|
||||
G_MAXUINT,
|
||||
0,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_COLUMN_SPACING,
|
||||
g_param_spec_uint ("column_spacing",
|
||||
_("Column spacing"),
|
||||
_("The amount of space between two consecutive columns"),
|
||||
0,
|
||||
G_MAXUINT,
|
||||
0,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_HOMOGENEOUS,
|
||||
g_param_spec_boolean ("homogeneous",
|
||||
_("Homogenous"),
|
||||
_("If TRUE this means the table cells are all the same width/height"),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
gtk_container_add_child_arg_type ("GtkTable::left_attach", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_LEFT_ATTACH);
|
||||
gtk_container_add_child_arg_type ("GtkTable::right_attach", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_RIGHT_ATTACH);
|
||||
gtk_container_add_child_arg_type ("GtkTable::top_attach", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_TOP_ATTACH);
|
||||
@ -175,64 +222,67 @@ gtk_table_child_type (GtkContainer *container)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_table_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_table_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkTable *table;
|
||||
|
||||
table = GTK_TABLE (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_N_ROWS:
|
||||
GTK_VALUE_UINT (*arg) = table->nrows;
|
||||
case PROP_N_ROWS:
|
||||
g_value_set_uint (value, table->nrows);
|
||||
break;
|
||||
case ARG_N_COLUMNS:
|
||||
GTK_VALUE_UINT (*arg) = table->ncols;
|
||||
case PROP_N_COLUMNS:
|
||||
g_value_set_uint (value, table->ncols);
|
||||
break;
|
||||
case ARG_ROW_SPACING:
|
||||
GTK_VALUE_UINT (*arg) = table->row_spacing;
|
||||
case PROP_ROW_SPACING:
|
||||
g_value_set_uint (value, table->row_spacing);
|
||||
break;
|
||||
case ARG_COLUMN_SPACING:
|
||||
GTK_VALUE_UINT (*arg) = table->column_spacing;
|
||||
case PROP_COLUMN_SPACING:
|
||||
g_value_set_uint (value, table->column_spacing);
|
||||
break;
|
||||
case ARG_HOMOGENEOUS:
|
||||
GTK_VALUE_BOOL (*arg) = table->homogeneous;
|
||||
case PROP_HOMOGENEOUS:
|
||||
g_value_set_boolean (value, table->homogeneous);
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_table_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_table_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkTable *table;
|
||||
|
||||
table = GTK_TABLE (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_N_ROWS:
|
||||
gtk_table_resize (table, GTK_VALUE_UINT (*arg), table->ncols);
|
||||
case PROP_N_ROWS:
|
||||
gtk_table_resize (table, g_value_get_uint (value), table->ncols);
|
||||
break;
|
||||
case ARG_N_COLUMNS:
|
||||
gtk_table_resize (table, table->nrows, GTK_VALUE_UINT (*arg));
|
||||
case PROP_N_COLUMNS:
|
||||
gtk_table_resize (table, table->nrows, g_value_get_uint (value));
|
||||
break;
|
||||
case ARG_ROW_SPACING:
|
||||
gtk_table_set_row_spacings (table, GTK_VALUE_UINT (*arg));
|
||||
case PROP_ROW_SPACING:
|
||||
gtk_table_set_row_spacings (table, g_value_get_uint (value));
|
||||
break;
|
||||
case ARG_COLUMN_SPACING:
|
||||
gtk_table_set_col_spacings (table, GTK_VALUE_UINT (*arg));
|
||||
case PROP_COLUMN_SPACING:
|
||||
gtk_table_set_col_spacings (table, g_value_get_uint (value));
|
||||
break;
|
||||
case ARG_HOMOGENEOUS:
|
||||
gtk_table_set_homogeneous (table, GTK_VALUE_BOOL (*arg));
|
||||
case PROP_HOMOGENEOUS:
|
||||
gtk_table_set_homogeneous (table, g_value_get_boolean (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -458,6 +508,8 @@ gtk_table_resize (GtkTable *table,
|
||||
table->rows[i].expand = 0;
|
||||
table->rows[i].shrink = 0;
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (table), "n_rows");
|
||||
}
|
||||
|
||||
if (n_cols != table->ncols)
|
||||
@ -478,6 +530,8 @@ gtk_table_resize (GtkTable *table,
|
||||
table->cols[i].expand = 0;
|
||||
table->cols[i].shrink = 0;
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (table), "n_columns");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -576,6 +630,8 @@ gtk_table_set_row_spacing (GtkTable *table,
|
||||
if (GTK_WIDGET_VISIBLE (table))
|
||||
gtk_widget_queue_resize (GTK_WIDGET (table));
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (table), "row_spacing");
|
||||
}
|
||||
|
||||
void
|
||||
@ -594,6 +650,8 @@ gtk_table_set_col_spacing (GtkTable *table,
|
||||
if (GTK_WIDGET_VISIBLE (table))
|
||||
gtk_widget_queue_resize (GTK_WIDGET (table));
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (table), "column_spacing");
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -26,24 +26,27 @@
|
||||
|
||||
#include "gtksignal.h"
|
||||
#include "gtkviewport.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_HADJUSTMENT,
|
||||
ARG_VADJUSTMENT,
|
||||
ARG_SHADOW_TYPE
|
||||
PROP_0,
|
||||
PROP_HADJUSTMENT,
|
||||
PROP_VADJUSTMENT,
|
||||
PROP_SHADOW_TYPE
|
||||
};
|
||||
|
||||
|
||||
static void gtk_viewport_class_init (GtkViewportClass *klass);
|
||||
static void gtk_viewport_init (GtkViewport *viewport);
|
||||
static void gtk_viewport_destroy (GtkObject *object);
|
||||
static void gtk_viewport_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_viewport_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_viewport_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_viewport_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_viewport_set_scroll_adjustments (GtkViewport *viewport,
|
||||
GtkAdjustment *hadjustment,
|
||||
GtkAdjustment *vadjustment);
|
||||
@ -99,16 +102,18 @@ static void
|
||||
gtk_viewport_class_init (GtkViewportClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GObjectClass *gobject_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
GtkContainerClass *container_class;
|
||||
|
||||
object_class = (GtkObjectClass*) class;
|
||||
gobject_class = G_OBJECT_CLASS (class);
|
||||
widget_class = (GtkWidgetClass*) class;
|
||||
container_class = (GtkContainerClass*) class;
|
||||
parent_class = (GtkBinClass*) gtk_type_class (GTK_TYPE_BIN);
|
||||
|
||||
object_class->set_arg = gtk_viewport_set_arg;
|
||||
object_class->get_arg = gtk_viewport_get_arg;
|
||||
gobject_class->set_property = gtk_viewport_set_property;
|
||||
gobject_class->get_property = gtk_viewport_get_property;
|
||||
object_class->destroy = gtk_viewport_destroy;
|
||||
|
||||
widget_class->map = gtk_viewport_map;
|
||||
@ -124,18 +129,30 @@ gtk_viewport_class_init (GtkViewportClass *class)
|
||||
|
||||
class->set_scroll_adjustments = gtk_viewport_set_scroll_adjustments;
|
||||
|
||||
gtk_object_add_arg_type ("GtkViewport::hadjustment",
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_HADJUSTMENT);
|
||||
gtk_object_add_arg_type ("GtkViewport::vadjustment",
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_VADJUSTMENT);
|
||||
gtk_object_add_arg_type ("GtkViewport::shadow_type",
|
||||
GTK_TYPE_SHADOW_TYPE,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_SHADOW_TYPE);
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_HADJUSTMENT,
|
||||
g_param_spec_object ("hadjustment",
|
||||
_("Horizontal adjustment"),
|
||||
_("The GtkAdjustment that determines the values of the horizontal position for this viewport."),
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_VADJUSTMENT,
|
||||
g_param_spec_object ("vadjustment",
|
||||
_("Vertical adjustment"),
|
||||
_("The GtkAdjustment that determines the values of the vertical position for this viewport."),
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SHADOW_TYPE,
|
||||
g_param_spec_enum ("shadow_type",
|
||||
_("Shadow type"),
|
||||
_("Determines how the shadowed box around the viewport is drawn."),
|
||||
GTK_TYPE_SHADOW_TYPE,
|
||||
GTK_SHADOW_IN,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
widget_class->set_scroll_adjustments_signal =
|
||||
gtk_signal_new ("set_scroll_adjustments",
|
||||
@ -147,52 +164,55 @@ gtk_viewport_class_init (GtkViewportClass *class)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_viewport_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_viewport_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkViewport *viewport;
|
||||
|
||||
viewport = GTK_VIEWPORT (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_HADJUSTMENT:
|
||||
gtk_viewport_set_hadjustment (viewport, GTK_VALUE_POINTER (*arg));
|
||||
case PROP_HADJUSTMENT:
|
||||
gtk_viewport_set_hadjustment (viewport, g_value_get_object (value));
|
||||
break;
|
||||
case ARG_VADJUSTMENT:
|
||||
gtk_viewport_set_vadjustment (viewport, GTK_VALUE_POINTER (*arg));
|
||||
case PROP_VADJUSTMENT:
|
||||
gtk_viewport_set_vadjustment (viewport, g_value_get_object (value));
|
||||
break;
|
||||
case ARG_SHADOW_TYPE:
|
||||
gtk_viewport_set_shadow_type (viewport, GTK_VALUE_ENUM (*arg));
|
||||
case PROP_SHADOW_TYPE:
|
||||
gtk_viewport_set_shadow_type (viewport, g_value_get_enum (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_viewport_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_viewport_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkViewport *viewport;
|
||||
|
||||
viewport = GTK_VIEWPORT (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_HADJUSTMENT:
|
||||
GTK_VALUE_POINTER (*arg) = viewport->hadjustment;
|
||||
case PROP_HADJUSTMENT:
|
||||
g_value_set_object (value, viewport->hadjustment);
|
||||
break;
|
||||
case ARG_VADJUSTMENT:
|
||||
GTK_VALUE_POINTER (*arg) = viewport->vadjustment;
|
||||
case PROP_VADJUSTMENT:
|
||||
g_value_set_object (value, viewport->vadjustment);
|
||||
break;
|
||||
case ARG_SHADOW_TYPE:
|
||||
GTK_VALUE_ENUM (*arg) = viewport->shadow_type;
|
||||
case PROP_SHADOW_TYPE:
|
||||
g_value_set_enum (value, viewport->shadow_type);
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -305,6 +325,8 @@ gtk_viewport_set_hadjustment (GtkViewport *viewport,
|
||||
|
||||
gtk_viewport_adjustment_changed (adjustment, viewport);
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (viewport), "hadjustment");
|
||||
}
|
||||
|
||||
void
|
||||
@ -342,6 +364,8 @@ gtk_viewport_set_vadjustment (GtkViewport *viewport,
|
||||
|
||||
gtk_viewport_adjustment_changed (adjustment, viewport);
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (viewport), "vadjustment");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -372,6 +396,8 @@ gtk_viewport_set_shadow_type (GtkViewport *viewport,
|
||||
gtk_widget_queue_draw (GTK_WIDGET (viewport));
|
||||
}
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (viewport), "shadow_type");
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,24 +28,27 @@
|
||||
#include "gtkvscale.h"
|
||||
#include "gtksignal.h"
|
||||
#include "gdk/gdkkeysyms.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
#define SCALE_CLASS(w) GTK_SCALE_GET_CLASS (w)
|
||||
#define RANGE_CLASS(w) GTK_RANGE_GET_CLASS (w)
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_ADJUSTMENT
|
||||
PROP_0,
|
||||
PROP_ADJUSTMENT
|
||||
};
|
||||
|
||||
static void gtk_vscale_class_init (GtkVScaleClass *klass);
|
||||
static void gtk_vscale_init (GtkVScale *vscale);
|
||||
static void gtk_vscale_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_vscale_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_vscale_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_vscale_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_vscale_realize (GtkWidget *widget);
|
||||
static void gtk_vscale_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
@ -98,22 +101,19 @@ static void
|
||||
gtk_vscale_class_init (GtkVScaleClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GObjectClass *gobject_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
GtkRangeClass *range_class;
|
||||
GtkScaleClass *scale_class;
|
||||
|
||||
object_class = (GtkObjectClass*) class;
|
||||
gobject_class = G_OBJECT_CLASS (class);
|
||||
widget_class = (GtkWidgetClass*) class;
|
||||
range_class = (GtkRangeClass*) class;
|
||||
scale_class = (GtkScaleClass*) class;
|
||||
|
||||
gtk_object_add_arg_type ("GtkVScale::adjustment",
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_ADJUSTMENT);
|
||||
|
||||
object_class->set_arg = gtk_vscale_set_arg;
|
||||
object_class->get_arg = gtk_vscale_get_arg;
|
||||
gobject_class->set_property = gtk_vscale_set_property;
|
||||
gobject_class->get_property = gtk_vscale_get_property;
|
||||
|
||||
widget_class->realize = gtk_vscale_realize;
|
||||
widget_class->size_request = gtk_vscale_size_request;
|
||||
@ -127,43 +127,55 @@ gtk_vscale_class_init (GtkVScaleClass *class)
|
||||
range_class->clear_background = gtk_vscale_clear_background;
|
||||
|
||||
scale_class->draw_value = gtk_vscale_draw_value;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ADJUSTMENT,
|
||||
g_param_spec_object ("adjustment",
|
||||
_("Adjustment"),
|
||||
_("The GtkAdjustment that determines the values to use for this VScale."),
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_vscale_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_vscale_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkVScale *vscale;
|
||||
|
||||
vscale = GTK_VSCALE (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_ADJUSTMENT:
|
||||
gtk_range_set_adjustment (GTK_RANGE (vscale), GTK_VALUE_POINTER (*arg));
|
||||
case PROP_ADJUSTMENT:
|
||||
gtk_range_set_adjustment (GTK_RANGE (vscale), g_value_get_object (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_vscale_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_vscale_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkVScale *vscale;
|
||||
|
||||
vscale = GTK_VSCALE (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_ADJUSTMENT:
|
||||
GTK_VALUE_POINTER (*arg) = GTK_RANGE (vscale);
|
||||
case PROP_ADJUSTMENT:
|
||||
g_value_set_object (value,
|
||||
G_OBJECT (gtk_range_get_adjustment (GTK_RANGE (vscale))));
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "gtkvscrollbar.h"
|
||||
#include "gtksignal.h"
|
||||
#include "gdk/gdkkeysyms.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
#define EPSILON 0.01
|
||||
@ -34,18 +35,20 @@
|
||||
#define RANGE_CLASS(w) GTK_RANGE_GET_CLASS (w)
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_ADJUSTMENT
|
||||
PROP_0,
|
||||
PROP_ADJUSTMENT
|
||||
};
|
||||
|
||||
static void gtk_vscrollbar_class_init (GtkVScrollbarClass *klass);
|
||||
static void gtk_vscrollbar_init (GtkVScrollbar *vscrollbar);
|
||||
static void gtk_vscrollbar_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_vscrollbar_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_vscrollbar_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_vscrollbar_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_vscrollbar_realize (GtkWidget *widget);
|
||||
static void gtk_vscrollbar_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
@ -87,21 +90,16 @@ gtk_vscrollbar_get_type (void)
|
||||
static void
|
||||
gtk_vscrollbar_class_init (GtkVScrollbarClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GObjectClass *gobject_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
GtkRangeClass *range_class;
|
||||
|
||||
object_class = (GtkObjectClass*) class;
|
||||
gobject_class = G_OBJECT_CLASS (class);
|
||||
widget_class = (GtkWidgetClass*) class;
|
||||
range_class = (GtkRangeClass*) class;
|
||||
|
||||
gtk_object_add_arg_type ("GtkVScrollbar::adjustment",
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_ARG_READWRITE,
|
||||
ARG_ADJUSTMENT);
|
||||
|
||||
object_class->set_arg = gtk_vscrollbar_set_arg;
|
||||
object_class->get_arg = gtk_vscrollbar_get_arg;
|
||||
gobject_class->set_property = gtk_vscrollbar_set_property;
|
||||
gobject_class->get_property = gtk_vscrollbar_get_property;
|
||||
|
||||
widget_class->realize = gtk_vscrollbar_realize;
|
||||
widget_class->size_allocate = gtk_vscrollbar_size_allocate;
|
||||
@ -112,43 +110,55 @@ gtk_vscrollbar_class_init (GtkVScrollbarClass *class)
|
||||
range_class->trough_click = _gtk_range_default_vtrough_click;
|
||||
range_class->trough_keys = gtk_vscrollbar_trough_keys;
|
||||
range_class->motion = _gtk_range_default_vmotion;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ADJUSTMENT,
|
||||
g_param_spec_object ("adjustment",
|
||||
_("Adjustment"),
|
||||
_("The GtkAdjustment that determines the values to use for this scrollbar."),
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_vscrollbar_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_vscrollbar_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkVScrollbar *vscrollbar;
|
||||
|
||||
vscrollbar = GTK_VSCROLLBAR (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_ADJUSTMENT:
|
||||
gtk_range_set_adjustment (GTK_RANGE (vscrollbar), GTK_VALUE_POINTER (*arg));
|
||||
case PROP_ADJUSTMENT:
|
||||
gtk_range_set_adjustment (GTK_RANGE (vscrollbar), g_value_get_object (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_vscrollbar_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_vscrollbar_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkVScrollbar *vscrollbar;
|
||||
|
||||
vscrollbar = GTK_VSCROLLBAR (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_ADJUSTMENT:
|
||||
GTK_VALUE_POINTER (*arg) = GTK_RANGE (vscrollbar);
|
||||
case PROP_ADJUSTMENT:
|
||||
g_value_set_object (value, G_OBJECT (vscrollbar));
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
450
gtk/gtkwidget.c
450
gtk/gtkwidget.c
@ -41,6 +41,7 @@
|
||||
#include "gdk/gdkprivate.h" /* Used in gtk_reset_shapes_recurse to avoid copy */
|
||||
#include "gobject/gvaluecollector.h"
|
||||
#include "gdk/gdkkeysyms.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
#define WIDGET_CLASS(w) GTK_WIDGET_GET_CLASS (w)
|
||||
@ -107,25 +108,25 @@ enum {
|
||||
};
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_NAME,
|
||||
ARG_PARENT,
|
||||
ARG_X,
|
||||
ARG_Y,
|
||||
ARG_WIDTH,
|
||||
ARG_HEIGHT,
|
||||
ARG_VISIBLE,
|
||||
ARG_SENSITIVE,
|
||||
ARG_APP_PAINTABLE,
|
||||
ARG_CAN_FOCUS,
|
||||
ARG_HAS_FOCUS,
|
||||
ARG_CAN_DEFAULT,
|
||||
ARG_HAS_DEFAULT,
|
||||
ARG_RECEIVES_DEFAULT,
|
||||
ARG_COMPOSITE_CHILD,
|
||||
ARG_STYLE,
|
||||
ARG_EVENTS,
|
||||
ARG_EXTENSION_EVENTS
|
||||
PROP_0,
|
||||
PROP_NAME,
|
||||
PROP_PARENT,
|
||||
PROP_X,
|
||||
PROP_Y,
|
||||
PROP_WIDTH,
|
||||
PROP_HEIGHT,
|
||||
PROP_VISIBLE,
|
||||
PROP_SENSITIVE,
|
||||
PROP_APP_PAINTABLE,
|
||||
PROP_CAN_FOCUS,
|
||||
PROP_HAS_FOCUS,
|
||||
PROP_CAN_DEFAULT,
|
||||
PROP_HAS_DEFAULT,
|
||||
PROP_RECEIVES_DEFAULT,
|
||||
PROP_COMPOSITE_CHILD,
|
||||
PROP_STYLE,
|
||||
PROP_EVENTS,
|
||||
PROP_EXTENSION_EVENTS
|
||||
};
|
||||
|
||||
typedef struct _GtkStateData GtkStateData;
|
||||
@ -140,12 +141,14 @@ struct _GtkStateData
|
||||
|
||||
static void gtk_widget_class_init (GtkWidgetClass *klass);
|
||||
static void gtk_widget_init (GtkWidget *widget);
|
||||
static void gtk_widget_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_widget_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_widget_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_widget_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_widget_shutdown (GObject *object);
|
||||
static void gtk_widget_real_destroy (GtkObject *object);
|
||||
static void gtk_widget_finalize (GObject *object);
|
||||
@ -291,9 +294,9 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
|
||||
gobject_class->shutdown = gtk_widget_shutdown;
|
||||
gobject_class->finalize = gtk_widget_finalize;
|
||||
gobject_class->set_property = gtk_widget_set_property;
|
||||
gobject_class->get_property = gtk_widget_get_property;
|
||||
|
||||
object_class->set_arg = gtk_widget_set_arg;
|
||||
object_class->get_arg = gtk_widget_get_arg;
|
||||
object_class->destroy = gtk_widget_real_destroy;
|
||||
|
||||
klass->activate_signal = 0;
|
||||
@ -364,24 +367,161 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
|
||||
style_property_spec_pool = g_param_spec_pool_new (FALSE);
|
||||
|
||||
gtk_object_add_arg_type ("GtkWidget::name", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_NAME);
|
||||
gtk_object_add_arg_type ("GtkWidget::parent", GTK_TYPE_CONTAINER, GTK_ARG_READWRITE, ARG_PARENT);
|
||||
gtk_object_add_arg_type ("GtkWidget::x", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_X);
|
||||
gtk_object_add_arg_type ("GtkWidget::y", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_Y);
|
||||
gtk_object_add_arg_type ("GtkWidget::width", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_WIDTH);
|
||||
gtk_object_add_arg_type ("GtkWidget::height", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_HEIGHT);
|
||||
gtk_object_add_arg_type ("GtkWidget::visible", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_VISIBLE);
|
||||
gtk_object_add_arg_type ("GtkWidget::sensitive", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_SENSITIVE);
|
||||
gtk_object_add_arg_type ("GtkWidget::app_paintable", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_APP_PAINTABLE);
|
||||
gtk_object_add_arg_type ("GtkWidget::can_focus", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_CAN_FOCUS);
|
||||
gtk_object_add_arg_type ("GtkWidget::has_focus", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HAS_FOCUS);
|
||||
gtk_object_add_arg_type ("GtkWidget::can_default", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_CAN_DEFAULT);
|
||||
gtk_object_add_arg_type ("GtkWidget::has_default", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HAS_DEFAULT);
|
||||
gtk_object_add_arg_type ("GtkWidget::receives_default", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_RECEIVES_DEFAULT);
|
||||
gtk_object_add_arg_type ("GtkWidget::composite_child", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_COMPOSITE_CHILD);
|
||||
gtk_object_add_arg_type ("GtkWidget::style", GTK_TYPE_STYLE, GTK_ARG_READWRITE, ARG_STYLE);
|
||||
gtk_object_add_arg_type ("GtkWidget::events", GTK_TYPE_GDK_EVENT_MASK, GTK_ARG_READWRITE, ARG_EVENTS);
|
||||
gtk_object_add_arg_type ("GtkWidget::extension_events", GTK_TYPE_GDK_EVENT_MASK, GTK_ARG_READWRITE, ARG_EXTENSION_EVENTS);
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_NAME,
|
||||
g_param_spec_string ("name",
|
||||
_("Widget name"),
|
||||
_("The name of the widget"),
|
||||
NULL,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_PARENT,
|
||||
g_param_spec_object ("parent",
|
||||
_("Parent widget"),
|
||||
_("The parent widget of this widget. Must be a Container widget."),
|
||||
GTK_TYPE_CONTAINER,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_X,
|
||||
g_param_spec_int ("x",
|
||||
_("x coordinate"),
|
||||
_("The x coordinate of the top-left corner of the widget, or -1 if not set"),
|
||||
-G_MAXINT,
|
||||
G_MAXINT,
|
||||
-1,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_Y,
|
||||
g_param_spec_int ("y",
|
||||
_("y coordinate"),
|
||||
_("The y coordinate of the top-left corner of the widget, or -1 if not set"),
|
||||
-G_MAXINT,
|
||||
G_MAXINT,
|
||||
-1,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_WIDTH,
|
||||
g_param_spec_int ("width",
|
||||
_("Width"),
|
||||
_("The width of the widget, or -1 if unset."),
|
||||
-1,
|
||||
G_MAXINT,
|
||||
-1,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_HEIGHT,
|
||||
g_param_spec_int ("height",
|
||||
_("Height"),
|
||||
_("The height of the widget, or -1 if unset."),
|
||||
-1,
|
||||
G_MAXINT,
|
||||
-1,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_VISIBLE,
|
||||
g_param_spec_boolean ("visible",
|
||||
_("Visible"),
|
||||
_("Whether the widget is visible"),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SENSITIVE,
|
||||
g_param_spec_boolean ("sensitive",
|
||||
_("Sensitive"),
|
||||
_("Whether the widget responds to input"),
|
||||
TRUE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_APP_PAINTABLE,
|
||||
g_param_spec_boolean ("app_paintable",
|
||||
_("Application paintable"),
|
||||
_("Whether the application will paint directly on the widget"),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_CAN_FOCUS,
|
||||
g_param_spec_boolean ("can_focus",
|
||||
_("Can focus"),
|
||||
_("Whether the widget can accept the input focus"),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_HAS_FOCUS,
|
||||
g_param_spec_boolean ("has_focus",
|
||||
_("Has focus"),
|
||||
_("Whether the widget has the input focus"),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_CAN_DEFAULT,
|
||||
g_param_spec_boolean ("can_default",
|
||||
_("Can default"),
|
||||
_("Whether the widget can be the default widget"),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_HAS_DEFAULT,
|
||||
g_param_spec_boolean ("has_default",
|
||||
_("Has default"),
|
||||
_("Whether the widget is the default widget"),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_RECEIVES_DEFAULT,
|
||||
g_param_spec_boolean ("receives_default",
|
||||
_("Receives default"),
|
||||
_("If TRUE, the widget will receive the default action when it is focused."),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_COMPOSITE_CHILD,
|
||||
g_param_spec_boolean ("composite_child",
|
||||
_("Composite child"),
|
||||
_("Whether the widget is composed of other widgets"),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_STYLE,
|
||||
g_param_spec_object ("style",
|
||||
_("Style"),
|
||||
_("The style of the widget, which contains information about how it will look (colors etc)."),
|
||||
GTK_TYPE_STYLE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_EVENTS,
|
||||
g_param_spec_flags ("events",
|
||||
_("Events"),
|
||||
_("The event mask that decides what kind of GdkEvents this widget gets."),
|
||||
GTK_TYPE_GDK_EVENT_MASK,
|
||||
GDK_STRUCTURE_MASK,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_EXTENSION_EVENTS,
|
||||
g_param_spec_enum ("extension_events",
|
||||
_("Extension events"),
|
||||
_("The mask that decides what kind of extension events this widget gets."),
|
||||
GTK_TYPE_GDK_EXTENSION_MODE,
|
||||
GDK_EXTENSION_EVENTS_NONE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
|
||||
widget_signals[SHOW] =
|
||||
gtk_signal_new ("show",
|
||||
@ -834,112 +974,113 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_widget_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_widget_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWidgetAuxInfo *aux_info;
|
||||
|
||||
widget = GTK_WIDGET (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
guint32 saved_flags;
|
||||
|
||||
case ARG_NAME:
|
||||
gtk_widget_set_name (widget, GTK_VALUE_STRING (*arg));
|
||||
case PROP_NAME:
|
||||
gtk_widget_set_name (widget, g_value_get_string (value));
|
||||
break;
|
||||
case ARG_PARENT:
|
||||
gtk_container_add (GTK_CONTAINER (GTK_VALUE_OBJECT (*arg)), widget);
|
||||
case PROP_PARENT:
|
||||
gtk_container_add (GTK_CONTAINER (g_value_get_object (value)), widget);
|
||||
break;
|
||||
case ARG_X:
|
||||
case PROP_X:
|
||||
aux_info = _gtk_widget_get_aux_info (widget, TRUE);
|
||||
if (GTK_VALUE_INT (*arg) == -1)
|
||||
if (g_value_get_int (value) == -1)
|
||||
aux_info->x_set = FALSE;
|
||||
else
|
||||
{
|
||||
aux_info->x_set = TRUE;
|
||||
aux_info->x = GTK_VALUE_INT (*arg);
|
||||
aux_info->x = g_value_get_int (value);
|
||||
}
|
||||
gtk_widget_do_uposition (widget);
|
||||
break;
|
||||
case ARG_Y:
|
||||
case PROP_Y:
|
||||
aux_info = _gtk_widget_get_aux_info (widget, TRUE);
|
||||
if (GTK_VALUE_INT (*arg) == -1)
|
||||
if (g_value_get_int (value) == -1)
|
||||
aux_info->y_set = FALSE;
|
||||
else
|
||||
{
|
||||
aux_info->y_set = TRUE;
|
||||
aux_info->y = GTK_VALUE_INT (*arg);
|
||||
aux_info->y = g_value_get_int (value);
|
||||
}
|
||||
gtk_widget_do_uposition (widget);
|
||||
break;
|
||||
case ARG_WIDTH:
|
||||
gtk_widget_set_usize (widget, GTK_VALUE_INT (*arg), -2);
|
||||
case PROP_WIDTH:
|
||||
gtk_widget_set_usize (widget, g_value_get_int (value), -2);
|
||||
break;
|
||||
case ARG_HEIGHT:
|
||||
gtk_widget_set_usize (widget, -2, GTK_VALUE_INT (*arg));
|
||||
case PROP_HEIGHT:
|
||||
gtk_widget_set_usize (widget, -2, g_value_get_int (value));
|
||||
break;
|
||||
case ARG_VISIBLE:
|
||||
if (GTK_VALUE_BOOL(*arg))
|
||||
case PROP_VISIBLE:
|
||||
if (g_value_get_boolean (value))
|
||||
gtk_widget_show (widget);
|
||||
else
|
||||
gtk_widget_hide (widget);
|
||||
break;
|
||||
case ARG_SENSITIVE:
|
||||
gtk_widget_set_sensitive (widget, GTK_VALUE_BOOL (*arg));
|
||||
case PROP_SENSITIVE:
|
||||
gtk_widget_set_sensitive (widget, g_value_get_boolean (value));
|
||||
break;
|
||||
case ARG_APP_PAINTABLE:
|
||||
gtk_widget_set_app_paintable (widget, GTK_VALUE_BOOL (*arg));
|
||||
case PROP_APP_PAINTABLE:
|
||||
gtk_widget_set_app_paintable (widget, g_value_get_boolean (value));
|
||||
break;
|
||||
case ARG_CAN_FOCUS:
|
||||
case PROP_CAN_FOCUS:
|
||||
saved_flags = GTK_WIDGET_FLAGS (widget);
|
||||
if (GTK_VALUE_BOOL (*arg))
|
||||
if (g_value_get_boolean (value))
|
||||
GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
|
||||
else
|
||||
GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
|
||||
if (saved_flags != GTK_WIDGET_FLAGS (widget))
|
||||
gtk_widget_queue_resize (widget);
|
||||
break;
|
||||
case ARG_HAS_FOCUS:
|
||||
if (GTK_VALUE_BOOL (*arg))
|
||||
case PROP_HAS_FOCUS:
|
||||
if (g_value_get_boolean (value))
|
||||
gtk_widget_grab_focus (widget);
|
||||
break;
|
||||
case ARG_CAN_DEFAULT:
|
||||
case PROP_CAN_DEFAULT:
|
||||
saved_flags = GTK_WIDGET_FLAGS (widget);
|
||||
if (GTK_VALUE_BOOL (*arg))
|
||||
if (g_value_get_boolean (value))
|
||||
GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_DEFAULT);
|
||||
else
|
||||
GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_DEFAULT);
|
||||
if (saved_flags != GTK_WIDGET_FLAGS (widget))
|
||||
gtk_widget_queue_resize (widget);
|
||||
break;
|
||||
case ARG_HAS_DEFAULT:
|
||||
if (GTK_VALUE_BOOL (*arg))
|
||||
case PROP_HAS_DEFAULT:
|
||||
if (g_value_get_boolean (value))
|
||||
gtk_widget_grab_default (widget);
|
||||
break;
|
||||
case ARG_RECEIVES_DEFAULT:
|
||||
if (GTK_VALUE_BOOL (*arg))
|
||||
case PROP_RECEIVES_DEFAULT:
|
||||
if (g_value_get_boolean (value))
|
||||
GTK_WIDGET_SET_FLAGS (widget, GTK_RECEIVES_DEFAULT);
|
||||
else
|
||||
GTK_WIDGET_UNSET_FLAGS (widget, GTK_RECEIVES_DEFAULT);
|
||||
break;
|
||||
case ARG_COMPOSITE_CHILD:
|
||||
if (GTK_VALUE_BOOL(*arg))
|
||||
case PROP_COMPOSITE_CHILD:
|
||||
if (g_value_get_boolean (value))
|
||||
GTK_WIDGET_SET_FLAGS (widget, GTK_COMPOSITE_CHILD);
|
||||
else
|
||||
GTK_WIDGET_UNSET_FLAGS (widget, GTK_COMPOSITE_CHILD);
|
||||
break;
|
||||
case ARG_STYLE:
|
||||
gtk_widget_set_style (widget, (GtkStyle*) GTK_VALUE_BOXED (*arg));
|
||||
case PROP_STYLE:
|
||||
gtk_widget_set_style (widget, g_value_get_object (value));
|
||||
break;
|
||||
case ARG_EVENTS:
|
||||
case PROP_EVENTS:
|
||||
if (!GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_NO_WINDOW (widget))
|
||||
gtk_widget_set_events (widget, GTK_VALUE_FLAGS (*arg));
|
||||
gtk_widget_set_events (widget, g_value_get_flags (value));
|
||||
break;
|
||||
case ARG_EXTENSION_EVENTS:
|
||||
gtk_widget_set_extension_events (widget, GTK_VALUE_FLAGS (*arg));
|
||||
case PROP_EXTENSION_EVENTS:
|
||||
gtk_widget_set_extension_events (widget, g_value_get_enum (value));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -947,7 +1088,7 @@ gtk_widget_set_arg (GtkObject *object,
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* gtk_widget_get_arg:
|
||||
* gtk_widget_get_property:
|
||||
*
|
||||
* arguments:
|
||||
*
|
||||
@ -955,103 +1096,104 @@ gtk_widget_set_arg (GtkObject *object,
|
||||
*****************************************/
|
||||
|
||||
static void
|
||||
gtk_widget_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
gtk_widget_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = GTK_WIDGET (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
GtkWidgetAuxInfo *aux_info;
|
||||
gint *eventp;
|
||||
GdkExtensionMode *modep;
|
||||
|
||||
case ARG_NAME:
|
||||
case PROP_NAME:
|
||||
if (widget->name)
|
||||
GTK_VALUE_STRING (*arg) = g_strdup (widget->name);
|
||||
g_value_set_string (value, widget->name);
|
||||
else
|
||||
GTK_VALUE_STRING (*arg) = g_strdup ("");
|
||||
g_value_set_string (value, "");
|
||||
break;
|
||||
case ARG_PARENT:
|
||||
GTK_VALUE_OBJECT (*arg) = (GtkObject*) widget->parent;
|
||||
case PROP_PARENT:
|
||||
g_value_set_object (value, G_OBJECT (widget->parent));
|
||||
break;
|
||||
case ARG_X:
|
||||
case PROP_X:
|
||||
aux_info =_gtk_widget_get_aux_info (widget, FALSE);
|
||||
if (!aux_info || !aux_info->x_set)
|
||||
GTK_VALUE_INT (*arg) = -1;
|
||||
g_value_set_int (value, -1);
|
||||
else
|
||||
GTK_VALUE_INT (*arg) = aux_info->x;
|
||||
g_value_set_int (value, aux_info->x);
|
||||
break;
|
||||
case ARG_Y:
|
||||
case PROP_Y:
|
||||
aux_info =_gtk_widget_get_aux_info (widget, FALSE);
|
||||
if (!aux_info || !aux_info->y_set)
|
||||
GTK_VALUE_INT (*arg) = -1;
|
||||
g_value_set_int (value, -1);
|
||||
else
|
||||
GTK_VALUE_INT (*arg) = aux_info->y;
|
||||
g_value_set_int (value, aux_info->y);
|
||||
break;
|
||||
case ARG_WIDTH:
|
||||
case PROP_WIDTH:
|
||||
aux_info =_gtk_widget_get_aux_info (widget, FALSE);
|
||||
if (!aux_info)
|
||||
GTK_VALUE_INT (*arg) = -1;
|
||||
g_value_set_int (value, -1);
|
||||
else
|
||||
GTK_VALUE_INT (*arg) = aux_info->width;
|
||||
g_value_set_int (value, aux_info->width);
|
||||
break;
|
||||
case ARG_HEIGHT:
|
||||
case PROP_HEIGHT:
|
||||
aux_info =_gtk_widget_get_aux_info (widget, FALSE);
|
||||
if (!aux_info)
|
||||
GTK_VALUE_INT (*arg) = -1;
|
||||
g_value_set_int (value, -1);
|
||||
else
|
||||
GTK_VALUE_INT (*arg) = aux_info->height;
|
||||
g_value_set_int (value, aux_info->height);
|
||||
break;
|
||||
case ARG_VISIBLE:
|
||||
GTK_VALUE_BOOL (*arg) = (GTK_WIDGET_VISIBLE (widget) != FALSE);
|
||||
case PROP_VISIBLE:
|
||||
g_value_set_boolean (value, (GTK_WIDGET_VISIBLE (widget) != FALSE));
|
||||
break;
|
||||
case ARG_SENSITIVE:
|
||||
GTK_VALUE_BOOL (*arg) = (GTK_WIDGET_SENSITIVE (widget) != FALSE);
|
||||
case PROP_SENSITIVE:
|
||||
g_value_set_boolean (value, (GTK_WIDGET_SENSITIVE (widget) != FALSE));
|
||||
break;
|
||||
case ARG_APP_PAINTABLE:
|
||||
GTK_VALUE_BOOL (*arg) = (GTK_WIDGET_APP_PAINTABLE (widget) != FALSE);
|
||||
case PROP_APP_PAINTABLE:
|
||||
g_value_set_boolean (value, (GTK_WIDGET_APP_PAINTABLE (widget) != FALSE));
|
||||
break;
|
||||
case ARG_CAN_FOCUS:
|
||||
GTK_VALUE_BOOL (*arg) = (GTK_WIDGET_CAN_FOCUS (widget) != FALSE);
|
||||
case PROP_CAN_FOCUS:
|
||||
g_value_set_boolean (value, (GTK_WIDGET_CAN_FOCUS (widget) != FALSE));
|
||||
break;
|
||||
case ARG_HAS_FOCUS:
|
||||
GTK_VALUE_BOOL (*arg) = (GTK_WIDGET_HAS_FOCUS (widget) != FALSE);
|
||||
case PROP_HAS_FOCUS:
|
||||
g_value_set_boolean (value, (GTK_WIDGET_HAS_FOCUS (widget) != FALSE));
|
||||
break;
|
||||
case ARG_CAN_DEFAULT:
|
||||
GTK_VALUE_BOOL (*arg) = (GTK_WIDGET_CAN_DEFAULT (widget) != FALSE);
|
||||
case PROP_CAN_DEFAULT:
|
||||
g_value_set_boolean (value, (GTK_WIDGET_CAN_DEFAULT (widget) != FALSE));
|
||||
break;
|
||||
case ARG_HAS_DEFAULT:
|
||||
GTK_VALUE_BOOL (*arg) = (GTK_WIDGET_HAS_DEFAULT (widget) != FALSE);
|
||||
case PROP_HAS_DEFAULT:
|
||||
g_value_set_boolean (value, (GTK_WIDGET_HAS_DEFAULT (widget) != FALSE));
|
||||
break;
|
||||
case ARG_RECEIVES_DEFAULT:
|
||||
GTK_VALUE_BOOL (*arg) = (GTK_WIDGET_RECEIVES_DEFAULT (widget) != FALSE);
|
||||
case PROP_RECEIVES_DEFAULT:
|
||||
g_value_set_boolean (value, (GTK_WIDGET_RECEIVES_DEFAULT (widget) != FALSE));
|
||||
break;
|
||||
case ARG_COMPOSITE_CHILD:
|
||||
GTK_VALUE_BOOL (*arg) = (GTK_WIDGET_COMPOSITE_CHILD (widget) != FALSE);
|
||||
case PROP_COMPOSITE_CHILD:
|
||||
g_value_set_boolean (value, (GTK_WIDGET_COMPOSITE_CHILD (widget) != FALSE));
|
||||
break;
|
||||
case ARG_STYLE:
|
||||
GTK_VALUE_BOXED (*arg) = (gpointer) gtk_widget_get_style (widget);
|
||||
case PROP_STYLE:
|
||||
g_value_set_object (value, G_OBJECT (gtk_widget_get_style (widget)));
|
||||
break;
|
||||
case ARG_EVENTS:
|
||||
case PROP_EVENTS:
|
||||
eventp = gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_event_mask);
|
||||
if (!eventp)
|
||||
GTK_VALUE_FLAGS (*arg) = 0;
|
||||
g_value_set_int (value, 0);
|
||||
else
|
||||
GTK_VALUE_FLAGS (*arg) = *eventp;
|
||||
g_value_set_int (value, *eventp);
|
||||
break;
|
||||
case ARG_EXTENSION_EVENTS:
|
||||
case PROP_EXTENSION_EVENTS:
|
||||
modep = gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_extension_event_mode);
|
||||
if (!modep)
|
||||
GTK_VALUE_FLAGS (*arg) = 0;
|
||||
g_value_set_flags (value, 0);
|
||||
else
|
||||
GTK_VALUE_FLAGS (*arg) = *modep;
|
||||
g_value_set_flags (value, (GdkExtensionMode) *modep);
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1302,6 +1444,7 @@ gtk_widget_unparent (GtkWidget *widget)
|
||||
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[PARENT_SET], old_parent);
|
||||
gtk_widget_propagate_hierarchy_changed (widget, NULL);
|
||||
|
||||
g_object_notify (G_OBJECT (widget), "parent");
|
||||
gtk_widget_unref (widget);
|
||||
}
|
||||
|
||||
@ -1388,6 +1531,7 @@ gtk_widget_show (GtkWidget *widget)
|
||||
if (!GTK_WIDGET_TOPLEVEL (widget))
|
||||
gtk_widget_queue_resize (widget);
|
||||
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[SHOW]);
|
||||
g_object_notify (G_OBJECT (widget), "visible");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1469,6 +1613,7 @@ gtk_widget_hide (GtkWidget *widget)
|
||||
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[HIDE]);
|
||||
if (!GTK_WIDGET_TOPLEVEL (widget) && !GTK_OBJECT_DESTROYED (widget))
|
||||
gtk_widget_queue_resize (widget);
|
||||
g_object_notify (G_OBJECT (widget), "visible");
|
||||
gtk_widget_unref (widget);
|
||||
}
|
||||
}
|
||||
@ -2786,6 +2931,8 @@ gtk_widget_grab_focus (GtkWidget *widget)
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[GRAB_FOCUS]);
|
||||
|
||||
g_object_notify (G_OBJECT (widget), "has_focus");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2926,7 +3073,10 @@ gtk_widget_grab_default (GtkWidget *widget)
|
||||
window = window->parent;
|
||||
|
||||
if (window && gtk_type_is_a (GTK_WIDGET_TYPE (window), window_type))
|
||||
gtk_window_set_default (GTK_WINDOW (window), widget);
|
||||
{
|
||||
gtk_window_set_default (GTK_WINDOW (window), widget);
|
||||
g_object_notify (G_OBJECT (window), "has_default");
|
||||
}
|
||||
else
|
||||
g_warning("gtk_widget_grab_default() called on a widget not within a GtkWindow");
|
||||
}
|
||||
@ -2955,6 +3105,8 @@ gtk_widget_set_name (GtkWidget *widget,
|
||||
|
||||
if (GTK_WIDGET_RC_STYLE (widget))
|
||||
gtk_widget_set_rc_style (widget);
|
||||
|
||||
g_object_notify (G_OBJECT (widget), "name");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3038,6 +3190,8 @@ gtk_widget_set_app_paintable (GtkWidget *widget,
|
||||
if (GTK_WIDGET_DRAWABLE (widget))
|
||||
gtk_widget_queue_clear (widget);
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (widget), "app_paintable");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3119,6 +3273,8 @@ gtk_widget_set_sensitive (GtkWidget *widget,
|
||||
gtk_widget_propagate_state (widget, &data);
|
||||
if (GTK_WIDGET_DRAWABLE (widget))
|
||||
gtk_widget_queue_clear (widget);
|
||||
|
||||
g_object_notify (G_OBJECT (widget), "sensitive");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3168,6 +3324,7 @@ gtk_widget_set_parent (GtkWidget *widget,
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[PARENT_SET], NULL);
|
||||
gtk_widget_propagate_hierarchy_changed (widget, NULL);
|
||||
g_object_notify (G_OBJECT (widget), "parent");
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
@ -3210,6 +3367,8 @@ gtk_widget_set_style (GtkWidget *widget,
|
||||
}
|
||||
|
||||
gtk_widget_set_style_internal (widget, style, initial_emission);
|
||||
|
||||
g_object_notify (G_OBJECT (widget), "style");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3950,7 +4109,7 @@ gtk_widget_get_parent_window (GtkWidget *widget)
|
||||
}
|
||||
|
||||
/* Update the position from aux_info. Used from gtk_widget_set_uposition
|
||||
* and gtk_widget_set_arg().
|
||||
* and gtk_widget_set_property().
|
||||
*/
|
||||
static void
|
||||
gtk_widget_do_uposition (GtkWidget *widget)
|
||||
@ -3962,6 +4121,11 @@ gtk_widget_do_uposition (GtkWidget *widget)
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (widget) && widget->parent)
|
||||
gtk_widget_size_allocate (widget, &widget->allocation);
|
||||
|
||||
if (aux_info->x_set)
|
||||
g_object_notify (G_OBJECT (widget), "x");
|
||||
if (aux_info->y_set)
|
||||
g_object_notify (G_OBJECT (widget), "y");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4070,6 +4234,11 @@ gtk_widget_set_usize (GtkWidget *widget,
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (widget))
|
||||
gtk_widget_queue_resize (widget);
|
||||
|
||||
if (width > -2)
|
||||
g_object_notify (G_OBJECT (widget), "width");
|
||||
if (height > -2)
|
||||
g_object_notify (G_OBJECT (widget), "height");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4115,6 +4284,8 @@ gtk_widget_set_events (GtkWidget *widget,
|
||||
g_free (eventp);
|
||||
gtk_object_remove_data_by_id (GTK_OBJECT (widget), quark_event_mask);
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (widget), "events");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4160,6 +4331,8 @@ gtk_widget_add_events (GtkWidget *widget,
|
||||
gdk_window_set_events (widget->window,
|
||||
gdk_window_get_events (widget->window) | events);
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (widget), "events");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4187,6 +4360,7 @@ gtk_widget_set_extension_events (GtkWidget *widget,
|
||||
|
||||
*modep = mode;
|
||||
gtk_object_set_data_by_id (GTK_OBJECT (widget), quark_extension_event_mode, modep);
|
||||
g_object_notify (G_OBJECT (widget), "extension_events");
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user