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 glib.MemorySlice; 28 public import gobject.ObjectG; 29 public import gtk.Adjustment; 30 public import gtk.Border; 31 public import gtk.c.functions; 32 public import gtk.c.types; 33 34 35 /** 36 * `GtkScrollable` is an interface for widgets with native scrolling ability. 37 * 38 * To implement this interface you should override the 39 * [property@Gtk.Scrollable:hadjustment] and 40 * [property@Gtk.Scrollable:vadjustment] properties. 41 * 42 * ## Creating a scrollable widget 43 * 44 * All scrollable widgets should do the following. 45 * 46 * - When a parent widget sets the scrollable child widget’s adjustments, 47 * the widget should populate the adjustments’ 48 * [property@Gtk.Adjustment:lower], 49 * [property@Gtk.Adjustment:upper], 50 * [property@Gtk.Adjustment:step-increment], 51 * [property@Gtk.Adjustment:page-increment] and 52 * [property@Gtk.Adjustment:page-size] properties and connect to the 53 * [signal@Gtk.Adjustment::value-changed] signal. 54 * 55 * - Because its preferred size is the size for a fully expanded widget, 56 * the scrollable widget must be able to cope with underallocations. 57 * This means that it must accept any value passed to its 58 * GtkWidgetClass.size_allocate() function. 59 * 60 * - When the parent allocates space to the scrollable child widget, 61 * the widget should update the adjustments’ properties with new values. 62 * 63 * - When any of the adjustments emits the [signal@Gtk.Adjustment::value-changed] 64 * signal, the scrollable widget should scroll its contents. 65 */ 66 public template ScrollableT(TStruct) 67 { 68 /** Get the main Gtk struct */ 69 public GtkScrollable* getScrollableStruct(bool transferOwnership = false) 70 { 71 if (transferOwnership) 72 ownedRef = false; 73 return cast(GtkScrollable*)getStruct(); 74 } 75 76 77 /** 78 * Returns the size of a non-scrolling border around the 79 * outside of the scrollable. 80 * 81 * An example for this would be treeview headers. GTK can use 82 * this information to display overlaid graphics, like the 83 * overshoot indication, at the right position. 84 * 85 * Params: 86 * border = return location for the results 87 * 88 * Returns: %TRUE if @border has been set 89 */ 90 public bool getBorder(out Border border) 91 { 92 GtkBorder* outborder = sliceNew!GtkBorder(); 93 94 auto __p = gtk_scrollable_get_border(getScrollableStruct(), outborder) != 0; 95 96 border = ObjectG.getDObject!(Border)(outborder, true); 97 98 return __p; 99 } 100 101 /** 102 * Retrieves the `GtkAdjustment` used for horizontal scrolling. 103 * 104 * Returns: horizontal `GtkAdjustment`. 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 public GtkScrollablePolicy getHscrollPolicy() 124 { 125 return gtk_scrollable_get_hscroll_policy(getScrollableStruct()); 126 } 127 128 /** 129 * Retrieves the `GtkAdjustment` used for vertical scrolling. 130 * 131 * Returns: vertical `GtkAdjustment`. 132 */ 133 public Adjustment getVadjustment() 134 { 135 auto __p = gtk_scrollable_get_vadjustment(getScrollableStruct()); 136 137 if(__p is null) 138 { 139 return null; 140 } 141 142 return ObjectG.getDObject!(Adjustment)(cast(GtkAdjustment*) __p); 143 } 144 145 /** 146 * Gets the vertical `GtkScrollablePolicy`. 147 * 148 * Returns: The vertical `GtkScrollablePolicy`. 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 public void setHadjustment(Adjustment hadjustment) 162 { 163 gtk_scrollable_set_hadjustment(getScrollableStruct(), (hadjustment is null) ? null : hadjustment.getAdjustmentStruct()); 164 } 165 166 /** 167 * Sets the `GtkScrollablePolicy`. 168 * 169 * The policy determines whether horizontal scrolling should start 170 * below the minimum width or below the natural width. 171 * 172 * Params: 173 * policy = the horizontal `GtkScrollablePolicy` 174 */ 175 public void setHscrollPolicy(GtkScrollablePolicy policy) 176 { 177 gtk_scrollable_set_hscroll_policy(getScrollableStruct(), policy); 178 } 179 180 /** 181 * Sets the vertical adjustment of the `GtkScrollable`. 182 * 183 * Params: 184 * vadjustment = a `GtkAdjustment` 185 */ 186 public void setVadjustment(Adjustment vadjustment) 187 { 188 gtk_scrollable_set_vadjustment(getScrollableStruct(), (vadjustment is null) ? null : vadjustment.getAdjustmentStruct()); 189 } 190 191 /** 192 * Sets the `GtkScrollablePolicy`. 193 * 194 * The policy determines whether vertical scrolling should start 195 * below the minimum height or below the natural height. 196 * 197 * Params: 198 * policy = the vertical `GtkScrollablePolicy` 199 */ 200 public void setVscrollPolicy(GtkScrollablePolicy policy) 201 { 202 gtk_scrollable_set_vscroll_policy(getScrollableStruct(), policy); 203 } 204 }