Interface to gtktext...or perhaps gtkeditable




Inside gtktext.c there's a lot of nice functions for moving around:

static void gtk_text_move_forward_character    (GtkText          *text);
static void gtk_text_move_backward_character   (GtkText          *text);
static void gtk_text_move_forward_word         (GtkText          *text);
static void gtk_text_move_backward_word        (GtkText          *text);
static void gtk_text_move_beginning_of_line    (GtkText          *text);
static void gtk_text_move_end_of_line          (GtkText          *text);
static void gtk_text_move_next_line            (GtkText          *text);
static void gtk_text_move_previous_line        (GtkText          *text);

These are really virtual functions from gtkeditable:

  void (* move_cursor)     (GtkEditable *editable,
			    gint         x,
			    gint         y);
  void (* move_word)       (GtkEditable *editable,
			    gint         n);
  void (* move_page)       (GtkEditable *editable,
			    gint         x,
			    gint         y);
  void (* move_to_row)     (GtkEditable *editable,
			    gint         row);
  void (* move_to_column)  (GtkEditable *editable,
			    gint         row);

Something simular goes for kill_* functions.

Now, I would like to bind these to GUILE (macros using such functions
are *vastly* more useful than macros how doesn't).  but I cannot get
to them...cause there's no gtk_editable_* or (gtk_text_*) counterpart.

I know, I know, I can get to the functions if I get the class
struct...but this seems a little more trouble than absolutely needed.

I really need the gtk_editable_* functions!  Is there any reason *not*
to add them?

It should be fairly easy to do...for each of the functions in
GtkEditableClass add a function:

void
gtk_editable_foo (GtkEditable *editable, gfoo foo)
{
  GtkEditableClass *klass;

  g_return_if_fail (editable != NULL);
  g_return_if_fail (GTK_IS_EDITABLE (editable));

  klass = GTK_EDITABLE_CLASS (GTK_OBJECT (editable)->klass);

  return klass->foo (editable, foo);
}

/mailund



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]