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

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

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