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