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

unikeyboardimpl.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 <qobject.h>
00022 #include <qpixmap.h>
00023 #include "unikeyboard.h"
00024 #include "unikeyboardimpl.h"
00025 
00026 /* XPM */
00027 static const char * uni_xpm[]={
00028 "28 13 2 1",
00029 "# c #000000",
00030 ". c None",
00031 "............................",
00032 "...####....#####.....####...",
00033 "...####....######....####...",
00034 "...####....#######..........",
00035 "...####....########..####...",
00036 "...####....####.####.####...",
00037 "...####....####..########...",
00038 "...####....####...#######...",
00039 "...####....####....######...",
00040 "...#####..#####.....#####...",
00041 "....##########.......####...",
00042 "......######..........###...",
00043 "............................"};
00044 
00045 UniKeyboardImpl::UniKeyboardImpl()
00046     : input(0), icn(0)
00047 {
00048 }
00049 
00050 UniKeyboardImpl::~UniKeyboardImpl()
00051 {
00052     delete input;
00053     delete icn;
00054 }
00055 
00056 QWidget *UniKeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f )
00057 {
00058     if ( !input )
00059         input = new UniKeyboard( parent, "UniKeyboard", f );
00060     return input;
00061 }
00062 
00063 void UniKeyboardImpl::resetState()
00064 {
00065     if ( input )
00066         input->resetState();
00067 }
00068 
00069 QPixmap *UniKeyboardImpl::icon()
00070 {
00071     if ( !icn )
00072         icn = new QPixmap( (const char **)uni_xpm );
00073     return icn;
00074 }
00075 
00076 QString UniKeyboardImpl::name()
00077 {
00078     return qApp->translate( "InputMethods", "Unicode" );
00079 }
00080 
00081 void UniKeyboardImpl::onKeyPress( QObject *receiver, const char *slot )
00082 {
00083     if ( input )
00084             QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot );
00085 }
00086 
00087 QRESULT UniKeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
00088 {
00089     *iface = 0;
00090     if ( uuid == IID_QUnknown )
00091         *iface = this;
00092     else if ( uuid == IID_InputMethod )
00093         *iface = this;
00094     else
00095         return QS_FALSE;
00096 
00097     if ( *iface )
00098         (*iface)->addRef();
00099     return QS_OK;
00100 }
00101 
00102 Q_EXPORT_INTERFACE()
00103 {
00104     Q_CREATE_INSTANCE( UniKeyboardImpl )
00105 }
00106 
00107 

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