Cursor movement in text widgets




I had emailed yesterday regarding the cursor movement functions within gtk
which seem to be static functions, because I'm looking for a way to 
efficiently manipulate the cursor.

Writing little methods like moving to the beginning/end of the buffer/line was
easy, but moving the cursor vertically up or down by one line isn't coming to
me.

I was trying to take those functions out of gtktext.c but the macros, other
functions, and everything was a nightmare to get right to the point where it
seems I would have had to include the whole gtk library in there just to get
a few functions, which obviously doesn't work.

If there was a function to, say, get the number of characters that could fit
on one line within a text widget of a given size, then that would help some.

Also, about casting - I was looking at the definition for a GtkText pointer,
and at some of the things that I could manipulate within that.  I've declared
my text widget as a GtkWidget originally, and then I cast it to a text widget
using GTK_TEXT() when needed in callbacks and so on, but is it ok/advisable
to declare a GtkText * from the beginning, and if so, how do you get around
things like the gtk_text_new() which returns a GtkWidget?  Casting?

Any help would be appreciated.
-- 
David Allen
http://opop.nols.com/
----------------------------------------
AUTHOR'S NOTE:
(B FLAT, 4/4, Staccato)



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