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