1 /* 2 * grid.h 3 * 4 * 5 * Author: 6 * Richard Hult <rhult@hem.passagen.se> 7 * Ricardo Markiewicz <rmarkie@fi.uba.ar> 8 * Andres de Barbara <adebarbara@fi.uba.ar> 9 * Marc Lorber <lorber.marc@wanadoo.fr> 10 * 11 * Web page: https://github.com/marc-lorber/oregano 12 * 13 * Copyright (C) 1999-2001 Richard Hult 14 * Copyright (C) 2003,2004 Ricardo Markiewicz 15 * Copyright (C) 2009-2012 Marc Lorber 16 * 17 * This program is free software; you can redistribute it and/or 18 * modify it under the terms of the GNU General Public License as 19 * published by the Free Software Foundation; either version 2 of the 20 * License, or (at your option) any later version. 21 * 22 * This program is distributed in the hope that it will be useful, 23 * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 25 * General Public License for more details. 26 * 27 * You should have received a copy of the GNU General Public 28 * License along with this program; if not, write to the 29 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 30 * Boston, MA 02110-1301, USA. 31 */ 32 33 #ifndef __GRID_H 34 #define __GRID_H 35 36 #include <glib.h> 37 #include <gtk/gtk.h> 38 #include <goocanvas.h> 39 #include "coords.h" 40 41 #define TYPE_GRID (grid_get_type ()) 42 #define GRID(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, grid_get_type (), Grid)) 43 #define GRID_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, grid_get_type (), GridClass)) 44 #define IS_GRID(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, grid_get_type ())) 45 46 typedef struct _Grid Grid; 47 typedef struct _GridClass GridClass; 48 typedef struct _GridPriv GridPriv; 49 50 struct _Grid 51 { 52 GooCanvasGroup canvas_group; 53 gdouble width; 54 gdouble height; 55 gdouble x; 56 gdouble y; 57 GridPriv *priv; 58 }; 59 60 struct _GridClass 61 { 62 GooCanvasGroupClass parent_class; 63 }; 64 65 Grid *grid_new (GooCanvasItem *root, gdouble width, gdouble height); 66 GType grid_get_type (void); 67 gboolean snap_to_grid (Grid *grid, double *x, double *y); 68 void grid_show (Grid *grid, gboolean snap); 69 void grid_snap (Grid *grid, gboolean snap); 70 71 #endif 72