~lidaobing/ibus/ibus-qt

« back to all changes in this revision

Viewing changes to qtim/ibus-input-context.h

  • Committer: LI Daobing
  • Date: 2009-07-28 14:30:44 UTC
  • Revision ID: lidaobing@gmail.com-20090728143044-2swzp2fwuu7p8xae
importĀ 1.2.0.20090728

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* vim:set noet ts=4: */
 
2
/*
 
3
 * ibus - The Input Bus
 
4
 *
 
5
 * Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@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 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
 
15
 * GNU 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 program; if not, write to the
 
19
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 
20
 * Boston, MA  02111-1307  USA
 
21
 */
 
22
#ifndef __IBUS_INPUT_CONTEXT_H_
 
23
#define __IBUS_INPUT_CONTEXT_H_
 
24
#include <QInputContext>
 
25
#include <QList>
 
26
#include <qibusinputcontext.h>
 
27
 
 
28
using namespace IBus;
 
29
 
 
30
class IBusInputContext : public QInputContext  {
 
31
        Q_OBJECT
 
32
public:
 
33
        IBusInputContext (const BusPointer &bus);
 
34
        ~IBusInputContext ();
 
35
 
 
36
public:
 
37
        bool filterEvent (const QEvent *event);
 
38
        QFont font (void) const;
 
39
        QString identifierName (void);
 
40
        bool isComposing (void) const;
 
41
        QString language (void);
 
42
        void mouseHandler (int x, QMouseEvent *event);
 
43
        void reset (void);
 
44
        void update (void);
 
45
        void setFocusWidget (QWidget *widget );
 
46
        void widgetDestroyed (QWidget *widget);
 
47
#ifdef Q_WS_X11
 
48
        bool x11FilterEvent (QWidget *keywidget, XEvent *event);
 
49
#endif
 
50
private Q_SLOTS:
 
51
        void slotCommitText (const TextPointer &text);
 
52
        void slotUpdatePreeditText (const TextPointer &text, uint cursor_pos, bool visible);
 
53
        void slotShowPreeditText (void);
 
54
        void slotHidePreeditText (void);
 
55
        void slotConnected (void);
 
56
        void slotDisconnected (void);
 
57
 
 
58
private:
 
59
        void createInputContext (void);
 
60
        void deleteInputContext (void);
 
61
        void displayPreeditText (const TextPointer &text, uint cursor_pos, bool visible);
 
62
 
 
63
private:
 
64
        BusPointer m_bus;
 
65
        InputContextPointer m_context;
 
66
        TextPointer m_preedit;
 
67
        bool m_preedit_visible;
 
68
        uint m_preedit_cursor_pos;
 
69
        bool m_has_focus;
 
70
        uint m_caps;
 
71
};
 
72
 
 
73
#endif //__IBUS_INPUT_CONTEXT_H_