workbook-control.h 5.27 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
#ifndef GNUMERIC_WORKBOOK_CONTROL_H
#define GNUMERIC_WORKBOOK_CONTROL_H

#include "gnumeric.h"
#include <gtk/gtkobject.h>

struct _WorkbookControl {
	GtkObject  gtk_object;

	WorkbookView *wb_view;
Jody Goldberg's avatar
Jody Goldberg committed
11
	GSList *template_list;
12 13 14 15
};
typedef struct {
	GtkObjectClass   gtk_object_class;

Jody Goldberg's avatar
Jody Goldberg committed
16 17 18
	/* Create a new control of the same form */
	WorkbookControl *(*control_new) (WorkbookControl *wbc, WorkbookView *wbv, Workbook *wb);

19 20 21 22 23 24 25 26
	/* Actions on the workbook UI */
	void (*title_set)	(WorkbookControl *wbc, char const *title);
	void (*size_pixels_set)	(WorkbookControl *wbc, int width, int height);
	void (*prefs_update)	(WorkbookControl *wbc);
	void (*progress_set)	(WorkbookControl *wbc, gfloat val);
	void (*format_feedback)	(WorkbookControl *wbc, MStyle *style);
	void (*zoom_feedback)	(WorkbookControl *wbc);
	void (*edit_line_set)   (WorkbookControl *wbc, char const *text);
Jody Goldberg's avatar
Jody Goldberg committed
27
	void (*auto_expr_value) (WorkbookControl *wbc, char const *value);
Jody Goldberg's avatar
Jody Goldberg committed
28 29 30
	struct {
		void (*add)	(WorkbookControl *wbc, Sheet *sheet);
		void (*remove)	(WorkbookControl *wbc, Sheet *sheet);
Jody Goldberg's avatar
Jody Goldberg committed
31 32 33
		void (*rename)  (WorkbookControl *wbc, Sheet *sheet);
		void (*focus)   (WorkbookControl *wbc, Sheet *sheet);
		void (*move)    (WorkbookControl *wbc, Sheet *sheet, int dir);
Jody Goldberg's avatar
Jody Goldberg committed
34
		void (*remove_all) (WorkbookControl *wbc);
Jody Goldberg's avatar
Jody Goldberg committed
35
	} sheet;
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
	struct {
		void (*clear)	(WorkbookControl *wbc, gboolean is_undo);
		void (*pop)	(WorkbookControl *wbc, gboolean is_undo);
		void (*push)	(WorkbookControl *wbc,
				 char const *text, gboolean is_undo);
		void (*labels)	(WorkbookControl *wbc,
				 char const *undo, char const *redo);
	} undo_redo;
	struct {
		void (*special_enable) (WorkbookControl *wbc, gboolean enable);
		void (*from_selection) (WorkbookControl *wbc,
					PasteTarget const *pt, guint32 time);
	} paste;
	struct {
		void (*system)	(WorkbookControl *wbc, char const *msg);
		void (*plugin)	(WorkbookControl *wbc, char const *msg);
		void (*read)	(WorkbookControl *wbc, char const *msg);
		void (*save)	(WorkbookControl *wbc, char const *msg);
		void (*invalid)	(WorkbookControl *wbc,
				 char const *msg, char const *val);
	} error;
} WorkbookControlClass;

#define WORKBOOK_CONTROL_TYPE     (workbook_control_get_type ())
#define WORKBOOK_CONTROL(obj)     (GTK_CHECK_CAST ((obj), WORKBOOK_CONTROL_TYPE, WorkbookControl))
#define WORKBOOK_CONTROL_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), WORKBOOK_CONTROL_TYPE, WorkbookControlClass))
#define IS_WORKBOOK_CONTROL(o)	  (GTK_CHECK_TYPE ((o), WORKBOOK_CONTROL_TYPE))

GtkType workbook_control_get_type    (void);
Jody Goldberg's avatar
Jody Goldberg committed
65
void 	workbook_control_set_view    (WorkbookControl *wbc,
Jody Goldberg's avatar
Jody Goldberg committed
66 67 68 69 70 71 72
				      WorkbookView *optional_view,
				      Workbook *optional_wb);
void    workbook_control_sheets_init (WorkbookControl *wbc);

/* Create a new control of the same form */
WorkbookControl *wb_control_wrapper_new (WorkbookControl *wbc,
					 WorkbookView *wbv, Workbook *wb);
73 74 75 76 77 78 79

void wb_control_title_set	     (WorkbookControl *wbc, char const *title);
void wb_control_size_pixels_set	     (WorkbookControl *wbc, int w, int h);
void wb_control_prefs_update	     (WorkbookControl *wbc);
void wb_control_format_feedback	     (WorkbookControl *wbc, MStyle *style);
void wb_control_zoom_feedback	     (WorkbookControl *wbc);
void wb_control_edit_line_set        (WorkbookControl *wbc, char const *text);
Jody Goldberg's avatar
Jody Goldberg committed
80
void wb_control_auto_expr_value	     (WorkbookControl *wbc, char const *value);
Jody Goldberg's avatar
Jody Goldberg committed
81

Jody Goldberg's avatar
Jody Goldberg committed
82 83
void wb_control_sheet_add	     (WorkbookControl *wbc, Sheet *sheet);
void wb_control_sheet_remove	     (WorkbookControl *wbc, Sheet *sheet);
Jody Goldberg's avatar
Jody Goldberg committed
84 85 86
void wb_control_sheet_rename	     (WorkbookControl *wbc, Sheet *sheet);
void wb_control_sheet_focus	     (WorkbookControl *wbc, Sheet *sheet);
void wb_control_sheet_move	     (WorkbookControl *wbc, Sheet *sheet, int dir);
Jody Goldberg's avatar
Jody Goldberg committed
87
void wb_control_sheet_remove_all     (WorkbookControl *wbc);
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103

void wb_control_undo_redo_clear	     (WorkbookControl *wbc, gboolean is_undo);
void wb_control_undo_redo_pop	     (WorkbookControl *wbc, gboolean is_undo);
void wb_control_undo_redo_push	     (WorkbookControl *wbc,
				      char const *text, gboolean is_undo);
void wb_control_undo_redo_labels     (WorkbookControl *wbc,
				      char const *undo, char const *redo);

void wb_control_paste_special_enable (WorkbookControl *wbc, gboolean enable);
void wb_control_paste_from_selection (WorkbookControl *wbc,
				      PasteTarget const *pt, guint32 time);
/*
 * These routines represent the exceptions that can arise.
 * NOTE : The selection is quite limited by IDL's intentional non-support for
 *        inheritance (single or multiple).
 */
Jody Goldberg's avatar
Jody Goldberg committed
104 105 106 107 108 109 110 111 112 113 114
void wb_control_system_err	  (WorkbookControl *wbc, char const *msg);
void wb_control_plugin_err	  (WorkbookControl *wbc, char const *msg);
void wb_control_read_err	  (WorkbookControl *wbc, char const *msg);
void wb_control_save_err	  (WorkbookControl *wbc, char const *msg);
void wb_control_splits_array_err  (WorkbookControl *wbc, char const *cmd);
void wb_control_invalid_err	  (WorkbookControl *wbc, char const *msg,
				   char const *val);
void wb_control_push_err_template (WorkbookControl *wbc, const char *str);
void wb_control_pop_err_template  (WorkbookControl *wbc);

WorkbookView *wb_control_view		(WorkbookControl *wbc);
115 116 117
Workbook     *wb_control_workbook	(WorkbookControl *wbc);
Sheet        *wb_control_cur_sheet	(WorkbookControl *wbc);

Jody Goldberg's avatar
Jody Goldberg committed
118
gboolean      workbook_parse_and_jump   (WorkbookControl *wbc, const char *text);
119 120

#endif /* GNUMERIC_WORKBOOK_CONTROL_H */