Re: Simple Html-View widget



Yes, GtkLabel indeed supports multi lines. Both with and without markup.
Here's an example:

 #include <stdlib.h>

#include <gtk/gtk.h>

 int main(int argc, char **argv)

{

  gtk_init(&argc, &argv);

  GtkWidget *w_mw = gtk_window_new(GTK_WINDOW_TOPLEVEL);

  g_signal_connect(w_mw,"destroy",gtk_main_quit, NULL);

  GtkWidget *w_label = gtk_label_new(NULL);

   gtk_label_set_markup(GTK_LABEL(w_label),

     "A long label\n"

     "That has <b>bold</b>\n"

     "And <i>italic</i>\n"

     "And <span foreground='red'>red</span>,"

     "<span foreground='darkgreen'>green</span>,"

     "and <span foreground='blue'>blue</span>");

   gtk_container_add(GTK_CONTAINER(w_mw), w_label);

  gtk_widget_show_all(w_mw);

  gtk_main();

   exit(0);

}

Regards,
Dov

On Sun, Sep 11, 2011 at 16:52, Arne Pagel <arne pagelnet de> wrote:

You mean using a label instead of a text view then?
Or can I use gtk_label_set_markup() together with a text-buffer?

A label can use Pango-Markup language, but I didn't find a way to make a
newline using a markup.
When parsing xml, all line-ends are ignored.

regards,
 Arne


Am 11.09.2011 13:45, schrieb Dov Grobgeld:

 Just use gtk_label_set_markup().

Regards,
Dov

On Sat, Sep 10, 2011 at 20:35, Craig<craigbakalian verizon **net<craigbakalian verizon net>>
 wrote:

 Hi,

I am not expert on this issue, but isn't Pango the way to go.  I think
you should look up the Pango functions or how gtk deals with the Pango
thing.

Craig Bakalian

 Hello,

in my application I store some Text data in xml files.
Some nodes are displayed via a gtk-label or an gtk-entry, others are

displayed via a gtk text-view.


Now I want to extend the text-view (and storage) with the capability to

handle some formated text.

I just need things like bold text, linefeed, maybe headers and colors.
Since I don't want to create a own text storage format and I am using

already xml for text storing

html would be nearby.

Is there some Gtk-Widget like the textview/buffer which can render
simple

HTML Tags?

If not, what is your recommendation for my problem.

regards
   Arne



______________________________**_________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/**listinfo/gtk-app-devel-list<http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list>

 ______________________________**_________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/**listinfo/gtk-app-devel-list<http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list>


______________________________**_________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/**listinfo/gtk-app-devel-list<http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list>




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