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