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(bool transferOwnership = false) 67 { 68 if (transferOwnership) 69 ownedRef = false; 70 return cast(GtkScrollable*)getStruct(); 71 } 72 73 74 /** 75 * Returns the size of a non-scrolling border around the 76 * outside of the scrollable. An example for this would 77 * be treeview headers. GTK+ can use this information to 78 * display overlayed graphics, like the overshoot indication, 79 * at the right position. 80 * 81 * Params: 82 * border = return location for the results 83 * 84 * Returns: %TRUE if @border has been set 85 * 86 * Since: 3.16 87 */ 88 public bool getBorder(out Border border) 89 { 90 GtkBorder* outborder = gMalloc!GtkBorder(); 91 92 auto p = gtk_scrollable_get_border(getScrollableStruct(), outborder) != 0; 93 94 border = ObjectG.getDObject!(Border)(outborder, true); 95 96 return p; 97 } 98 99 /** 100 * Retrieves the #GtkAdjustment used for horizontal scrolling. 101 * 102 * Returns: horizontal #GtkAdjustment. 103 * 104 * Since: 3.0 105 */ 106 public Adjustment getHadjustment() 107 { 108 auto p = gtk_scrollable_get_hadjustment(getScrollableStruct()); 109 110 if(p is null) 111 { 112 return null; 113 } 114 115 return ObjectG.getDObject!(Adjustment)(cast(GtkAdjustment*) p); 116 } 117 118 /** 119 * Gets the horizontal #GtkScrollablePolicy. 120 * 121 * Returns: The horizontal #GtkScrollablePolicy. 122 * 123 * Since: 3.0 124 */ 125 public GtkScrollablePolicy getHscrollPolicy() 126 { 127 return gtk_scrollable_get_hscroll_policy(getScrollableStruct()); 128 } 129 130 /** 131 * Retrieves the #GtkAdjustment used for vertical scrolling. 132 * 133 * Returns: vertical #GtkAdjustment. 134 * 135 * Since: 3.0 136 */ 137 public Adjustment getVadjustment() 138 { 139 auto p = gtk_scrollable_get_vadjustment(getScrollableStruct()); 140 141 if(p is null) 142 { 143 return null; 144 } 145 146 return ObjectG.getDObject!(Adjustment)(cast(GtkAdjustment*) p); 147 } 148 149 /** 150 * Gets the vertical #GtkScrollablePolicy. 151 * 152 * Returns: The vertical #GtkScrollablePolicy. 153 * 154 * Since: 3.0 155 */ 156 public GtkScrollablePolicy getVscrollPolicy() 157 { 158 return gtk_scrollable_get_vscroll_policy(getScrollableStruct()); 159 } 160 161 /** 162 * Sets the horizontal adjustment of the #GtkScrollable. 163 * 164 * Params: 165 * hadjustment = a #GtkAdjustment 166 * 167 * Since: 3.0 168 */ 169 public void setHadjustment(Adjustment hadjustment) 170 { 171 gtk_scrollable_set_hadjustment(getScrollableStruct(), (hadjustment is null) ? null : hadjustment.getAdjustmentStruct()); 172 } 173 174 /** 175 * Sets the #GtkScrollablePolicy to determine whether 176 * horizontal scrolling should start below the minimum width or 177 * below the natural width. 178 * 179 * Params: 180 * policy = the horizontal #GtkScrollablePolicy 181 * 182 * Since: 3.0 183 */ 184 public void setHscrollPolicy(GtkScrollablePolicy policy) 185 { 186 gtk_scrollable_set_hscroll_policy(getScrollableStruct(), policy); 187 } 188 189 /** 190 * Sets the vertical adjustment of the #GtkScrollable. 191 * 192 * Params: 193 * vadjustment = a #GtkAdjustment 194 * 195 * Since: 3.0 196 */ 197 public void setVadjustment(Adjustment vadjustment) 198 { 199 gtk_scrollable_set_vadjustment(getScrollableStruct(), (vadjustment is null) ? null : vadjustment.getAdjustmentStruct()); 200 } 201 202 /** 203 * Sets the #GtkScrollablePolicy to determine whether 204 * vertical scrolling should start below the minimum height or 205 * below the natural height. 206 * 207 * Params: 208 * policy = the vertical #GtkScrollablePolicy 209 * 210 * Since: 3.0 211 */ 212 public void setVscrollPolicy(GtkScrollablePolicy policy) 213 { 214 gtk_scrollable_set_vscroll_policy(getScrollableStruct(), policy); 215 } 216 }