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  = 
27  * outPack = gtk
28  * outFile = Border
29  * strct   = GtkBorder
30  * realStrct=
31  * ctorStrct=
32  * clss    = Border
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = GBoxed
38  * implements:
39  * prefixes:
40  * 	- gtk_border_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- gtkc.paths
47  * 	- gtkc.Loader
48  * structWrap:
49  * 	- GtkBorder* -> Border
50  * module aliases:
51  * local aliases:
52  * overrides:
53  */
54 
55 module gtk.Border;
56 
57 public  import gtkc.gtktypes;
58 
59 private import gtkc.gtk;
60 private import glib.ConstructionException;
61 private import gobject.ObjectG;
62 
63 private import gobject.Signals;
64 public  import gtkc.gdktypes;
65 
66 private import gtkc.paths;
67 private import gtkc.Loader;
68 
69 
70 
71 private import gobject.Boxed;
72 
73 /**
74  * GtkStyleContext is an object that stores styling information affecting
75  * a widget defined by GtkWidgetPath.
76  *
77  * In order to construct the final style information, GtkStyleContext
78  * queries information from all attached GtkStyleProviders. Style providers
79  * can be either attached explicitly to the context through
80  * gtk_style_context_add_provider(), or to the screen through
81  * gtk_style_context_add_provider_for_screen(). The resulting style is a
82  * combination of all providers' information in priority order.
83  *
84  * For GTK+ widgets, any GtkStyleContext returned by
85  * gtk_widget_get_style_context() will already have a GtkWidgetPath, a
86  * GdkScreen and RTL/LTR information set. The style context will be also
87  * updated automatically if any of these settings change on the widget.
88  *
89  * If you are using the theming layer standalone, you will need to set a
90  * widget path and a screen yourself to the created style context through
91  * gtk_style_context_set_path() and gtk_style_context_set_screen(), as well
92  * as updating the context yourself using gtk_style_context_invalidate()
93  * whenever any of the conditions change, such as a change in the
94  * "gtk-theme-name" setting or a hierarchy change in the rendered
95  * widget.
96  *
97  * Transition animations
98  *
99  * GtkStyleContext has built-in support for state change transitions.
100  * Note that these animations respect the "gtk-enable-animations"
101  * setting.
102  *
103  * For simple widgets where state changes affect the whole widget area,
104  * calling gtk_style_context_notify_state_change() with a NULL region
105  * is sufficient to trigger the transition animation. And GTK+ already
106  * does that when gtk_widget_set_state() or gtk_widget_set_state_flags()
107  * are called.
108  *
109  * If a widget needs to declare several animatable regions (i.e. not
110  * affecting the whole widget area), its "draw" signal handler
111  * needs to wrap the render operations for the different regions with
112  * calls to gtk_style_context_push_animatable_region() and
113  * gtk_style_context_pop_animatable_region(). These functions take an
114  * identifier for the region which must be unique within the style context.
115  * For simple widgets with a fixed set of animatable regions, using an
116  * enumeration works well:
117  *
118  * $(DDOC_COMMENT example)
119  *
120  * For complex widgets with an arbitrary number of animatable regions, it
121  * is up to the implementation to come up with a way to uniquely identify
122  * each animatable region. Using pointers to internal structs is one way
123  * to achieve this:
124  *
125  * $(DDOC_COMMENT example)
126  *
127  * The widget also needs to notify the style context about a state change
128  * for a given animatable region so the animation is triggered.
129  *
130  * $(DDOC_COMMENT example)
131  *
132  * gtk_style_context_notify_state_change() accepts NULL region IDs as a
133  * special value, in this case, the whole widget area will be updated
134  * by the animation.
135  *
136  * <hr>
137  *
138  * Style classes and regions
139  *
140  * Widgets can add style classes to their context, which can be used
141  * to associate different styles by class (see the section called “Selectors”). Theme engines can also use style classes to vary their
142  * rendering. GTK+ has a number of predefined style classes:
143  * GTK_STYLE_CLASS_CELL,
144  * GTK_STYLE_CLASS_ENTRY,
145  * GTK_STYLE_CLASS_BUTTON,
146  * GTK_STYLE_CLASS_COMBOBOX_ENTRY,
147  * GTK_STYLE_CLASS_CALENDAR,
148  * GTK_STYLE_CLASS_SLIDER,
149  * GTK_STYLE_CLASS_BACKGROUND,
150  * GTK_STYLE_CLASS_RUBBERBAND,
151  * GTK_STYLE_CLASS_TOOLTIP,
152  * GTK_STYLE_CLASS_MENU,
153  * GTK_STYLE_CLASS_MENUBAR,
154  * GTK_STYLE_CLASS_MENUITEM,
155  * GTK_STYLE_CLASS_TOOLBAR,
156  * GTK_STYLE_CLASS_PRIMARY_TOOLBAR,
157  * GTK_STYLE_CLASS_INLINE_TOOLBAR,
158  * GTK_STYLE_CLASS_RADIO,
159  * GTK_STYLE_CLASS_CHECK,
160  * GTK_STYLE_CLASS_TROUGH,
161  * GTK_STYLE_CLASS_SCROLLBAR,
162  * GTK_STYLE_CLASS_SCALE,
163  * GTK_STYLE_CLASS_SCALE_HAS_MARKS_ABOVE,
164  * GTK_STYLE_CLASS_SCALE_HAS_MARKS_BELOW,
165  * GTK_STYLE_CLASS_HEADER,
166  * GTK_STYLE_CLASS_ACCELERATOR,
167  * GTK_STYLE_CLASS_GRIP,
168  * GTK_STYLE_CLASS_DOCK,
169  * GTK_STYLE_CLASS_PROGRESSBAR,
170  * GTK_STYLE_CLASS_SPINNER,
171  * GTK_STYLE_CLASS_EXPANDER,
172  * GTK_STYLE_CLASS_SPINBUTTON,
173  * GTK_STYLE_CLASS_NOTEBOOK,
174  * GTK_STYLE_CLASS_VIEW,
175  * GTK_STYLE_CLASS_SIDEBAR,
176  * GTK_STYLE_CLASS_IMAGE,
177  * GTK_STYLE_CLASS_HIGHLIGHT,
178  * GTK_STYLE_CLASS_FRAME,
179  * GTK_STYLE_CLASS_DND,
180  * GTK_STYLE_CLASS_PANE_SEPARATOR,
181  * GTK_STYLE_CLASS_SEPARATOR,
182  * GTK_STYLE_CLASS_INFO,
183  * GTK_STYLE_CLASS_WARNING,
184  * GTK_STYLE_CLASS_QUESTION,
185  * GTK_STYLE_CLASS_ERROR,
186  * GTK_STYLE_CLASS_HORIZONTAL,
187  * GTK_STYLE_CLASS_VERTICAL,
188  * GTK_STYLE_CLASS_TOP,
189  * GTK_STYLE_CLASS_BOTTOM,
190  * GTK_STYLE_CLASS_LEFT,
191  * GTK_STYLE_CLASS_RIGHT,
192  *
193  * Widgets can also add regions with flags to their context.
194  * The regions used by GTK+ widgets are:
195  *
196  * Region
197  * Flags
198  * Macro
199  * Used by
200  *
201  * row
202  * even, odd
203  * GTK_STYLE_REGION_ROW
204  * GtkTreeView
205  *
206  * column
207  * first, last, sorted
208  * GTK_STYLE_REGION_COLUMN
209  * GtkTreeView
210  *
211  * column-header
212  *
213  * GTK_STYLE_REGION_COLUMN_HEADER
214  *
215  * tab
216  * even, odd, first, last
217  * GTK_STYLE_REGION_TAB
218  * GtkNotebook
219  *
220  * <hr>
221  *
222  * Custom styling in UI libraries and applications
223  *
224  * If you are developing a library with custom GtkWidgets that
225  * render differently than standard components, you may need to add a
226  * GtkStyleProvider yourself with the GTK_STYLE_PROVIDER_PRIORITY_FALLBACK
227  * priority, either a GtkCssProvider or a custom object implementing the
228  * GtkStyleProvider interface. This way theming engines may still attempt
229  * to style your UI elements in a different way if needed so.
230  *
231  * If you are using custom styling on an applications, you probably want then
232  * to make your style information prevail to the theme's, so you must use
233  * a GtkStyleProvider with the GTK_STYLE_PROVIDER_PRIORITY_APPLICATION
234  * priority, keep in mind that the user settings in
235  * XDG_CONFIG_HOME/gtk-3.0/gtk.css will
236  * still take precedence over your changes, as it uses the
237  * GTK_STYLE_PROVIDER_PRIORITY_USER priority.
238  *
239  * If a custom theming engine is needed, you probably want to implement a
240  * GtkStyleProvider yourself so it points to your GtkThemingEngine
241  * implementation, as GtkCssProvider uses gtk_theming_engine_load()
242  * which loads the theming engine module from the standard paths.
243  */
244 public class Border : Boxed
245 {
246 	
247 	/** the main Gtk struct */
248 	protected GtkBorder* gtkBorder;
249 	
250 	
251 	public GtkBorder* getBorderStruct()
252 	{
253 		return gtkBorder;
254 	}
255 	
256 	
257 	/** the main Gtk struct as a void* */
258 	protected void* getStruct()
259 	{
260 		return cast(void*)gtkBorder;
261 	}
262 	
263 	/**
264 	 * Sets our main struct and passes it to the parent class
265 	 */
266 	public this (GtkBorder* gtkBorder)
267 	{
268 		this.gtkBorder = gtkBorder;
269 	}
270 	
271 	~this ()
272 	{
273 		if ( Linker.isLoaded(LIBRARY.GTK) && gtkBorder !is null )
274 		{
275 			gtk_border_free(gtkBorder);
276 		}
277 	}
278 	
279 	/**
280 	 */
281 	int[string] connectedSignals;
282 	
283 	void delegate(Border)[] onChangedListeners;
284 	/**
285 	 */
286 	void addOnChanged(void delegate(Border) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
287 	{
288 		if ( !("changed" in connectedSignals) )
289 		{
290 			Signals.connectData(
291 			getStruct(),
292 			"changed",
293 			cast(GCallback)&callBackChanged,
294 			cast(void*)this,
295 			null,
296 			connectFlags);
297 			connectedSignals["changed"] = 1;
298 		}
299 		onChangedListeners ~= dlg;
300 	}
301 	extern(C) static void callBackChanged(GtkStyleContext* stylecontextStruct, Border _border)
302 	{
303 		foreach ( void delegate(Border) dlg ; _border.onChangedListeners )
304 		{
305 			dlg(_border);
306 		}
307 	}
308 	
309 	
310 	/**
311 	 * Allocates a new GtkBorder structure and initializes its elements to zero.
312 	 * Since 2.14
313 	 * Throws: ConstructionException GTK+ fails to create the object.
314 	 */
315 	public this ()
316 	{
317 		// GtkBorder * gtk_border_new (void);
318 		auto p = gtk_border_new();
319 		if(p is null)
320 		{
321 			throw new ConstructionException("null returned by gtk_border_new()");
322 		}
323 		this(cast(GtkBorder*) p);
324 	}
325 	
326 	/**
327 	 * Copies a GtkBorder structure.
328 	 * Returns: a copy of border_.
329 	 */
330 	public Border copy()
331 	{
332 		// GtkBorder * gtk_border_copy (const GtkBorder *border_);
333 		auto p = gtk_border_copy(gtkBorder);
334 		
335 		if(p is null)
336 		{
337 			return null;
338 		}
339 		
340 		return ObjectG.getDObject!(Border)(cast(GtkBorder*) p);
341 	}
342 	
343 	/**
344 	 * Frees a GtkBorder structure.
345 	 */
346 	public void free()
347 	{
348 		// void gtk_border_free (GtkBorder *border_);
349 		gtk_border_free(gtkBorder);
350 	}
351 }