Re: gtk+ about dialog doesn't close
On Sat, Jun 02, 2007 at 07:26:02AM +0200, John Zoidberg wrote: I have a problem with the gtk about dialog: When I click on the Close button it doesn't close. There seems to be no event connected to the close button clicked signal. And I can't add one either in Glade (v2 as well as v3). What am I supposed to add to the code so that it works? Connect to response signal of the about dialog and if the response id is one of GTK_RESPONSE_CLOSE (Close button should emit this) GTK_RESPONSE_CANCEL (but Close button actually emits this) GTK_RESPONSE_DELETE_EVENT (closed by window manager means) destroy/hide/whatever the dialog. I find GtkAboutDialog a textbook example of second system effect -- I mean an about dialog with several nested subdialogs, at least one of them tabbed? The complete user interface of some applications is simplier than GtkAboutDialog. Yeti -- http://gwyddion.net/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Clear A Pixmap
On Fri, Jun 01, 2007 at 05:38:54PM -0700, nahuel9728 wrote: Thaxs Yeti for the answer but Sorry I'm not able to do it. I explain a little bit what im doing and i would like to do: main(){ mem_map=gtk_drawing_area_new(); gtk_signal_connect (GTK_OBJECT (mem_map), expose_event,(GtkSignalFunc) expose_event, NULL); gtk_signal_connect (GTK_OBJECT(mem_map),configure_event,(GtkSignalFunc)configure_event, NULL); gtk_signal_connect (GTK_OBJECT (mem_map), button_press_event,(GtkSignalFunc) button_press_event, NULL); /*A button to erase all the drawed and paint things*/ boton = gtk_button_new_with_label (Clear and paint); gtk_signal_connect_object (GTK_OBJECT (boton), clicked,GTK_SIGNAL_FUNC (clear_and_paint),GTK_OBJECT (main_window)); show } void expose_event(){ gdk_draw_pixmap } void clear_and_pain(GtkWidget *widget, GdkEventExpose *event){ /*HERE I WANNA CLEAN ALL MY DRAWED AREA*/ gtk_widget_queue_draw_area(GTK_WIDGET(mem_map),0,0,910,440); /*This up should clean all the area??? */ /*And later draw things.*/ draw_brush(); } Any idea anyone??? Has done somthing similar Sorry, this is a mess, I have no idea what you are doing. However, you seem to started from the Gtk+ scribble example, so here's a patch to scribble-simple.c that adds a Clear button: === --- scribble-simple.c.orig 2007-05-02 18:27:36.0 +0200 +++ scribble-simple.c 2007-06-02 12:25:02.0 +0200 @@ -115,12 +115,21 @@ exit (0); } +static void +clear(GtkWidget *widget) +{ +gdk_draw_rectangle(pixmap, widget-style-white_gc, TRUE, + 0, 0, + widget-allocation.width, widget-allocation.height); +gtk_widget_queue_draw(widget); +} + int main( int argc, char *argv[] ) { GtkWidget *window; GtkWidget *drawing_area; - GtkWidget *vbox; + GtkWidget *vbox, *hbox; GtkWidget *button; @@ -164,16 +173,19 @@ | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK); - /* .. And a quit button */ - button = gtk_button_new_with_label (Quit); - gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); - - g_signal_connect_swapped (G_OBJECT (button), clicked, - G_CALLBACK (gtk_widget_destroy), - G_OBJECT (window)); - gtk_widget_show (button); + hbox = gtk_hbox_new(TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + + button = gtk_button_new_with_label(Clear); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + g_signal_connect_swapped(button, clicked, G_CALLBACK(clear), drawing_area); + + button = gtk_button_new_with_label(Quit); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + g_signal_connect_swapped(button, clicked, + G_CALLBACK(gtk_widget_destroy), window); - gtk_widget_show (window); + gtk_widget_show_all(window); gtk_main (); === Yeti -- http://gwyddion.net/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Clear A Pixmap
Yeti.. THANK U VERY MUCH!! Sorry for use the forum for this but... THANK YOU for YOUR HELP! You're the best David Nečas (Yeti)-2 wrote: On Fri, Jun 01, 2007 at 05:38:54PM -0700, nahuel9728 wrote: Thaxs Yeti for the answer but Sorry I'm not able to do it. I explain a little bit what im doing and i would like to do: main(){ mem_map=gtk_drawing_area_new(); gtk_signal_connect (GTK_OBJECT (mem_map), expose_event,(GtkSignalFunc) expose_event, NULL); gtk_signal_connect (GTK_OBJECT(mem_map),configure_event,(GtkSignalFunc)configure_event, NULL); gtk_signal_connect (GTK_OBJECT (mem_map), button_press_event,(GtkSignalFunc) button_press_event, NULL); /*A button to erase all the drawed and paint things*/ boton = gtk_button_new_with_label (Clear and paint); gtk_signal_connect_object (GTK_OBJECT (boton), clicked,GTK_SIGNAL_FUNC (clear_and_paint),GTK_OBJECT (main_window)); show } void expose_event(){ gdk_draw_pixmap } void clear_and_pain(GtkWidget *widget, GdkEventExpose *event){ /*HERE I WANNA CLEAN ALL MY DRAWED AREA*/ gtk_widget_queue_draw_area(GTK_WIDGET(mem_map),0,0,910,440); /*This up should clean all the area??? */ /*And later draw things.*/ draw_brush(); } Any idea anyone??? Has done somthing similar Sorry, this is a mess, I have no idea what you are doing. However, you seem to started from the Gtk+ scribble example, so here's a patch to scribble-simple.c that adds a Clear button: === --- scribble-simple.c.orig2007-05-02 18:27:36.0 +0200 +++ scribble-simple.c 2007-06-02 12:25:02.0 +0200 @@ -115,12 +115,21 @@ exit (0); } +static void +clear(GtkWidget *widget) +{ +gdk_draw_rectangle(pixmap, widget-style-white_gc, TRUE, + 0, 0, + widget-allocation.width, widget-allocation.height); +gtk_widget_queue_draw(widget); +} + int main( int argc, char *argv[] ) { GtkWidget *window; GtkWidget *drawing_area; - GtkWidget *vbox; + GtkWidget *vbox, *hbox; GtkWidget *button; @@ -164,16 +173,19 @@ | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK); - /* .. And a quit button */ - button = gtk_button_new_with_label (Quit); - gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); - - g_signal_connect_swapped (G_OBJECT (button), clicked, - G_CALLBACK (gtk_widget_destroy), - G_OBJECT (window)); - gtk_widget_show (button); + hbox = gtk_hbox_new(TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + + button = gtk_button_new_with_label(Clear); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + g_signal_connect_swapped(button, clicked, G_CALLBACK(clear), drawing_area); + + button = gtk_button_new_with_label(Quit); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + g_signal_connect_swapped(button, clicked, + G_CALLBACK(gtk_widget_destroy), window); - gtk_widget_show (window); + gtk_widget_show_all(window); gtk_main (); === Yeti -- http://gwyddion.net/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- View this message in context: http://www.nabble.com/Clear-A-Pixmap-tf3849301.html#a10928145 Sent from the Gtk+ - Apps Dev mailing list archive at Nabble.com. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list