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