1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = GtkDrawingArea.html
27  * outPack = gtk
28  * outFile = DrawingArea
29  * strct   = GtkDrawingArea
30  * realStrct=
31  * ctorStrct=
32  * clss    = DrawingArea
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_drawing_area_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * structWrap:
47  * module aliases:
48  * local aliases:
49  * overrides:
50  */
51 
52 module gtk.DrawingArea;
53 
54 public  import gtkc.gtktypes;
55 
56 private import gtkc.gtk;
57 private import glib.ConstructionException;
58 private import gobject.ObjectG;
59 
60 
61 
62 private import gtk.Widget;
63 
64 /**
65  * The GtkDrawingArea widget is used for creating custom user interface
66  * elements. It's essentially a blank widget; you can draw on it. After
67  * creating a drawing area, the application may want to connect to:
68  *
69  *  Mouse and button press signals to respond to input from
70  *  the user. (Use gtk_widget_add_events() to enable events
71  *  you wish to receive.)
72  *
73  *  The "realize" signal to take any necessary actions
74  *  when the widget is instantiated on a particular display.
75  *  (Create GDK resources in response to this signal.)
76  *
77  *  The "configure-event" signal to take any necessary
78  *  actions when the widget changes size.
79  *
80  *  The "draw" signal to handle redrawing the
81  *  contents of the widget.
82  *
83  * The following code portion demonstrates using a drawing
84  * area to display a circle in the normal widget foreground
85  * color.
86  *
87  * Note that GDK automatically clears the exposed area to the
88  * background color before sending the expose event, and that
89  * drawing is implicitly clipped to the exposed area.
90  *
91  * $(DDOC_COMMENT example)
92  *
93  * Draw signals are normally delivered when a drawing area first comes
94  * onscreen, or when it's covered by another window and then uncovered.
95  * You can also force an expose event by adding to the "damage region"
96  * of the drawing area's window; gtk_widget_queue_draw_area() and
97  * gdk_window_invalidate_rect() are equally good ways to do this.
98  * You'll then get a draw signal for the invalid region.
99  *
100  * The available routines for drawing are documented on the GDK Drawing Primitives page
101  * and the cairo documentation.
102  *
103  * To receive mouse events on a drawing area, you will need to enable
104  * them with gtk_widget_add_events(). To receive keyboard events, you
105  * will need to set the "can-focus" property on the drawing area, and you
106  * should probably draw some user-visible indication that the drawing
107  * area is focused. Use gtk_widget_has_focus() in your expose event
108  * handler to decide whether to draw the focus indicator. See
109  * gtk_render_focus() for one way to draw focus.
110  */
111 public class DrawingArea : Widget
112 {
113 	
114 	/** the main Gtk struct */
115 	protected GtkDrawingArea* gtkDrawingArea;
116 	
117 	
118 	/** Get the main Gtk struct */
119 	public GtkDrawingArea* getDrawingAreaStruct()
120 	{
121 		return gtkDrawingArea;
122 	}
123 	
124 	
125 	/** the main Gtk struct as a void* */
126 	protected override void* getStruct()
127 	{
128 		return cast(void*)gtkDrawingArea;
129 	}
130 	
131 	/**
132 	 * Sets our main struct and passes it to the parent class
133 	 */
134 	public this (GtkDrawingArea* gtkDrawingArea)
135 	{
136 		super(cast(GtkWidget*)gtkDrawingArea);
137 		this.gtkDrawingArea = gtkDrawingArea;
138 	}
139 	
140 	protected override void setStruct(GObject* obj)
141 	{
142 		super.setStruct(obj);
143 		gtkDrawingArea = cast(GtkDrawingArea*)obj;
144 	}
145 	
146 	/**
147 	 * Create a new DrawingArea and sets the SizeRequest
148 	 * Params:
149 	 *    	width =
150 	 *    	height =
151 	 */
152 	this(int width, int height)
153 	{
154 		this();
155 		setSizeRequest(width, height);
156 	}
157 	
158 	/**
159 	 */
160 	
161 	/**
162 	 * Creates a new drawing area.
163 	 * Throws: ConstructionException GTK+ fails to create the object.
164 	 */
165 	public this ()
166 	{
167 		// GtkWidget * gtk_drawing_area_new (void);
168 		auto p = gtk_drawing_area_new();
169 		if(p is null)
170 		{
171 			throw new ConstructionException("null returned by gtk_drawing_area_new()");
172 		}
173 		this(cast(GtkDrawingArea*) p);
174 	}
175 }