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 KeyboardImpl::KeyboardImpl()
00048     : input(0), icn(0)
00049 {
00050 }
00051 
00052 KeyboardImpl::~KeyboardImpl()
00053 {
00054     delete input;
00055     delete icn;
00056 }
00057 
00058 QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f )
00059 {
00060     if ( !input )
00061         input = new MultiKey::Keyboard( parent, "Keyboard", f );
00062     return input;
00063 }
00064 
00065 void KeyboardImpl::resetState()
00066 {
00067     if ( input )
00068         input->resetState();
00069 }
00070 
00071 QPixmap *KeyboardImpl::icon()
00072 {
00073     if ( !icn )
00074         icn = new QPixmap( (const char **)kb_xpm );
00075     return icn;
00076 }
00077 
00078 QString KeyboardImpl::name()
00079 {
00080     return qApp->translate( "InputMethods", "Multikey" );
00081 }
00082 
00083 void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot )
00084 {
00085     if ( input )
00086         QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot );
00087 }
00088 
00089 #ifndef QT_NO_COMPONENT
00090 QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
00091 {
00092     *iface = 0;
00093     if ( uuid == IID_QUnknown )
00094         *iface = this;
00095     else if ( uuid == IID_InputMethod )
00096         *iface = this;
00097     else
00098         return QS_FALSE;
00099 
00100     if ( *iface )
00101         (*iface)->addRef();
00102     return QS_OK;
00103 }
00104 
00105 Q_EXPORT_INTERFACE()
00106 {
00107     Q_CREATE_INSTANCE( KeyboardImpl )
00108 }
00109 #endif

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