1 /* 2 * This file is part of d-handy. 3 * 4 * d-handy 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-handy 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-handy; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 module handy.SwipeGroup; 20 21 private import glib.ConstructionException; 22 private import glib.ListSG; 23 private import gobject.ObjectG; 24 private import gtk.BuildableIF; 25 private import gtk.BuildableT; 26 private import handy.SwipeableIF; 27 private import handy.c.functions; 28 public import handy.c.types; 29 30 31 /** */ 32 public class SwipeGroup : ObjectG, BuildableIF 33 { 34 /** the main Gtk struct */ 35 protected HdySwipeGroup* hdySwipeGroup; 36 37 /** Get the main Gtk struct */ 38 public HdySwipeGroup* getSwipeGroupStruct(bool transferOwnership = false) 39 { 40 if (transferOwnership) 41 ownedRef = false; 42 return hdySwipeGroup; 43 } 44 45 /** the main Gtk struct as a void* */ 46 protected override void* getStruct() 47 { 48 return cast(void*)hdySwipeGroup; 49 } 50 51 /** 52 * Sets our main struct and passes it to the parent class. 53 */ 54 public this (HdySwipeGroup* hdySwipeGroup, bool ownedRef = false) 55 { 56 this.hdySwipeGroup = hdySwipeGroup; 57 super(cast(GObject*)hdySwipeGroup, ownedRef); 58 } 59 60 // add the Buildable capabilities 61 mixin BuildableT!(HdySwipeGroup); 62 63 64 /** */ 65 public static GType getType() 66 { 67 return hdy_swipe_group_get_type(); 68 } 69 70 /** 71 * Create a new #HdySwipeGroup object. 72 * 73 * Returns: The newly created #HdySwipeGroup object 74 * 75 * Since: 0.0.12 76 * 77 * Throws: ConstructionException GTK+ fails to create the object. 78 */ 79 public this() 80 { 81 auto __p = hdy_swipe_group_new(); 82 83 if(__p is null) 84 { 85 throw new ConstructionException("null returned by new"); 86 } 87 88 this(cast(HdySwipeGroup*) __p, true); 89 } 90 91 /** 92 * When the widget is destroyed or no longer referenced elsewhere, it will 93 * be removed from the swipe group. 94 * 95 * Params: 96 * swipeable = the #HdySwipeable to add 97 * 98 * Since: 0.0.12 99 */ 100 public void addSwipeable(SwipeableIF swipeable) 101 { 102 hdy_swipe_group_add_swipeable(hdySwipeGroup, (swipeable is null) ? null : swipeable.getSwipeableStruct()); 103 } 104 105 /** 106 * Returns the list of swipeables associated with @self. 107 * 108 * Returns: a #GSList of 109 * swipeables. The list is owned by libhandy and should not be modified. 110 * 111 * Since: 0.0.12 112 */ 113 public ListSG getSwipeables() 114 { 115 auto __p = hdy_swipe_group_get_swipeables(hdySwipeGroup); 116 117 if(__p is null) 118 { 119 return null; 120 } 121 122 return new ListSG(cast(GSList*) __p); 123 } 124 125 /** 126 * Removes a widget from a #HdySwipeGroup. 127 * 128 * Params: 129 * swipeable = the #HdySwipeable to remove 130 * 131 * Since: 0.0.12 132 */ 133 public void removeSwipeable(SwipeableIF swipeable) 134 { 135 hdy_swipe_group_remove_swipeable(hdySwipeGroup, (swipeable is null) ? null : swipeable.getSwipeableStruct()); 136 } 137 }