Diffstat (limited to 'inputmethods/keyboard/keyboardimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/keyboard/keyboardimpl.cpp | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/inputmethods/keyboard/keyboardimpl.cpp b/inputmethods/keyboard/keyboardimpl.cpp new file mode 100644 index 0000000..ea61272 --- a/dev/null +++ b/inputmethods/keyboard/keyboardimpl.cpp | |||
@@ -0,0 +1,131 @@ | |||
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 | /* XPM */ | ||
48 | static char * opti_xpm[] = { | ||
49 | "28 13 4 1", | ||
50 | " c None", | ||
51 | ". c #4C4C4C", | ||
52 | "+ c #FFF7DD", | ||
53 | "@ c #D6CFBA", | ||
54 | " ......................... ", | ||
55 | " .+++.+++.+++.+++.+++.+++. ", | ||
56 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", | ||
57 | " ......................... ", | ||
58 | " .+++.+++.+++.+++.+++.+++. ", | ||
59 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", | ||
60 | " ......................... ", | ||
61 | " .+++.+++.+++.+++.+++.+++. ", | ||
62 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", | ||
63 | " ......................... ", | ||
64 | " .+++.+++.+++.+++.+++.+++. ", | ||
65 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", | ||
66 | " ......................... "}; | ||
67 | |||
68 | |||
69 | |||
70 | KeyboardImpl::KeyboardImpl() | ||
71 | : input(0), icn(0), ref(0) | ||
72 | { | ||
73 | } | ||
74 | |||
75 | KeyboardImpl::~KeyboardImpl() | ||
76 | { | ||
77 | delete input; | ||
78 | delete icn; | ||
79 | } | ||
80 | |||
81 | QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) | ||
82 | { | ||
83 | if ( !input ) | ||
84 | input = new Keyboard( parent, "Keyboard", f ); | ||
85 | return input; | ||
86 | } | ||
87 | |||
88 | void KeyboardImpl::resetState() | ||
89 | { | ||
90 | if ( input ) | ||
91 | input->resetState(); | ||
92 | } | ||
93 | |||
94 | QPixmap *KeyboardImpl::icon() | ||
95 | { | ||
96 | if ( !icn ) | ||
97 | icn = new QPixmap( (const char **)kb_xpm ); | ||
98 | return icn; | ||
99 | } | ||
100 | |||
101 | QString KeyboardImpl::name() | ||
102 | { | ||
103 | return qApp->translate( "InputMethods", "Keyboard" ); | ||
104 | // return qApp->translate( "InputMethods", "Opti" ); | ||
105 | } | ||
106 | |||
107 | void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) | ||
108 | { | ||
109 | if ( input ) | ||
110 | QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); | ||
111 | } | ||
112 | |||
113 | #ifndef QT_NO_COMPONENT | ||
114 | QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | ||
115 | { | ||
116 | *iface = 0; | ||
117 | if ( uuid == IID_QUnknown ) | ||
118 | *iface = this; | ||
119 | else if ( uuid == IID_InputMethod ) | ||
120 | *iface = this; | ||
121 | |||
122 | if ( *iface ) | ||
123 | (*iface)->addRef(); | ||
124 | return QS_OK; | ||
125 | } | ||
126 | |||
127 | Q_EXPORT_INTERFACE() | ||
128 | { | ||
129 | Q_CREATE_INSTANCE( KeyboardImpl ) | ||
130 | } | ||
131 | #endif | ||