00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <qapplication.h>
00021 #include <qobject.h>
00022 #include <qpixmap.h>
00023 #include "unikeyboard.h"
00024 #include "unikeyboardimpl.h"
00025
00026
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