mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-05 16:20:10 +00:00
move insert_text and delete_text virtual functions to do_insert_text and
Wed Oct 3 23:47:25 Kristian Rietveld <kristian@planet.nl> * gtk/gtkeditable.[ch]: move insert_text and delete_text virtual functions to do_insert_text and do_delete_text, add signals insert_text, delete_text and changed * gtk/gtkentry.[ch]: remove signals insert_text, delete_text and changed. Updates to match new situation. * gtk/gtkspinbutton.c: updates to match new situation * gtk/gtkoldeditable.h: remove signals changed, insert_text and delete_text * gtk/gtkoldeditable.c: updates to match new situation * gtk/gtktext.c: updates to match new situation Fixes bug #59803
This commit is contained in:
parent
77dc57e960
commit
3c09d348d3
20
ChangeLog
20
ChangeLog
@ -1,3 +1,23 @@
|
||||
Wed Oct 3 23:47:25 Kristian Rietveld <kristian@planet.nl>
|
||||
|
||||
* gtk/gtkeditable.[ch]: move insert_text and delete_text virtual
|
||||
functions to do_insert_text and do_delete_text, add signals
|
||||
insert_text, delete_text and changed
|
||||
|
||||
* gtk/gtkentry.[ch]: remove signals insert_text, delete_text
|
||||
and changed. Updates to match new situation.
|
||||
|
||||
* gtk/gtkspinbutton.c: updates to match new situation
|
||||
|
||||
* gtk/gtkoldeditable.h: remove signals changed, insert_text
|
||||
and delete_text
|
||||
|
||||
* gtk/gtkoldeditable.c: updates to match new situation
|
||||
|
||||
* gtk/gtktext.c: updates to match new situation
|
||||
|
||||
Fixes bug #59803
|
||||
|
||||
2001-10-03 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
|
||||
|
@ -1,3 +1,23 @@
|
||||
Wed Oct 3 23:47:25 Kristian Rietveld <kristian@planet.nl>
|
||||
|
||||
* gtk/gtkeditable.[ch]: move insert_text and delete_text virtual
|
||||
functions to do_insert_text and do_delete_text, add signals
|
||||
insert_text, delete_text and changed
|
||||
|
||||
* gtk/gtkentry.[ch]: remove signals insert_text, delete_text
|
||||
and changed. Updates to match new situation.
|
||||
|
||||
* gtk/gtkspinbutton.c: updates to match new situation
|
||||
|
||||
* gtk/gtkoldeditable.h: remove signals changed, insert_text
|
||||
and delete_text
|
||||
|
||||
* gtk/gtkoldeditable.c: updates to match new situation
|
||||
|
||||
* gtk/gtktext.c: updates to match new situation
|
||||
|
||||
Fixes bug #59803
|
||||
|
||||
2001-10-03 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
|
||||
|
@ -1,3 +1,23 @@
|
||||
Wed Oct 3 23:47:25 Kristian Rietveld <kristian@planet.nl>
|
||||
|
||||
* gtk/gtkeditable.[ch]: move insert_text and delete_text virtual
|
||||
functions to do_insert_text and do_delete_text, add signals
|
||||
insert_text, delete_text and changed
|
||||
|
||||
* gtk/gtkentry.[ch]: remove signals insert_text, delete_text
|
||||
and changed. Updates to match new situation.
|
||||
|
||||
* gtk/gtkspinbutton.c: updates to match new situation
|
||||
|
||||
* gtk/gtkoldeditable.h: remove signals changed, insert_text
|
||||
and delete_text
|
||||
|
||||
* gtk/gtkoldeditable.c: updates to match new situation
|
||||
|
||||
* gtk/gtktext.c: updates to match new situation
|
||||
|
||||
Fixes bug #59803
|
||||
|
||||
2001-10-03 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
|
||||
|
@ -1,3 +1,23 @@
|
||||
Wed Oct 3 23:47:25 Kristian Rietveld <kristian@planet.nl>
|
||||
|
||||
* gtk/gtkeditable.[ch]: move insert_text and delete_text virtual
|
||||
functions to do_insert_text and do_delete_text, add signals
|
||||
insert_text, delete_text and changed
|
||||
|
||||
* gtk/gtkentry.[ch]: remove signals insert_text, delete_text
|
||||
and changed. Updates to match new situation.
|
||||
|
||||
* gtk/gtkspinbutton.c: updates to match new situation
|
||||
|
||||
* gtk/gtkoldeditable.h: remove signals changed, insert_text
|
||||
and delete_text
|
||||
|
||||
* gtk/gtkoldeditable.c: updates to match new situation
|
||||
|
||||
* gtk/gtktext.c: updates to match new situation
|
||||
|
||||
Fixes bug #59803
|
||||
|
||||
2001-10-03 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
|
||||
|
@ -1,3 +1,23 @@
|
||||
Wed Oct 3 23:47:25 Kristian Rietveld <kristian@planet.nl>
|
||||
|
||||
* gtk/gtkeditable.[ch]: move insert_text and delete_text virtual
|
||||
functions to do_insert_text and do_delete_text, add signals
|
||||
insert_text, delete_text and changed
|
||||
|
||||
* gtk/gtkentry.[ch]: remove signals insert_text, delete_text
|
||||
and changed. Updates to match new situation.
|
||||
|
||||
* gtk/gtkspinbutton.c: updates to match new situation
|
||||
|
||||
* gtk/gtkoldeditable.h: remove signals changed, insert_text
|
||||
and delete_text
|
||||
|
||||
* gtk/gtkoldeditable.c: updates to match new situation
|
||||
|
||||
* gtk/gtktext.c: updates to match new situation
|
||||
|
||||
Fixes bug #59803
|
||||
|
||||
2001-10-03 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
|
||||
|
@ -1,3 +1,23 @@
|
||||
Wed Oct 3 23:47:25 Kristian Rietveld <kristian@planet.nl>
|
||||
|
||||
* gtk/gtkeditable.[ch]: move insert_text and delete_text virtual
|
||||
functions to do_insert_text and do_delete_text, add signals
|
||||
insert_text, delete_text and changed
|
||||
|
||||
* gtk/gtkentry.[ch]: remove signals insert_text, delete_text
|
||||
and changed. Updates to match new situation.
|
||||
|
||||
* gtk/gtkspinbutton.c: updates to match new situation
|
||||
|
||||
* gtk/gtkoldeditable.h: remove signals changed, insert_text
|
||||
and delete_text
|
||||
|
||||
* gtk/gtkoldeditable.c: updates to match new situation
|
||||
|
||||
* gtk/gtktext.c: updates to match new situation
|
||||
|
||||
Fixes bug #59803
|
||||
|
||||
2001-10-03 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
|
||||
|
@ -1,3 +1,23 @@
|
||||
Wed Oct 3 23:47:25 Kristian Rietveld <kristian@planet.nl>
|
||||
|
||||
* gtk/gtkeditable.[ch]: move insert_text and delete_text virtual
|
||||
functions to do_insert_text and do_delete_text, add signals
|
||||
insert_text, delete_text and changed
|
||||
|
||||
* gtk/gtkentry.[ch]: remove signals insert_text, delete_text
|
||||
and changed. Updates to match new situation.
|
||||
|
||||
* gtk/gtkspinbutton.c: updates to match new situation
|
||||
|
||||
* gtk/gtkoldeditable.h: remove signals changed, insert_text
|
||||
and delete_text
|
||||
|
||||
* gtk/gtkoldeditable.c: updates to match new situation
|
||||
|
||||
* gtk/gtktext.c: updates to match new situation
|
||||
|
||||
Fixes bug #59803
|
||||
|
||||
2001-10-03 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
|
||||
|
@ -29,6 +29,10 @@
|
||||
#include "gtkeditable.h"
|
||||
#include "gtksignal.h"
|
||||
|
||||
|
||||
static void gtk_editable_base_init (gpointer g_class);
|
||||
|
||||
|
||||
GtkType
|
||||
gtk_editable_get_type (void)
|
||||
{
|
||||
@ -39,7 +43,7 @@ gtk_editable_get_type (void)
|
||||
static const GTypeInfo editable_info =
|
||||
{
|
||||
sizeof (GtkEditableClass), /* class_size */
|
||||
NULL, /* base_init */
|
||||
gtk_editable_base_init, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
};
|
||||
|
||||
@ -49,6 +53,44 @@ gtk_editable_get_type (void)
|
||||
return editable_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_editable_base_init (gpointer g_class)
|
||||
{
|
||||
static gboolean initialized = FALSE;
|
||||
|
||||
if (! initialized)
|
||||
{
|
||||
g_signal_new ("insert_text",
|
||||
GTK_TYPE_EDITABLE,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkEditableClass, insert_text),
|
||||
NULL, NULL,
|
||||
gtk_marshal_VOID__STRING_INT_POINTER,
|
||||
G_TYPE_NONE, 3,
|
||||
GTK_TYPE_STRING,
|
||||
GTK_TYPE_INT,
|
||||
GTK_TYPE_POINTER);
|
||||
g_signal_new ("delete_text",
|
||||
GTK_TYPE_EDITABLE,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkEditableClass, delete_text),
|
||||
NULL, NULL,
|
||||
gtk_marshal_VOID__INT_INT,
|
||||
GTK_TYPE_NONE, 2,
|
||||
GTK_TYPE_INT,
|
||||
GTK_TYPE_INT);
|
||||
g_signal_new ("changed",
|
||||
GTK_TYPE_EDITABLE,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkEditableClass, changed),
|
||||
NULL, NULL,
|
||||
gtk_marshal_VOID__VOID,
|
||||
GTK_TYPE_NONE, 0);
|
||||
|
||||
initialized = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gtk_editable_insert_text (GtkEditable *editable,
|
||||
const gchar *new_text,
|
||||
@ -61,7 +103,7 @@ gtk_editable_insert_text (GtkEditable *editable,
|
||||
if (new_text_length < 0)
|
||||
new_text_length = strlen (new_text);
|
||||
|
||||
GTK_EDITABLE_GET_CLASS (editable)->insert_text (editable, new_text, new_text_length, position);
|
||||
GTK_EDITABLE_GET_CLASS (editable)->do_insert_text (editable, new_text, new_text_length, position);
|
||||
}
|
||||
|
||||
void
|
||||
@ -71,7 +113,7 @@ gtk_editable_delete_text (GtkEditable *editable,
|
||||
{
|
||||
g_return_if_fail (GTK_IS_EDITABLE (editable));
|
||||
|
||||
GTK_EDITABLE_GET_CLASS (editable)->delete_text (editable, start_pos, end_pos);
|
||||
GTK_EDITABLE_GET_CLASS (editable)->do_delete_text (editable, start_pos, end_pos);
|
||||
}
|
||||
|
||||
gchar *
|
||||
|
@ -50,7 +50,7 @@ struct _GtkEditableClass
|
||||
{
|
||||
GTypeInterface base_iface;
|
||||
|
||||
/* Signals for notification/filtering of changes */
|
||||
/* signals */
|
||||
void (* insert_text) (GtkEditable *editable,
|
||||
const gchar *text,
|
||||
gint length,
|
||||
@ -58,6 +58,17 @@ struct _GtkEditableClass
|
||||
void (* delete_text) (GtkEditable *editable,
|
||||
gint start_pos,
|
||||
gint end_pos);
|
||||
void (* changed) (GtkEditable *editable);
|
||||
|
||||
/* vtable */
|
||||
void (* do_insert_text) (GtkEditable *editable,
|
||||
const gchar *text,
|
||||
gint length,
|
||||
gint *position);
|
||||
void (* do_delete_text) (GtkEditable *editable,
|
||||
gint start_pos,
|
||||
gint end_pos);
|
||||
|
||||
gchar* (* get_chars) (GtkEditable *editable,
|
||||
gint start_pos,
|
||||
gint end_pos);
|
||||
|
@ -56,9 +56,6 @@
|
||||
#define MAX_SIZE G_MAXUSHORT
|
||||
|
||||
enum {
|
||||
INSERT_TEXT,
|
||||
DELETE_TEXT,
|
||||
CHANGED,
|
||||
ACTIVATE,
|
||||
POPULATE_POPUP,
|
||||
MOVE_CURSOR,
|
||||
@ -203,11 +200,11 @@ static void gtk_entry_start_editing (GtkCellEditable *cell_editable,
|
||||
|
||||
/* Default signal handlers
|
||||
*/
|
||||
static void gtk_entry_real_insert_text (GtkEntry *entry,
|
||||
static void gtk_entry_real_insert_text (GtkEditable *editable,
|
||||
const gchar *new_text,
|
||||
gint new_text_length,
|
||||
gint *position);
|
||||
static void gtk_entry_real_delete_text (GtkEntry *entry,
|
||||
static void gtk_entry_real_delete_text (GtkEditable *editable,
|
||||
gint start_pos,
|
||||
gint end_pos);
|
||||
static void gtk_entry_move_cursor (GtkEntry *entry,
|
||||
@ -393,9 +390,7 @@ gtk_entry_class_init (GtkEntryClass *class)
|
||||
widget_class->drag_data_delete = gtk_entry_drag_data_delete;
|
||||
|
||||
widget_class->popup_menu = gtk_entry_popup_menu;
|
||||
|
||||
class->insert_text = gtk_entry_real_insert_text;
|
||||
class->delete_text = gtk_entry_real_delete_text;
|
||||
|
||||
class->move_cursor = gtk_entry_move_cursor;
|
||||
class->insert_at_cursor = gtk_entry_insert_at_cursor;
|
||||
class->delete_from_cursor = gtk_entry_delete_from_cursor;
|
||||
@ -492,37 +487,6 @@ gtk_entry_class_init (GtkEntryClass *class)
|
||||
GDK_TYPE_COLOR,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
signals[INSERT_TEXT] =
|
||||
gtk_signal_new ("insert_text",
|
||||
GTK_RUN_LAST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkEntryClass, insert_text),
|
||||
gtk_marshal_VOID__STRING_INT_POINTER,
|
||||
GTK_TYPE_NONE,
|
||||
3,
|
||||
GTK_TYPE_STRING,
|
||||
GTK_TYPE_INT,
|
||||
GTK_TYPE_POINTER);
|
||||
|
||||
signals[DELETE_TEXT] =
|
||||
gtk_signal_new ("delete_text",
|
||||
GTK_RUN_LAST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkEntryClass, delete_text),
|
||||
gtk_marshal_VOID__INT_INT,
|
||||
GTK_TYPE_NONE,
|
||||
2,
|
||||
GTK_TYPE_INT,
|
||||
GTK_TYPE_INT);
|
||||
|
||||
signals[CHANGED] =
|
||||
gtk_signal_new ("changed",
|
||||
GTK_RUN_LAST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkEntryClass, changed),
|
||||
gtk_marshal_VOID__VOID,
|
||||
GTK_TYPE_NONE, 0);
|
||||
|
||||
signals[POPULATE_POPUP] =
|
||||
gtk_signal_new ("populate_popup",
|
||||
GTK_RUN_LAST,
|
||||
@ -777,8 +741,10 @@ gtk_entry_class_init (GtkEntryClass *class)
|
||||
static void
|
||||
gtk_entry_editable_init (GtkEditableClass *iface)
|
||||
{
|
||||
iface->insert_text = gtk_entry_insert_text;
|
||||
iface->delete_text = gtk_entry_delete_text;
|
||||
iface->do_insert_text = gtk_entry_insert_text;
|
||||
iface->do_delete_text = gtk_entry_delete_text;
|
||||
iface->insert_text = gtk_entry_real_insert_text;
|
||||
iface->delete_text = gtk_entry_real_delete_text;
|
||||
iface->get_chars = gtk_entry_get_chars;
|
||||
iface->set_selection_bounds = gtk_entry_set_selection_bounds;
|
||||
iface->get_selection_bounds = gtk_entry_get_selection_bounds;
|
||||
@ -1688,8 +1654,8 @@ gtk_entry_insert_text (GtkEditable *editable,
|
||||
text[new_text_length] = '\0';
|
||||
strncpy (text, new_text, new_text_length);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (editable), signals[INSERT_TEXT], text, new_text_length, position);
|
||||
gtk_signal_emit (GTK_OBJECT (editable), signals[CHANGED]);
|
||||
g_signal_emit_by_name (editable, "insert_text", text, new_text_length, position);
|
||||
g_signal_emit_by_name (editable, "changed");
|
||||
|
||||
if (new_text_length > 63)
|
||||
g_free (text);
|
||||
@ -1713,8 +1679,8 @@ gtk_entry_delete_text (GtkEditable *editable,
|
||||
|
||||
g_object_ref (G_OBJECT (editable));
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (editable), signals[DELETE_TEXT], start_pos, end_pos);
|
||||
gtk_signal_emit (GTK_OBJECT (editable), signals[CHANGED]);
|
||||
g_signal_emit_by_name (editable, "delete_text", start_pos, end_pos);
|
||||
g_signal_emit_by_name (editable, "changed");
|
||||
|
||||
g_object_unref (G_OBJECT (editable));
|
||||
}
|
||||
@ -1857,7 +1823,7 @@ gtk_entry_start_editing (GtkCellEditable *cell_editable,
|
||||
/* Default signal handlers
|
||||
*/
|
||||
static void
|
||||
gtk_entry_real_insert_text (GtkEntry *entry,
|
||||
gtk_entry_real_insert_text (GtkEditable *editable,
|
||||
const gchar *new_text,
|
||||
gint new_text_length,
|
||||
gint *position)
|
||||
@ -1865,6 +1831,8 @@ gtk_entry_real_insert_text (GtkEntry *entry,
|
||||
gint index;
|
||||
gint n_chars;
|
||||
|
||||
GtkEntry *entry = GTK_ENTRY (editable);
|
||||
|
||||
if (new_text_length < 0)
|
||||
new_text_length = strlen (new_text);
|
||||
|
||||
@ -1922,10 +1890,12 @@ gtk_entry_real_insert_text (GtkEntry *entry,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_entry_real_delete_text (GtkEntry *entry,
|
||||
gint start_pos,
|
||||
gint end_pos)
|
||||
gtk_entry_real_delete_text (GtkEditable *editable,
|
||||
gint start_pos,
|
||||
gint end_pos)
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (editable);
|
||||
|
||||
if (start_pos < 0)
|
||||
start_pos = 0;
|
||||
if (end_pos < 0 || end_pos > entry->text_length)
|
||||
|
@ -115,17 +115,6 @@ struct _GtkEntry
|
||||
struct _GtkEntryClass
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
|
||||
/* Notification of changes
|
||||
*/
|
||||
void (* changed) (GtkEntry *entry);
|
||||
void (* insert_text) (GtkEntry *entry,
|
||||
const gchar *text,
|
||||
gint length,
|
||||
gint *position);
|
||||
void (* delete_text) (GtkEntry *entry,
|
||||
gint start_pos,
|
||||
gint end_pos);
|
||||
|
||||
/* Hook to customize right-click popup */
|
||||
void (* populate_popup) (GtkEntry *entry,
|
||||
|
@ -39,9 +39,6 @@
|
||||
#define INNER_BORDER 2
|
||||
|
||||
enum {
|
||||
CHANGED,
|
||||
INSERT_TEXT,
|
||||
DELETE_TEXT,
|
||||
/* Binding actions */
|
||||
ACTIVATE,
|
||||
SET_EDITABLE,
|
||||
@ -182,9 +179,6 @@ gtk_old_editable_class_init (GtkOldEditableClass *class)
|
||||
widget_class->selection_received = gtk_old_editable_selection_received;
|
||||
widget_class->selection_get = gtk_old_editable_selection_get;
|
||||
|
||||
class->insert_text = NULL;
|
||||
class->delete_text = NULL;
|
||||
|
||||
class->activate = NULL;
|
||||
class->set_editable = gtk_old_editable_real_set_editable;
|
||||
|
||||
@ -207,37 +201,6 @@ gtk_old_editable_class_init (GtkOldEditableClass *class)
|
||||
class->set_selection = NULL;
|
||||
class->set_position = NULL;
|
||||
|
||||
editable_signals[CHANGED] =
|
||||
gtk_signal_new ("changed",
|
||||
GTK_RUN_LAST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkOldEditableClass, changed),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
|
||||
editable_signals[INSERT_TEXT] =
|
||||
gtk_signal_new ("insert_text",
|
||||
GTK_RUN_LAST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkOldEditableClass, insert_text),
|
||||
gtk_marshal_NONE__STRING_INT_POINTER,
|
||||
GTK_TYPE_NONE,
|
||||
3,
|
||||
GTK_TYPE_STRING,
|
||||
GTK_TYPE_INT,
|
||||
GTK_TYPE_POINTER);
|
||||
|
||||
editable_signals[DELETE_TEXT] =
|
||||
gtk_signal_new ("delete_text",
|
||||
GTK_RUN_LAST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkOldEditableClass, delete_text),
|
||||
gtk_marshal_NONE__INT_INT,
|
||||
GTK_TYPE_NONE,
|
||||
2,
|
||||
GTK_TYPE_INT,
|
||||
GTK_TYPE_INT);
|
||||
|
||||
editable_signals[ACTIVATE] =
|
||||
gtk_signal_new ("activate",
|
||||
GTK_RUN_LAST | GTK_RUN_ACTION,
|
||||
@ -361,8 +324,8 @@ gtk_old_editable_class_init (GtkOldEditableClass *class)
|
||||
static void
|
||||
gtk_old_editable_editable_init (GtkEditableClass *iface)
|
||||
{
|
||||
iface->insert_text = gtk_old_editable_insert_text;
|
||||
iface->delete_text = gtk_old_editable_delete_text;
|
||||
iface->do_insert_text = gtk_old_editable_insert_text;
|
||||
iface->do_delete_text = gtk_old_editable_delete_text;
|
||||
iface->get_chars = gtk_old_editable_get_chars;
|
||||
iface->set_selection_bounds = gtk_old_editable_set_selection_bounds;
|
||||
iface->get_selection_bounds = gtk_old_editable_get_selection_bounds;
|
||||
@ -455,10 +418,11 @@ gtk_old_editable_insert_text (GtkEditable *editable,
|
||||
|
||||
text[new_text_length] = '\0';
|
||||
strncpy (text, new_text, new_text_length);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (editable), editable_signals[INSERT_TEXT], text, new_text_length, position);
|
||||
gtk_signal_emit (GTK_OBJECT (editable), editable_signals[CHANGED]);
|
||||
|
||||
|
||||
g_signal_emit_by_name (editable, "insert_text", text, new_text_length,
|
||||
position);
|
||||
g_signal_emit_by_name (editable, "changed");
|
||||
|
||||
if (new_text_length > 63)
|
||||
g_free (text);
|
||||
|
||||
@ -474,8 +438,8 @@ gtk_old_editable_delete_text (GtkEditable *editable,
|
||||
|
||||
gtk_widget_ref (GTK_WIDGET (old_editable));
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (old_editable), editable_signals[DELETE_TEXT], start_pos, end_pos);
|
||||
gtk_signal_emit (GTK_OBJECT (old_editable), editable_signals[CHANGED]);
|
||||
g_signal_emit_by_name (editable, "delete_text", start_pos, end_pos);
|
||||
g_signal_emit_by_name (editable, "changed");
|
||||
|
||||
if (old_editable->selection_start_pos == old_editable->selection_end_pos &&
|
||||
old_editable->has_selection)
|
||||
@ -847,5 +811,5 @@ gtk_old_editable_changed (GtkOldEditable *old_editable)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_OLD_EDITABLE (old_editable));
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (old_editable), editable_signals[CHANGED]);
|
||||
g_signal_emit_by_name (old_editable, "changed");
|
||||
}
|
||||
|
@ -74,16 +74,6 @@ struct _GtkOldEditableClass
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
|
||||
/* Signals for notification/filtering of changes */
|
||||
void (* changed) (GtkOldEditable *editable);
|
||||
void (* insert_text) (GtkOldEditable *editable,
|
||||
const gchar *text,
|
||||
gint length,
|
||||
gint *position);
|
||||
void (* delete_text) (GtkOldEditable *editable,
|
||||
gint start_pos,
|
||||
gint end_pos);
|
||||
|
||||
/* Bindings actions */
|
||||
void (* activate) (GtkOldEditable *editable);
|
||||
void (* set_editable) (GtkOldEditable *editable,
|
||||
|
@ -69,6 +69,7 @@ enum
|
||||
};
|
||||
|
||||
static void gtk_spin_button_class_init (GtkSpinButtonClass *klass);
|
||||
static void gtk_spin_button_editable_init (GtkEditableClass *iface);
|
||||
static void gtk_spin_button_init (GtkSpinButton *spin_button);
|
||||
static void gtk_spin_button_finalize (GObject *object);
|
||||
static void gtk_spin_button_set_property (GObject *object,
|
||||
@ -115,7 +116,7 @@ static gint gtk_spin_button_scroll (GtkWidget *widget,
|
||||
static void gtk_spin_button_activate (GtkEntry *entry);
|
||||
static void gtk_spin_button_snap (GtkSpinButton *spin_button,
|
||||
gdouble val);
|
||||
static void gtk_spin_button_insert_text (GtkEntry *entry,
|
||||
static void gtk_spin_button_insert_text (GtkEditable *editable,
|
||||
const gchar *new_text,
|
||||
gint new_text_length,
|
||||
gint *position);
|
||||
@ -150,7 +151,17 @@ gtk_spin_button_get_type (void)
|
||||
(GtkClassInitFunc) NULL,
|
||||
};
|
||||
|
||||
static const GInterfaceInfo editable_info =
|
||||
{
|
||||
(GInterfaceInitFunc) gtk_spin_button_editable_init, /* interface_init */
|
||||
NULL, /* interface_finalize */
|
||||
NULL /* interface_data */
|
||||
};
|
||||
|
||||
spin_button_type = gtk_type_unique (GTK_TYPE_ENTRY, &spin_button_info);
|
||||
g_type_add_interface_static (spin_button_type,
|
||||
GTK_TYPE_EDITABLE,
|
||||
&editable_info);
|
||||
}
|
||||
return spin_button_type;
|
||||
}
|
||||
@ -165,7 +176,7 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
|
||||
|
||||
object_class = (GtkObjectClass*) class;
|
||||
widget_class = (GtkWidgetClass*) class;
|
||||
entry_class = (GtkEntryClass*) class;
|
||||
entry_class = (GtkEntryClass*) class;
|
||||
|
||||
parent_class = gtk_type_class (GTK_TYPE_ENTRY);
|
||||
|
||||
@ -191,7 +202,6 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
|
||||
widget_class->leave_notify_event = gtk_spin_button_leave_notify;
|
||||
widget_class->focus_out_event = gtk_spin_button_focus_out;
|
||||
|
||||
entry_class->insert_text = gtk_spin_button_insert_text;
|
||||
entry_class->activate = gtk_spin_button_activate;
|
||||
|
||||
class->input = NULL;
|
||||
@ -300,6 +310,12 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
|
||||
GTK_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_spin_button_editable_init (GtkEditableClass *iface)
|
||||
{
|
||||
iface->insert_text = gtk_spin_button_insert_text;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_spin_button_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
@ -1309,13 +1325,14 @@ gtk_spin_button_activate (GtkEntry *entry)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_spin_button_insert_text (GtkEntry *entry,
|
||||
gtk_spin_button_insert_text (GtkEditable *editable,
|
||||
const gchar *new_text,
|
||||
gint new_text_length,
|
||||
gint *position)
|
||||
{
|
||||
GtkEditable *editable = GTK_EDITABLE (entry);
|
||||
GtkEntry *entry = GTK_ENTRY (editable);
|
||||
GtkSpinButton *spin = GTK_SPIN_BUTTON (editable);
|
||||
GtkEditableClass *parent_editable_iface = g_type_interface_peek (parent_class, GTK_TYPE_EDITABLE);
|
||||
|
||||
if (spin->numeric)
|
||||
{
|
||||
@ -1385,8 +1402,8 @@ gtk_spin_button_insert_text (GtkEntry *entry,
|
||||
}
|
||||
}
|
||||
|
||||
GTK_ENTRY_CLASS (parent_class)->insert_text (entry, new_text,
|
||||
new_text_length, position);
|
||||
parent_editable_iface->insert_text (editable, new_text,
|
||||
new_text_length, position);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -204,6 +204,7 @@ static void gtk_text_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_text_editable_init (GtkEditableClass *iface);
|
||||
static void gtk_text_init (GtkText *text);
|
||||
static void gtk_text_destroy (GtkObject *object);
|
||||
static void gtk_text_finalize (GObject *object);
|
||||
@ -220,11 +221,11 @@ static void gtk_text_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static void gtk_text_adjustment (GtkAdjustment *adjustment,
|
||||
GtkText *text);
|
||||
static void gtk_text_insert_text (GtkOldEditable *old_editable,
|
||||
static void gtk_text_insert_text (GtkEditable *editable,
|
||||
const gchar *new_text,
|
||||
gint new_text_length,
|
||||
gint *position);
|
||||
static void gtk_text_delete_text (GtkOldEditable *old_editable,
|
||||
static void gtk_text_delete_text (GtkEditable *editable,
|
||||
gint start_pos,
|
||||
gint end_pos);
|
||||
static void gtk_text_update_text (GtkOldEditable *old_editable,
|
||||
@ -526,8 +527,18 @@ gtk_text_get_type (void)
|
||||
/* reserved_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL,
|
||||
};
|
||||
|
||||
static const GInterfaceInfo editable_info =
|
||||
{
|
||||
(GInterfaceInitFunc) gtk_text_editable_init, /* interface_init */
|
||||
NULL, /* interface_finalize */
|
||||
NULL /* interface_data */
|
||||
};
|
||||
|
||||
text_type = gtk_type_unique (GTK_TYPE_OLD_EDITABLE, &text_info);
|
||||
g_type_add_interface_static (text_type,
|
||||
GTK_TYPE_EDITABLE,
|
||||
&editable_info);
|
||||
}
|
||||
|
||||
return text_type;
|
||||
@ -568,8 +579,6 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
widget_class->focus_out_event = gtk_text_focus_out;
|
||||
|
||||
old_editable_class->set_editable = gtk_text_real_set_editable;
|
||||
old_editable_class->insert_text = gtk_text_insert_text;
|
||||
old_editable_class->delete_text = gtk_text_delete_text;
|
||||
|
||||
old_editable_class->move_cursor = gtk_text_move_cursor;
|
||||
old_editable_class->move_word = gtk_text_move_word;
|
||||
@ -693,6 +702,13 @@ gtk_text_get_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_editable_init (GtkEditableClass *iface)
|
||||
{
|
||||
iface->insert_text = gtk_text_insert_text;
|
||||
iface->delete_text = gtk_text_delete_text;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_init (GtkText *text)
|
||||
{
|
||||
@ -1861,12 +1877,12 @@ gtk_text_motion_notify (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_insert_text (GtkOldEditable *old_editable,
|
||||
gtk_text_insert_text (GtkEditable *editable,
|
||||
const gchar *new_text,
|
||||
gint new_text_length,
|
||||
gint *position)
|
||||
{
|
||||
GtkText *text = GTK_TEXT (old_editable);
|
||||
GtkText *text = GTK_TEXT (editable);
|
||||
GdkFont *font;
|
||||
GdkColor *fore, *back;
|
||||
|
||||
@ -1885,7 +1901,7 @@ gtk_text_insert_text (GtkOldEditable *old_editable,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_delete_text (GtkOldEditable *old_editable,
|
||||
gtk_text_delete_text (GtkEditable *editable,
|
||||
gint start_pos,
|
||||
gint end_pos)
|
||||
{
|
||||
@ -1893,7 +1909,7 @@ gtk_text_delete_text (GtkOldEditable *old_editable,
|
||||
|
||||
g_return_if_fail (start_pos >= 0);
|
||||
|
||||
text = GTK_TEXT (old_editable);
|
||||
text = GTK_TEXT (editable);
|
||||
|
||||
gtk_text_set_point (text, start_pos);
|
||||
if (end_pos < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user