[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Clear A Pixmap
- From: nahuel9728 <nahuelsgk hotmail com>
- To: gtk-app-devel-list gnome org
- Subject: Re: Clear A Pixmap
- Date: Sat, 2 Jun 2007 08:00:59 -0700 (PDT)
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.orig 2007-05-02 18:27:36.000000000 +0200
> +++ scribble-simple.c 2007-06-02 12:25:02.000000000 +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.
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]