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.DockItemIF;
20 
21 private import dazzle.DockItemIF;
22 private import dazzle.DockManager;
23 private import dazzle.c.functions;
24 public  import dazzle.c.types;
25 private import gio.IconIF;
26 private import glib.Str;
27 private import gobject.ObjectG;
28 private import gobject.Signals;
29 private import std.algorithm;
30 
31 
32 /** */
33 public interface DockItemIF{
34 	/** Get the main Gtk struct */
35 	public DzlDockItem* getDockItemStruct(bool transferOwnership = false);
36 
37 	/** the main Gtk struct as a void* */
38 	protected void* getStruct();
39 
40 
41 	/** */
42 	public static GType getType()
43 	{
44 		return dzl_dock_item_get_type();
45 	}
46 
47 	/** */
48 	public bool adopt(DockItemIF child);
49 
50 	/**
51 	 * This function will request that the dock item close itself.
52 	 *
53 	 * Returns: %TRUE if the dock item was closed
54 	 */
55 	public bool close();
56 
57 	/**
58 	 * Emits the #DzlDockItem::presented signal.
59 	 *
60 	 * Containers should emit this when their descendant has been presented as the
61 	 * current visible child. This allows dock items to do lazy initialization of
62 	 * content once the widgetry is visible to the user.
63 	 *
64 	 * Currently, this is best effort, as there are a number of situations that
65 	 * make covering all cases problematic.
66 	 *
67 	 * Since: 3.30
68 	 */
69 	public void emitPresented();
70 
71 	/**
72 	 * If this dock item can be closed by the user, this virtual function should be
73 	 * implemented by the panel and return %TRUE.
74 	 *
75 	 * Returns: %TRUE if the dock item can be closed by the user, otherwise %FALSE.
76 	 */
77 	public bool getCanClose();
78 
79 	/**
80 	 * Returns: %TRUE if the widget can be minimized.
81 	 */
82 	public bool getCanMinimize();
83 
84 	/** */
85 	public bool getChildVisible(DockItemIF child);
86 
87 	/**
88 	 * Gets the dock manager for this dock item.
89 	 *
90 	 * Returns: A #DzlDockmanager.
91 	 */
92 	public DockManager getManager();
93 
94 	/**
95 	 * Gets the parent #DzlDockItem, or %NULL.
96 	 *
97 	 * Returns: A #DzlDockItem or %NULL.
98 	 */
99 	public DockItemIF getParent();
100 
101 	/** */
102 	public bool hasWidgets();
103 
104 	/**
105 	 * This requests that @self minimize @child if it knows how.
106 	 *
107 	 * If not, it should suggest the gravity for @child if it knows how to
108 	 * determine that. For example, a #DzlDockBin might know if the widget was part
109 	 * of the right panel and therefore may set @position to %GTK_POS_RIGHT.
110 	 *
111 	 * Params:
112 	 *     child = A #DzlDockItem that is a child of @self
113 	 *     position = A location for a #GtkPositionType
114 	 *
115 	 * Returns: %TRUE if @child was minimized. Otherwise %FALSE and @position
116 	 *     may be updated to a suggested position.
117 	 */
118 	public bool minimize(DockItemIF child, ref GtkPositionType position);
119 
120 	/**
121 	 * Emits the "needs-attention" signal.
122 	 *
123 	 * Since: 3.34
124 	 */
125 	public void needsAttention();
126 
127 	/** */
128 	public void presentChild(DockItemIF child);
129 
130 	/**
131 	 * Gets a #GIcon for the dock item, if any has been set.
132 	 *
133 	 * If an icon-name has been set, a new #GIcon for that icon-name
134 	 * may be returned.
135 	 *
136 	 * Returns: a #GIcon or %NULL
137 	 *
138 	 * Since: 3.34
139 	 */
140 	public IconIF refGicon();
141 
142 	/**
143 	 * This virtual method should remove @child from @self if the
144 	 * dock item knows how to do so. For example, the #DzlDockStack
145 	 * will remove @child from it's internal #GtkStack.
146 	 *
147 	 * After the virtual function has been executed, child tracking
148 	 * will be removed so that #DzlDockItem implementations do not
149 	 * need to implement themselves.
150 	 */
151 	public void release(DockItemIF child);
152 
153 	/** */
154 	public void setChildVisible(DockItemIF child, bool childVisible);
155 
156 	/**
157 	 * Sets the dock manager for this #DzlDockItem.
158 	 *
159 	 * Params:
160 	 *     manager = A #DzlDockManager
161 	 */
162 	public void setManager(DockManager manager);
163 
164 	/** */
165 	public void updateVisibility();
166 
167 	/** */
168 	gulong addOnManagerSet(void delegate(DockManager, DockItemIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
169 
170 	/** */
171 	gulong addOnNeedsAttention(void delegate(DockItemIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
172 
173 	/** */
174 	gulong addOnPresented(void delegate(DockItemIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
175 }