init for 0.3
[platform/core/uifw/ise-engine-unikey.git] / src / scim_unikey_imengine.h
1 /**
2    Scim-Unikey Input Method
3    Version: 0.2.0a
4
5    Copyright (C) 2008-2009 Ubuntu-VN <http://www.ubuntu-vn.org>
6    Author: Le Quoc Tuan <mr.lequoctuan@gmail.com>
7    Home: http://scim-unikey.googlecode.com
8    License: GNU LESSER GENERAL PUBLIC LICENSE v2.1
9 */
10
11 #if !defined (__SCIM_UNIKEY_IMENGINE_H)
12 #define __SCIM_UNIKEY_IMENGINE_H
13
14 #include "unikey.h"
15
16 using namespace scim;
17
18 class UnikeyFactory : public IMEngineFactoryBase
19 {
20         friend class UnikeyInstance;
21
22 public:
23         UnikeyFactory();
24         virtual ~UnikeyFactory ();
25
26         virtual WideString  get_name () const;
27         virtual WideString  get_authors () const;
28         virtual WideString  get_credits () const;
29         virtual WideString  get_help () const;
30         virtual String      get_uuid () const;
31         virtual String      get_icon_file () const;
32
33         virtual IMEngineInstancePointer create_instance (const String& encoding, int id = -1);
34 };
35
36 class UnikeyInstance : public IMEngineInstanceBase
37 {
38 public:
39         UnikeyInstance(UnikeyFactory *factory, const String& encoding, int id = -1);
40         virtual ~UnikeyInstance ();
41
42         virtual bool process_key_event(const KeyEvent& key);
43         virtual void reset();
44         virtual void focus_in();
45         virtual void focus_out();
46         virtual void trigger_property(const String &property);
47
48 private:
49         bool Unikey_process_key_event_direct(const KeyEvent& key);
50         bool Unikey_process_key_event_preedit(const KeyEvent& key);
51         void Unikey_send_backspace(int nBackspace);
52         void Unikey_update_preedit_string(const WideString s, const bool visible);
53         PropertyList CreatePropertyList();
54
55         int m_im;                               // input method
56         int m_oc;                               // output charset
57         UnikeyOptions m_ukopt;                  // Unikey Options
58         WideString m_preeditstring;             // store PreEdit String
59         bool m_preedit;                         // is PreEdit On?
60         bool m_codertelex;                      // is CoderTelex on?
61         bool m_process_w_AtBeginWord;           // process W at Begin Word?
62         bool m_auto_commit;                     // auto commit?
63         std::vector<KeyEvent> m_preeditskey;    // keys to switch preedit and non preedit mode
64         bool m_lastkey_with_shift;              // last press key with modifier is shift
65 };
66
67 #endif
68