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.CountersWindow; 20 21 private import dazzle.CounterArena; 22 private import dazzle.c.functions; 23 public import dazzle.c.types; 24 private import glib.ConstructionException; 25 private import gobject.ObjectG; 26 private import gtk.BuildableIF; 27 private import gtk.BuildableT; 28 private import gtk.Widget; 29 private import gtk.Window; 30 31 32 /** */ 33 public class CountersWindow : Window 34 { 35 /** the main Gtk struct */ 36 protected DzlCountersWindow* dzlCountersWindow; 37 38 /** Get the main Gtk struct */ 39 public DzlCountersWindow* getCountersWindowStruct(bool transferOwnership = false) 40 { 41 if (transferOwnership) 42 ownedRef = false; 43 return dzlCountersWindow; 44 } 45 46 /** the main Gtk struct as a void* */ 47 protected override void* getStruct() 48 { 49 return cast(void*)dzlCountersWindow; 50 } 51 52 /** 53 * Sets our main struct and passes it to the parent class. 54 */ 55 public this (DzlCountersWindow* dzlCountersWindow, bool ownedRef = false) 56 { 57 this.dzlCountersWindow = dzlCountersWindow; 58 super(cast(GtkWindow*)dzlCountersWindow, ownedRef); 59 } 60 61 62 /** */ 63 public static GType getType() 64 { 65 return dzl_counters_window_get_type(); 66 } 67 68 /** */ 69 public this() 70 { 71 auto p = dzl_counters_window_new(); 72 73 if(p is null) 74 { 75 throw new ConstructionException("null returned by new"); 76 } 77 78 this(cast(DzlCountersWindow*) p); 79 } 80 81 /** 82 * Gets the currently viewed arena, if any. 83 * 84 * Returns: A #DzlCounterArena or %NULL. 85 */ 86 public CounterArena getArena() 87 { 88 auto p = dzl_counters_window_get_arena(dzlCountersWindow); 89 90 if(p is null) 91 { 92 return null; 93 } 94 95 return ObjectG.getDObject!(CounterArena)(cast(DzlCounterArena*) p); 96 } 97 98 /** */ 99 public void setArena(CounterArena arena) 100 { 101 dzl_counters_window_set_arena(dzlCountersWindow, (arena is null) ? null : arena.getCounterArenaStruct()); 102 } 103 }