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