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.ShortcutsWindow;
26 
27 private import gobject.Signals;
28 private import gtk.Window;
29 public  import gtkc.gdktypes;
30 private import gtkc.gtk;
31 public  import gtkc.gtktypes;
32 
33 
34 /**
35  * A GtkShortcutsWindow shows brief information about the keyboard shortcuts
36  * and gestures of an application. The shortcuts can be grouped, and you can
37  * have multiple sections in this window, corresponding to the major modes of
38  * your application.
39  * 
40  * Additionally, the shortcuts can be filtered by the current view, to avoid
41  * showing information that is not relevant in the current application context.
42  * 
43  * The recommended way to construct a GtkShortcutsWindow is with GtkBuilder,
44  * by populating a #GtkShortcutsWindow with one or more #GtkShortcutsSection
45  * objects, which contain #GtkShortcutsGroups that in turn contain objects of
46  * class #GtkShortcutsShortcut.
47  * 
48  * # A simple example:
49  * 
50  * ![](gedit-shortcuts.png)
51  * 
52  * This example has as single section. As you can see, the shortcut groups
53  * are arranged in columns, and spread across several pages if there are too
54  * many to find on a single page.
55  * 
56  * The .ui file for this example can be found [here](https://git.gnome.org/browse/gtk+/tree/demos/gtk-demo/shortcuts-gedit.ui).
57  * 
58  * # An example with multiple views:
59  * 
60  * ![](clocks-shortcuts.png)
61  * 
62  * This example shows a #GtkShortcutsWindow that has been configured to show only
63  * the shortcuts relevant to the "stopwatch" view.
64  * 
65  * The .ui file for this example can be found [here](https://git.gnome.org/browse/gtk+/tree/demos/gtk-demo/shortcuts-clocks.ui).
66  * 
67  * # An example with multiple sections:
68  * 
69  * ![](builder-shortcuts.png)
70  * 
71  * This example shows a #GtkShortcutsWindow with two sections, "Editor Shortcuts"
72  * and "Terminal Shortcuts".
73  * 
74  * The .ui file for this example can be found [here](https://git.gnome.org/browse/gtk+/tree/demos/gtk-demo/shortcuts-builder.ui).
75  */
76 public class ShortcutsWindow : Window
77 {
78 	/** the main Gtk struct */
79 	protected GtkShortcutsWindow* gtkShortcutsWindow;
80 
81 	/** Get the main Gtk struct */
82 	public GtkShortcutsWindow* getShortcutsWindowStruct()
83 	{
84 		return gtkShortcutsWindow;
85 	}
86 
87 	/** the main Gtk struct as a void* */
88 	protected override void* getStruct()
89 	{
90 		return cast(void*)gtkShortcutsWindow;
91 	}
92 
93 	protected override void setStruct(GObject* obj)
94 	{
95 		gtkShortcutsWindow = cast(GtkShortcutsWindow*)obj;
96 		super.setStruct(obj);
97 	}
98 
99 	/**
100 	 * Sets our main struct and passes it to the parent class.
101 	 */
102 	public this (GtkShortcutsWindow* gtkShortcutsWindow, bool ownedRef = false)
103 	{
104 		this.gtkShortcutsWindow = gtkShortcutsWindow;
105 		super(cast(GtkWindow*)gtkShortcutsWindow, ownedRef);
106 	}
107 
108 
109 	/** */
110 	public static GType getType()
111 	{
112 		return gtk_shortcuts_window_get_type();
113 	}
114 
115 	int[string] connectedSignals;
116 
117 	void delegate(ShortcutsWindow)[] onCloseListeners;
118 	/**
119 	 * The ::close signal is a
120 	 * [keybinding signal][GtkBindingSignal]
121 	 * which gets emitted when the user uses a keybinding to close
122 	 * the window.
123 	 *
124 	 * The default binding for this signal is the Escape key.
125 	 */
126 	void addOnClose(void delegate(ShortcutsWindow) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
127 	{
128 		if ( "close" !in connectedSignals )
129 		{
130 			Signals.connectData(
131 				this,
132 				"close",
133 				cast(GCallback)&callBackClose,
134 				cast(void*)this,
135 				null,
136 				connectFlags);
137 			connectedSignals["close"] = 1;
138 		}
139 		onCloseListeners ~= dlg;
140 	}
141 	extern(C) static void callBackClose(GtkShortcutsWindow* shortcutswindowStruct, ShortcutsWindow _shortcutswindow)
142 	{
143 		foreach ( void delegate(ShortcutsWindow) dlg; _shortcutswindow.onCloseListeners )
144 		{
145 			dlg(_shortcutswindow);
146 		}
147 	}
148 
149 	void delegate(ShortcutsWindow)[] onSearchListeners;
150 	/**
151 	 * The ::search signal is a
152 	 * [keybinding signal][GtkBindingSignal]
153 	 * which gets emitted when the user uses a keybinding to start a search.
154 	 *
155 	 * The default binding for this signal is Control-F.
156 	 */
157 	void addOnSearch(void delegate(ShortcutsWindow) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
158 	{
159 		if ( "search" !in connectedSignals )
160 		{
161 			Signals.connectData(
162 				this,
163 				"search",
164 				cast(GCallback)&callBackSearch,
165 				cast(void*)this,
166 				null,
167 				connectFlags);
168 			connectedSignals["search"] = 1;
169 		}
170 		onSearchListeners ~= dlg;
171 	}
172 	extern(C) static void callBackSearch(GtkShortcutsWindow* shortcutswindowStruct, ShortcutsWindow _shortcutswindow)
173 	{
174 		foreach ( void delegate(ShortcutsWindow) dlg; _shortcutswindow.onSearchListeners )
175 		{
176 			dlg(_shortcutswindow);
177 		}
178 	}
179 }