~ubuntu-branches/ubuntu/vivid/scim-bridge/vivid

« back to all changes in this revision

Viewing changes to client-qt/qt4/scim-bridge-client-imcontext-qt.h

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2009-06-25 22:02:52 UTC
  • mfrom: (1.1.9 upstream) (6.2.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090625220252-2qn0jwi9re34zcth
Tags: 0.4.16-2ubuntu1
* Resynchronise with Debian. Remaining changes:
  - 50_check_scim_binary.dpatch: Fix 10-20s delay in launching apps when
    scim is not running.
  - 50_fix_qt4_focus.dpatch: Fix focus loss under KDE 4.
  - 51_quiet.dpatch: Turn some error messages into debug lines.
  - Just have scim-bridge-agent depend on scim, not scim | skim.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * SCIM Bridge
3
 
 *
4
 
 * Copyright (c) 2006 Ryo Dairiki <ryo-dairiki@users.sourceforge.net>
5
 
 *
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 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.
14
 
 *
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.
18
 
 */
19
 
 
20
 
/**
21
 
 * @file
22
 
 * @author Ryo Dairiki <ryo-dairiki@users.sourceforge.net>
23
 
 * @brief This is the header of the public interface of IMContexts.
24
 
 */
25
 
 
26
 
#ifndef SCIMBRIDGECLIENTIMCONTEXTQT_H_
27
 
#define SCIMBRIDGECLIENTIMCONTEXTQT_H_
28
 
 
29
 
#ifdef QT4
30
 
#include <QApplication>
31
 
#include <QEvent>
32
 
#include <QFont>
33
 
#include <QInputContext>
34
 
#include <QInputMethodEvent>
35
 
#include <QObject>
36
 
#include <QPoint>
37
 
#include <QWidget>
38
 
#else
39
 
#include <qapplication.h>
40
 
#include <qevent.h>
41
 
#include <qfont.h>
42
 
#include <qinputcontext.h>
43
 
#include <qobject.h>
44
 
#include <qptrlist.h>
45
 
#include <qpoint.h>
46
 
#include <qwidget.h>
47
 
#endif
48
 
 
49
 
#include "scim-bridge.h"
50
 
#include "scim-bridge-attribute.h"
51
 
 
52
 
#include "scim-bridge-client-imcontext.h"
53
 
 
54
 
#include "scim-bridge-client-common-qt.h"
55
 
 
56
 
/**
57
 
 * IMContext class for qt client.
58
 
 */
59
 
struct _ScimBridgeClientIMContext: public QInputContext
60
 
{
61
 
 
62
 
    public:
63
 
 
64
 
        /**
65
 
         * Initialize the class itself.
66
 
         */
67
 
        static void static_initialize ();
68
 
        
69
 
        /**
70
 
         * Finalize the class itself.
71
 
         */
72
 
        static void static_finalize ();
73
 
 
74
 
        /**
75
 
         * The connection with the agent is opened.
76
 
         */
77
 
        static void connection_opened ();
78
 
 
79
 
        /**
80
 
         * The connection with the agent is closed.
81
 
         */
82
 
        static void connection_closed ();
83
 
 
84
 
        /**
85
 
         * Allocate a new IMContext.
86
 
         *
87
 
         * @return A new IMContext.
88
 
         */
89
 
        static _ScimBridgeClientIMContext *alloc ();
90
 
 
91
 
        /**
92
 
         * Destructor.
93
 
         */
94
 
        virtual ~_ScimBridgeClientIMContext () {}
95
 
 
96
 
        /**
97
 
         * Filter a event from X11.
98
 
         *
99
 
         * @param widget The widget.
100
 
         * @param A event from X11.
101
 
         * @return If this event is consumed or not.
102
 
         */
103
 
        virtual bool x11FilterEvent (QWidget *widget, XEvent *event) = 0;
104
 
 
105
 
        /**
106
 
         * Filter a key event.
107
 
         *
108
 
         * @param event The key event.
109
 
         * @return If this event is consumed or not.
110
 
         */
111
 
        virtual bool filterEvent (const QEvent *event) = 0;
112
 
 
113
 
#ifdef QT4
114
 
        /**
115
 
         * The focus has been changed.
116
 
         */
117
 
        virtual void update () = 0;
118
 
 
119
 
        /**
120
 
         * Get the identifier name for this input context.
121
 
         *
122
 
         * @return The identifier name.
123
 
         */
124
 
        virtual QString identifierName () = 0;
125
 
 
126
 
        /**
127
 
         * Get the languages for the input context.
128
 
         *
129
 
         * @return The languages for the input context.
130
 
         */
131
 
        virtual QString language () = 0;
132
 
 
133
 
        /**
134
 
         * Filter a mouse event.
135
 
         *
136
 
         * @param offset The cursor offset in the preedit string.
137
 
         * @param event The mouse event. 
138
 
         */
139
 
        virtual void mouseHandler (int offset, QMouseEvent *event) = 0;
140
 
 
141
 
        /**
142
 
         * The current focused widget is destroied.
143
 
         *
144
 
         * @param widget The widget under destroying.
145
 
         */
146
 
        virtual void widgetDestroyed (QWidget *widget) = 0;
147
 
 
148
 
#else
149
 
 
150
 
        /**
151
 
         * Focus an IMContext.
152
 
         */
153
 
        virtual void setFocus () = 0;
154
 
 
155
 
        /**
156
 
         * Unfocus an IMContext.
157
 
         */
158
 
        virtual void unsetFocus () = 0;
159
 
        
160
 
        /**
161
 
         * Set the focused area in the display.
162
 
         *
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.
168
 
         */
169
 
        virtual void setMicroFocus (int x, int y, int w, int h, QFont *font = 0) = 0;
170
 
 
171
 
        /**
172
 
         * Filter a mouse event.
173
 
         *
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.
178
 
         */
179
 
        virtual void mouseHandler (int offset, QEvent::Type type, ButtonState button, ButtonState state) = 0;
180
 
 
181
 
#endif
182
 
 
183
 
        /**
184
 
         * Reset the current IME.
185
 
         */
186
 
        virtual void reset () = 0;
187
 
 
188
 
    protected:
189
 
 
190
 
        /**
191
 
         * Constructor.
192
 
         */
193
 
        _ScimBridgeClientIMContext () {}
194
 
 
195
 
};
196
 
 
197
 
#endif                                            /*SCIMBRIDGECLIENTIMCONTEXTQT_H_*/