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 gtk.c.functions;
33 public  import gtk.c.types;
34 public  import gtkc.gtktypes;
35 
36 
37 /**
38  * The #GtkScrollbar widget is a horizontal or vertical scrollbar,
39  * depending on the value of the #GtkOrientable:orientation property.
40  * 
41  * Its position and movement are controlled by the adjustment that is passed to
42  * or created by gtk_scrollbar_new(). See #GtkAdjustment for more details. The
43  * #GtkAdjustment:value field sets the position of the thumb and must be between
44  * #GtkAdjustment:lower and #GtkAdjustment:upper - #GtkAdjustment:page-size. The
45  * #GtkAdjustment:page-size represents the size of the visible scrollable area.
46  * The fields #GtkAdjustment:step-increment and #GtkAdjustment:page-increment
47  * fields are added to or subtracted from the #GtkAdjustment:value when the user
48  * asks to move by a step (using e.g. the cursor arrow keys or, if present, the
49  * stepper buttons) or by a page (using e.g. the Page Down/Up keys).
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(bool transferOwnership = false)
85 	{
86 		if (transferOwnership)
87 			ownedRef = false;
88 		return gtkScrollbar;
89 	}
90 
91 	/** the main Gtk struct as a void* */
92 	protected override void* getStruct()
93 	{
94 		return cast(void*)gtkScrollbar;
95 	}
96 
97 	/**
98 	 * Sets our main struct and passes it to the parent class.
99 	 */
100 	public this (GtkScrollbar* gtkScrollbar, bool ownedRef = false)
101 	{
102 		this.gtkScrollbar = gtkScrollbar;
103 		super(cast(GtkRange*)gtkScrollbar, ownedRef);
104 	}
105 
106 
107 	/** */
108 	public static GType getType()
109 	{
110 		return gtk_scrollbar_get_type();
111 	}
112 
113 	/**
114 	 * Creates a new scrollbar with the given orientation.
115 	 *
116 	 * Params:
117 	 *     orientation = the scrollbar’s orientation.
118 	 *     adjustment = the #GtkAdjustment to use, or %NULL to create a new adjustment.
119 	 *
120 	 * Returns: the new #GtkScrollbar.
121 	 *
122 	 * Since: 3.0
123 	 *
124 	 * Throws: ConstructionException GTK+ fails to create the object.
125 	 */
126 	public this(GtkOrientation orientation, Adjustment adjustment)
127 	{
128 		auto p = gtk_scrollbar_new(orientation, (adjustment is null) ? null : adjustment.getAdjustmentStruct());
129 
130 		if(p is null)
131 		{
132 			throw new ConstructionException("null returned by new");
133 		}
134 
135 		this(cast(GtkScrollbar*) p);
136 	}
137 }