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 module gtk.ContainerClass;
26 
27 private import glib.Str;
28 private import gobject.ObjectG;
29 private import gobject.ParamSpec;
30 private import gtkc.gtk;
31 public  import gtkc.gtktypes;
32 
33 
34 /**
35  * Base class for containers.
36  */
37 public class ContainerClass
38 {
39 	/** the main Gtk struct */
40 	protected GtkContainerClass* gtkContainerClass;
41 
42 	/** Get the main Gtk struct */
43 	public GtkContainerClass* getContainerClassStruct()
44 	{
45 		return gtkContainerClass;
46 	}
47 
48 	/** the main Gtk struct as a void* */
49 	protected void* getStruct()
50 	{
51 		return cast(void*)gtkContainerClass;
52 	}
53 
54 	/**
55 	 * Sets our main struct and passes it to the parent class.
56 	 */
57 	public this (GtkContainerClass* gtkContainerClass)
58 	{
59 		this.gtkContainerClass = gtkContainerClass;
60 	}
61 
62 	/**
63 	 */
64 
65 	/**
66 	 * Finds a child property of a container class by name.
67 	 *
68 	 * Params:
69 	 *     propertyName = the name of the child property to find
70 	 *
71 	 * Return: the #GParamSpec of the child
72 	 *     property or %NULL if @class has no child property with that
73 	 *     name.
74 	 */
75 	public ParamSpec findChildProperty(string propertyName)
76 	{
77 		auto p = gtk_container_class_find_child_property(cast(GObjectClass*)gtkContainerClass, Str.toStringz(propertyName));
78 		
79 		if(p is null)
80 		{
81 			return null;
82 		}
83 		
84 		return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p);
85 	}
86 
87 	/**
88 	 * Modifies a subclass of #GtkContainerClass to automatically add and
89 	 * remove the border-width setting on GtkContainer.  This allows the
90 	 * subclass to ignore the border width in its size request and
91 	 * allocate methods. The intent is for a subclass to invoke this
92 	 * in its class_init function.
93 	 *
94 	 * gtk_container_class_handle_border_width() is necessary because it
95 	 * would break API too badly to make this behavior the default. So
96 	 * subclasses must “opt in” to the parent class handling border_width
97 	 * for them.
98 	 */
99 	public void handleBorderWidth()
100 	{
101 		gtk_container_class_handle_border_width(gtkContainerClass);
102 	}
103 
104 	/**
105 	 * Installs a child property on a container class.
106 	 *
107 	 * Params:
108 	 *     propertyId = the id for the property
109 	 *     pspec = the #GParamSpec for the property
110 	 */
111 	public void installChildProperty(uint propertyId, ParamSpec pspec)
112 	{
113 		gtk_container_class_install_child_property(gtkContainerClass, propertyId, (pspec is null) ? null : pspec.getParamSpecStruct());
114 	}
115 
116 	/**
117 	 * Returns all child properties of a container class.
118 	 *
119 	 * Params:
120 	 *     nProperties = location to return the number of child properties found
121 	 *
122 	 * Return: a newly allocated %NULL-terminated array of #GParamSpec*.
123 	 *     The array must be freed with g_free().
124 	 */
125 	public ParamSpec[] listChildProperties()
126 	{
127 		uint nProperties;
128 		
129 		auto p = gtk_container_class_list_child_properties(cast(GObjectClass*)gtkContainerClass, &nProperties);
130 		
131 		if(p is null)
132 		{
133 			return null;
134 		}
135 		
136 		ParamSpec[] arr = new ParamSpec[nProperties];
137 		for(int i = 0; i < nProperties; i++)
138 		{
139 			arr[i] = ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p[i]);
140 		}
141 		
142 		return arr;
143 	}
144 }