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

inputmethods.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 ** Copyright (C) 2000-2002 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of the 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 #ifndef __INPUT_METHODS_H__
00022 #define __INPUT_METHODS_H__
00023 
00024 #include <qtopia/qlibrary.h>
00025 #include <qtopia/inputmethodinterface.h>
00026 
00027 #include <qwidget.h>
00028 #include <qvaluelist.h>
00029 
00030 class QToolButton;
00031 class QWidgetStack;
00032 
00033 struct InputMethod
00034 {
00035 #ifndef QT_NO_COMPONENT
00036     QLibrary *library;
00037 #endif
00038     QWidget *widget;
00039     QString libName;
00040     bool newIM;
00041     union {
00042         InputMethodInterface *interface;
00043         ExtInputMethodInterface *extInterface;
00044     };
00045 
00046     inline void releaseInterface() {
00047         newIM ? (void)extInterface->release() : (void)interface->release();
00048         library->unload();
00049         delete library; library = 0l;
00050     }
00051     inline QString name() const { return newIM ? extInterface->name() : interface->name(); }
00052     inline QPixmap *icon() const { return newIM ? extInterface->icon() : interface->icon(); }
00053     inline QUnknownInterface *iface() { return newIM ? (QUnknownInterface *)extInterface : (QUnknownInterface *)interface; }
00054     inline void resetState() { if ( !newIM ) interface->resetState(); }
00055 
00056     int operator <(const InputMethod& o) const;
00057     int operator >(const InputMethod& o) const;
00058     int operator <=(const InputMethod& o) const;
00059 };
00060 
00061 class InputMethods : public QWidget
00062 {
00063     Q_OBJECT
00064 public:
00065     InputMethods( QWidget * );
00066     ~InputMethods();
00067 
00068     QRect inputRect() const;
00069     bool shown() const;
00070     QString currentShown() const; // name of interface
00071     void showInputMethod(const QString& id);
00072     void showInputMethod();
00073     void hideInputMethod();
00074     void unloadInputMethods();
00075     void loadInputMethods();
00076     virtual bool eventFilter( QObject *, QEvent * );
00077     void readConfig();
00078 
00079 signals:
00080     void inputToggled( bool on );
00081 
00082 private slots:
00083     void chooseKbd();
00084     void chooseIm();
00085     void showKbd( bool );
00086     void resetStates();
00087     void sendKey( ushort unicode, ushort scancode, ushort modifiers, bool, bool );
00088     void qcopReceive( const QCString &msg, const QByteArray &data );
00089 
00090 private:
00091     void setPreferedHandlers();
00092     /*static */QStringList plugins()const;
00093     /*static */void installTranslator( const QString& );
00094     void unloadMethod( QValueList<InputMethod>& );
00095     void chooseMethod(InputMethod* im);
00096     void chooseKeyboard(InputMethod* im);
00097     void updateKeyboards(InputMethod *im);
00098 
00099 private:
00100     QToolButton *kbdButton;
00101     QToolButton *kbdChoice;
00102     QWidgetStack *imButton; // later will be widget stack
00103     QToolButton *imChoice;
00104     InputMethod *mkeyboard;
00105     InputMethod *imethod;
00106     QValueList<InputMethod> inputMethodList;
00107     QValueList<InputMethod> inputModifierList;
00108     int inputWidgetStyle;
00109     int inputWidgetWidth;
00110 };
00111 
00112 
00113 #endif // __INPUT_METHODS_H__
00114 

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