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(out Border border) 87 { 88 GtkBorder* outborder = gMalloc!GtkBorder(); 89 90 auto p = gtk_scrollable_get_border(getScrollableStruct(), outborder) != 0; 91 92 border = ObjectG.getDObject!(Border)(outborder, true); 93 94 return p; 95 } 96 97 /** 98 * Retrieves the #GtkAdjustment used for horizontal scrolling. 99 * 100 * Return: horizontal #GtkAdjustment. 101 * 102 * Since: 3.0 103 */ 104 public Adjustment getHadjustment() 105 { 106 auto p = gtk_scrollable_get_hadjustment(getScrollableStruct()); 107 108 if(p is null) 109 { 110 return null; 111 } 112 113 return ObjectG.getDObject!(Adjustment)(cast(GtkAdjustment*) p); 114 } 115 116 /** 117 * Gets the horizontal #GtkScrollablePolicy. 118 * 119 * Return: The horizontal #GtkScrollablePolicy. 120 * 121 * Since: 3.0 122 */ 123 public GtkScrollablePolicy getHscrollPolicy() 124 { 125 return gtk_scrollable_get_hscroll_policy(getScrollableStruct()); 126 } 127 128 /** 129 * Retrieves the #GtkAdjustment used for vertical scrolling. 130 * 131 * Return: vertical #GtkAdjustment. 132 * 133 * Since: 3.0 134 */ 135 public Adjustment getVadjustment() 136 { 137 auto p = gtk_scrollable_get_vadjustment(getScrollableStruct()); 138 139 if(p is null) 140 { 141 return null; 142 } 143 144 return ObjectG.getDObject!(Adjustment)(cast(GtkAdjustment*) p); 145 } 146 147 /** 148 * Gets the vertical #GtkScrollablePolicy. 149 * 150 * Return: The vertical #GtkScrollablePolicy. 151 * 152 * Since: 3.0 153 */ 154 public GtkScrollablePolicy getVscrollPolicy() 155 { 156 return gtk_scrollable_get_vscroll_policy(getScrollableStruct()); 157 } 158 159 /** 160 * Sets the horizontal adjustment of the #GtkScrollable. 161 * 162 * Params: 163 * hadjustment = a #GtkAdjustment 164 * 165 * Since: 3.0 166 */ 167 public void setHadjustment(Adjustment hadjustment) 168 { 169 gtk_scrollable_set_hadjustment(getScrollableStruct(), (hadjustment is null) ? null : hadjustment.getAdjustmentStruct()); 170 } 171 172 /** 173 * Sets the #GtkScrollablePolicy to determine whether 174 * horizontal scrolling should start below the minimum width or 175 * below the natural width. 176 * 177 * Params: 178 * policy = the horizontal #GtkScrollablePolicy 179 * 180 * Since: 3.0 181 */ 182 public void setHscrollPolicy(GtkScrollablePolicy policy) 183 { 184 gtk_scrollable_set_hscroll_policy(getScrollableStruct(), policy); 185 } 186 187 /** 188 * Sets the vertical adjustment of the #GtkScrollable. 189 * 190 * Params: 191 * vadjustment = a #GtkAdjustment 192 * 193 * Since: 3.0 194 */ 195 public void setVadjustment(Adjustment vadjustment) 196 { 197 gtk_scrollable_set_vadjustment(getScrollableStruct(), (vadjustment is null) ? null : vadjustment.getAdjustmentStruct()); 198 } 199 200 /** 201 * Sets the #GtkScrollablePolicy to determine whether 202 * vertical scrolling should start below the minimum height or 203 * below the natural height. 204 * 205 * Params: 206 * policy = the vertical #GtkScrollablePolicy 207 * 208 * Since: 3.0 209 */ 210 public void setVscrollPolicy(GtkScrollablePolicy policy) 211 { 212 gtk_scrollable_set_vscroll_policy(getScrollableStruct(), policy); 213 } 214 }