1 / 4

Sung-Ju Kang Department of Physics Kangwon National University

Handling Area in The Drawingarea. Sung-Ju Kang Department of Physics Kangwon National University. We will handle the area in the drawingarea widget. The area is determined by GDK event. and we can handle the area. We use the dialog box for the area handling. Select The Area.

lars
Download Presentation

Sung-Ju Kang Department of Physics Kangwon National University

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Handling Area in The Drawingarea. Sung-Ju Kang Department of Physics Kangwon National University We will handle the area in the drawingarea widget. The area is determined by GDK event. and we can handle the area. We use the dialog box for the area handling.

  2. Select The Area To select the area is to find two points. We use the GDK event. GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK gboolean on_drawingarea1_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data) { X1 = (event->x); Y1 = (event->y); coords = g_strdup_printf("%5.3lf, %5.3lf\n",X1,Y1); gtk_label_set( GTK_LABEL(user_data), coords ); return TRUE; }

  3. void gdk_draw_rectangle (GdkDrawable *drawable, GdkGC *gc, gint filled, gint x, gint y, gint width, gint height); Coordinate of the left top edge of the rectangle. The width of the rectangle. The height of the rectangle. Express The Area as The Rectangle Description the gdk_draw_rectangle gboolean on_drawingarea1_button_release_event (GtkWidget *widget, GdkEventButton *event, gpointer drawingarea1) { GdkGC *plot_gc plot_gc=GTK_WIDGET(drawingarea1)->style->black_gc; gdk_draw_rectangle(GTK_WIDGET(drawingarea1)->window,plot_gc,FALSE,X1,Y1,100,100); }

  4. Toolbar Rectangle Coordinate The Result of The Area as The Rectangle

More Related