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
22G_BEGIN_DECLS
23
24#define GTK_TYPE_TEXT_HISTORY (gtk_text_history_get_type())
25
26typedef struct _GtkTextHistoryFuncs GtkTextHistoryFuncs;
27
28G_DECLARE_FINAL_TYPE (GtkTextHistory, gtk_text_history, GTK, TEXT_HISTORY, GObject)
29
30struct _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
51GtkTextHistory *gtk_text_history_new (const GtkTextHistoryFuncs *funcs,
52 gpointer funcs_data);
53void gtk_text_history_begin_user_action (GtkTextHistory *self);
54void gtk_text_history_end_user_action (GtkTextHistory *self);
55void gtk_text_history_begin_irreversible_action (GtkTextHistory *self);
56void gtk_text_history_end_irreversible_action (GtkTextHistory *self);
57gboolean gtk_text_history_get_can_undo (GtkTextHistory *self);
58gboolean gtk_text_history_get_can_redo (GtkTextHistory *self);
59void gtk_text_history_undo (GtkTextHistory *self);
60void gtk_text_history_redo (GtkTextHistory *self);
61guint gtk_text_history_get_max_undo_levels (GtkTextHistory *self);
62void gtk_text_history_set_max_undo_levels (GtkTextHistory *self,
63 guint max_undo_levels);
64void gtk_text_history_modified_changed (GtkTextHistory *self,
65 gboolean modified);
66void gtk_text_history_selection_changed (GtkTextHistory *self,
67 int selection_insert,
68 int selection_bound);
69void gtk_text_history_text_inserted (GtkTextHistory *self,
70 guint position,
71 const char *text,
72 int len);
73void gtk_text_history_text_deleted (GtkTextHistory *self,
74 guint begin,
75 guint end,
76 const char *text,
77 int len);
78gboolean gtk_text_history_get_enabled (GtkTextHistory *self);
79void gtk_text_history_set_enabled (GtkTextHistory *self,
80 gboolean enabled);
81
82G_END_DECLS
83
84#endif /* __GTK_TEXT_HISTORY_PRIVATE_H__ */
85

source code of gtk/gtk/gtktexthistoryprivate.h