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.ShortcutsSection; 26 27 private import gobject.Signals; 28 private import gtk.Box; 29 public import gtkc.gdktypes; 30 private import gtkc.gtk; 31 public import gtkc.gtktypes; 32 private import std.algorithm; 33 34 35 /** 36 * A GtkShortcutsSection collects all the keyboard shortcuts and gestures 37 * for a major application mode. If your application needs multiple sections, 38 * you should give each section a unique #GtkShortcutsSection:section-name and 39 * a #GtkShortcutsSection:title that can be shown in the section selector of 40 * the GtkShortcutsWindow. 41 * 42 * The #GtkShortcutsSection:max-height property can be used to influence how 43 * the groups in the section are distributed over pages and columns. 44 * 45 * This widget is only meant to be used with #GtkShortcutsWindow. 46 */ 47 public class ShortcutsSection : Box 48 { 49 /** the main Gtk struct */ 50 protected GtkShortcutsSection* gtkShortcutsSection; 51 52 /** Get the main Gtk struct */ 53 public GtkShortcutsSection* getShortcutsSectionStruct() 54 { 55 return gtkShortcutsSection; 56 } 57 58 /** the main Gtk struct as a void* */ 59 protected override void* getStruct() 60 { 61 return cast(void*)gtkShortcutsSection; 62 } 63 64 protected override void setStruct(GObject* obj) 65 { 66 gtkShortcutsSection = cast(GtkShortcutsSection*)obj; 67 super.setStruct(obj); 68 } 69 70 /** 71 * Sets our main struct and passes it to the parent class. 72 */ 73 public this (GtkShortcutsSection* gtkShortcutsSection, bool ownedRef = false) 74 { 75 this.gtkShortcutsSection = gtkShortcutsSection; 76 super(cast(GtkBox*)gtkShortcutsSection, ownedRef); 77 } 78 79 80 /** */ 81 public static GType getType() 82 { 83 return gtk_shortcuts_section_get_type(); 84 } 85 86 protected class OnChangeCurrentPageDelegateWrapper 87 { 88 bool delegate(int, ShortcutsSection) dlg; 89 gulong handlerId; 90 ConnectFlags flags; 91 this(bool delegate(int, ShortcutsSection) dlg, gulong handlerId, ConnectFlags flags) 92 { 93 this.dlg = dlg; 94 this.handlerId = handlerId; 95 this.flags = flags; 96 } 97 } 98 protected OnChangeCurrentPageDelegateWrapper[] onChangeCurrentPageListeners; 99 100 /** */ 101 gulong addOnChangeCurrentPage(bool delegate(int, ShortcutsSection) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 102 { 103 onChangeCurrentPageListeners ~= new OnChangeCurrentPageDelegateWrapper(dlg, 0, connectFlags); 104 onChangeCurrentPageListeners[onChangeCurrentPageListeners.length - 1].handlerId = Signals.connectData( 105 this, 106 "change-current-page", 107 cast(GCallback)&callBackChangeCurrentPage, 108 cast(void*)onChangeCurrentPageListeners[onChangeCurrentPageListeners.length - 1], 109 cast(GClosureNotify)&callBackChangeCurrentPageDestroy, 110 connectFlags); 111 return onChangeCurrentPageListeners[onChangeCurrentPageListeners.length - 1].handlerId; 112 } 113 114 extern(C) static int callBackChangeCurrentPage(GtkShortcutsSection* shortcutssectionStruct, int object,OnChangeCurrentPageDelegateWrapper wrapper) 115 { 116 return wrapper.dlg(object, wrapper.outer); 117 } 118 119 extern(C) static void callBackChangeCurrentPageDestroy(OnChangeCurrentPageDelegateWrapper wrapper, GClosure* closure) 120 { 121 wrapper.outer.internalRemoveOnChangeCurrentPage(wrapper); 122 } 123 124 protected void internalRemoveOnChangeCurrentPage(OnChangeCurrentPageDelegateWrapper source) 125 { 126 foreach(index, wrapper; onChangeCurrentPageListeners) 127 { 128 if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId) 129 { 130 onChangeCurrentPageListeners[index] = null; 131 onChangeCurrentPageListeners = std.algorithm.remove(onChangeCurrentPageListeners, index); 132 break; 133 } 134 } 135 } 136 137 }