* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
+#undef GDK_DISABLE_DEPRECATED
+#undef GTK_DISABLE_DEPRECATED
+
#include <ctype.h>
#include <string.h>
#include "gdk/gdkkeysyms.h"
static void text_font_unref (GtkTextFont *text_font);
static void insert_text_property (GtkText* text, GdkFont* font,
- GdkColor *fore, GdkColor* back, guint len);
+ const GdkColor *fore, const GdkColor* back, guint len);
static TextProperty* new_text_property (GtkText *text, GdkFont* font,
- GdkColor* fore, GdkColor* back, guint length);
+ const GdkColor* fore, const GdkColor* back, guint length);
static void destroy_text_property (TextProperty *prop);
static void init_properties (GtkText *text);
static void realize_property (GtkText *text, TextProperty *prop);
g_object_class_install_property (gobject_class,
PROP_HADJUSTMENT,
g_param_spec_object ("hadjustment",
- _("Horizontal Adjustment"),
- _("Horizontal adjustment for the text widget"),
+ P_("Horizontal Adjustment"),
+ P_("Horizontal adjustment for the text widget"),
GTK_TYPE_ADJUSTMENT,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_VADJUSTMENT,
g_param_spec_object ("vadjustment",
- _("Vertical Adjustment"),
- _("Vertical adjustment for the text widget"),
+ P_("Vertical Adjustment"),
+ P_("Vertical adjustment for the text widget"),
GTK_TYPE_ADJUSTMENT,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_LINE_WRAP,
g_param_spec_boolean ("line_wrap",
- _("Line Wrap"),
- _("Whether lines are wrapped at widget edges"),
+ P_("Line Wrap"),
+ P_("Whether lines are wrapped at widget edges"),
TRUE,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_WORD_WRAP,
g_param_spec_boolean ("word_wrap",
- _("Word Wrap"),
- _("Whether words are wrapped at widget edges"),
+ P_("Word Wrap"),
+ P_("Whether words are wrapped at widget edges"),
FALSE,
G_PARAM_READWRITE));
}
void
-gtk_text_insert (GtkText *text,
- GdkFont *font,
- GdkColor *fore,
- GdkColor *back,
- const char *chars,
- gint nchars)
+gtk_text_insert (GtkText *text,
+ GdkFont *font,
+ const GdkColor *fore,
+ const GdkColor *back,
+ const char *chars,
+ gint nchars)
{
GtkOldEditable *old_editable = GTK_OLD_EDITABLE (text);
gboolean frozen = FALSE;
if (text->timer)
{
- gtk_timeout_remove (text->timer);
+ g_source_remove (text->timer);
text->timer = 0;
}
gtk_text_scroll_timeout (gpointer data)
{
GtkText *text;
- GdkEventMotion event;
gint x, y;
GdkModifierType mask;
if (mask & (GDK_BUTTON1_MASK | GDK_BUTTON3_MASK))
{
- event.is_hint = 0;
- event.x = x;
- event.y = y;
- event.state = mask;
+ GdkEvent *event = gdk_event_new (GDK_MOTION_NOTIFY);
+
+ event->motion.is_hint = 0;
+ event->motion.x = x;
+ event->motion.y = y;
+ event->motion.state = mask;
- gtk_text_motion_notify (GTK_WIDGET (text), &event);
+ gtk_text_motion_notify (GTK_WIDGET (text), (GdkEventMotion *)event);
+
+ gdk_event_free (event);
}
GDK_THREADS_LEAVE ();
if (text->timer)
{
- gtk_timeout_remove (text->timer);
+ g_source_remove (text->timer);
text->timer = 0;
}
{
if (text->timer == 0)
{
- text->timer = gtk_timeout_add (SCROLL_TIME,
- gtk_text_scroll_timeout,
- text);
+ text->timer = g_timeout_add (SCROLL_TIME,
+ gtk_text_scroll_timeout,
+ text);
if (y < 0)
scroll_int (text, y/2);
}
static gint
-text_properties_equal (TextProperty* prop, GdkFont* font, GdkColor *fore, GdkColor *back)
+text_properties_equal (TextProperty* prop, GdkFont* font, const GdkColor *fore, const GdkColor *back)
{
if (prop->flags & PROPERTY_FONT)
{
}
static TextProperty*
-new_text_property (GtkText *text, GdkFont *font, GdkColor* fore,
- GdkColor* back, guint length)
+new_text_property (GtkText *text, GdkFont *font, const GdkColor* fore,
+ const GdkColor* back, guint length)
{
TextProperty *prop;
* point. */
static void
insert_text_property (GtkText* text, GdkFont* font,
- GdkColor *fore, GdkColor* back, guint len)
+ const GdkColor *fore, const GdkColor* back, guint len)
{
GtkPropertyMark *mark = &text->point;
TextProperty* forward_prop = MARK_CURRENT_PROPERTY(mark);