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