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 
72 private import gdk.Window;
73 private import gtk.Adjustment;
74 private import gtk.ScrollableT;
75 private import gtk.ScrollableIF;
76 
77 
78 
79 private import gtk.Bin;
80 
81 /**
82  * The GtkViewport widget acts as an adaptor class, implementing
83  * scrollability for child widgets that lack their own scrolling
84  * capabilities. Use GtkViewport to scroll child widgets such as
85  * GtkGrid, GtkBox, and so on.
86  *
87  * If a widget has native scrolling abilities, such as GtkTextView,
88  * GtkTreeView or GtkIconView, it can be added to a GtkScrolledWindow
89  * with gtk_container_add(). If a widget does not, you must first add the
90  * widget to a GtkViewport, then add the viewport to the scrolled window.
91  * gtk_container_add() does this automatically if a child that does not
92  * implement GtkScrollable is added to a GtkScrolledWindow, so you can
93  * ignore the presence of the viewport.
94  *
95  * The GtkViewport will start scrolling content only if allocated less
96  * than the child widget's minimum size in a given orientation.
97  */
98 public class Viewport : Bin, ScrollableIF
99 {
100 	
101 	/** the main Gtk struct */
102 	protected GtkViewport* gtkViewport;
103 	
104 	
105 	public GtkViewport* getViewportStruct()
106 	{
107 		return gtkViewport;
108 	}
109 	
110 	
111 	/** the main Gtk struct as a void* */
112 	protected override void* getStruct()
113 	{
114 		return cast(void*)gtkViewport;
115 	}
116 	
117 	/**
118 	 * Sets our main struct and passes it to the parent class
119 	 */
120 	public this (GtkViewport* gtkViewport)
121 	{
122 		super(cast(GtkBin*)gtkViewport);
123 		this.gtkViewport = gtkViewport;
124 	}
125 	
126 	protected override void setStruct(GObject* obj)
127 	{
128 		super.setStruct(obj);
129 		gtkViewport = cast(GtkViewport*)obj;
130 	}
131 	
132 	// add the Scrollable capabilities
133 	mixin ScrollableT!(GtkViewport);
134 	
135 	/**
136 	 */
137 	
138 	/**
139 	 * Creates a new GtkViewport with the given adjustments, or with default
140 	 * adjustments if none are given.
141 	 * Params:
142 	 * hadjustment = horizontal adjustment. [allow-none]
143 	 * vadjustment = vertical adjustment. [allow-none]
144 	 * Throws: ConstructionException GTK+ fails to create the object.
145 	 */
146 	public this (Adjustment hadjustment, Adjustment vadjustment)
147 	{
148 		// GtkWidget * gtk_viewport_new (GtkAdjustment *hadjustment,  GtkAdjustment *vadjustment);
149 		auto p = gtk_viewport_new((hadjustment is null) ? null : hadjustment.getAdjustmentStruct(), (vadjustment is null) ? null : vadjustment.getAdjustmentStruct());
150 		if(p is null)
151 		{
152 			throw new ConstructionException("null returned by gtk_viewport_new((hadjustment is null) ? null : hadjustment.getAdjustmentStruct(), (vadjustment is null) ? null : vadjustment.getAdjustmentStruct())");
153 		}
154 		this(cast(GtkViewport*) p);
155 	}
156 	
157 	/**
158 	 * Sets the shadow type of the viewport.
159 	 * Params:
160 	 * type = the new shadow type.
161 	 */
162 	public void setShadowType(GtkShadowType type)
163 	{
164 		// void gtk_viewport_set_shadow_type (GtkViewport *viewport,  GtkShadowType type);
165 		gtk_viewport_set_shadow_type(gtkViewport, type);
166 	}
167 	
168 	/**
169 	 * Gets the shadow type of the GtkViewport. See
170 	 * gtk_viewport_set_shadow_type().
171 	 * Returns: the shadow type
172 	 */
173 	public GtkShadowType getShadowType()
174 	{
175 		// GtkShadowType gtk_viewport_get_shadow_type (GtkViewport *viewport);
176 		return gtk_viewport_get_shadow_type(gtkViewport);
177 	}
178 	
179 	/**
180 	 * Gets the bin window of the GtkViewport.
181 	 * Since 2.20
182 	 * Returns: a GdkWindow. [transfer none]
183 	 */
184 	public Window getBinWindow()
185 	{
186 		// GdkWindow * gtk_viewport_get_bin_window (GtkViewport *viewport);
187 		auto p = gtk_viewport_get_bin_window(gtkViewport);
188 		
189 		if(p is null)
190 		{
191 			return null;
192 		}
193 		
194 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
195 	}
196 	
197 	/**
198 	 * Gets the view window of the GtkViewport.
199 	 * Since 2.22
200 	 * Returns: a GdkWindow. [transfer none]
201 	 */
202 	public Window getViewWindow()
203 	{
204 		// GdkWindow * gtk_viewport_get_view_window (GtkViewport *viewport);
205 		auto p = gtk_viewport_get_view_window(gtkViewport);
206 		
207 		if(p is null)
208 		{
209 			return null;
210 		}
211 		
212 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
213 	}
214 }