1 | /* Copyright (C) 2019 Red Hat, Inc. |
2 | * |
3 | * This library is free software; you can redistribute it and/or |
4 | * modify it under the terms of the GNU Lesser General Public |
5 | * License as published by the Free Software Foundation; either |
6 | * version 2 of the License, or (at your option) any later version. |
7 | * |
8 | * This library is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | * Lesser General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU Lesser General Public |
14 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
15 | */ |
16 | |
17 | #ifndef __GTK_TEXT_HISTORY_PRIVATE_H__ |
18 | #define __GTK_TEXT_HISTORY_PRIVATE_H__ |
19 | |
20 | #include <glib-object.h> |
21 | |
22 | G_BEGIN_DECLS |
23 | |
24 | #define GTK_TYPE_TEXT_HISTORY (gtk_text_history_get_type()) |
25 | |
26 | typedef struct _GtkTextHistoryFuncs GtkTextHistoryFuncs; |
27 | |
28 | G_DECLARE_FINAL_TYPE (GtkTextHistory, gtk_text_history, GTK, TEXT_HISTORY, GObject) |
29 | |
30 | struct _GtkTextHistoryFuncs |
31 | { |
32 | void (*change_state) (gpointer funcs_data, |
33 | gboolean is_modified, |
34 | gboolean can_undo, |
35 | gboolean can_redo); |
36 | void (*insert) (gpointer funcs_data, |
37 | guint begin, |
38 | guint end, |
39 | const char *text, |
40 | guint len); |
41 | void (*delete) (gpointer funcs_data, |
42 | guint begin, |
43 | guint end, |
44 | const char *expected_text, |
45 | guint len); |
46 | void (*select) (gpointer funcs_data, |
47 | int selection_insert, |
48 | int selection_bound); |
49 | }; |
50 | |
51 | GtkTextHistory *gtk_text_history_new (const GtkTextHistoryFuncs *funcs, |
52 | gpointer funcs_data); |
53 | void gtk_text_history_begin_user_action (GtkTextHistory *self); |
54 | void gtk_text_history_end_user_action (GtkTextHistory *self); |
55 | void gtk_text_history_begin_irreversible_action (GtkTextHistory *self); |
56 | void gtk_text_history_end_irreversible_action (GtkTextHistory *self); |
57 | gboolean gtk_text_history_get_can_undo (GtkTextHistory *self); |
58 | gboolean gtk_text_history_get_can_redo (GtkTextHistory *self); |
59 | void gtk_text_history_undo (GtkTextHistory *self); |
60 | void gtk_text_history_redo (GtkTextHistory *self); |
61 | guint gtk_text_history_get_max_undo_levels (GtkTextHistory *self); |
62 | void gtk_text_history_set_max_undo_levels (GtkTextHistory *self, |
63 | guint max_undo_levels); |
64 | void gtk_text_history_modified_changed (GtkTextHistory *self, |
65 | gboolean modified); |
66 | void gtk_text_history_selection_changed (GtkTextHistory *self, |
67 | int selection_insert, |
68 | int selection_bound); |
69 | void gtk_text_history_text_inserted (GtkTextHistory *self, |
70 | guint position, |
71 | const char *text, |
72 | int len); |
73 | void gtk_text_history_text_deleted (GtkTextHistory *self, |
74 | guint begin, |
75 | guint end, |
76 | const char *text, |
77 | int len); |
78 | gboolean gtk_text_history_get_enabled (GtkTextHistory *self); |
79 | void gtk_text_history_set_enabled (GtkTextHistory *self, |
80 | gboolean enabled); |
81 | |
82 | G_END_DECLS |
83 | |
84 | #endif /* __GTK_TEXT_HISTORY_PRIVATE_H__ */ |
85 | |