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  * # CSS nodes
52  * 
53  * |[<!-- language="plain" -->
54  * scrollbar[.fine-tune]
55  * ╰── contents
56  * ├── [button.up]
57  * ├── [button.down]
58  * ├── trough
59  * │   ╰── slider
60  * ├── [button.up]
61  * ╰── [button.down]
62  * ]|
63  * 
64  * GtkScrollbar has a main CSS node with name scrollbar and a subnode for its
65  * contents, with subnodes named trough and slider.
66  * 
67  * The main node gets the style class .fine-tune added when the scrollbar is
68  * in 'fine-tuning' mode.
69  * 
70  * If steppers are enabled, they are represented by up to four additional
71  * subnodes with name button. These get the style classes .up and .down to
72  * indicate in which direction they are moving.
73  * 
74  * Other style classes that may be added to scrollbars inside #GtkScrolledWindow
75  * include the positional classes (.left, .right, .top, .bottom) and style
76  * classes related to overlay scrolling (.overlay-indicator, .dragging, .hovering).
77  */
78 public class Scrollbar : Range
79 {
80 	/** the main Gtk struct */
81 	protected GtkScrollbar* gtkScrollbar;
82 
83 	/** Get the main Gtk struct */
84 	public GtkScrollbar* getScrollbarStruct()
85 	{
86 		return gtkScrollbar;
87 	}
88 
89 	/** the main Gtk struct as a void* */
90 	protected override void* getStruct()
91 	{
92 		return cast(void*)gtkScrollbar;
93 	}
94 
95 	protected override void setStruct(GObject* obj)
96 	{
97 		gtkScrollbar = cast(GtkScrollbar*)obj;
98 		super.setStruct(obj);
99 	}
100 
101 	/**
102 	 * Sets our main struct and passes it to the parent class.
103 	 */
104 	public this (GtkScrollbar* gtkScrollbar, bool ownedRef = false)
105 	{
106 		this.gtkScrollbar = gtkScrollbar;
107 		super(cast(GtkRange*)gtkScrollbar, ownedRef);
108 	}
109 
110 
111 	/** */
112 	public static GType getType()
113 	{
114 		return gtk_scrollbar_get_type();
115 	}
116 
117 	/**
118 	 * Creates a new scrollbar with the given orientation.
119 	 *
120 	 * Params:
121 	 *     orientation = the scrollbar’s orientation.
122 	 *     adjustment = the #GtkAdjustment to use, or %NULL to create a new adjustment.
123 	 *
124 	 * Return: the new #GtkScrollbar.
125 	 *
126 	 * Since: 3.0
127 	 *
128 	 * Throws: ConstructionException GTK+ fails to create the object.
129 	 */
130 	public this(GtkOrientation orientation, Adjustment adjustment)
131 	{
132 		auto p = gtk_scrollbar_new(orientation, (adjustment is null) ? null : adjustment.getAdjustmentStruct());
133 		
134 		if(p is null)
135 		{
136 			throw new ConstructionException("null returned by new");
137 		}
138 		
139 		this(cast(GtkScrollbar*) p);
140 	}
141 }