(no subject)
- From: Tristan Van Berkom <vantr touchtunes com>
- To: christophe Meyer <chr meyer nerim net>
- Cc: gtk-app-devel-list gnome org
- Subject: (no subject)
- Date: Fri, 23 Jan 2004 12:45:50 -0500
Christophe,
[snip]
Can anyone show me how to get the graphic context (GdkGC *gc) using
gdk_gc_new ()
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Graphics-Contexts.html#gdk-gc-new
says that its:
GdkGC* gdk_gc_new (GdkDrawable *drawable);
A GdkDrawable in gdk is anything thats reasonable to draw to.
Right now, a GdkWindow is a GdkDrawable and so is a GdkPixmap. You
can get your drawable from a widget like so:
=========================================================================
GdkWindow *window = NULL;
if (GTK_WIDGET_FLAGS(GTK_WIDGET(any_widget)) & GTK_NO_WINDOW) {
/* XXX I'm not sure about this function because I never used it.
* (the name seems to indicate what you want though).
*/
window = gtk_widget_get_parent_window (GTK_WIDGET(any_widget));
} else {
window = GTK_WIDGET(any_widget)->window;
}
=========================================================================
See:
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#GtkWidgetFlags
For a note on GTK_NO_WINDOW and the reason to call gtk_widget_get_parent_window.
Note that the coordinates will be relative to the parent's window when
a widget is GTK_NO_WINDOW.
and how to complete the gdk_draw_point() function if
it's false ,
gdk_draw_point() looks fine. in your code you draw a line
from (X:0,Y:100) to (X:100,Y:100)
and to make this example run ?
Sorry but your on your own.
Cheers,
-Tristan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]