Diffstat (limited to 'inputmethods/multikey/keyboardimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/multikey/keyboardimpl.cpp | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/inputmethods/multikey/keyboardimpl.cpp b/inputmethods/multikey/keyboardimpl.cpp new file mode 100644 index 0000000..2bcb0fa --- a/dev/null +++ b/inputmethods/multikey/keyboardimpl.cpp | |||
@@ -0,0 +1,108 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #include <qapplication.h> | ||
21 | #include <qpixmap.h> | ||
22 | #include "keyboard.h" | ||
23 | #include "keyboardimpl.h" | ||
24 | |||
25 | /* XPM */ | ||
26 | static const char * kb_xpm[] = { | ||
27 | "28 13 4 1", | ||
28 | " c None", | ||
29 | ". c #4C4C4C", | ||
30 | "+ c #FFF7DD", | ||
31 | "@ c #D6CFBA", | ||
32 | " .......................... ", | ||
33 | " .+++.+++.+++.+++.+++.++++. ", | ||
34 | " .+@@.+@@.+@@.+@@.+@@.+@@@. ", | ||
35 | " .......................... ", | ||
36 | " .+++++.+++.+++.+++.++++++. ", | ||
37 | " .+@@@@.+@@.+@@.+@@.+@@@@@. ", | ||
38 | " .......................... ", | ||
39 | " .++++++.+++.+++.+++.+++++. ", | ||
40 | " .+@@@@@.+@@.+@@.+@@.+@@@@. ", | ||
41 | " .......................... ", | ||
42 | " .++++.++++++++++++++.++++. ", | ||
43 | " .+@@@.+@@@@@@@@@@@@@.+@@@. ", | ||
44 | " .......................... "}; | ||
45 | |||
46 | |||
47 | KeyboardImpl::KeyboardImpl() | ||
48 | : input(0), icn(0), ref(0) | ||
49 | { | ||
50 | } | ||
51 | |||
52 | KeyboardImpl::~KeyboardImpl() | ||
53 | { | ||
54 | delete input; | ||
55 | delete icn; | ||
56 | } | ||
57 | |||
58 | QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) | ||
59 | { | ||
60 | if ( !input ) | ||
61 | input = new Keyboard( parent, "Keyboard", f ); | ||
62 | return input; | ||
63 | } | ||
64 | |||
65 | void KeyboardImpl::resetState() | ||
66 | { | ||
67 | if ( input ) | ||
68 | input->resetState(); | ||
69 | } | ||
70 | |||
71 | QPixmap *KeyboardImpl::icon() | ||
72 | { | ||
73 | if ( !icn ) | ||
74 | icn = new QPixmap( (const char **)kb_xpm ); | ||
75 | return icn; | ||
76 | } | ||
77 | |||
78 | QString KeyboardImpl::name() | ||
79 | { | ||
80 | return qApp->translate( "InputMethods", "Multikey" ); | ||
81 | // return qApp->translate( "InputMethods", "Opti" ); | ||
82 | } | ||
83 | |||
84 | void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) | ||
85 | { | ||
86 | if ( input ) | ||
87 | QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); | ||
88 | } | ||
89 | |||
90 | #ifndef QT_NO_COMPONENT | ||
91 | QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | ||
92 | { | ||
93 | *iface = 0; | ||
94 | if ( uuid == IID_QUnknown ) | ||
95 | *iface = this; | ||
96 | else if ( uuid == IID_InputMethod ) | ||
97 | *iface = this; | ||
98 | |||
99 | if ( *iface ) | ||
100 | (*iface)->addRef(); | ||
101 | return QS_OK; | ||
102 | } | ||
103 | |||
104 | Q_EXPORT_INTERFACE() | ||
105 | { | ||
106 | Q_CREATE_INSTANCE( KeyboardImpl ) | ||
107 | } | ||
108 | #endif | ||