Re: [Vala] Access GTKText



2014/1/14 Gilzad Hamuni <gilli4 gmx net>

Hi list,

I've compiled and tested this C-tutorial that shows how to have different
fonts, colors and and sizes in a single text box:
http://www.gtk.org/tutorial1.2/gtk_tut-14.html

GtkWidget *text;
...
text = gtk_text_new (NULL, NULL);
...
fixed_font = gdk_font_load ("-misc-fixed-medium-r-*-*-*-140-*-*-*-*-*-*");
...
gtk_text_insert (GTK_TEXT (text), fixed_font, &text->style->black,
NULL,"Hello\n", -1);


Now I'd like to do the same in Vala. I've looked through valadoc and what
valencia's completion would provide. But I couldn't find the keywords I
expected in the Gtk namespace. Basically, I need an object that provides
the gtk_text_insert(...) function, which allows me to add formatted text
immediately.

VteTerminal, SourceView and TextView seem to be too limited, as they
doesn't seem to provide such a function. Or am I just to blind to find a
substitude that is as rich?

My understanding of creating GIR and VAPIs is not sufficient, but I think
I wouldn't have to do this for gtktext.h, because the whole gtk-library is
available to vala already?

I'll be happy about any input. Thanks a bunch in advance.

gilzad


In the documentation [1] it says:

    GtkText is deprecated and unsupported. It is known to be buggy. To use
it, you must
    define the symbol GTK_ENABLE_BROKEN prior to including the GTK+ header
files.
    Use GtkTextView instead.

That might be the reason it doesn't show up in Vala, although I'm not sure
myself.

Jonas

[1] https://developer.gnome.org/gtk2/stable/GtkText.html


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