GUI: Dead kittens.
[gnumeric.git] / src / workbook-view.h
blobf0adc76d765713ab2f25d2d33bd0c4f3a4dd0be6
1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 #ifndef _GNM_WORKBOOK_VIEW_H_
3 # define _GNM_WORKBOOK_VIEW_H_
5 #include "gnumeric.h"
6 #include "dependent.h"
7 #include <goffice/goffice.h>
9 G_BEGIN_DECLS
11 struct _WorkbookView {
12 GoView base;
14 Workbook *wb;
15 GPtrArray *wb_controls;
17 Sheet *current_sheet; /* convenience */
18 SheetView *current_sheet_view;
20 /* preferences */
21 gboolean show_horizontal_scrollbar;
22 gboolean show_vertical_scrollbar;
23 gboolean show_notebook_tabs;
24 gboolean show_function_cell_markers;
25 gboolean show_extension_markers;
26 gboolean do_auto_completion;
27 gboolean is_protected;
29 /* Non-normative size information */
30 int preferred_width, preferred_height;
32 /* The auto-expression */
33 struct {
34 GnmFunc *func;
35 char *descr;
36 GnmValue *value;
37 gboolean use_max_precision;
38 GnmDependent dep;
39 gulong sheet_detached_sig;
40 } auto_expr;
42 /* selection */
43 char *selection_description;
45 /* Style for feedback */
46 GnmStyle const *current_style;
47 SheetObject *in_cell_combo; /* validation or data slicer */
50 typedef struct {
51 GObjectClass base_class;
52 void (*sheet_entered) (Sheet *sheet);
53 } WorkbookViewClass;
55 #define GNM_WORKBOOK_VIEW_TYPE (workbook_view_get_type ())
56 #define GNM_WORKBOOK_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNM_WORKBOOK_VIEW_TYPE, WorkbookView))
57 #define GNM_IS_WORKBOOK_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNM_WORKBOOK_VIEW_TYPE))
59 /* Lifecycle */
60 GType workbook_view_get_type (void);
61 WorkbookView *workbook_view_new (Workbook *wb);
62 void wb_view_attach_control (WorkbookView *wbv, WorkbookControl *wbc);
63 void wb_view_detach_control (WorkbookControl *wbc);
64 void wb_view_detach_from_workbook (WorkbookView *wbv);
66 /* Information */
67 GODoc *wb_view_get_doc (WorkbookView const *wbv);
68 Workbook *wb_view_get_workbook (WorkbookView const *wbv);
69 int wb_view_get_index_in_wb (WorkbookView const *wbv);
70 Sheet *wb_view_cur_sheet (WorkbookView const *wbv);
71 SheetView *wb_view_cur_sheet_view (WorkbookView const *wbv);
72 void wb_view_sheet_focus (WorkbookView *wbv, Sheet *sheet);
73 void wb_view_sheet_add (WorkbookView *wbv, Sheet *new_sheet);
74 gboolean wb_view_is_protected (WorkbookView *wbv, gboolean check_sheet);
76 /* Manipulation */
77 void wb_view_set_attribute (WorkbookView *wbv, char const *name,
78 char const *value);
79 void wb_view_preferred_size (WorkbookView *wbv,
80 int w_pixels, int h_pixels);
81 void wb_view_style_feedback (WorkbookView *wbv);
82 void wb_view_menus_update (WorkbookView *wbv);
83 void wb_view_selection_desc (WorkbookView *wbv, gboolean use_pos,
84 WorkbookControl *wbc);
85 void wb_view_edit_line_set (WorkbookView *wbv,
86 WorkbookControl *wbc);
87 void wb_view_auto_expr_recalc (WorkbookView *wbv);
89 /* I/O routines */
90 gboolean workbook_view_save_as (WorkbookView *wbv, GOFileSaver *fs,
91 char const *uri, GOCmdContext *cc);
92 gboolean workbook_view_save (WorkbookView *wbv, GOCmdContext *cc);
93 void workbook_view_save_to_output (WorkbookView *wbv,
94 GOFileSaver const *fs,
95 GsfOutput *output,
96 GOIOContext *io_context);
97 void workbook_view_save_to_uri (WorkbookView *wbv, GOFileSaver const *fs,
98 char const *uri, GOIOContext *io_context);
100 WorkbookView *workbook_view_new_from_input (GsfInput *input,
101 const char *uri,
102 GOFileOpener const *file_opener,
103 GOIOContext *io_context,
104 gchar const *encoding);
105 WorkbookView *workbook_view_new_from_uri (char const *uri,
106 GOFileOpener const *file_opener,
107 GOIOContext *io_context,
108 gchar const *encoding);
110 #define WORKBOOK_VIEW_FOREACH_CONTROL(wbv, control, code) \
111 do { \
112 int jNd; \
113 GPtrArray *wb_controls = (wbv)->wb_controls; \
114 if (wb_controls != NULL) /* Reverse is important during destruction */ \
115 for (jNd = wb_controls->len; jNd-- > 0 ;) { \
116 WorkbookControl *control = \
117 g_ptr_array_index (wb_controls, jNd); \
118 code \
120 } while (0)
123 G_END_DECLS
125 #endif /* _GNM_WORKBOOK_VIEW_H_ */