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.DockOverlay; 20 21 private import dazzle.DockIF; 22 private import dazzle.DockItemIF; 23 private import dazzle.DockItemT; 24 private import dazzle.DockOverlayEdge; 25 private import dazzle.DockT; 26 private import dazzle.c.functions; 27 public import dazzle.c.types; 28 private import glib.ConstructionException; 29 private import gobject.ObjectG; 30 private import gobject.Signals; 31 private import gtk.Adjustment; 32 private import gtk.BuildableIF; 33 private import gtk.BuildableT; 34 private import gtk.EventBox; 35 private import gtk.Widget; 36 private import std.algorithm; 37 38 39 /** */ 40 public class DockOverlay : EventBox, DockIF, DockItemIF 41 { 42 /** the main Gtk struct */ 43 protected DzlDockOverlay* dzlDockOverlay; 44 45 /** Get the main Gtk struct */ 46 public DzlDockOverlay* getDockOverlayStruct(bool transferOwnership = false) 47 { 48 if (transferOwnership) 49 ownedRef = false; 50 return dzlDockOverlay; 51 } 52 53 /** the main Gtk struct as a void* */ 54 protected override void* getStruct() 55 { 56 return cast(void*)dzlDockOverlay; 57 } 58 59 /** 60 * Sets our main struct and passes it to the parent class. 61 */ 62 public this (DzlDockOverlay* dzlDockOverlay, bool ownedRef = false) 63 { 64 this.dzlDockOverlay = dzlDockOverlay; 65 super(cast(GtkEventBox*)dzlDockOverlay, ownedRef); 66 } 67 68 // add the Dock capabilities 69 mixin DockT!(DzlDockOverlay); 70 71 // add the DockItem capabilities 72 mixin DockItemT!(DzlDockOverlay); 73 74 alias getParent = Widget.getParent; 75 76 /** 77 */ 78 79 /** */ 80 public static GType getType() 81 { 82 return dzl_dock_overlay_get_type(); 83 } 84 85 /** */ 86 public this() 87 { 88 auto p = dzl_dock_overlay_new(); 89 90 if(p is null) 91 { 92 throw new ConstructionException("null returned by new"); 93 } 94 95 this(cast(DzlDockOverlay*) p); 96 } 97 98 /** 99 * 100 * Params: 101 * position = the edge position. 102 * Returns: The corresponding #DzlDockOverlayEdge. 103 */ 104 public DockOverlayEdge getEdge(GtkPositionType position) 105 { 106 auto p = dzl_dock_overlay_get_edge(dzlDockOverlay, position); 107 108 if(p is null) 109 { 110 return null; 111 } 112 113 return ObjectG.getDObject!(DockOverlayEdge)(cast(DzlDockOverlayEdge*) p); 114 } 115 116 /** 117 * 118 * Params: 119 * position = the edge position. 120 * Returns: The corresponding #GtkAdjustment. 121 */ 122 public Adjustment getEdgeAdjustment(GtkPositionType position) 123 { 124 auto p = dzl_dock_overlay_get_edge_adjustment(dzlDockOverlay, position); 125 126 if(p is null) 127 { 128 return null; 129 } 130 131 return ObjectG.getDObject!(Adjustment)(cast(GtkAdjustment*) p); 132 } 133 134 /** */ 135 gulong addOnHideEdges(void delegate(DockOverlay) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 136 { 137 return Signals.connect(this, "hide-edges", dlg, connectFlags ^ ConnectFlags.SWAPPED); 138 } 139 }