1 /*
2  * This file is part of d-dazzle.
3  *
4  * d-dazzle 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  * d-dazzle 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 d-dazzle; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 module dazzle.DockBin;
20 
21 private import dazzle.DockIF;
22 private import dazzle.DockItemIF;
23 private import dazzle.DockItemT;
24 private import dazzle.DockT;
25 private import dazzle.c.functions;
26 public  import dazzle.c.types;
27 private import glib.ConstructionException;
28 private import gobject.ObjectG;
29 private import gtk.BuildableIF;
30 private import gtk.BuildableT;
31 private import gtk.Container;
32 private import gtk.Widget;
33 
34 
35 /** */
36 public class DockBin : Container, DockIF, DockItemIF
37 {
38 	/** the main Gtk struct */
39 	protected DzlDockBin* dzlDockBin;
40 
41 	/** Get the main Gtk struct */
42 	public DzlDockBin* getDockBinStruct(bool transferOwnership = false)
43 	{
44 		if (transferOwnership)
45 			ownedRef = false;
46 		return dzlDockBin;
47 	}
48 
49 	/** the main Gtk struct as a void* */
50 	protected override void* getStruct()
51 	{
52 		return cast(void*)dzlDockBin;
53 	}
54 
55 	/**
56 	 * Sets our main struct and passes it to the parent class.
57 	 */
58 	public this (DzlDockBin* dzlDockBin, bool ownedRef = false)
59 	{
60 		this.dzlDockBin = dzlDockBin;
61 		super(cast(GtkContainer*)dzlDockBin, ownedRef);
62 	}
63 
64 	// add the Dock capabilities
65 	mixin DockT!(DzlDockBin);
66 
67 	// add the DockItem capabilities
68 	mixin DockItemT!(DzlDockBin);
69 
70 	alias getParent = Widget.getParent;
71 
72 	/**
73 	 */
74 
75 	/** */
76 	public static GType getType()
77 	{
78 		return dzl_dock_bin_get_type();
79 	}
80 
81 	/** */
82 	public this()
83 	{
84 		auto p = dzl_dock_bin_new();
85 
86 		if(p is null)
87 		{
88 			throw new ConstructionException("null returned by new");
89 		}
90 
91 		this(cast(DzlDockBin*) p);
92 	}
93 
94 	/**
95 	 * Returns: A #GtkWidget
96 	 */
97 	public Widget getBottomEdge()
98 	{
99 		auto p = dzl_dock_bin_get_bottom_edge(dzlDockBin);
100 
101 		if(p is null)
102 		{
103 			return null;
104 		}
105 
106 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
107 	}
108 
109 	/**
110 	 * Gets the center widget for the dock.
111 	 *
112 	 * Returns: A #GtkWidget or %NULL.
113 	 */
114 	public Widget getCenterWidget()
115 	{
116 		auto p = dzl_dock_bin_get_center_widget(dzlDockBin);
117 
118 		if(p is null)
119 		{
120 			return null;
121 		}
122 
123 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
124 	}
125 
126 	/**
127 	 * Returns: A #GtkWidget
128 	 */
129 	public Widget getLeftEdge()
130 	{
131 		auto p = dzl_dock_bin_get_left_edge(dzlDockBin);
132 
133 		if(p is null)
134 		{
135 			return null;
136 		}
137 
138 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
139 	}
140 
141 	/**
142 	 * Returns: A #GtkWidget
143 	 */
144 	public Widget getRightEdge()
145 	{
146 		auto p = dzl_dock_bin_get_right_edge(dzlDockBin);
147 
148 		if(p is null)
149 		{
150 			return null;
151 		}
152 
153 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
154 	}
155 
156 	/**
157 	 * Returns: A #GtkWidget
158 	 */
159 	public Widget getTopEdge()
160 	{
161 		auto p = dzl_dock_bin_get_top_edge(dzlDockBin);
162 
163 		if(p is null)
164 		{
165 			return null;
166 		}
167 
168 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
169 	}
170 }