1/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
2/* vim:set et sts=4: */
3/* ibus - The Input Bus
4 * Copyright (c) 2009-2014 Google Inc. All rights reserved.
5 * Copyright (c) 2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
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 Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
20 * USA
21 */
22
23#if !defined (__IBUS_H_INSIDE__) && !defined (IBUS_COMPILATION)
24#error "Only <ibus.h> can be included directly"
25#endif
26
27#ifndef __IBUS_PANEL_SERVICE_H_
28#define __IBUS_PANEL_SERVICE_H_
29
30/**
31 * SECTION: ibuspanelservice
32 * @short_description: Panel service back-end.
33 * @stability: Stable
34 *
35 * An IBusPanelService is a base class for UI services.
36 * Developers can "extend" this class for panel UI development.
37 */
38#include "ibuslookuptable.h"
39#include "ibusservice.h"
40#include "ibusproplist.h"
41
42/*
43 * Type macros.
44 */
45
46/* define GOBJECT macros */
47#define IBUS_TYPE_PANEL_SERVICE \
48 (ibus_panel_service_get_type ())
49#define IBUS_PANEL_SERVICE(obj) \
50 (G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_TYPE_PANEL_SERVICE, IBusPanelService))
51#define IBUS_PANEL_SERVICE_CLASS(klass) \
52 (G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_TYPE_PANEL_SERVICE, IBusPanelServiceClass))
53#define IBUS_IS_PANEL_SERVICE(obj) \
54 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_PANEL_SERVICE))
55#define IBUS_IS_PANEL_SERVICE_CLASS(klass) \
56 (G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_TYPE_PANEL_SERVICE))
57#define IBUS_PANEL_SERVICE_GET_CLASS(obj) \
58 (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_PANEL_SERVICE, IBusPanelServiceClass))
59
60G_BEGIN_DECLS
61
62typedef struct _IBusPanelService IBusPanelService;
63typedef struct _IBusPanelServiceClass IBusPanelServiceClass;
64
65/**
66 * IBusPanelService:
67 *
68 * An opaque data type representing an IBusPanelService.
69 */
70struct _IBusPanelService {
71 IBusService parent;
72 /* instance members */
73};
74
75struct _IBusPanelServiceClass {
76 IBusServiceClass parent;
77
78 /* class members */
79 void (* focus_in) (IBusPanelService *panel,
80 const gchar
81 *input_context_path);
82 void (* focus_out) (IBusPanelService *panel,
83 const gchar
84 *input_context_path);
85 void (* register_properties) (IBusPanelService *panel,
86 IBusPropList *prop_list);
87 void (* set_cursor_location) (IBusPanelService *panel,
88 gint x,
89 gint y,
90 gint w,
91 gint h);
92 void (* update_auxiliary_text) (IBusPanelService *panel,
93 IBusText *text,
94 gboolean visible);
95 void (* update_lookup_table) (IBusPanelService *panel,
96 IBusLookupTable *lookup_table,
97 gboolean visible);
98 void (* update_preedit_text) (IBusPanelService *panel,
99 IBusText *text,
100 guint cursor_pos,
101 gboolean visible);
102 void (* update_property) (IBusPanelService *panel,
103 IBusProperty *prop);
104 void (* cursor_down_lookup_table) (IBusPanelService *panel);
105 void (* cursor_up_lookup_table) (IBusPanelService *panel);
106 void (* hide_auxiliary_text) (IBusPanelService *panel);
107 void (* hide_language_bar) (IBusPanelService *panel);
108 void (* hide_lookup_table) (IBusPanelService *panel);
109 void (* hide_preedit_text) (IBusPanelService *panel);
110 void (* page_down_lookup_table) (IBusPanelService *panel);
111 void (* page_up_lookup_table) (IBusPanelService *panel);
112 void (* reset) (IBusPanelService *panel);
113 void (* show_auxiliary_text) (IBusPanelService *panel);
114 void (* show_language_bar) (IBusPanelService *panel);
115 void (* show_lookup_table) (IBusPanelService *panel);
116 void (* show_preedit_text) (IBusPanelService *panel);
117 void (* start_setup) (IBusPanelService *panel);
118 void (* state_changed) (IBusPanelService *panel);
119 void (* destroy_context) (IBusPanelService *panel,
120 const gchar
121 *input_context_path);
122 void (* set_content_type) (IBusPanelService *panel,
123 guint purpose,
124 guint hints);
125 void (* set_cursor_location_relative)
126 (IBusPanelService *panel,
127 gint x,
128 gint y,
129 gint w,
130 gint h);
131
132 /*< private >*/
133 /* padding */
134 gpointer pdummy[5]; // We can add 8 pointers without breaking the ABI.
135};
136
137GType ibus_panel_service_get_type (void);
138
139/**
140 * ibus_panel_service_new:
141 * @connection: An GDBusConnection.
142 *
143 * Creates a new #IBusPanelService from an #GDBusConnection.
144 *
145 * Returns: A newly allocated #IBusPanelService.
146 */
147IBusPanelService *ibus_panel_service_new (GDBusConnection *connection);
148
149/**
150 * ibus_panel_service_candidate_clicked:
151 * @panel: An IBusPanelService
152 * @index: Index in the Lookup table
153 * @button: GdkEventButton::button (1: left button, etc.)
154 * @state: GdkEventButton::state (key modifier flags)
155 *
156 * Notify that a candidate is clicked
157 * by sending a "CandidateClicked" to IBus service.
158 */
159void ibus_panel_service_candidate_clicked (IBusPanelService *panel,
160 guint index,
161 guint button,
162 guint state);
163
164/**
165 * ibus_panel_service_cursor_down:
166 * @panel: An IBusPanelService
167 *
168 * Notify that the cursor is down
169 * by sending a "CursorDown" to IBus service.
170 */
171void ibus_panel_service_cursor_down (IBusPanelService *panel);
172
173/**
174 * ibus_panel_service_cursor_up:
175 * @panel: An IBusPanelService
176 *
177 * Notify that the cursor is up
178 * by sending a "CursorUp" to IBus service.
179 */
180void ibus_panel_service_cursor_up (IBusPanelService *panel);
181
182/**
183 * ibus_panel_service_page_down:
184 * @panel: An IBusPanelService
185 *
186 * Notify that the page is down
187 * by sending a "PageDown" to IBus service.
188 */
189void ibus_panel_service_page_down (IBusPanelService *panel);
190
191/**
192 * ibus_panel_service_page_up:
193 * @panel: An IBusPanelService
194 *
195 * Notify that the page is up
196 * by sending a "PageUp" to IBus service.
197 */
198void ibus_panel_service_page_up (IBusPanelService *panel);
199
200/**
201 * ibus_panel_service_property_activate:
202 * @panel: An IBusPanelService
203 * @prop_name: A property name
204 * @prop_state: State of the property
205 *
206 * Notify that a property is active
207 * by sending a "PropertyActivate" message to IBus service.
208 */
209void ibus_panel_service_property_activate (IBusPanelService *panel,
210 const gchar *prop_name,
211 guint prop_state);
212/**
213 * ibus_panel_service_property_show:
214 * @panel: An IBusPanelService
215 * @prop_name: A property name
216 *
217 * Notify that a property is shown
218 * by sending a "ValueChanged" message to IBus service.
219 */
220void ibus_panel_service_property_show (IBusPanelService *panel,
221 const gchar *prop_name);
222
223/**
224 * ibus_panel_service_property_hide:
225 * @panel: An IBusPanelService
226 * @prop_name: A property name
227 *
228 * Notify that a property is hidden
229 * by sending a "ValueChanged" message to IBus service.
230 */
231void ibus_panel_service_property_hide (IBusPanelService *panel,
232 const gchar *prop_name);
233
234/**
235 * ibus_panel_service_commit_text:
236 * @panel: An #IBusPanelService
237 * @text: An #IBusText
238 *
239 * Notify that a text is sent
240 * by sending a "CommitText" message to IBus service.
241 */
242void ibus_panel_service_commit_text (IBusPanelService *panel,
243 IBusText *text);
244
245G_END_DECLS
246#endif
247