Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

keyboardimpl.cpp

Go to the documentation of this file.
00001 /**********************************************************************
00002 ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
00018 **
00019 **********************************************************************/
00020 #include <qapplication.h>
00021 #include <qpixmap.h>
00022 #include "keyboard.h"
00023 #include "keyboardimpl.h"
00024 
00025 /* XPM */
00026 static const char * const kb_xpm[] = {
00027 "28 13 4 1",
00028 "       c None",
00029 ".      c #4C4C4C",
00030 "+      c #FFF7DD",
00031 "@      c #D6CFBA",
00032 " .......................... ",
00033 " .+++.+++.+++.+++.+++.++++. ",
00034 " .+@@.+@@.+@@.+@@.+@@.+@@@. ",
00035 " .......................... ",
00036 " .+++++.+++.+++.+++.++++++. ",
00037 " .+@@@@.+@@.+@@.+@@.+@@@@@. ",
00038 " .......................... ",
00039 " .++++++.+++.+++.+++.+++++. ",
00040 " .+@@@@@.+@@.+@@.+@@.+@@@@. ",
00041 " .......................... ",
00042 " .++++.++++++++++++++.++++. ",
00043 " .+@@@.+@@@@@@@@@@@@@.+@@@. ",
00044 " .......................... "};
00045 
00046 
00047 /* XPM */
00048 static const char * const ipti_xpm[] = {
00049 "28 13 4 1",
00050 "       c None",
00051 ".      c #4C4C4C",
00052 "+      c #FFF7DD",
00053 "@      c #D6CFBA",
00054 " .........................  ",
00055 " .+++.+++.+++.+++.+++.+++.  ",
00056 " .+@@.+@@.+@@.+@@.+@@.+@@.  ",
00057 " .........................  ",
00058 " .+++.+++.+++.+++.+++.+++.  ",
00059 " .+@@.+@@.+@@.+@@.+@@.+@@.  ",
00060 " .........................  ",
00061 " .+++.+++.+++.+++.+++.+++.  ",
00062 " .+@@.+@@.+@@.+@@.+@@.+@@.  ",
00063 " .........................  ",
00064 " .+++.+++.+++.+++.+++.+++.  ",
00065 " .+@@.+@@.+@@.+@@.+@@.+@@.  ",
00066 " .........................  "};
00067 
00068 KeyboardImpl::KeyboardImpl()
00069     : input(0), icn(0)
00070 {
00071 }
00072 
00073 KeyboardImpl::~KeyboardImpl()
00074 {
00075     delete input;
00076     delete icn;
00077 }
00078 
00079 QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f )
00080 {
00081     if ( !input )
00082         input = new KeyboardInput::Keyboard( parent, "Keyboard", f );
00083     return input;
00084 }
00085 
00086 void KeyboardImpl::resetState()
00087 {
00088     if ( input )
00089         input->resetState();
00090 }
00091 
00092 QPixmap *KeyboardImpl::icon()
00093 {
00094     if ( !icn )
00095         icn = new QPixmap( (const char **)kb_xpm );
00096     return icn;
00097 }
00098 
00099 QString KeyboardImpl::name()
00100 {
00101     return qApp->translate( "InputMethods", "Keyboard" );
00102 }
00103 
00104 void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot )
00105 {
00106     if ( input )
00107         QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot );
00108 }
00109 
00110 #ifndef QT_NO_COMPONENT
00111 QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
00112 {
00113     *iface = 0;
00114     if ( uuid == IID_QUnknown )
00115         *iface = this;
00116     else if ( uuid == IID_InputMethod )
00117         *iface = this;
00118     else
00119         return QS_FALSE;
00120 
00121     if ( *iface )
00122         (*iface)->addRef();
00123     return QS_OK;
00124 }
00125 
00126 Q_EXPORT_INTERFACE()
00127 {
00128     Q_CREATE_INSTANCE( KeyboardImpl )
00129 }
00130 #endif

Generated on Sat Nov 5 16:15:58 2005 for OPIE by  doxygen 1.4.2