unbreak this function
2001-02-21 Havoc Pennington <hp@redhat.com> * gtk/gtktextbuffer.c (gtk_text_buffer_insert_child_anchor): unbreak this function * gtk/gtkentry.c: apply patch from Lee Mallabone to add object properties * gtk/gtkcurve.c: apply patch from Lee Mallabone to add object properties * gtk/gtkcombo.c: apply patch from Lee Mallabone to add object properties * gtk/gtkentry.c (gtk_entry_set_max_length): have this take -1 to mean unset the max length
This commit is contained in:
parent
334a40e893
commit
0ebf76901c
12 changed files with 470 additions and 128 deletions
17
ChangeLog
17
ChangeLog
|
|
@ -1,3 +1,20 @@
|
|||
2001-02-21 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextbuffer.c (gtk_text_buffer_insert_child_anchor):
|
||||
unbreak this function
|
||||
|
||||
* gtk/gtkentry.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkcurve.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkcombo.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkentry.c (gtk_entry_set_max_length): have this take -1 to
|
||||
mean unset the max length
|
||||
|
||||
Wed Feb 21 14:23:05 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_cell_data_func):
|
||||
|
|
|
|||
|
|
@ -1,3 +1,20 @@
|
|||
2001-02-21 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextbuffer.c (gtk_text_buffer_insert_child_anchor):
|
||||
unbreak this function
|
||||
|
||||
* gtk/gtkentry.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkcurve.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkcombo.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkentry.c (gtk_entry_set_max_length): have this take -1 to
|
||||
mean unset the max length
|
||||
|
||||
Wed Feb 21 14:23:05 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_cell_data_func):
|
||||
|
|
|
|||
|
|
@ -1,3 +1,20 @@
|
|||
2001-02-21 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextbuffer.c (gtk_text_buffer_insert_child_anchor):
|
||||
unbreak this function
|
||||
|
||||
* gtk/gtkentry.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkcurve.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkcombo.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkentry.c (gtk_entry_set_max_length): have this take -1 to
|
||||
mean unset the max length
|
||||
|
||||
Wed Feb 21 14:23:05 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_cell_data_func):
|
||||
|
|
|
|||
|
|
@ -1,3 +1,20 @@
|
|||
2001-02-21 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextbuffer.c (gtk_text_buffer_insert_child_anchor):
|
||||
unbreak this function
|
||||
|
||||
* gtk/gtkentry.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkcurve.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkcombo.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkentry.c (gtk_entry_set_max_length): have this take -1 to
|
||||
mean unset the max length
|
||||
|
||||
Wed Feb 21 14:23:05 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_cell_data_func):
|
||||
|
|
|
|||
|
|
@ -1,3 +1,20 @@
|
|||
2001-02-21 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextbuffer.c (gtk_text_buffer_insert_child_anchor):
|
||||
unbreak this function
|
||||
|
||||
* gtk/gtkentry.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkcurve.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkcombo.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkentry.c (gtk_entry_set_max_length): have this take -1 to
|
||||
mean unset the max length
|
||||
|
||||
Wed Feb 21 14:23:05 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_cell_data_func):
|
||||
|
|
|
|||
|
|
@ -1,3 +1,20 @@
|
|||
2001-02-21 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextbuffer.c (gtk_text_buffer_insert_child_anchor):
|
||||
unbreak this function
|
||||
|
||||
* gtk/gtkentry.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkcurve.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkcombo.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkentry.c (gtk_entry_set_max_length): have this take -1 to
|
||||
mean unset the max length
|
||||
|
||||
Wed Feb 21 14:23:05 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_cell_data_func):
|
||||
|
|
|
|||
|
|
@ -1,3 +1,20 @@
|
|||
2001-02-21 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextbuffer.c (gtk_text_buffer_insert_child_anchor):
|
||||
unbreak this function
|
||||
|
||||
* gtk/gtkentry.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkcurve.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkcombo.c: apply patch from Lee Mallabone to add object
|
||||
properties
|
||||
|
||||
* gtk/gtkentry.c (gtk_entry_set_max_length): have this take -1 to
|
||||
mean unset the max length
|
||||
|
||||
Wed Feb 21 14:23:05 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_cell_data_func):
|
||||
|
|
|
|||
108
gtk/gtkcombo.c
108
gtk/gtkcombo.c
|
|
@ -40,12 +40,20 @@
|
|||
#include "gdk/gdkkeysyms.h"
|
||||
#include "gtkcombo.h"
|
||||
#include "gtkframe.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
const gchar *gtk_combo_string_key = "gtk-combo-string-value";
|
||||
|
||||
#define COMBO_LIST_MAX_HEIGHT (400)
|
||||
#define EMPTY_LIST_HEIGHT (15)
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_ENABLE_ARROW_KEYS,
|
||||
PROP_ENABLE_ARROWS_ALWAYS,
|
||||
PROP_CASE_SENSITIVE
|
||||
};
|
||||
|
||||
static void gtk_combo_class_init (GtkComboClass *klass);
|
||||
static void gtk_combo_init (GtkCombo *combo);
|
||||
static void gtk_combo_destroy (GtkObject *combo);
|
||||
|
|
@ -93,20 +101,57 @@ static gint gtk_combo_window_key_press (GtkWidget *window,
|
|||
GtkCombo *combo);
|
||||
static void gtk_combo_item_destroy (GtkObject *object);
|
||||
static void gtk_combo_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
|
||||
GtkAllocation *allocation);
|
||||
static void gtk_combo_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec,
|
||||
const gchar *trailer);
|
||||
static void gtk_combo_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec,
|
||||
const gchar *trailer);
|
||||
static GtkHBoxClass *parent_class = NULL;
|
||||
|
||||
static void
|
||||
gtk_combo_class_init (GtkComboClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GtkObjectClass *oclass;
|
||||
GtkWidgetClass *widget_class;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
parent_class = gtk_type_class (GTK_TYPE_HBOX);
|
||||
oclass = (GtkObjectClass *) klass;
|
||||
widget_class = (GtkWidgetClass *) klass;
|
||||
|
||||
gobject_class->set_property = gtk_combo_set_property;
|
||||
gobject_class->get_property = gtk_combo_get_property;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ENABLE_ARROW_KEYS,
|
||||
g_param_spec_boolean ("enable_arrow_keys",
|
||||
_("Enable arrow keys"),
|
||||
_("Whether the arrow keys move through the list of items"),
|
||||
TRUE,
|
||||
G_PARAM_READABLE | G_PARAM_WRITABLE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ENABLE_ARROWS_ALWAYS,
|
||||
g_param_spec_boolean ("enable_arrows_always",
|
||||
_("Always enable arrows"),
|
||||
_("Whether the arrow keys work, even if the entry contents are not in the list"),
|
||||
TRUE,
|
||||
G_PARAM_READABLE | G_PARAM_WRITABLE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_CASE_SENSITIVE,
|
||||
g_param_spec_boolean ("case_sensitive",
|
||||
_("Case sensitive"),
|
||||
_("Whether list item matching is case sensitive"),
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_WRITABLE));
|
||||
|
||||
|
||||
oclass->destroy = gtk_combo_destroy;
|
||||
|
||||
widget_class->size_allocate = gtk_combo_size_allocate;
|
||||
|
|
@ -822,6 +867,7 @@ gtk_combo_set_case_sensitive (GtkCombo * combo, gint val)
|
|||
g_return_if_fail (GTK_IS_COMBO (combo));
|
||||
|
||||
combo->case_sensitive = val;
|
||||
g_object_notify (G_OBJECT (combo), "case_sensitive");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -831,6 +877,7 @@ gtk_combo_set_use_arrows (GtkCombo * combo, gint val)
|
|||
g_return_if_fail (GTK_IS_COMBO (combo));
|
||||
|
||||
combo->use_arrows = val;
|
||||
g_object_notify (G_OBJECT (combo), "enable_arrows");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -841,6 +888,8 @@ gtk_combo_set_use_arrows_always (GtkCombo * combo, gint val)
|
|||
|
||||
combo->use_arrows_always = val;
|
||||
combo->use_arrows = 1;
|
||||
g_object_notify (G_OBJECT (combo), "enable_arrows");
|
||||
g_object_notify (G_OBJECT (combo), "enable_arrows_always");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -947,3 +996,58 @@ gtk_combo_disable_activate (GtkCombo* combo)
|
|||
combo->activate_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void gtk_combo_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec,
|
||||
const gchar *trailer)
|
||||
{
|
||||
GtkCombo *combo = GTK_COMBO (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ENABLE_ARROW_KEYS:
|
||||
/* This call does the notification */
|
||||
gtk_combo_set_use_arrows (combo, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_ENABLE_ARROWS_ALWAYS:
|
||||
/* This call does the notification */
|
||||
gtk_combo_set_use_arrows_always (combo, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_CASE_SENSITIVE:
|
||||
/* This call does the notification */
|
||||
gtk_combo_set_case_sensitive (combo, g_value_get_boolean (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void gtk_combo_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec,
|
||||
const gchar *trailer)
|
||||
{
|
||||
GtkCombo *combo = GTK_COMBO (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ENABLE_ARROW_KEYS:
|
||||
g_value_set_boolean (value, combo->use_arrows);
|
||||
break;
|
||||
case PROP_ENABLE_ARROWS_ALWAYS:
|
||||
g_value_set_boolean (value, combo->use_arrows_always);
|
||||
break;
|
||||
case PROP_CASE_SENSITIVE:
|
||||
g_value_set_boolean (value, combo->case_sensitive);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
187
gtk/gtkcurve.c
187
gtk/gtkcurve.c
|
|
@ -34,6 +34,7 @@
|
|||
#include "gtkradiobutton.h"
|
||||
#include "gtksignal.h"
|
||||
#include "gtktable.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
#define RADIUS 3 /* radius of the control points */
|
||||
#define MIN_DISTANCE 8 /* min distance between control points */
|
||||
|
|
@ -47,12 +48,12 @@
|
|||
GDK_BUTTON1_MOTION_MASK)
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_CURVE_TYPE,
|
||||
ARG_MIN_X,
|
||||
ARG_MAX_X,
|
||||
ARG_MIN_Y,
|
||||
ARG_MAX_Y
|
||||
PROP_0,
|
||||
PROP_CURVE_TYPE,
|
||||
PROP_MIN_X,
|
||||
PROP_MAX_X,
|
||||
PROP_MIN_Y,
|
||||
PROP_MAX_Y
|
||||
};
|
||||
|
||||
static GtkDrawingAreaClass *parent_class = NULL;
|
||||
|
|
@ -62,12 +63,16 @@ static guint curve_type_changed_signal = 0;
|
|||
/* forward declarations: */
|
||||
static void gtk_curve_class_init (GtkCurveClass *class);
|
||||
static void gtk_curve_init (GtkCurve *curve);
|
||||
static void gtk_curve_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_curve_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_curve_get_property (GObject *object,
|
||||
guint param_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec,
|
||||
const gchar *trailer);
|
||||
static void gtk_curve_set_property (GObject *object,
|
||||
guint param_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec,
|
||||
const gchar *trailer);
|
||||
static void gtk_curve_finalize (GObject *object);
|
||||
static gint gtk_curve_graph_events (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
|
|
@ -108,24 +113,63 @@ gtk_curve_class_init (GtkCurveClass *class)
|
|||
|
||||
gobject_class->finalize = gtk_curve_finalize;
|
||||
|
||||
object_class->set_arg = gtk_curve_set_arg;
|
||||
object_class->get_arg = gtk_curve_get_arg;
|
||||
gobject_class->set_property = gtk_curve_set_property;
|
||||
gobject_class->get_property = gtk_curve_get_property;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_CURVE_TYPE,
|
||||
g_param_spec_enum ("curve_type",
|
||||
_("Curve type"),
|
||||
_("Is this curve linear, spline interpolated, or free-form"),
|
||||
GTK_TYPE_CURVE_TYPE,
|
||||
GTK_CURVE_TYPE_LINEAR,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_WRITABLE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_MIN_X,
|
||||
g_param_spec_float ("min_x",
|
||||
_("Minimum X"),
|
||||
_("Minimum possible value for X"),
|
||||
-G_MAXFLOAT,
|
||||
G_MAXFLOAT,
|
||||
0.0,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_WRITABLE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_MAX_X,
|
||||
g_param_spec_float ("max_x",
|
||||
_("Maximum X"),
|
||||
_("Maximum possible X value."),
|
||||
-G_MAXFLOAT,
|
||||
G_MAXFLOAT,
|
||||
1.0,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_WRITABLE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_MIN_Y,
|
||||
g_param_spec_float ("min_y",
|
||||
_("Minimum Y"),
|
||||
_("Minimum possible value for Y"),
|
||||
-G_MAXFLOAT,
|
||||
G_MAXFLOAT,
|
||||
0.0,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_WRITABLE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_MAX_Y,
|
||||
g_param_spec_float ("max_y",
|
||||
_("Maximum Y"),
|
||||
_("Maximum possible value for Y"),
|
||||
-G_MAXFLOAT,
|
||||
G_MAXFLOAT,
|
||||
1.0,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_WRITABLE));
|
||||
|
||||
curve_type_changed_signal =
|
||||
gtk_signal_new ("curve_type_changed", GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkCurveClass, curve_type_changed),
|
||||
gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0);
|
||||
|
||||
gtk_object_add_arg_type ("GtkCurve::curve_type", GTK_TYPE_CURVE_TYPE,
|
||||
GTK_ARG_READWRITE, ARG_CURVE_TYPE);
|
||||
gtk_object_add_arg_type ("GtkCurve::min_x", GTK_TYPE_FLOAT,
|
||||
GTK_ARG_READWRITE, ARG_MIN_X);
|
||||
gtk_object_add_arg_type ("GtkCurve::max_x", GTK_TYPE_FLOAT,
|
||||
GTK_ARG_READWRITE, ARG_MAX_X);
|
||||
gtk_object_add_arg_type ("GtkCurve::min_y", GTK_TYPE_FLOAT,
|
||||
GTK_ARG_READWRITE, ARG_MIN_Y);
|
||||
gtk_object_add_arg_type ("GtkCurve::max_y", GTK_TYPE_FLOAT,
|
||||
GTK_ARG_READWRITE, ARG_MAX_Y);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -157,63 +201,68 @@ gtk_curve_init (GtkCurve *curve)
|
|||
gtk_curve_size_graph (curve);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_curve_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
static void gtk_curve_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec,
|
||||
const gchar *trailer)
|
||||
{
|
||||
GtkCurve *curve = GTK_CURVE (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_CURVE_TYPE:
|
||||
gtk_curve_set_curve_type (curve, GTK_VALUE_ENUM (*arg));
|
||||
case PROP_CURVE_TYPE:
|
||||
gtk_curve_set_curve_type (curve, g_value_get_enum (value));
|
||||
break;
|
||||
case ARG_MIN_X:
|
||||
gtk_curve_set_range (curve, GTK_VALUE_FLOAT (*arg), curve->max_x,
|
||||
case PROP_MIN_X:
|
||||
gtk_curve_set_range (curve, g_value_get_float (value), curve->max_x,
|
||||
curve->min_y, curve->max_y);
|
||||
break;
|
||||
case ARG_MAX_X:
|
||||
gtk_curve_set_range (curve, curve->min_x, GTK_VALUE_FLOAT (*arg),
|
||||
case PROP_MAX_X:
|
||||
gtk_curve_set_range (curve, curve->min_x, g_value_get_float (value),
|
||||
curve->min_y, curve->max_y);
|
||||
break;
|
||||
case ARG_MIN_Y:
|
||||
case PROP_MIN_Y:
|
||||
gtk_curve_set_range (curve, curve->min_x, curve->max_x,
|
||||
GTK_VALUE_FLOAT (*arg), curve->max_y);
|
||||
g_value_get_float (value), curve->max_y);
|
||||
break;
|
||||
case ARG_MAX_Y:
|
||||
case PROP_MAX_Y:
|
||||
gtk_curve_set_range (curve, curve->min_x, curve->max_x,
|
||||
curve->min_y, GTK_VALUE_FLOAT (*arg));
|
||||
curve->min_y, g_value_get_float (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_curve_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
static void gtk_curve_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec,
|
||||
const gchar *trailer)
|
||||
{
|
||||
GtkCurve *curve = GTK_CURVE (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_CURVE_TYPE:
|
||||
GTK_VALUE_ENUM (*arg) = curve->curve_type;
|
||||
case PROP_CURVE_TYPE:
|
||||
g_value_set_enum (value, curve->curve_type);
|
||||
break;
|
||||
case ARG_MIN_X:
|
||||
GTK_VALUE_FLOAT (*arg) = curve->min_x;
|
||||
case PROP_MIN_X:
|
||||
g_value_set_float (value, curve->min_x);
|
||||
break;
|
||||
case ARG_MAX_X:
|
||||
GTK_VALUE_FLOAT (*arg) = curve->max_x;
|
||||
case PROP_MAX_X:
|
||||
g_value_set_float (value, curve->max_x);
|
||||
break;
|
||||
case ARG_MIN_Y:
|
||||
GTK_VALUE_FLOAT (*arg) = curve->min_y;
|
||||
case PROP_MIN_Y:
|
||||
g_value_set_float (value, curve->min_y);
|
||||
break;
|
||||
case ARG_MAX_Y:
|
||||
GTK_VALUE_FLOAT (*arg) = curve->max_y;
|
||||
case PROP_MAX_Y:
|
||||
g_value_set_float (value, curve->max_y);
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -659,6 +708,7 @@ gtk_curve_set_curve_type (GtkCurve *c, GtkCurveType new_type)
|
|||
gtk_curve_interpolate (c, width, height);
|
||||
}
|
||||
gtk_signal_emit (GTK_OBJECT (c), curve_type_changed_signal);
|
||||
g_object_notify (G_OBJECT (c), "curve_type");
|
||||
gtk_curve_draw (c, width, height);
|
||||
}
|
||||
}
|
||||
|
|
@ -766,12 +816,27 @@ gtk_curve_set_gamma (GtkCurve *c, gfloat gamma)
|
|||
|
||||
void
|
||||
gtk_curve_set_range (GtkCurve *curve,
|
||||
gfloat min_x, gfloat max_x, gfloat min_y, gfloat max_y)
|
||||
gfloat min_x,
|
||||
gfloat max_x,
|
||||
gfloat min_y,
|
||||
gfloat max_y)
|
||||
{
|
||||
curve->min_x = min_x;
|
||||
curve->max_x = max_x;
|
||||
curve->min_y = min_y;
|
||||
curve->max_y = max_y;
|
||||
if (curve->min_x != min_x) {
|
||||
curve->min_x = min_x;
|
||||
g_object_notify (G_OBJECT (curve), "min_x");
|
||||
}
|
||||
if (curve->max_x != max_x) {
|
||||
curve->max_x = max_x;
|
||||
g_object_notify (G_OBJECT (curve), "max_x");
|
||||
}
|
||||
if (curve->min_y != min_y) {
|
||||
curve->min_y = min_y;
|
||||
g_object_notify (G_OBJECT (curve), "min_y");
|
||||
}
|
||||
if (curve->max_y != max_y) {
|
||||
curve->max_y = max_y;
|
||||
g_object_notify (G_OBJECT (curve), "max_y");
|
||||
}
|
||||
|
||||
gtk_curve_size_graph (curve);
|
||||
gtk_curve_reset_vector (curve);
|
||||
|
|
|
|||
169
gtk/gtkentry.c
169
gtk/gtkentry.c
|
|
@ -68,12 +68,12 @@ enum {
|
|||
};
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_TEXT_POSITION,
|
||||
ARG_EDITABLE,
|
||||
ARG_MAX_LENGTH,
|
||||
ARG_VISIBILITY,
|
||||
ARG_INVISIBLE_CHAR
|
||||
PROP_0,
|
||||
PROP_TEXT_POSITION,
|
||||
PROP_EDITABLE,
|
||||
PROP_MAX_LENGTH,
|
||||
PROP_VISIBILITY,
|
||||
PROP_INVISIBLE_CHAR
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
|
@ -96,12 +96,16 @@ static GtkTargetEntry target_table[] = {
|
|||
static void gtk_entry_class_init (GtkEntryClass *klass);
|
||||
static void gtk_entry_editable_init (GtkEditableClass *iface);
|
||||
static void gtk_entry_init (GtkEntry *entry);
|
||||
static void gtk_entry_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_entry_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void gtk_entry_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec,
|
||||
const gchar *trailer);
|
||||
static void gtk_entry_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec,
|
||||
const gchar *trailer);
|
||||
static void gtk_entry_finalize (GObject *object);
|
||||
|
||||
/* GtkWidget methods
|
||||
|
|
@ -318,9 +322,8 @@ gtk_entry_class_init (GtkEntryClass *class)
|
|||
parent_class = gtk_type_class (GTK_TYPE_WIDGET);
|
||||
|
||||
gobject_class->finalize = gtk_entry_finalize;
|
||||
|
||||
object_class->set_arg = gtk_entry_set_arg;
|
||||
object_class->get_arg = gtk_entry_get_arg;
|
||||
gobject_class->set_property = gtk_entry_set_property;
|
||||
gobject_class->get_property = gtk_entry_get_property;
|
||||
|
||||
widget_class->realize = gtk_entry_realize;
|
||||
widget_class->unrealize = gtk_entry_unrealize;
|
||||
|
|
@ -354,12 +357,51 @@ gtk_entry_class_init (GtkEntryClass *class)
|
|||
class->paste_clipboard = gtk_entry_paste_clipboard;
|
||||
class->toggle_overwrite = gtk_entry_toggle_overwrite;
|
||||
|
||||
gtk_object_add_arg_type ("GtkEntry::text_position", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_TEXT_POSITION);
|
||||
gtk_object_add_arg_type ("GtkEntry::editable", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EDITABLE);
|
||||
gtk_object_add_arg_type ("GtkEntry::max_length", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_MAX_LENGTH);
|
||||
gtk_object_add_arg_type ("GtkEntry::visibility", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_VISIBILITY);
|
||||
gtk_object_add_arg_type ("GtkEntry::invisible_char", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_INVISIBLE_CHAR);
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_TEXT_POSITION,
|
||||
g_param_spec_int ("text_position",
|
||||
_("Text Position"),
|
||||
_("The current position of the insertion point"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
G_PARAM_READABLE | G_PARAM_WRITABLE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_EDITABLE,
|
||||
g_param_spec_boolean ("editable",
|
||||
_("Editable"),
|
||||
_("Whether the entry contents can be edited"),
|
||||
TRUE,
|
||||
G_PARAM_READABLE | G_PARAM_WRITABLE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_MAX_LENGTH,
|
||||
g_param_spec_int ("max_length",
|
||||
_("Maximum length"),
|
||||
_("Maximum number of characters for this entry"),
|
||||
-1,
|
||||
G_MAXINT,
|
||||
-1,
|
||||
G_PARAM_READABLE | G_PARAM_WRITABLE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_VISIBILITY,
|
||||
g_param_spec_boolean ("visibility",
|
||||
_("Visibility"),
|
||||
_("FALSE displays the \"invisible char\" instead of the actual text (password mode)"),
|
||||
TRUE,
|
||||
G_PARAM_READABLE | G_PARAM_WRITABLE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_INVISIBLE_CHAR,
|
||||
g_param_spec_int ("invisible_char",
|
||||
_("Invisible character"),
|
||||
_("The character to use when masking entry contents (in \"password mode\")"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
|
||||
'*',
|
||||
G_PARAM_READABLE | G_PARAM_WRITABLE));
|
||||
|
||||
signals[INSERT_TEXT] =
|
||||
gtk_signal_new ("insert_text",
|
||||
GTK_RUN_LAST,
|
||||
|
|
@ -595,70 +637,80 @@ gtk_entry_editable_init (GtkEditableClass *iface)
|
|||
iface->get_position = gtk_entry_get_position;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_entry_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
static void gtk_entry_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec,
|
||||
const gchar *trailer)
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_TEXT_POSITION:
|
||||
gtk_editable_set_position (GTK_EDITABLE (object), GTK_VALUE_INT (*arg));
|
||||
case PROP_TEXT_POSITION:
|
||||
gtk_editable_set_position (GTK_EDITABLE (object),
|
||||
g_value_get_int (value));
|
||||
break;
|
||||
case ARG_EDITABLE:
|
||||
|
||||
case PROP_EDITABLE:
|
||||
{
|
||||
gboolean new_value = GTK_VALUE_BOOL (*arg) != 0;
|
||||
if (new_value != entry->editable)
|
||||
gboolean new_value = g_value_get_boolean (value);
|
||||
|
||||
if (new_value != entry->editable)
|
||||
{
|
||||
entry->editable = new_value;
|
||||
gtk_entry_queue_draw (entry);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ARG_MAX_LENGTH:
|
||||
gtk_entry_set_max_length (entry, GTK_VALUE_UINT (*arg));
|
||||
|
||||
case PROP_MAX_LENGTH:
|
||||
gtk_entry_set_max_length (entry, g_value_get_int (value));
|
||||
break;
|
||||
case ARG_VISIBILITY:
|
||||
gtk_entry_set_visibility (entry, GTK_VALUE_BOOL (*arg));
|
||||
|
||||
case PROP_VISIBILITY:
|
||||
gtk_entry_set_visibility (entry, g_value_get_boolean (value));
|
||||
break;
|
||||
case ARG_INVISIBLE_CHAR:
|
||||
gtk_entry_set_invisible_char (entry, GTK_VALUE_INT (*arg));
|
||||
|
||||
case PROP_INVISIBLE_CHAR:
|
||||
gtk_entry_set_invisible_char (entry, g_value_get_int (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_entry_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
static void gtk_entry_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec,
|
||||
const gchar *trailer)
|
||||
{
|
||||
GtkEntry *entry;
|
||||
|
||||
entry = GTK_ENTRY (object);
|
||||
|
||||
switch (arg_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_TEXT_POSITION:
|
||||
GTK_VALUE_INT (*arg) = entry->current_pos;
|
||||
case PROP_TEXT_POSITION:
|
||||
g_value_set_int (value, entry->current_pos);
|
||||
break;
|
||||
case ARG_EDITABLE:
|
||||
GTK_VALUE_BOOL (*arg) = entry->editable;
|
||||
case PROP_EDITABLE:
|
||||
g_value_set_boolean (value, entry->editable);
|
||||
break;
|
||||
case ARG_MAX_LENGTH:
|
||||
GTK_VALUE_UINT (*arg) = entry->text_max_length;
|
||||
case PROP_MAX_LENGTH:
|
||||
g_value_set_int (value, entry->text_max_length);
|
||||
break;
|
||||
case ARG_VISIBILITY:
|
||||
GTK_VALUE_BOOL (*arg) = entry->visible;
|
||||
case PROP_VISIBILITY:
|
||||
g_value_set_boolean (value, entry->visible);
|
||||
break;
|
||||
case ARG_INVISIBLE_CHAR:
|
||||
GTK_VALUE_INT (*arg) = entry->invisible_char;
|
||||
case PROP_INVISIBLE_CHAR:
|
||||
g_value_set_int (value, entry->invisible_char);
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1344,6 +1396,8 @@ gtk_entry_real_set_position (GtkEditable *editable,
|
|||
|
||||
entry->current_pos = entry->selection_bound = position;
|
||||
gtk_entry_recompute (entry);
|
||||
|
||||
g_object_notify (G_OBJECT (entry), "text_position");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2502,7 +2556,7 @@ gtk_entry_new (void)
|
|||
}
|
||||
|
||||
GtkWidget*
|
||||
gtk_entry_new_with_max_length (guint16 max)
|
||||
gtk_entry_new_with_max_length (gint max)
|
||||
{
|
||||
GtkEntry *entry;
|
||||
|
||||
|
|
@ -2578,7 +2632,7 @@ gtk_entry_set_visibility (GtkEntry *entry,
|
|||
g_return_if_fail (GTK_IS_ENTRY (entry));
|
||||
|
||||
entry->visible = visible ? TRUE : FALSE;
|
||||
|
||||
g_object_notify (G_OBJECT (entry), "visibility");
|
||||
gtk_entry_recompute (entry);
|
||||
}
|
||||
|
||||
|
|
@ -2606,7 +2660,7 @@ gtk_entry_set_invisible_char (GtkEntry *entry,
|
|||
return;
|
||||
|
||||
entry->invisible_char = ch;
|
||||
|
||||
g_object_notify (G_OBJECT (entry), "invisible_char");
|
||||
gtk_entry_recompute (entry);
|
||||
}
|
||||
|
||||
|
|
@ -2639,15 +2693,16 @@ gtk_entry_select_region (GtkEntry *entry,
|
|||
|
||||
void
|
||||
gtk_entry_set_max_length (GtkEntry *entry,
|
||||
guint16 max)
|
||||
gint max)
|
||||
{
|
||||
g_return_if_fail (entry != NULL);
|
||||
g_return_if_fail (GTK_IS_ENTRY (entry));
|
||||
|
||||
if (max && entry->text_length > max)
|
||||
if (max > 0 && entry->text_length > max)
|
||||
gtk_editable_delete_text (GTK_EDITABLE(entry), max, -1);
|
||||
|
||||
entry->text_max_length = max;
|
||||
g_object_notify (G_OBJECT (entry), "max_length");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ void gtk_entry_set_has_frame (GtkEntry *entry,
|
|||
gboolean gtk_entry_get_has_frame (GtkEntry *entry);
|
||||
/* text is truncated if needed */
|
||||
void gtk_entry_set_max_length (GtkEntry *entry,
|
||||
guint16 max);
|
||||
gint max);
|
||||
|
||||
/* Somewhat more convenient than the GtkEditable generic functions
|
||||
*/
|
||||
|
|
@ -156,7 +156,7 @@ G_CONST_RETURN gchar* gtk_entry_get_text (GtkEntry *entry);
|
|||
|
||||
/* Deprecated compatibility functions
|
||||
*/
|
||||
GtkWidget* gtk_entry_new_with_max_length (guint16 max);
|
||||
GtkWidget* gtk_entry_new_with_max_length (gint max);
|
||||
void gtk_entry_append_text (GtkEntry *entry,
|
||||
const gchar *text);
|
||||
void gtk_entry_prepend_text (GtkEntry *entry,
|
||||
|
|
|
|||
|
|
@ -150,6 +150,7 @@ gtk_text_buffer_class_init (GtkTextBufferClass *klass)
|
|||
|
||||
klass->insert_text = gtk_text_buffer_real_insert_text;
|
||||
klass->insert_pixbuf = gtk_text_buffer_real_insert_pixbuf;
|
||||
klass->insert_child_anchor = gtk_text_buffer_real_insert_anchor;
|
||||
klass->delete_range = gtk_text_buffer_real_delete_range;
|
||||
klass->apply_tag = gtk_text_buffer_real_apply_tag;
|
||||
klass->remove_tag = gtk_text_buffer_real_remove_tag;
|
||||
|
|
@ -1482,11 +1483,9 @@ gtk_text_buffer_insert_child_anchor (GtkTextBuffer *buffer,
|
|||
GtkTextIter *iter,
|
||||
GtkTextChildAnchor *anchor)
|
||||
{
|
||||
GtkTextChildAnchor *anchor;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), NULL);
|
||||
g_return_val_if_fail (iter != NULL, NULL);
|
||||
g_return_val_if_fail (GTK_IS_TEXT_CHILD_ANCHOR (anchor), NULL);
|
||||
g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
|
||||
g_return_if_fail (iter != NULL);
|
||||
g_return_if_fail (GTK_IS_TEXT_CHILD_ANCHOR (anchor));
|
||||
|
||||
g_signal_emit (G_OBJECT (buffer), signals[INSERT_CHILD_ANCHOR], 0,
|
||||
iter, anchor);
|
||||
|
|
|
|||
Loading…
Reference in a new issue