summaryrefslogtreecommitdiffstats
path: root/client/qt4/ibus-input-context.h
blob: 2e20bb8cb3fa1705245df97db9d76d4a88285bf9 (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
/* vim:set noet ts=4: */
/*
 * ibus - The Input Bus
 *
 * Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA  02111-1307  USA
 */
#ifndef __IBUS_INPUT_CONTEXT_H_
#define __IBUS_INPUT_CONTEXT_H_
#include <QInputContext>
#include <QList>
#include "ibus-client.h"

class IBusClient;

class IBusInputContext : public QInputContext  {
	Q_OBJECT
public:
	IBusInputContext (QObject *parent, IBusClient *client, QString &ic);
	~IBusInputContext ();

public:
	bool filterEvent (const QEvent *event);
	QFont font () const;
	QString identifierName ();
	bool isComposing() const;
	QString language();
	void mouseHandler (int x, QMouseEvent *event);
	void reset();
	void update ();
	void setFocusWidget (QWidget *widget );
	void widgetDestroyed (QWidget *widget);
#ifdef Q_WS_X11
	bool x11FilterEvent (QWidget *keywidget, XEvent *event);
#endif
	void setIC (QString ic);
	QString getIC ();

	void commitString (QString text);
	void updatePreedit (QString text, QList <QList <quint32> > attr_list, int cursor_pos, bool visible);
	void showPreedit ();
	void hidePreedit ();


private:
	IBusClient *client;
	QString ic;
	QString preedit_string;
	bool preedit_visible;
	int preedit_cursor_pos;
	bool has_focus;
	QList <QList <quint32> > preedit_attrs;
	QRect cursor_location;
};

#endif //__IBUS_INPUT_CONTEXT_H_