tagging release
[dasher.git] / trunk / Src / Gtk2 / dasher_editor.h
blobae859eb7a2bc10dc5499bc644017f7281ae97da6
1 #ifndef __dasher_editor_h__
2 #define __dasher_editor_h__
4 #include <glade/glade.h>
5 #include <glib.h>
6 #include <glib-object.h>
7 #include <gtk/gtk.h>
9 #include "DasherAppSettings.h"
10 #include "dasher_action.h"
11 #include "dasher_buffer_set.h"
13 /* Forward declaration */
14 typedef struct _DasherMain DasherMain;
15 struct _DasherMain;
17 G_BEGIN_DECLS
18 #define TYPE_DASHER_EDITOR (dasher_editor_get_type())
19 #define DASHER_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_DASHER_EDITOR, DasherEditor ))
20 #define DASHER_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DASHER_EDITOR, DasherEditorClass ))
21 #define IS_DASHER_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_DASHER_EDITOR))
22 #define IS_DASHER_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DASHER_EDITOR))
23 #define DASHER_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DASHER_EDITOR, DasherEditorClass))
25 typedef struct _DasherEditor DasherEditor;
26 typedef struct _DasherEditorClass DasherEditorClass;
28 struct _DasherEditor {
29 GtkVBox box;
32 struct _DasherEditorClass {
33 GtkVBoxClass parent_class;
35 void (*filename_changed)(DasherEditor *pDasherEditor);
36 void (*buffer_changed)(DasherEditor *pDasherEditor);
37 void (*context_changed)(DasherEditor *pDasherEditor);
40 void (*initialise)(DasherEditor *pSelf, DasherAppSettings *pAppSettings, DasherMain *pDasherMain, GladeXML *pGladeXML, const gchar *szFullPath);
41 gboolean (*command)(DasherEditor *pSelf, const gchar *szCommand);
42 void (*handle_font)(DasherEditor *pSelf, const gchar *szFont);
43 void (*output)(DasherEditor *pSelf, const gchar *szText, int iOffset);
44 void (*delete_text)(DasherEditor *pSelf, int iLength, int iOffset);
45 const gchar *(*get_context)(DasherEditor *pSelf, int iOffset, int iLength);
46 gint (*get_offset)(DasherEditor *pSelf);
47 void (*handle_stop)(DasherEditor *pSelf);
48 void (*handle_start)(DasherEditor *pSelf);
49 void (*handle_control)(DasherEditor *pSelf, int iNodeID);
50 void (*action_button)(DasherEditor *pSelf, DasherAction *pAction);
51 void (*actions_start)(DasherEditor *pSelf);
52 bool (*actions_more)(DasherEditor *pSelf);
53 void (*actions_get_next)(DasherEditor *pSelf, const gchar **szName, gint *iID, gboolean *bShow, gboolean *bControl, gboolean *bAuto);
54 void (*action_set_show)(DasherEditor *pSelf, int iActionID, bool bValue);
55 void (*action_set_control)(DasherEditor *pSelf, int iActionID, bool bValue);
56 void (*action_set_auto)(DasherEditor *pSelf, int iActionID, bool bValue);
57 void (*grab_focus)(DasherEditor *pSelf);
58 gboolean (*file_changed)(DasherEditor *pSelf);
59 const gchar *(*get_filename)(DasherEditor *pSelf);
60 const gchar *(*get_all_text)(DasherEditor *pSelf);
61 const gchar *(*get_new_text)(DasherEditor *pSelf);
64 void dasher_editor_initialise(DasherEditor *pSelf, DasherAppSettings *pAppSettings, DasherMain *pDasherMain, GladeXML *pGladeXML, const gchar *szFullPath);
66 GType dasher_editor_get_type();
68 /* Replace this with GTK text buffer */
69 //IDasherBufferSet *dasher_editor_get_buffer_set(DasherEditor *pSelf);
71 // TODO: Just have one 'handle event' method?
72 gboolean dasher_editor_command(DasherEditor *pSelf, const gchar *szCommand);
74 void dasher_editor_handle_font(DasherEditor *pSelf, const gchar *szFont);
76 /* To be obsoleted by movement to GTK buffers */
77 void dasher_editor_output(DasherEditor *pSelf, const gchar *szText, int iOffset);
78 void dasher_editor_delete(DasherEditor *pSelf, int iLength, int iOffset);
79 const gchar *dasher_editor_get_context(DasherEditor *pSelf, int iOffset, int iLength);
80 gint dasher_editor_get_offset(DasherEditor *pSelf);
82 /* Events proagated from main */
83 void dasher_editor_handle_stop(DasherEditor *pSelf);
84 void dasher_editor_handle_start(DasherEditor *pSelf);
85 void dasher_editor_handle_control(DasherEditor *pSelf, int iNodeID);
87 /* Action related methods - TODO: a lot of this should be moved to dasher_main (eg action on stop etc) - that way we get a better level of abstraction, and can incorporate commands from otehr modules too. Actions should only be externally visible as a list of string commands*/
88 void dasher_editor_action_button(DasherEditor *pSelf, DasherAction *pAction);
89 void dasher_editor_actions_start(DasherEditor *pSelf);
90 bool dasher_editor_actions_more(DasherEditor *pSelf);
91 void dasher_editor_actions_get_next(DasherEditor *pSelf, const gchar **szName, gint *iID, gboolean *bShow, gboolean *bControl, gboolean *bAuto);
92 void dasher_editor_action_set_show(DasherEditor *pSelf, int iActionID, bool bValue);
93 void dasher_editor_action_set_control(DasherEditor *pSelf, int iActionID, bool bValue);
94 void dasher_editor_action_set_auto(DasherEditor *pSelf, int iActionID, bool bValue);
96 void dasher_editor_grab_focus(DasherEditor *pSelf);
98 /* TODO: Tutorial editor should be a separate class */
99 //void dasher_editor_start_tutorial(DasherEditor *pSelf);
101 /* Todo: possibly tidy up the need to have this public (quit in dasher_main possibly too connected) */
102 gboolean dasher_editor_file_changed(DasherEditor *pSelf);
103 const gchar *dasher_editor_get_filename(DasherEditor *pSelf);
105 const gchar *dasher_editor_get_all_text(DasherEditor *pSelf);
106 const gchar *dasher_editor_get_new_text(DasherEditor *pSelf);
107 G_END_DECLS
109 #endif