Tag: gtk

  • signal “expose-event”

    g_signal_connect . The second argument for this function is detailed_signal : a string of the form “signal-name::detail”. source :http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html GtkWidget is the base class for all widgets. “expose-event” is an signal and the signal list is available at http://library.gnome.org/devel/gtk/unstable/GtkWidget.html

  • programming tip 1.

    In CAIRO + GTK programming.The GTK part will be in the main() function. and cairo API will be in the functions that GTK calls. Ofcourse GTK API can be in the functions too, but CAIRO will not be inside main() normally.

  • cairo graphics 0.8 (intersection)

    /* Jeffrin Jose Licensed GPL v3 Copyright August 2010 GPL –> http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include //the global pixmap that will serve as our buffer static GdkPixmap *pixmap = NULL; gboolean on_window_configure_event(GtkWidget * da, GdkEventConfigure * event, gpointer user_data){ static int oldw = 0; static int oldh = 0; //make our selves a properly […]

  • cairo graphics 0.1 (line)

    #include #include int i=0; static gboolean draw(GtkWidget *widget, GdkEventExpose *event, gpointer data) { cairo_t *cr; cr = gdk_cairo_create(widget->window); cairo_set_source_rgb(cr, 0, 0, 0); cairo_set_line_width (cr, 0.5); /*for (i=0;i<200;i++) { */ cairo_move_to(cr,30,60); /* cairo_line_to(cr,30+i,60+i);*/ cairo_line_to(cr,40,200); cairo_stroke(cr); /* cairo_surface_flush(); */ /* usleep(100000);*/ /*} */ cairo_destroy(cr); return FALSE; } int main (int argc, char *argv[]) { GtkWidget *window; gtk_init(&argc, […]