4
* Copyright (c) 2006 Ryo Dairiki <ryo-dairiki@users.sourceforge.net>
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 and
10
* appearing in the file LICENSE.LGPL included in the package of this file.
11
* You can also redistribute it and/or modify it under the terms of
12
* the GNU General Public License as published by the Free Software Foundation and
13
* appearing in the file LICENSE.GPL included in the package of this file.
15
* This library is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22
* @author Ryo Dairiki <ryo-dairiki@users.sourceforge.net>
23
* @brief This is the header of the public interface of IMContexts.
26
#ifndef SCIMBRIDGECLIENTIMCONTEXTQT_H_
27
#define SCIMBRIDGECLIENTIMCONTEXTQT_H_
30
#include <QApplication>
33
#include <QInputContext>
34
#include <QInputMethodEvent>
39
#include <qapplication.h>
42
#include <qinputcontext.h>
49
#include "scim-bridge.h"
50
#include "scim-bridge-attribute.h"
52
#include "scim-bridge-client-imcontext.h"
54
#include "scim-bridge-client-common-qt.h"
57
* IMContext class for qt client.
59
struct _ScimBridgeClientIMContext: public QInputContext
65
* Initialize the class itself.
67
static void static_initialize ();
70
* Finalize the class itself.
72
static void static_finalize ();
75
* The connection with the agent is opened.
77
static void connection_opened ();
80
* The connection with the agent is closed.
82
static void connection_closed ();
85
* Allocate a new IMContext.
87
* @return A new IMContext.
89
static _ScimBridgeClientIMContext *alloc ();
94
virtual ~_ScimBridgeClientIMContext () {}
97
* Filter a event from X11.
99
* @param widget The widget.
100
* @param A event from X11.
101
* @return If this event is consumed or not.
103
virtual bool x11FilterEvent (QWidget *widget, XEvent *event) = 0;
106
* Filter a key event.
108
* @param event The key event.
109
* @return If this event is consumed or not.
111
virtual bool filterEvent (const QEvent *event) = 0;
115
* The focus has been changed.
117
virtual void update () = 0;
120
* Get the identifier name for this input context.
122
* @return The identifier name.
124
virtual QString identifierName () = 0;
127
* Get the languages for the input context.
129
* @return The languages for the input context.
131
virtual QString language () = 0;
134
* Filter a mouse event.
136
* @param offset The cursor offset in the preedit string.
137
* @param event The mouse event.
139
virtual void mouseHandler (int offset, QMouseEvent *event) = 0;
142
* The current focused widget is destroied.
144
* @param widget The widget under destroying.
146
virtual void widgetDestroyed (QWidget *widget) = 0;
151
* Focus an IMContext.
153
virtual void setFocus () = 0;
156
* Unfocus an IMContext.
158
virtual void unsetFocus () = 0;
161
* Set the focused area in the display.
163
* @param x The X loation of the focused area.
164
* @param y The Y loation of the focused area.
165
* @param w The width of the focused area.
166
* @param h The height of the focused area.
167
* @param font The font.
169
virtual void setMicroFocus (int x, int y, int w, int h, QFont *font = 0) = 0;
172
* Filter a mouse event.
174
* @param offset The cursor offset in the preedit string.
175
* @param type The type of the event.
176
* @param button The button of this event.
177
* @param state The state of the button.
179
virtual void mouseHandler (int offset, QEvent::Type type, ButtonState button, ButtonState state) = 0;
184
* Reset the current IME.
186
virtual void reset () = 0;
193
_ScimBridgeClientIMContext () {}
197
#endif /*SCIMBRIDGECLIENTIMCONTEXTQT_H_*/