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.Range;
31 private import gtk.Widget;
32 private import gtkc.gtk;
33 public  import gtkc.gtktypes;
34 
35 
36 /**
37  * The #GtkScrollbar widget is a horizontal or vertical scrollbar,
38  * depending on the value of the #GtkOrientable:orientation property.
39  * 
40  * The position of the thumb in a scrollbar is controlled by the scroll
41  * adjustments. See #GtkAdjustment for the fields in an adjustment - for
42  * #GtkScrollbar, the #GtkAdjustment:value field represents the position
43  * of the scrollbar, which must be between the #GtkAdjustment:lower field
44  * and #GtkAdjustment:upper - #GtkAdjustment:page-size. The
45  * #GtkAdjustment:page-size field represents the size of the visible
46  * scrollable area. The #GtkAdjustment:step-increment and
47  * #GtkAdjustment:page-increment fields are properties when the user asks to
48  * step down (using the small stepper arrows) or page down (using for
49  * example the `Page Down` key).
50  */
51 public class Scrollbar : Range
52 {
53 	/** the main Gtk struct */
54 	protected GtkScrollbar* gtkScrollbar;
55 
56 	/** Get the main Gtk struct */
57 	public GtkScrollbar* getScrollbarStruct()
58 	{
59 		return gtkScrollbar;
60 	}
61 
62 	/** the main Gtk struct as a void* */
63 	protected override void* getStruct()
64 	{
65 		return cast(void*)gtkScrollbar;
66 	}
67 
68 	protected override void setStruct(GObject* obj)
69 	{
70 		gtkScrollbar = cast(GtkScrollbar*)obj;
71 		super.setStruct(obj);
72 	}
73 
74 	/**
75 	 * Sets our main struct and passes it to the parent class.
76 	 */
77 	public this (GtkScrollbar* gtkScrollbar, bool ownedRef = false)
78 	{
79 		this.gtkScrollbar = gtkScrollbar;
80 		super(cast(GtkRange*)gtkScrollbar, ownedRef);
81 	}
82 
83 
84 	/** */
85 	public static GType getType()
86 	{
87 		return gtk_scrollbar_get_type();
88 	}
89 
90 	/**
91 	 * Creates a new scrollbar with the given orientation.
92 	 *
93 	 * Params:
94 	 *     orientation = the scrollbar’s orientation.
95 	 *     adjustment = the #GtkAdjustment to use, or %NULL to create a new adjustment.
96 	 *
97 	 * Return: the new #GtkScrollbar.
98 	 *
99 	 * Since: 3.0
100 	 *
101 	 * Throws: ConstructionException GTK+ fails to create the object.
102 	 */
103 	public this(GtkOrientation orientation, Adjustment adjustment)
104 	{
105 		auto p = gtk_scrollbar_new(orientation, (adjustment is null) ? null : adjustment.getAdjustmentStruct());
106 		
107 		if(p is null)
108 		{
109 			throw new ConstructionException("null returned by new");
110 		}
111 		
112 		this(cast(GtkScrollbar*) p);
113 	}
114 }