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.ScrollableT;
26 
27 public  import gobject.ObjectG;
28 public  import gtk.Adjustment;
29 public  import gtk.Border;
30 public  import gtk.c.functions;
31 public  import gtk.c.types;
32 public  import gtkc.gtktypes;
33 
34 
35 /**
36  * #GtkScrollable is an interface that is implemented by widgets with native
37  * scrolling ability.
38  * 
39  * To implement this interface you should override the
40  * #GtkScrollable:hadjustment and #GtkScrollable:vadjustment properties.
41  * 
42  * ## Creating a scrollable widget
43  * 
44  * All scrollable widgets should do the following.
45  * 
46  * - When a parent widget sets the scrollable child widget’s adjustments,
47  * the widget should populate the adjustments’
48  * #GtkAdjustment:lower, #GtkAdjustment:upper,
49  * #GtkAdjustment:step-increment, #GtkAdjustment:page-increment and
50  * #GtkAdjustment:page-size properties and connect to the
51  * #GtkAdjustment::value-changed signal.
52  * 
53  * - Because its preferred size is the size for a fully expanded widget,
54  * the scrollable widget must be able to cope with underallocations.
55  * This means that it must accept any value passed to its
56  * #GtkWidgetClass.size_allocate() function.
57  * 
58  * - When the parent allocates space to the scrollable child widget,
59  * the widget should update the adjustments’ properties with new values.
60  * 
61  * - When any of the adjustments emits the #GtkAdjustment::value-changed signal,
62  * the scrollable widget should scroll its contents.
63  */
64 public template ScrollableT(TStruct)
65 {
66 	/** Get the main Gtk struct */
67 	public GtkScrollable* getScrollableStruct(bool transferOwnership = false)
68 	{
69 		if (transferOwnership)
70 			ownedRef = false;
71 		return cast(GtkScrollable*)getStruct();
72 	}
73 
74 
75 	/**
76 	 * Returns the size of a non-scrolling border around the
77 	 * outside of the scrollable. An example for this would
78 	 * be treeview headers. GTK+ can use this information to
79 	 * display overlayed graphics, like the overshoot indication,
80 	 * at the right position.
81 	 *
82 	 * Params:
83 	 *     border = return location for the results
84 	 *
85 	 * Returns: %TRUE if @border has been set
86 	 *
87 	 * Since: 3.16
88 	 */
89 	public bool getBorder(out Border border)
90 	{
91 		GtkBorder* outborder = gMalloc!GtkBorder();
92 
93 		auto p = gtk_scrollable_get_border(getScrollableStruct(), outborder) != 0;
94 
95 		border = ObjectG.getDObject!(Border)(outborder, true);
96 
97 		return p;
98 	}
99 
100 	/**
101 	 * Retrieves the #GtkAdjustment used for horizontal scrolling.
102 	 *
103 	 * Returns: horizontal #GtkAdjustment.
104 	 *
105 	 * Since: 3.0
106 	 */
107 	public Adjustment getHadjustment()
108 	{
109 		auto p = gtk_scrollable_get_hadjustment(getScrollableStruct());
110 
111 		if(p is null)
112 		{
113 			return null;
114 		}
115 
116 		return ObjectG.getDObject!(Adjustment)(cast(GtkAdjustment*) p);
117 	}
118 
119 	/**
120 	 * Gets the horizontal #GtkScrollablePolicy.
121 	 *
122 	 * Returns: The horizontal #GtkScrollablePolicy.
123 	 *
124 	 * Since: 3.0
125 	 */
126 	public GtkScrollablePolicy getHscrollPolicy()
127 	{
128 		return gtk_scrollable_get_hscroll_policy(getScrollableStruct());
129 	}
130 
131 	/**
132 	 * Retrieves the #GtkAdjustment used for vertical scrolling.
133 	 *
134 	 * Returns: vertical #GtkAdjustment.
135 	 *
136 	 * Since: 3.0
137 	 */
138 	public Adjustment getVadjustment()
139 	{
140 		auto p = gtk_scrollable_get_vadjustment(getScrollableStruct());
141 
142 		if(p is null)
143 		{
144 			return null;
145 		}
146 
147 		return ObjectG.getDObject!(Adjustment)(cast(GtkAdjustment*) p);
148 	}
149 
150 	/**
151 	 * Gets the vertical #GtkScrollablePolicy.
152 	 *
153 	 * Returns: The vertical #GtkScrollablePolicy.
154 	 *
155 	 * Since: 3.0
156 	 */
157 	public GtkScrollablePolicy getVscrollPolicy()
158 	{
159 		return gtk_scrollable_get_vscroll_policy(getScrollableStruct());
160 	}
161 
162 	/**
163 	 * Sets the horizontal adjustment of the #GtkScrollable.
164 	 *
165 	 * Params:
166 	 *     hadjustment = a #GtkAdjustment
167 	 *
168 	 * Since: 3.0
169 	 */
170 	public void setHadjustment(Adjustment hadjustment)
171 	{
172 		gtk_scrollable_set_hadjustment(getScrollableStruct(), (hadjustment is null) ? null : hadjustment.getAdjustmentStruct());
173 	}
174 
175 	/**
176 	 * Sets the #GtkScrollablePolicy to determine whether
177 	 * horizontal scrolling should start below the minimum width or
178 	 * below the natural width.
179 	 *
180 	 * Params:
181 	 *     policy = the horizontal #GtkScrollablePolicy
182 	 *
183 	 * Since: 3.0
184 	 */
185 	public void setHscrollPolicy(GtkScrollablePolicy policy)
186 	{
187 		gtk_scrollable_set_hscroll_policy(getScrollableStruct(), policy);
188 	}
189 
190 	/**
191 	 * Sets the vertical adjustment of the #GtkScrollable.
192 	 *
193 	 * Params:
194 	 *     vadjustment = a #GtkAdjustment
195 	 *
196 	 * Since: 3.0
197 	 */
198 	public void setVadjustment(Adjustment vadjustment)
199 	{
200 		gtk_scrollable_set_vadjustment(getScrollableStruct(), (vadjustment is null) ? null : vadjustment.getAdjustmentStruct());
201 	}
202 
203 	/**
204 	 * Sets the #GtkScrollablePolicy to determine whether
205 	 * vertical scrolling should start below the minimum height or
206 	 * below the natural height.
207 	 *
208 	 * Params:
209 	 *     policy = the vertical #GtkScrollablePolicy
210 	 *
211 	 * Since: 3.0
212 	 */
213 	public void setVscrollPolicy(GtkScrollablePolicy policy)
214 	{
215 		gtk_scrollable_set_vscroll_policy(getScrollableStruct(), policy);
216 	}
217 }