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 
63 
64 private import gtk.Widget;
65 
66 /**
67  * The GtkDrawingArea widget is used for creating custom user interface
68  * elements. It's essentially a blank widget; you can draw on it. After
69  * creating a drawing area, the application may want to connect to:
70  *
71  *  Mouse and button press signals to respond to input from
72  *  the user. (Use gtk_widget_add_events() to enable events
73  *  you wish to receive.)
74  *
75  *  The "realize" signal to take any necessary actions
76  *  when the widget is instantiated on a particular display.
77  *  (Create GDK resources in response to this signal.)
78  *
79  *  The "configure-event" signal to take any necessary
80  *  actions when the widget changes size.
81  *
82  *  The "draw" signal to handle redrawing the
83  *  contents of the widget.
84  *
85  * The following code portion demonstrates using a drawing
86  * area to display a circle in the normal widget foreground
87  * color.
88  *
89  * Note that GDK automatically clears the exposed area to the
90  * background color before sending the expose event, and that
91  * drawing is implicitly clipped to the exposed area.
92  *
93  * $(DDOC_COMMENT example)
94  *
95  * Draw signals are normally delivered when a drawing area first comes
96  * onscreen, or when it's covered by another window and then uncovered.
97  * You can also force an expose event by adding to the "damage region"
98  * of the drawing area's window; gtk_widget_queue_draw_area() and
99  * gdk_window_invalidate_rect() are equally good ways to do this.
100  * You'll then get a draw signal for the invalid region.
101  *
102  * The available routines for drawing are documented on the GDK Drawing Primitives page
103  * and the cairo documentation.
104  *
105  * To receive mouse events on a drawing area, you will need to enable
106  * them with gtk_widget_add_events(). To receive keyboard events, you
107  * will need to set the "can-focus" property on the drawing area, and you
108  * should probably draw some user-visible indication that the drawing
109  * area is focused. Use gtk_widget_has_focus() in your expose event
110  * handler to decide whether to draw the focus indicator. See
111  * gtk_render_focus() for one way to draw focus.
112  */
113 public class DrawingArea : Widget
114 {
115 	
116 	/** the main Gtk struct */
117 	protected GtkDrawingArea* gtkDrawingArea;
118 	
119 	
120 	public GtkDrawingArea* getDrawingAreaStruct()
121 	{
122 		return gtkDrawingArea;
123 	}
124 	
125 	
126 	/** the main Gtk struct as a void* */
127 	protected override void* getStruct()
128 	{
129 		return cast(void*)gtkDrawingArea;
130 	}
131 	
132 	/**
133 	 * Sets our main struct and passes it to the parent class
134 	 */
135 	public this (GtkDrawingArea* gtkDrawingArea)
136 	{
137 		super(cast(GtkWidget*)gtkDrawingArea);
138 		this.gtkDrawingArea = gtkDrawingArea;
139 	}
140 	
141 	protected override void setStruct(GObject* obj)
142 	{
143 		super.setStruct(obj);
144 		gtkDrawingArea = cast(GtkDrawingArea*)obj;
145 	}
146 	
147 	/**
148 	 * Create a new DrawingArea and sets the SizeRequest
149 	 * Params:
150 	 *    	width =
151 	 *    	height =
152 	 */
153 	this(int width, int height)
154 	{
155 		this();
156 		setSizeRequest(width, height);
157 	}
158 	
159 	/**
160 	 */
161 	
162 	/**
163 	 * Creates a new drawing area.
164 	 * Throws: ConstructionException GTK+ fails to create the object.
165 	 */
166 	public this ()
167 	{
168 		// GtkWidget * gtk_drawing_area_new (void);
169 		auto p = gtk_drawing_area_new();
170 		if(p is null)
171 		{
172 			throw new ConstructionException("null returned by gtk_drawing_area_new()");
173 		}
174 		this(cast(GtkDrawingArea*) p);
175 	}
176 }