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.Arrows; 20 21 private import glib.ConstructionException; 22 private import gobject.ObjectG; 23 private import gtk.BuildableIF; 24 private import gtk.BuildableT; 25 private import gtk.DrawingArea; 26 private import gtk.Widget; 27 private import handy.c.functions; 28 public import handy.c.types; 29 30 31 /** */ 32 public class Arrows : DrawingArea 33 { 34 /** the main Gtk struct */ 35 protected HdyArrows* hdyArrows; 36 37 /** Get the main Gtk struct */ 38 public HdyArrows* getArrowsStruct(bool transferOwnership = false) 39 { 40 if (transferOwnership) 41 ownedRef = false; 42 return hdyArrows; 43 } 44 45 /** the main Gtk struct as a void* */ 46 protected override void* getStruct() 47 { 48 return cast(void*)hdyArrows; 49 } 50 51 /** 52 * Sets our main struct and passes it to the parent class. 53 */ 54 public this (HdyArrows* hdyArrows, bool ownedRef = false) 55 { 56 this.hdyArrows = hdyArrows; 57 super(cast(GtkDrawingArea*)hdyArrows, ownedRef); 58 } 59 60 alias getDirection = Widget.getDirection; 61 62 /** 63 * Get the direction the arrows point to 64 * 65 * Returns: the arrows direction 66 */ 67 public HdyArrowsDirection getDirection() 68 { 69 return hdy_arrows_get_direction(hdyArrows); 70 } 71 72 /** 73 */ 74 75 /** */ 76 public static GType getType() 77 { 78 return hdy_arrows_get_type(); 79 } 80 81 /** 82 * Create a new #HdyArrows widget. 83 * 84 * Returns: the newly created #HdyArrows widget 85 * 86 * Throws: ConstructionException GTK+ fails to create the object. 87 */ 88 public this() 89 { 90 auto p = hdy_arrows_new(); 91 92 if(p is null) 93 { 94 throw new ConstructionException("null returned by new"); 95 } 96 97 this(cast(HdyArrows*) p); 98 } 99 100 /** 101 * Render the arrows animation. 102 */ 103 public void animate() 104 { 105 hdy_arrows_animate(hdyArrows); 106 } 107 108 /** 109 * Get the number of arrows displayed in the widget. 110 * 111 * Returns: the current number of arrows 112 */ 113 public uint getCount() 114 { 115 return hdy_arrows_get_count(hdyArrows); 116 } 117 118 /** 119 * Get the duration of the arrows animation. 120 * 121 * Returns: the duration of the animation in ms 122 */ 123 public uint getDuration() 124 { 125 return hdy_arrows_get_duration(hdyArrows); 126 } 127 128 /** 129 * Set the number of arrows to display. 130 * 131 * Params: 132 * count = the number of arrows to display 133 */ 134 public void setCount(uint count) 135 { 136 hdy_arrows_set_count(hdyArrows, count); 137 } 138 139 /** 140 * Set the direction the arrows should point to. 141 * 142 * Params: 143 * direction = the arrows direction 144 */ 145 public void setDirection(HdyArrowsDirection direction) 146 { 147 hdy_arrows_set_direction(hdyArrows, direction); 148 } 149 150 /** 151 * Set the duration of the arrow animation. 152 * 153 * Params: 154 * duration = the duration of the animation in ms 155 */ 156 public void setDuration(uint duration) 157 { 158 hdy_arrows_set_duration(hdyArrows, duration); 159 } 160 }