1 /* This file is part of Ganv. 2 * Copyright 2007-2014 David Robillard <http://drobilla.net> 3 * 4 * Ganv is free software: you can redistribute it and/or modify it under the 5 * terms of the GNU General Public License as published by the Free Software 6 * Foundation, either version 3 of the License, or any later version. 7 * 8 * Ganv is distributed in the hope that it will be useful, but WITHOUT ANY 9 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 10 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. 11 * 12 * You should have received a copy of the GNU General Public License along 13 * with Ganv. If not, see <http://www.gnu.org/licenses/>. 14 */ 15 16 // IWYU pragma: no_include "ganv-private.h" 17 18 #ifndef GANV_BOX_H 19 #define GANV_BOX_H 20 21 #include "ganv/node.h" 22 #include "ganv/types.h" 23 24 #include <glib-object.h> 25 #include <glib.h> 26 #include <gtk/gtk.h> 27 28 G_BEGIN_DECLS 29 30 #define GANV_TYPE_BOX (ganv_box_get_type()) 31 #define GANV_BOX(obj) (GTK_CHECK_CAST((obj), GANV_TYPE_BOX, GanvBox)) 32 #define GANV_BOX_CLASS(klass) (GTK_CHECK_CLASS_CAST((klass), GANV_TYPE_BOX, GanvBoxClass)) 33 #define GANV_IS_BOX(obj) (GTK_CHECK_TYPE((obj), GANV_TYPE_BOX)) 34 #define GANV_IS_BOX_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), GANV_TYPE_BOX)) 35 #define GANV_BOX_GET_CLASS(obj) (GTK_CHECK_GET_CLASS((obj), GANV_TYPE_BOX, GanvBoxClass)) 36 37 struct _GanvBoxClass; 38 39 typedef struct _GanvBoxClass GanvBoxClass; 40 typedef struct _GanvBoxPrivate GanvBoxPrivate; 41 42 struct _GanvBox { 43 GanvNode node; 44 GanvBoxPrivate* impl; 45 }; 46 47 /** 48 * GanvBoxClass: 49 * @parent_class: Node superclass. 50 * @set_width: Set the width of the box. 51 * @set_height: Set the height of the box. 52 */ 53 struct _GanvBoxClass { 54 GanvNodeClass parent_class; 55 56 void (*set_width)(GanvBox* box, 57 double width); 58 59 void (*set_height)(GanvBox* box, 60 double height); 61 62 /* Reserved for future expansion */ 63 gpointer spare_vmethods[4]; 64 }; 65 66 GType ganv_box_get_type(void) G_GNUC_CONST; 67 double ganv_box_get_x1(const GanvBox* box); 68 double ganv_box_get_y1(const GanvBox* box); 69 double ganv_box_get_x2(const GanvBox* box); 70 double ganv_box_get_y2(const GanvBox* box); 71 double ganv_box_get_width(const GanvBox* box); 72 void ganv_box_set_width(GanvBox* box, double width); 73 double ganv_box_get_height(const GanvBox* box); 74 void ganv_box_set_height(GanvBox* box, double height); 75 double ganv_box_get_border_width(const GanvBox* box); 76 77 /** 78 * ganv_box_normalize: 79 * @box: The box to normalize. 80 * 81 * Normalize the box coordinates such that x1 < x2 and y1 < y2. 82 */ 83 void ganv_box_normalize(GanvBox* box); 84 85 G_END_DECLS 86 87 #endif /* GANV_BOX_H */ 88