summaryrefslogtreecommitdiff
path: root/src/sheet/sheet-item.h
blob: 78141991ac2c259347f4c9bbd62b62f828f0dd66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
 * sheet-item.h
 *
 *
 * Authors:
 *  Richard Hult <rhult@hem.passagen.se>
 *  Ricardo Markiewicz <rmarkie@fi.uba.ar>
 *  Andres de Barbara <adebarbara@fi.uba.ar>
 *  Marc Lorber <lorber.marc@wanadoo.fr>
 *
 * Web page: https://github.com/marc-lorber/oregano
 *
 * Copyright (C) 1999-2001  Richard Hult
 * Copyright (C) 2003,2004  Ricardo Markiewicz
 * Copyright (C) 2009-2012  Marc Lorber
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */
#ifndef __SHEET_ITEM_H
#define __SHEET_ITEM_H

#include <gtk/gtk.h>
#include <glib.h>
#include <goocanvas.h>

#include "sheet.h"
#include "sheet-pos.h"

#define TYPE_SHEET_ITEM			 (sheet_item_get_type())
#define SHEET_ITEM(obj)			 (G_TYPE_CHECK_INSTANCE_CAST(obj, sheet_item_get_type (), SheetItem))
#define SHEET_ITEM_CLASS(klass)	 (G_TYPE_CHECK_CLASS_CAST(klass, sheet_item_get_type (), SheetItemClass))
#define IS_SHEET_ITEM(obj)		 (G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_SHEET_ITEM))

typedef struct _SheetItemClass SheetItemClass;
typedef struct _SheetItemPriv SheetItemPriv;

#include "sheet.h"
#include "clipboard.h"

struct _SheetItem {
	GooCanvasGroup canvas_group;
	gdouble 	   width;
	gdouble        height;
	gdouble        x;
	gdouble		   y;
	SheetItemPriv *priv;
};

struct _SheetItemClass {
	GooCanvasGroupClass parent_class;

	// Methods.
	gboolean (*is_in_area)		 (SheetItem *item, SheetPos *p1, SheetPos *p2);
	void	 (*show_labels)		 (SheetItem *sheet_item, gboolean show);
	void	 (*edit_properties)	 (SheetItem *item);
	void	 (*paste)			 (Sheet *sheet, ItemData *data);
	void	 (*place)			 (SheetItem *item, Sheet *sheet);
	void	 (*place_ghost)		 (SheetItem *item, Sheet *sheet);

	// Signal handlers.
	void	 (*moved)			 (SheetItem *item);
	void	 (*selection_changed)(SheetItem *item);
	void	 (*mouse_over)		 (SheetItem *item);
};

GType		sheet_item_get_type (void);
void 		sheet_item_select_all (Sheet *sheet, gboolean select);
gboolean	sheet_item_select (SheetItem *item, gboolean  select);
Sheet	*	sheet_item_get_sheet (SheetItem *item);
gboolean    sheet_item_event (GooCanvasItem *sheet_item, 
                GooCanvasItem *sheet_target_item, GdkEvent *event, 
                Sheet *sheet);
int 		sheet_item_floating_event (Sheet *sheet, const GdkEvent *event);
void 		sheet_item_cancel_floating (Sheet *sheet);
void 		sheet_item_edit_properties (SheetItem *item);
ItemData *	sheet_item_get_data (SheetItem *item);
void 		sheet_item_paste (Sheet *sheet, 
				ClipboardData *data);
void 		sheet_item_rotate (SheetItem *sheet_item, int angle, 
		        SheetPos *center);
gboolean 	sheet_item_get_selected (SheetItem *item);
gboolean 	sheet_item_get_preserve_selection (SheetItem *item);
void 		sheet_item_set_preserve_selection (SheetItem *item, gboolean   set);
void 		sheet_item_select_in_area (SheetItem *item, SheetPos  *p1,
		    	SheetPos  *p2);
void 		sheet_item_place (SheetItem *item, Sheet *sheet);
void 		sheet_item_place_ghost (SheetItem *item, Sheet *sheet);
void 		sheet_item_add_menu (SheetItem *item, const char *menu, 
    			const GtkActionEntry *action_entries, int nb_entries);

#endif