src/hbplugins/inputmethods/touchinput/virtualqwerty.h
changeset 0 16d8024aca5e
child 1 f7ac710697a9
equal deleted inserted replaced
-1:000000000000 0:16d8024aca5e
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (developer.feedback@nokia.com)
       
     6 **
       
     7 ** This file is part of the HbPlugins module of the UI Extensions for Mobile.
       
     8 **
       
     9 ** GNU Lesser General Public License Usage
       
    10 ** This file may be used under the terms of the GNU Lesser General Public
       
    11 ** License version 2.1 as published by the Free Software Foundation and
       
    12 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
       
    13 ** Please review the following information to ensure the GNU Lesser General
       
    14 ** Public License version 2.1 requirements will be met:
       
    15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    16 **
       
    17 ** In addition, as a special exception, Nokia gives you certain additional
       
    18 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    20 **
       
    21 ** If you have questions regarding the use of this file, please contact
       
    22 ** Nokia at developer.feedback@nokia.com.
       
    23 **
       
    24 ****************************************************************************/
       
    25 
       
    26 #ifndef _VirtualQwerty_H
       
    27 #define _VirtualQwerty_H
       
    28 
       
    29 #include <QPointer>
       
    30 #include <hbinputabstractbase.h>
       
    31 #include <hbinputpredictioncallback.h>
       
    32 #include <hbinputvirtualrocker.h>
       
    33 #include <hbinputvkbwidget.h>
       
    34 
       
    35 class QTimer;
       
    36 class HbQwertyKeyboard;
       
    37 class HbKeyMapData;
       
    38 class HbPredictionEngine;
       
    39 class HbCandidateList;
       
    40 class HbExactWordPopup;
       
    41 class HbInputSctLandscape;
       
    42 
       
    43 class HbInputModeHandler;
       
    44 class HbInputBasicQwertyHandler;
       
    45 class HbInputPredictionQwertyHandler;
       
    46 class HbInputNumericQwertyHandler;
       
    47 
       
    48 class HbVirtualQwerty : public HbInputAbstractMethod
       
    49 {
       
    50     Q_OBJECT
       
    51 
       
    52 public:
       
    53     HbVirtualQwerty();
       
    54     ~HbVirtualQwerty();
       
    55 
       
    56 public: // From QInputContext
       
    57     QString identifierName();
       
    58     bool isComposing() const;
       
    59     QString language();
       
    60     void reset();
       
    61     void mouseHandler(int x, QMouseEvent* aEvent);
       
    62     bool filterEvent(const QEvent* event);
       
    63 
       
    64 public slots:
       
    65     void sctCharacterSelected(QString aChar);
       
    66     void orientationAboutToChange();
       
    67     void rockerDirection(int aDirection, HbInputVirtualRocker::RockerSelectionMode aSelectionMode);
       
    68     // keypad related slots
       
    69     void keypadClosed();
       
    70     void keypadCloseEventDetected(HbInputVkbWidget::HbVkbCloseMethod vkbCloseMethod);
       
    71     void flickEvent(HbInputVkbWidget::HbFlickDirection direction);
       
    72     void mouseMovedOutOfButton();
       
    73     void smileySelected(QString smiley);
       
    74 
       
    75 public: // From HbInputMethod
       
    76     void focusReceived();
       
    77     void focusLost(bool focusSwitch);
       
    78     void inputStateActivated(const HbInputState& aNewState);
       
    79     void candidatePopupClosed(int closingKey);
       
    80     void inputLanguageChanged(const HbInputLanguage &aNewLanguage);
       
    81     void secondaryInputLanguageChanged(const HbInputLanguage &newLanguage);
       
    82     int displaySpecialCharacterTable(QObject* aReceiver);
       
    83     bool usePrediction() const;
       
    84 public: //From HbAbstractQwerty
       
    85     QList<HbKeyPressProbability> probableKeypresses();
       
    86 signals:
       
    87     void autoCompletionPopupClosed(QString word, int closingkey);
       
    88 
       
    89 public:
       
    90     void initializeModeHandlers();
       
    91     void launchCandidatePopup(const QStringList &candidates);
       
    92 
       
    93     void closeKeypad();
       
    94     void launchCharacterPreviewPane(int key);
       
    95     void switchSpecialCharacterTable();
       
    96     void selectSpecialCharacterTableMode();
       
    97     void closeExactWordPopup();
       
    98     void launchExactWordPopup(QString exactWord);
       
    99     void closeAutoCompletionPopup();
       
   100     void launchAutoCompletionPopup(const QStringList &candidates);
       
   101 
       
   102 protected:
       
   103     void predictiveInputStatusChanged(int newStatus);
       
   104 
       
   105 private slots:
       
   106     void candidatePopupCancelled();
       
   107 
       
   108 private:
       
   109     void initializePredictiveMode();
       
   110     void updateEditor();
       
   111     bool selectWord(bool selectFromLeft = true);
       
   112     void launchCandidatePopup();
       
   113     QPointF getCursorCoordinatePosition();
       
   114     void loadKeymap(const HbInputLanguage &newLanguage);
       
   115 
       
   116 private:
       
   117     void openKeypad(HbInputVkbWidget * keypadToOpen, bool inMinimizedMode = false);
       
   118     HbQwertyKeyboard* constructKeypad(HbKeypadMode currentInputType);
       
   119 
       
   120 private:
       
   121     // mCurrentKeypad contains currently active keypad, we dont need to have
       
   122     // anyother variables to tell us which is current keypad
       
   123     QPointer<HbInputVkbWidget> mCurrentKeypad;
       
   124     // contains qwerty alpha keypad
       
   125     QPointer<HbQwertyKeyboard> mQwertyAlphaKeypad;
       
   126     // contains qwerty numeric keypad
       
   127     QPointer<HbQwertyKeyboard> mQwertyNumericKeypad;
       
   128     // contains sct keypad
       
   129     QPointer<HbInputSctLandscape> mSctKeypad;
       
   130 
       
   131     const HbKeymap *mKeymap;
       
   132     HbFnState mFnState;
       
   133     HbInputState mPreviousInputState;
       
   134 
       
   135     HbExactWordPopup *mExactWordPopup;
       
   136     HbCandidateList *mCandidatePopup;
       
   137     bool mOrientationAboutToChange;
       
   138     HbInputVkbWidget::HbSctView mSctMode;
       
   139     int mShiftKeyState;
       
   140     // mode handlers
       
   141     HbInputModeHandler *mActiveModeHandler;
       
   142     HbInputBasicQwertyHandler *mBasicModeHandler;
       
   143     HbInputPredictionQwertyHandler *mPredictionModeHandler;
       
   144     HbInputNumericQwertyHandler *mNumericModeHandler;
       
   145     // vkbhost
       
   146     QPointer<HbVkbHost> mVkbHost;
       
   147 };
       
   148 
       
   149 #endif // _VirtualQwerty_H
       
   150 
       
   151 // End of file