src/hbcore/inputfw/hbinputstate.h
changeset 6 c3690ec91ef8
parent 1 f7ac710697a9
equal deleted inserted replaced
5:627c4a0fd0e7 6:c3690ec91ef8
    34 \class HbInputState
    34 \class HbInputState
    35 \brief Holds all the information for defining an input state.
    35 \brief Holds all the information for defining an input state.
    36 
    36 
    37 This class describes the state of the input framework.
    37 This class describes the state of the input framework.
    38 Active input method is notified every time the state changes.
    38 Active input method is notified every time the state changes.
    39 If the active input method cannot handle new state, the framework will find 
    39 If the active input method cannot handle new state, the framework will find
    40 suitable handler for it. The input state is a combination of input mode, text case,
    40 suitable handler for it. The input state is a combination of input mode, text case,
    41 keyboard type and language.
    41 keyboard type and language.
    42 
    42 
    43 This class is for input method developers, it should never be needed in application code.
    43 This class is for input method developers, it should never be needed in application code.
    44 
    44 
    59           mTextCase(textCase),
    59           mTextCase(textCase),
    60           mKeyboardType(keyboardType),
    60           mKeyboardType(keyboardType),
    61           mLanguage(language)
    61           mLanguage(language)
    62     {}
    62     {}
    63 
    63 
    64     void operator=(const HbInputState& other) {
    64     void operator=(const HbInputState &other) {
    65         mModeType = other.mModeType;
    65         mModeType = other.mModeType;
    66         mTextCase = other.mTextCase;
    66         mTextCase = other.mTextCase;
    67         mKeyboardType = other.mKeyboardType;
    67         mKeyboardType = other.mKeyboardType;
    68         mLanguage = other.mLanguage;
    68         mLanguage = other.mLanguage;
    69     }
    69     }
    70 
    70 
    71     bool operator==(const HbInputState& other) {
    71     bool operator==(const HbInputState &other) const {
    72         if (mModeType == other.mModeType
    72         if (mModeType == other.mModeType
    73             && mTextCase == other.mTextCase
    73             && mTextCase == other.mTextCase
    74             && mKeyboardType == other.mKeyboardType
    74             && mKeyboardType == other.mKeyboardType
    75             && mLanguage == other.mLanguage) {
    75             && mLanguage == other.mLanguage) {
    76                 return true;
    76             return true;
    77         }
    77         }
    78         return false;
    78         return false;
    79     }
    79     }
    80 
    80 
    81     /*!
    81     /*!
    82     This is same as compare operator except for the language value. If either one of the
    82     This is same as compare operator except for the language value. If either one of the
    83     states being compared has undefined language value, it will match to any language.
    83     states being compared has undefined language value, it will match to any language.
    84     If both language values are defined, then they are compared directly.
    84     If both language values are defined, then they are compared directly.
    85     */
    85     */
    86     bool isMatch(const HbInputState& other) {
    86     bool isMatch(const HbInputState &other) const {
    87         if (mModeType == other.mModeType
    87         if (mModeType == other.mModeType
    88             && mTextCase == other.mTextCase
    88             && mTextCase == other.mTextCase
    89             && mKeyboardType == other.mKeyboardType
    89             && mKeyboardType == other.mKeyboardType
    90             && (mLanguage == other.mLanguage ||
    90             && (mLanguage == other.mLanguage ||
    91                 mLanguage.undefined() ||           // Undefined matches to anything.
    91                 mLanguage.undefined() ||           // Undefined matches to anything.
    92         other.mLanguage.undefined())) {
    92                 other.mLanguage.undefined())) {
    93                 return true;
    93             return true;
    94         }
    94         }
    95         return false;
    95         return false;
    96     }
    96     }
    97 
    97 
    98     bool operator!=(const HbInputState& other) {
    98     bool operator!=(const HbInputState &other) const {
    99         if (mModeType != other.mModeType
    99         if (mModeType != other.mModeType
   100             || mTextCase != other.mTextCase
   100             || mTextCase != other.mTextCase
   101             || mKeyboardType != other.mKeyboardType
   101             || mKeyboardType != other.mKeyboardType
   102             || mLanguage != other.mLanguage) {
   102             || mLanguage != other.mLanguage) {
   103                 return true;
   103             return true;
   104         }
   104         }
   105         return false;
   105         return false;
   106     }
   106     }
   107 
   107 
   108     /*!
   108     /*!
   109     Returns input mode.
   109     Returns input mode.
   110     */
   110     */
   111     HbInputModeType inputMode() const { return mModeType; }
   111     HbInputModeType inputMode() const {
       
   112         return mModeType;
       
   113     }
   112 
   114 
   113     /*!
   115     /*!
   114     Sets input mode.
   116     Sets input mode.
   115     */
   117     */
   116     void setInputMode(HbInputModeType newMode) { mModeType = newMode; }
   118     void setInputMode(HbInputModeType newMode) {
       
   119         mModeType = newMode;
       
   120     }
   117 
   121 
   118     /*!
   122     /*!
   119     Returns text case.
   123     Returns text case.
   120     */
   124     */
   121     HbTextCase textCase() const { return mTextCase; }
   125     HbTextCase textCase() const {
       
   126         return mTextCase;
       
   127     }
   122 
   128 
   123     /*!
   129     /*!
   124     Sets text case.
   130     Sets text case.
   125     */
   131     */
   126     void setTextCase(HbTextCase newCase) { mTextCase = newCase; }
   132     void setTextCase(HbTextCase newCase) {
       
   133         mTextCase = newCase;
       
   134     }
   127 
   135 
   128     /*!
   136     /*!
   129     Returns keyboard type.
   137     Returns keyboard type.
   130     */
   138     */
   131     HbKeyboardType keyboard() const { return mKeyboardType; }
   139     HbKeyboardType keyboard() const {
       
   140         return mKeyboardType;
       
   141     }
   132 
   142 
   133     /*!
   143     /*!
   134     Sets keyboard type.
   144     Sets keyboard type.
   135     */
   145     */
   136     void setKeyboard(HbKeyboardType newKeyboard) { mKeyboardType = newKeyboard; }
   146     void setKeyboard(HbKeyboardType newKeyboard) {
       
   147         mKeyboardType = newKeyboard;
       
   148     }
   137 
   149 
   138     /*!
   150     /*!
   139     Returns language.
   151     Returns language.
   140     */
   152     */
   141     HbInputLanguage language() const { return HbInputLanguage(mLanguage); }
   153     HbInputLanguage language() const {
       
   154         return HbInputLanguage(mLanguage);
       
   155     }
   142 
   156 
   143     /*!
   157     /*!
   144     Sets language. 
   158     Sets language.
   145     */
   159     */
   146     void setLanguage(const HbInputLanguage &newLanguage) { mLanguage = newLanguage; }
   160     void setLanguage(const HbInputLanguage &newLanguage) {
       
   161         mLanguage = newLanguage;
       
   162     }
   147 
   163 
   148 private:
   164 private:
   149     HbInputModeType mModeType;
   165     HbInputModeType mModeType;
   150     HbTextCase mTextCase;
   166     HbTextCase mTextCase;
   151     HbKeyboardType mKeyboardType;
   167     HbKeyboardType mKeyboardType;