gtk programming




Hello,
I've started programming with gtk libs, and I have few questions about
them:

1. Looking at Pango reference manual, I found a useful function named
pango_parse_markup(). How is possible to use this to draw text with
attributes together with GtkTextBuffer and GtkTextView?

2. Are there widgets that display media contents, or how can I use
current
widgets to play a video with a player (as mplayer, or xine, for
example)?

3. Suppose I have to make a drawing area in which the cursor
must change when entered. Look at this code:


GtkWidget *dr = gtk_drawing_area_new();

gtk_widget_add_events(dr, GDK_BUTTON_PRESS_MASK);
gtk_widget_set_size_request(dr, width, height);
g_signal_connect(dr, "expose_event", G_CALLBACK(expose_callback),
NULL);
g_signal_connect(dr, "button_press_event",
G_CALLBACK(mouse_pressed), NULL);
gdk_window_set_cursor(dr->window, gdk_cursor_new(GDK_PENCIL));


However, when I run it I receive this objection:

Gdk-CRITICAL **: gdk_window_set_cursor: assertion `GDK_IS_WINDOW
(window)' failed

If I put gdk_window_set_cursor in the expose_callback() it works,
but I don't know
if it is needed or is a *bad* way.

Another problem: if I have multiple pixbufs to be over a drawing
area, there is
a way to draw them over only a pixbuf and repaint only it at expose
events or I
have to redraw all of them (in other words: can I use gdk-pixbuf or
another widget
as a offscreen drawable?)

Thanks,
Gaetano

.


Quantcast