summaryrefslogtreecommitdiff
path: root/gtk/gtktextprivate.h
blob: ec1d0af6d2e682cb6bc47fd173ce330d1e27d059 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/* gtkentryprivate.h
 * Copyright (C) 2019 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __GTK_TEXT_PRIVATE_H__
#define __GTK_TEXT_PRIVATE_H__

#include "gtktext.h"

#include "gtkeventcontroller.h"
#include  "gtkimcontext.h"

G_BEGIN_DECLS

#define GTK_TEXT_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TEXT, GtkTextClass))
#define GTK_IS_TEXT_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEXT))
#define GTK_TEXT_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TEXT, GtkTextClass))

typedef struct _GtkTextClass         GtkTextClass;

/*<private>
 * GtkTextClass:
 * @parent_class: The parent class.
 * @populate_popup: Class handler for the #GtkText::populate-popup signal. If
 *   non-%NULL, this will be called to add additional entries to the context
 *   menu when it is displayed.
 * @activate: Class handler for the #GtkText::activate signal. The default
 *   implementation activates the gtk.activate-default action.
 * @move_cursor: Class handler for the #GtkText::move-cursor signal. The
 *   default implementation specifies the standard #GtkText cursor movement
 *   behavior.
 * @insert_at_cursor: Class handler for the #GtkText::insert-at-cursor signal.
 *   The default implementation inserts text at the cursor.
 * @delete_from_cursor: Class handler for the #GtkText::delete-from-cursor
 *   signal. The default implementation deletes the selection or the specified
 *   number of characters or words.
 * @backspace: Class handler for the #GtkText::backspace signal. The default
 *   implementation deletes the selection or a single character or word.
 * @cut_clipboard: Class handler for the #GtkText::cut-clipboard signal. The
 *   default implementation cuts the selection, if one exists.
 * @copy_clipboard: Class handler for the #GtkText::copy-clipboard signal. The
 *   default implementation copies the selection, if one exists.
 * @paste_clipboard: Class handler for the #GtkText::paste-clipboard signal.
 *   The default implementation pastes at the current cursor position or over
 *   the current selection if one exists.
 * @toggle_overwrite: Class handler for the #GtkText::toggle-overwrite signal.
 *   The default implementation toggles overwrite mode and blinks the cursor.
 * @insert_emoji: Class handler for the #GtkText::insert-emoji signal.
 *
 * Class structure for #GtkText. All virtual functions have a default
 * implementation. Derived classes may set the virtual function pointers for the
 * signal handlers to %NULL, but must keep @get_text_area_size and
 * @get_frame_size non-%NULL; either use the default implementation, or provide
 * a custom one.
 */
struct _GtkTextClass
{
  GtkWidgetClass parent_class;

  /* Hook to customize right-click popup */
  void (* populate_popup)     (GtkText         *self,
                               GtkWidget       *popup);

  /* Action signals
   */
  void (* activate)           (GtkText         *self);
  void (* move_cursor)        (GtkText         *self,
                               GtkMovementStep  step,
                               gint             count,
                               gboolean         extend);
  void (* insert_at_cursor)   (GtkText         *self,
                               const gchar     *str);
  void (* delete_from_cursor) (GtkText         *self,
                               GtkDeleteType    type,
                               gint             count);
  void (* backspace)          (GtkText         *self);
  void (* cut_clipboard)      (GtkText         *self);
  void (* copy_clipboard)     (GtkText         *self);
  void (* paste_clipboard)    (GtkText         *self);
  void (* toggle_overwrite)   (GtkText         *self);
  void (* insert_emoji)       (GtkText         *self);
};

char *              gtk_text_get_display_text   (GtkText    *entry,
                                                 int         start_pos,
                                                 int         end_pos);
GtkIMContext *      gtk_text_get_im_context     (GtkText    *entry);
void                gtk_text_enter_text         (GtkText    *entry,
                                                 const char *text);
void                gtk_text_set_positions      (GtkText    *entry,
                                                 int         current_pos,
                                                 int         selection_bound);
PangoLayout *       gtk_text_get_layout         (GtkText    *entry);
void                gtk_text_get_layout_offsets (GtkText    *entry,
                                                 int        *x,
                                                 int        *y);
void                gtk_text_reset_im_context   (GtkText    *entry);
GtkEventController *gtk_text_get_key_controller (GtkText    *entry);

G_END_DECLS

#endif /* __GTK_TEXT_PRIVATE_H__ */