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  * Its position and movement are controlled by the adjustment that is passed to
41  * or created by gtk_scrollbar_new(). See #GtkAdjustment for more details. The
42  * #GtkAdjustment:value field sets the position of the thumb and must be between
43  * #GtkAdjustment:lower and #GtkAdjustment:upper - #GtkAdjustment:page-size. The
44  * #GtkAdjustment:page-size represents the size of the visible scrollable area.
45  * The fields #GtkAdjustment:step-increment and #GtkAdjustment:page-increment
46  * fields are added to or subtracted from the #GtkAdjustment:value when the user
47  * asks to move by a step (using e.g. the cursor arrow keys or, if present, the
48  * stepper buttons) or by a page (using e.g. the Page Down/Up keys).
49  * 
50  * # CSS nodes
51  * 
52  * |[<!-- language="plain" -->
53  * scrollbar[.fine-tune]
54  * ╰── contents
55  * ├── [button.up]
56  * ├── [button.down]
57  * ├── trough
58  * │   ╰── slider
59  * ├── [button.up]
60  * ╰── [button.down]
61  * ]|
62  * 
63  * GtkScrollbar has a main CSS node with name scrollbar and a subnode for its
64  * contents, with subnodes named trough and slider.
65  * 
66  * The main node gets the style class .fine-tune added when the scrollbar is
67  * in 'fine-tuning' mode.
68  * 
69  * If steppers are enabled, they are represented by up to four additional
70  * subnodes with name button. These get the style classes .up and .down to
71  * indicate in which direction they are moving.
72  * 
73  * Other style classes that may be added to scrollbars inside #GtkScrolledWindow
74  * include the positional classes (.left, .right, .top, .bottom) and style
75  * classes related to overlay scrolling (.overlay-indicator, .dragging, .hovering).
76  */
77 public class Scrollbar : Range
78 {
79 	/** the main Gtk struct */
80 	protected GtkScrollbar* gtkScrollbar;
81 
82 	/** Get the main Gtk struct */
83 	public GtkScrollbar* getScrollbarStruct(bool transferOwnership = false)
84 	{
85 		if (transferOwnership)
86 			ownedRef = false;
87 		return gtkScrollbar;
88 	}
89 
90 	/** the main Gtk struct as a void* */
91 	protected override void* getStruct()
92 	{
93 		return cast(void*)gtkScrollbar;
94 	}
95 
96 	protected override void setStruct(GObject* obj)
97 	{
98 		gtkScrollbar = cast(GtkScrollbar*)obj;
99 		super.setStruct(obj);
100 	}
101 
102 	/**
103 	 * Sets our main struct and passes it to the parent class.
104 	 */
105 	public this (GtkScrollbar* gtkScrollbar, bool ownedRef = false)
106 	{
107 		this.gtkScrollbar = gtkScrollbar;
108 		super(cast(GtkRange*)gtkScrollbar, ownedRef);
109 	}
110 
111 
112 	/** */
113 	public static GType getType()
114 	{
115 		return gtk_scrollbar_get_type();
116 	}
117 
118 	/**
119 	 * Creates a new scrollbar with the given orientation.
120 	 *
121 	 * Params:
122 	 *     orientation = the scrollbar’s orientation.
123 	 *     adjustment = the #GtkAdjustment to use, or %NULL to create a new adjustment.
124 	 *
125 	 * Returns: the new #GtkScrollbar.
126 	 *
127 	 * Since: 3.0
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 }