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.DockWidget; 20 21 private import dazzle.Bin; 22 private import dazzle.DockItemIF; 23 private import dazzle.DockItemT; 24 private import dazzle.c.functions; 25 public import dazzle.c.types; 26 private import gio.IconIF; 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gtk.Widget; 31 32 33 /** */ 34 public class DockWidget : Bin, DockItemIF 35 { 36 /** the main Gtk struct */ 37 protected DzlDockWidget* dzlDockWidget; 38 39 /** Get the main Gtk struct */ 40 public DzlDockWidget* getDockWidgetStruct(bool transferOwnership = false) 41 { 42 if (transferOwnership) 43 ownedRef = false; 44 return dzlDockWidget; 45 } 46 47 /** the main Gtk struct as a void* */ 48 protected override void* getStruct() 49 { 50 return cast(void*)dzlDockWidget; 51 } 52 53 /** 54 * Sets our main struct and passes it to the parent class. 55 */ 56 public this (DzlDockWidget* dzlDockWidget, bool ownedRef = false) 57 { 58 this.dzlDockWidget = dzlDockWidget; 59 super(cast(DzlBin*)dzlDockWidget, ownedRef); 60 } 61 62 // add the DockItem capabilities 63 mixin DockItemT!(DzlDockWidget); 64 65 alias getParent = Widget.getParent; 66 67 /** 68 */ 69 70 /** */ 71 public static GType getType() 72 { 73 return dzl_dock_widget_get_type(); 74 } 75 76 /** */ 77 public this() 78 { 79 auto p = dzl_dock_widget_new(); 80 81 if(p is null) 82 { 83 throw new ConstructionException("null returned by new"); 84 } 85 86 this(cast(DzlDockWidget*) p); 87 } 88 89 /** */ 90 public void setGicon(IconIF gicon) 91 { 92 dzl_dock_widget_set_gicon(dzlDockWidget, (gicon is null) ? null : gicon.getIconStruct()); 93 } 94 95 /** */ 96 public void setIconName(string iconName) 97 { 98 dzl_dock_widget_set_icon_name(dzlDockWidget, Str.toStringz(iconName)); 99 } 100 101 /** */ 102 public void setTitle(string title) 103 { 104 dzl_dock_widget_set_title(dzlDockWidget, Str.toStringz(title)); 105 } 106 }