2.38.0
[platform/upstream/at-spi2-atk.git] / tests / dummyatk / my-atk-editable-text.c
1 /*
2  * AT-SPI - Assistive Technology Service Provider Interface
3  * (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
4  *
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22
23 #include <stdio.h>
24 #include <string.h>
25 #include <glib-object.h>
26 #include <atk/atk.h>
27
28 #include "my-atk-object.h"
29 #include "my-atk-editable-text.h"
30
31 typedef struct _MyAtkEditableTextInfo MyAtkEditableTextInfo;
32
33 static void atk_editable_text_interface_init (AtkEditableTextIface *iface);
34
35 G_DEFINE_TYPE_WITH_CODE (MyAtkEditableText,
36                          my_atk_editable_text,
37                          MY_TYPE_ATK_OBJECT,
38                          G_IMPLEMENT_INTERFACE (ATK_TYPE_EDITABLE_TEXT,
39                              atk_editable_text_interface_init));
40
41 guint
42 my_atk_set_editable_text (AtkEditableText *editable_text, const gchar *text)
43 {
44   g_return_val_if_fail (MY_IS_ATK_EDITABLE_TEXT (editable_text), -1);
45
46   return 0;
47 }
48
49 static void
50 my_atk_editable_text_init (MyAtkEditableText *obj)
51 {
52   obj->text = NULL;
53 }
54
55 static gboolean
56 my_atk_set_editable_text_set_run_attributes (AtkEditableText  *text,
57     AtkAttributeSet  *attrib_set,
58     gint             start_offset,
59     gint             end_offset)
60 {
61   return FALSE;
62 }
63
64 static void
65 my_atk_set_editable_text_set_text_contents (AtkEditableText  *text,
66     const gchar      *string)
67 {
68 }
69
70 static void
71 my_atk_set_editable_text_insert_text (AtkEditableText  *text,
72                                       const gchar      *string,
73                                       gint             length,
74                                       gint             *position)
75 {
76 }
77
78 static void
79 my_atk_set_editable_text_copy_text (AtkEditableText  *text,
80                                     gint             start_pos,
81                                     gint             end_pos)
82 {
83 }
84
85 static void
86 my_atk_set_editable_text_cut_text (AtkEditableText  *text,
87                                    gint             start_pos,
88                                    gint             end_pos)
89 {
90 }
91
92 static void
93 my_atk_set_editable_text_delete_text (AtkEditableText  *text,
94                                       gint             start_pos,
95                                       gint             end_pos)
96 {
97 }
98
99 static void
100 my_atk_set_editable_text_paste_text (AtkEditableText  *text,
101                                      gint             position)
102 {
103 }
104
105
106 static void
107 atk_editable_text_interface_init (AtkEditableTextIface *iface)
108 {
109   if (!iface) return;
110   iface->set_run_attributes = my_atk_set_editable_text_set_run_attributes;
111   iface->set_text_contents = my_atk_set_editable_text_set_text_contents;
112   iface->insert_text = my_atk_set_editable_text_insert_text;
113   iface->copy_text = my_atk_set_editable_text_copy_text;
114   iface->cut_text = my_atk_set_editable_text_cut_text;
115   iface->delete_text = my_atk_set_editable_text_delete_text;
116   iface->paste_text = my_atk_set_editable_text_paste_text;
117 }
118
119 static void
120 my_atk_editable_text_initialize (AtkObject *obj, gpointer data)
121 {
122 }
123
124 static void
125 my_atk_editable_text_finalize (GObject *object)
126 {
127 }
128
129 static void
130 my_atk_editable_text_class_init (MyAtkEditableTextClass *my_class)
131 {
132   AtkObjectClass *atk_class = ATK_OBJECT_CLASS (my_class);
133   GObjectClass *gobject_class = G_OBJECT_CLASS (my_class);
134
135   gobject_class->finalize = my_atk_editable_text_finalize;
136
137   atk_class->initialize = my_atk_editable_text_initialize;
138 }