1 /* biji-webkit-editor
2  * Copyright (C) Pierre-Yves LUYTEN 2012 <py@luyten.fr>
3  *
4  * bijiben is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * bijiben is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12  * See the GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #pragma once
19 
20 #include <gtk/gtk.h>
21 #include <webkit2/webkit2.h>
22 
23 #include "../biji-note-obj.h"
24 #include "../bjb-settings.h"
25 
26 G_BEGIN_DECLS
27 
28 #define BIJI_TYPE_WEBKIT_EDITOR             (biji_webkit_editor_get_type ())
29 #define BIJI_WEBKIT_EDITOR(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), BIJI_TYPE_WEBKIT_EDITOR, BijiWebkitEditor))
30 #define BIJI_WEBKIT_EDITOR_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), BIJI_TYPE_WEBKIT_EDITOR, BijiWebkitEditorClass))
31 #define BIJI_IS_WEBKIT_EDITOR(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BIJI_TYPE_WEBKIT_EDITOR))
32 #define BIJI_IS_WEBKIT_EDITOR_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), BIJI_TYPE_WEBKIT_EDITOR))
33 #define BIJI_WEBKIT_EDITOR_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), BIJI_TYPE_WEBKIT_EDITOR, BijiWebkitEditorClass))
34 
35 typedef struct _BijiWebkitEditorClass BijiWebkitEditorClass;
36 typedef struct _BijiWebkitEditor BijiWebkitEditor;
37 typedef struct _BijiWebkitEditorPrivate BijiWebkitEditorPrivate;
38 
39 struct _BijiWebkitEditorClass
40 {
41   WebKitWebViewClass parent_class;
42 };
43 
44 struct _BijiWebkitEditor
45 {
46   WebKitWebView parent_instance;
47   BijiWebkitEditorPrivate * priv;
48 };
49 
50 GType biji_webkit_editor_get_type (void) G_GNUC_CONST;
51 
52 BijiWebkitEditor * biji_webkit_editor_new (BijiNoteObj *note);
53 
54 void biji_webkit_editor_apply_format (BijiWebkitEditor *self, gint format);
55 
56 gboolean biji_webkit_editor_has_selection (BijiWebkitEditor *self);
57 
58 const gchar * biji_webkit_editor_get_selection (BijiWebkitEditor *self);
59 
60 void biji_webkit_editor_cut (BijiWebkitEditor *self);
61 
62 void biji_webkit_editor_copy (BijiWebkitEditor *self);
63 
64 void biji_webkit_editor_paste (BijiWebkitEditor *self);
65 
66 void biji_webkit_editor_undo (BijiWebkitEditor *self);
67 void biji_webkit_editor_redo (BijiWebkitEditor *self);
68 
69 void biji_webkit_editor_set_font (BijiWebkitEditor *self, gchar *font);
70 
71 void biji_webkit_editor_set_text_size (BijiWebkitEditor *self,
72                                        BjbTextSizeType   text_size);
73 
74 G_END_DECLS
75