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