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.Scrollbar; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gtk.Adjustment; 30 private import gtk.OrientableIF; 31 private import gtk.OrientableT; 32 private import gtk.Widget; 33 private import gtk.c.functions; 34 public import gtk.c.types; 35 36 37 /** 38 * The `GtkScrollbar` widget is a horizontal or vertical scrollbar. 39 * 40 * ![An example GtkScrollbar](scrollbar.png) 41 * 42 * Its position and movement are controlled by the adjustment that is passed to 43 * or created by [ctor@Gtk.Scrollbar.new]. See [class.Gtk.Adjustment] for more 44 * details. The [property@Gtk.Adjustment:value] field sets the position of the 45 * thumb and must be between [property@Gtk.Adjustment:lower] and 46 * [property@Gtk.Adjustment:upper] - [property@Gtk.Adjustment:page-size]. 47 * The [property@Gtk.Adjustment:page-size] represents the size of the visible 48 * scrollable area. 49 * 50 * The fields [property@Gtk.Adjustment:step-increment] and 51 * [property@Gtk.Adjustment:page-increment] fields are added to or subtracted 52 * from the [property@Gtk.Adjustment:value] when the user asks to move by a step 53 * (using e.g. the cursor arrow keys) or by a page (using e.g. the Page Down/Up 54 * keys). 55 * 56 * # CSS nodes 57 * 58 * ``` 59 * scrollbar 60 * ╰── range[.fine-tune] 61 * ╰── trough 62 * ╰── slider 63 * ``` 64 * 65 * `GtkScrollbar` has a main CSS node with name scrollbar and a subnode for its 66 * contents. The main node gets the .horizontal or .vertical style classes applied, 67 * depending on the scrollbar's orientation. 68 * 69 * The range node gets the style class .fine-tune added when the scrollbar is 70 * in 'fine-tuning' mode. 71 * 72 * Other style classes that may be added to scrollbars inside 73 * [class@Gtk.ScrolledWindow] include the positional classes (.left, .right, 74 * .top, .bottom) and style classes related to overlay scrolling (.overlay-indicator, 75 * .dragging, .hovering). 76 * 77 * # Accessibility 78 * 79 * `GtkScrollbar` uses the %GTK_ACCESSIBLE_ROLE_SCROLLBAR role. 80 */ 81 public class Scrollbar : Widget, OrientableIF 82 { 83 /** the main Gtk struct */ 84 protected GtkScrollbar* gtkScrollbar; 85 86 /** Get the main Gtk struct */ 87 public GtkScrollbar* getScrollbarStruct(bool transferOwnership = false) 88 { 89 if (transferOwnership) 90 ownedRef = false; 91 return gtkScrollbar; 92 } 93 94 /** the main Gtk struct as a void* */ 95 protected override void* getStruct() 96 { 97 return cast(void*)gtkScrollbar; 98 } 99 100 /** 101 * Sets our main struct and passes it to the parent class. 102 */ 103 public this (GtkScrollbar* gtkScrollbar, bool ownedRef = false) 104 { 105 this.gtkScrollbar = gtkScrollbar; 106 super(cast(GtkWidget*)gtkScrollbar, ownedRef); 107 } 108 109 // add the Orientable capabilities 110 mixin OrientableT!(GtkScrollbar); 111 112 113 /** */ 114 public static GType getType() 115 { 116 return gtk_scrollbar_get_type(); 117 } 118 119 /** 120 * Creates a new scrollbar with the given orientation. 121 * 122 * Params: 123 * orientation = the scrollbar’s orientation. 124 * adjustment = the [class@Gtk.Adjustment] to use, or %NULL 125 * to create a new adjustment. 126 * 127 * Returns: the new `GtkScrollbar`. 128 * 129 * Throws: ConstructionException GTK+ fails to create the object. 130 */ 131 public this(GtkOrientation orientation, Adjustment adjustment) 132 { 133 auto __p = gtk_scrollbar_new(orientation, (adjustment is null) ? null : adjustment.getAdjustmentStruct()); 134 135 if(__p is null) 136 { 137 throw new ConstructionException("null returned by new"); 138 } 139 140 this(cast(GtkScrollbar*) __p); 141 } 142 143 /** 144 * Returns the scrollbar's adjustment. 145 * 146 * Returns: the scrollbar's adjustment 147 */ 148 public Adjustment getAdjustment() 149 { 150 auto __p = gtk_scrollbar_get_adjustment(gtkScrollbar); 151 152 if(__p is null) 153 { 154 return null; 155 } 156 157 return ObjectG.getDObject!(Adjustment)(cast(GtkAdjustment*) __p); 158 } 159 160 /** 161 * Makes the scrollbar use the given adjustment. 162 * 163 * Params: 164 * adjustment = the adjustment to set 165 */ 166 public void setAdjustment(Adjustment adjustment) 167 { 168 gtk_scrollbar_set_adjustment(gtkScrollbar, (adjustment is null) ? null : adjustment.getAdjustmentStruct()); 169 } 170 }