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  * Conversion parameters:
26  * inFile  = GtkViewport.html
27  * outPack = gtk
28  * outFile = Viewport
29  * strct   = GtkViewport
30  * realStrct=
31  * ctorStrct=
32  * clss    = Viewport
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * 	- ScrollableIF
40  * prefixes:
41  * 	- gtk_viewport_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * 	- gtk_viewport_get_hadjustment
46  * 	- gtk_viewport_get_vadjustment
47  * 	- gtk_viewport_set_hadjustment
48  * 	- gtk_viewport_set_vadjustment
49  * omit signals:
50  * imports:
51  * 	- gdk.Window
52  * 	- gtk.Adjustment
53  * 	- gtk.ScrollableT
54  * 	- gtk.ScrollableIF
55  * structWrap:
56  * 	- GdkWindow* -> Window
57  * 	- GtkAdjustment* -> Adjustment
58  * module aliases:
59  * local aliases:
60  * overrides:
61  */
62 
63 module gtk.Viewport;
64 
65 public  import gtkc.gtktypes;
66 
67 private import gtkc.gtk;
68 private import glib.ConstructionException;
69 private import gobject.ObjectG;
70 
71 private import gdk.Window;
72 private import gtk.Adjustment;
73 private import gtk.ScrollableT;
74 private import gtk.ScrollableIF;
75 
76 
77 private import gtk.Bin;
78 
79 /**
80  * The GtkViewport widget acts as an adaptor class, implementing
81  * scrollability for child widgets that lack their own scrolling
82  * capabilities. Use GtkViewport to scroll child widgets such as
83  * GtkGrid, GtkBox, and so on.
84  *
85  * If a widget has native scrolling abilities, such as GtkTextView,
86  * GtkTreeView or GtkIconView, it can be added to a GtkScrolledWindow
87  * with gtk_container_add(). If a widget does not, you must first add the
88  * widget to a GtkViewport, then add the viewport to the scrolled window.
89  * gtk_container_add() does this automatically if a child that does not
90  * implement GtkScrollable is added to a GtkScrolledWindow, so you can
91  * ignore the presence of the viewport.
92  *
93  * The GtkViewport will start scrolling content only if allocated less
94  * than the child widget's minimum size in a given orientation.
95  */
96 public class Viewport : Bin, ScrollableIF
97 {
98 	
99 	/** the main Gtk struct */
100 	protected GtkViewport* gtkViewport;
101 	
102 	
103 	/** Get the main Gtk struct */
104 	public GtkViewport* getViewportStruct()
105 	{
106 		return gtkViewport;
107 	}
108 	
109 	
110 	/** the main Gtk struct as a void* */
111 	protected override void* getStruct()
112 	{
113 		return cast(void*)gtkViewport;
114 	}
115 	
116 	/**
117 	 * Sets our main struct and passes it to the parent class
118 	 */
119 	public this (GtkViewport* gtkViewport)
120 	{
121 		super(cast(GtkBin*)gtkViewport);
122 		this.gtkViewport = gtkViewport;
123 	}
124 	
125 	protected override void setStruct(GObject* obj)
126 	{
127 		super.setStruct(obj);
128 		gtkViewport = cast(GtkViewport*)obj;
129 	}
130 	
131 	// add the Scrollable capabilities
132 	mixin ScrollableT!(GtkViewport);
133 	
134 	/**
135 	 */
136 	
137 	/**
138 	 * Creates a new GtkViewport with the given adjustments, or with default
139 	 * adjustments if none are given.
140 	 * Params:
141 	 * hadjustment = horizontal adjustment. [allow-none]
142 	 * vadjustment = vertical adjustment. [allow-none]
143 	 * Throws: ConstructionException GTK+ fails to create the object.
144 	 */
145 	public this (Adjustment hadjustment, Adjustment vadjustment)
146 	{
147 		// GtkWidget * gtk_viewport_new (GtkAdjustment *hadjustment,  GtkAdjustment *vadjustment);
148 		auto p = gtk_viewport_new((hadjustment is null) ? null : hadjustment.getAdjustmentStruct(), (vadjustment is null) ? null : vadjustment.getAdjustmentStruct());
149 		if(p is null)
150 		{
151 			throw new ConstructionException("null returned by gtk_viewport_new((hadjustment is null) ? null : hadjustment.getAdjustmentStruct(), (vadjustment is null) ? null : vadjustment.getAdjustmentStruct())");
152 		}
153 		this(cast(GtkViewport*) p);
154 	}
155 	
156 	/**
157 	 * Sets the shadow type of the viewport.
158 	 * Params:
159 	 * type = the new shadow type.
160 	 */
161 	public void setShadowType(GtkShadowType type)
162 	{
163 		// void gtk_viewport_set_shadow_type (GtkViewport *viewport,  GtkShadowType type);
164 		gtk_viewport_set_shadow_type(gtkViewport, type);
165 	}
166 	
167 	/**
168 	 * Gets the shadow type of the GtkViewport. See
169 	 * gtk_viewport_set_shadow_type().
170 	 * Returns: the shadow type
171 	 */
172 	public GtkShadowType getShadowType()
173 	{
174 		// GtkShadowType gtk_viewport_get_shadow_type (GtkViewport *viewport);
175 		return gtk_viewport_get_shadow_type(gtkViewport);
176 	}
177 	
178 	/**
179 	 * Gets the bin window of the GtkViewport.
180 	 * Since 2.20
181 	 * Returns: a GdkWindow. [transfer none]
182 	 */
183 	public Window getBinWindow()
184 	{
185 		// GdkWindow * gtk_viewport_get_bin_window (GtkViewport *viewport);
186 		auto p = gtk_viewport_get_bin_window(gtkViewport);
187 		
188 		if(p is null)
189 		{
190 			return null;
191 		}
192 		
193 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
194 	}
195 	
196 	/**
197 	 * Gets the view window of the GtkViewport.
198 	 * Since 2.22
199 	 * Returns: a GdkWindow. [transfer none]
200 	 */
201 	public Window getViewWindow()
202 	{
203 		// GdkWindow * gtk_viewport_get_view_window (GtkViewport *viewport);
204 		auto p = gtk_viewport_get_view_window(gtkViewport);
205 		
206 		if(p is null)
207 		{
208 			return null;
209 		}
210 		
211 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
212 	}
213 }