(no subject)


Can anyone show me how to get the graphic context (GdkGC *gc) using
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;
        /* 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;

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.


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