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_SHEET_H
22 #define GNUCASH_SHEET_H
23 
24 #include <gtk/gtk.h>
25 #include "split-register-model.h"
26 #include "table-allgui.h"
27 
28 /** @ingroup Register
29  * @addtogroup Gnome
30  * @{
31  */
32 /** @file gnucash-sheet.h
33  * @brief Public declarations of GnucashSheet class.
34  */
35 
36 #define GNUCASH_TYPE_SHEET     (gnucash_sheet_get_type ())
37 #define GNUCASH_SHEET(obj)     (G_TYPE_CHECK_INSTANCE_CAST((obj), GNUCASH_TYPE_SHEET, GnucashSheet))
38 #define GNUCASH_SHEET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNUCASH_TYPE_SHEET))
39 #define GNUCASH_IS_SHEET(o)    (G_TYPE_CHECK_INSTANCE_TYPE((o), GNUCASH_TYPE_SHEET))
40 
41 
42 typedef struct _SheetBlockStyle SheetBlockStyle;
43 typedef struct _GnucashSheet GnucashSheet;
44 typedef struct _GnucashSheetClass GnucashSheetClass;
45 
46 
47 typedef struct
48 {
49     /** The style for this block */
50     SheetBlockStyle *style;
51 
52     gint origin_x; /** x origin of block */
53     gint origin_y; /** y origin of block */
54 
55     gboolean visible; /** is block visible */
56 } SheetBlock;
57 
58 
59 GType      gnucash_sheet_get_type (void);
60 GtkWidget *gnucash_sheet_new (Table *table);
61 
62 void gnucash_sheet_table_load (GnucashSheet *sheet, gboolean do_scroll);
63 
64 void gnucash_sheet_recompute_block_offsets (GnucashSheet *sheet);
65 
66 SheetBlock *gnucash_sheet_get_block (GnucashSheet *sheet,
67                                      VirtualCellLocation vcell_loc);
68 
69 gint gnucash_sheet_col_max_width (GnucashSheet *sheet,
70                                   gint virt_col, gint cell_col);
71 
72 void gnucash_sheet_redraw_all (GnucashSheet *sheet);
73 void gnucash_sheet_redraw_help (GnucashSheet *sheet);
74 
75 void gnucash_sheet_redraw_block (GnucashSheet *sheet,
76                                  VirtualCellLocation vcell_loc);
77 
78 const char * gnucash_sheet_modify_current_cell (GnucashSheet *sheet,
79                                                 const gchar *new_text);
80 
81 gboolean gnucash_sheet_block_set_from_table (GnucashSheet *sheet,
82                                              VirtualCellLocation vcell_loc);
83 
84 void gnucash_sheet_set_scroll_region (GnucashSheet *sheet);
85 
86 void gnucash_sheet_cursor_set_from_table (GnucashSheet *sheet,
87                                           gboolean do_scroll);
88 
89 void gnucash_sheet_compute_visible_range (GnucashSheet *sheet);
90 
91 void gnucash_sheet_make_cell_visible (GnucashSheet *sheet,
92                                       VirtualLocation virt_loc);
93 
94 void gnucash_sheet_show_range (GnucashSheet *sheet,
95                                VirtualCellLocation start_loc,
96                                VirtualCellLocation end_loc);
97 
98 void gnucash_sheet_update_adjustments (GnucashSheet *sheet);
99 
100 void gnucash_sheet_set_window (GnucashSheet *sheet, GtkWidget *window);
101 
102 void gnucash_get_style_classes (GnucashSheet *sheet, GtkStyleContext *stylectxt,
103                                 RegisterColor field_type, gboolean use_neg_class);
104 
105 void gnucash_sheet_set_text_bounds (GnucashSheet *sheet, GdkRectangle *rect,
106                                     gint x, gint y, gint width, gint height);
107 
108 gint gnucash_sheet_get_text_offset (GnucashSheet *sheet, const VirtualLocation virt_loc,
109                                     gint rect_width, gint logical_width);
110 
111 gboolean gnucash_sheet_is_read_only (GnucashSheet *sheet);
112 
113 void gnucash_sheet_set_has_focus (GnucashSheet *sheet, gboolean has_focus);
114 
115 /** @} */
116 #endif
117