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 /**************************************************************************************94x78**
00002 **
00003 ** This file may be distributed and/or modified under the terms of the
00004 ** GNU General Public License version 2 as published by the Free Software
00005 ** Foundation and appearing in the file LICENSE.GPL included in the
00006 ** packaging of this file.
00007 **
00008 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00009 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00010 **
00011 *********************************************************************************************/
00012 #include <qapplication.h>
00013 #include <qpixmap.h>
00014 #include "keyboard.h"
00015 #include "keyboardimpl.h"
00016 
00017 /* XPM */
00018 static const char * const icon_xpm[] = {
00019 "26 13 2 1",
00020 "       c None",
00021 ".      c #000000",
00022 " ... ... ... ... ... ...  ",
00023 ".   .   .           .   . ",
00024 ".   .     ...  ..   .   . ",
00025 ".   .          ..   .   . ",
00026 " ...... ...... ...  ....  ",
00027 ".        .. .. ..       . ",
00028 ".        .. .. ..       . ",
00029 ".         ...  ..       . ",
00030 " ......  ..       ......  ",
00031 ".   .    ..         .   . ",
00032 ".   .     .......   .   . ",
00033 ".   .   .           .   . ",
00034 " ... ... ... ... ... ...  "};
00035 
00036 
00037 KeyboardImpl::KeyboardImpl()
00038     : input(0), icn(0)
00039 {
00040 }
00041 
00042 KeyboardImpl::~KeyboardImpl()
00043 {
00044     delete input;
00045     delete icn;
00046 }
00047 
00048 QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f )
00049 {
00050     if ( !input )
00051         input = new KJumpX::Keyboard( parent, "Keyboard", f );
00052     return input;
00053 }
00054 
00055 void KeyboardImpl::resetState()
00056 {
00057     if ( input )
00058         input->resetState();
00059 }
00060 
00061 QPixmap *KeyboardImpl::icon()
00062 {
00063     if ( !icn )
00064         icn = new QPixmap( (const char **)icon_xpm );
00065     return icn;
00066 }
00067 
00068 QString KeyboardImpl::name()
00069 {
00070     return qApp->translate( "InputMethods", "KJumpX" );
00071 }
00072 
00073 void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot )
00074 {
00075     if ( input )
00076         QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot );
00077 }
00078 
00079 #ifndef QT_NO_COMPONENT
00080 QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
00081 {
00082     *iface = 0;
00083     if ( uuid == IID_QUnknown )
00084         *iface = this;
00085     else if ( uuid == IID_InputMethod )
00086         *iface = this;
00087     else
00088         return QS_FALSE;
00089 
00090     if ( *iface )
00091         (*iface)->addRef();
00092     return QS_OK;
00093 }
00094 
00095 Q_EXPORT_INTERFACE()
00096 {
00097     Q_CREATE_INSTANCE( KeyboardImpl )
00098 }
00099 #endif

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