1 /********************************************************************\
2  * This program is free software; you can redistribute it and/or    *
3  * modify it under the terms of the GNU General Public License as   *
4  * published by the Free Software Foundation; either version 2 of   *
5  * the License, or (at your option) any later version.              *
6  *                                                                  *
7  * This program is distributed in the hope that it will be useful,  *
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
10  * GNU General Public License for more details.                     *
11  *                                                                  *
12  * You should have received a copy of the GNU General Public License*
13  * along with this program; if not, contact:                        *
14  *                                                                  *
15  * Free Software Foundation           Voice:  +1-617-542-5942       *
16  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
17  * Boston, MA  02110-1301,  USA       gnu@gnu.org                   *
18  *                                                                  *
19 \********************************************************************/
20 
21 #ifndef GNUCASH_CURSOR_H
22 #define GNUCASH_CURSOR_H
23 
24 #include <glib.h>
25 #include "gnucash-sheet.h"
26 
27 /** @ingroup Register
28  * @addtogroup Gnome
29  * @{
30  */
31 /** @file gnucash-cursor.h
32  * @brief Public declarations for GnucashCursor class
33  */
34 #define GNUCASH_TYPE_CURSOR     (gnucash_cursor_get_type ())
35 #define GNUCASH_CURSOR(obj)     (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNUCASH_TYPE_CURSOR, GnucashCursor))
36 #define GNUCASH_CURSOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNUCASH_TYPE_CURSOR, GnucashCursorClass))
37 #define GNUCASH_IS_CURSOR(obj)  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNUCASH_TYPE_CURSOR))
38 
39 #define GNUCASH_TYPE_ITEM_CURSOR     (gnucash_item_cursor_get_type ())
40 #define GNUCASH_ITEM_CURSOR(obj)     (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNUCASH_TYPE_ITEM_CURSOR, GnucashItemCursor))
41 #define GNUCASH_ITEM_CURSOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNUCASH_TYPE_ITEM_CURSOR, GnucashItemCursorClass))
42 #define GNUCASH_IS_ITEM_CURSOR(o)    (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNUCASH_TYPE_ITEM_CURSOR))
43 
44 
45 GType    gnucash_item_cursor_get_type (void);
46 GType    gnucash_cursor_get_type (void);
47 
48 
49 enum
50 {
51     GNUCASH_CURSOR_CELL,
52     GNUCASH_CURSOR_BLOCK,
53     GNUCASH_CURSOR_NUM
54 };
55 
56 
57 typedef struct
58 {
59     gint row;
60     gint col;
61 
62     /* precomputed pixel coords for the item cursor*/
63     gint x, y, w, h;
64 } GnucashCursorCell;
65 
66 
67 typedef struct
68 {
69     GObject obj;
70 
71     GnucashCursorCell cell;
72     GnucashSheet *sheet;
73 
74     gint row;
75     gint col;
76     /* precomputed pixel coords for the block cursor*/
77     gint x, y, w, h;
78 
79     SheetBlockStyle *style;
80 } GnucashCursor;
81 
82 typedef struct
83 {
84     GObjectClass parent_class;
85 } GnucashCursorClass;
86 
87 
88 GnucashCursor *gnucash_cursor_new (GnucashSheet *sheet);
89 
90 void gnucash_cursor_get_virt (GnucashCursor *cursor,
91                               VirtualLocation *virt_loc);
92 
93 void gnucash_cursor_set (GnucashCursor *cursor, VirtualLocation virt_loc);
94 
95 void gnucash_cursor_set_style (GnucashCursor  *cursor, SheetBlockStyle *style);
96 
97 void gnucash_cursor_configure (GnucashCursor *cursor);
98 
99 /** @} */
100 #endif /* GNUCASH_CURSOR_H */
101