fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/AknFepUIAvkonCtrlInputPane.h
changeset 40 2cb9bae34d17
parent 31 f1bdd6b078d1
child 49 37f5d84451bd
equal deleted inserted replaced
31:f1bdd6b078d1 40:2cb9bae34d17
     1 /*
       
     2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:           
       
    15 *       Provides the CAknFepUICtrlInputPane definition.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 
       
    30 #ifndef __AKN_FEP_AVKON_INPUT_PANE_H__
       
    31 #define __AKN_FEP_AVKON_INPUT_PANE_H__
       
    32 
       
    33 #include <AknFepUICtrlInputPane.h>
       
    34 #include <coecntrl.h>
       
    35 #include <AknUtils.h>
       
    36 
       
    37 #include "AknFepUIAvkonCtrlContainerChinese.h"
       
    38 class CEikLabel;
       
    39 class CAknsFrameBackgroundControlContext;
       
    40 
       
    41 
       
    42 /**
       
    43  * pane in which the user's input is shown
       
    44  */
       
    45 NONSHARABLE_CLASS(CAknFepUICtrlInputPane) : public CCoeControl, public MAknFepUICtrlInputPane
       
    46     {
       
    47 public:
       
    48     /**
       
    49      * first phase construction
       
    50      *
       
    51      * @param aParent parent window
       
    52      * @param aPaneLayout the required layout
       
    53      *
       
    54      */
       
    55     static CAknFepUICtrlInputPane* NewL(RWindow& aParent, 
       
    56                                         TInputPaneLayout aPaneLayout,
       
    57                                         CAknFepUiLayoutDataMgr* aLafDataMgr);
       
    58 
       
    59     /**
       
    60      * destructor
       
    61      */
       
    62     ~CAknFepUICtrlInputPane();
       
    63 	
       
    64 	 /**
       
    65      * set the observer
       
    66      * <p> Note that only one observer is supported!
       
    67      *
       
    68      * @param aObserver pointer to the observer
       
    69      */
       
    70 
       
    71     void SetSizeChangedObserver(MAknFepUICtrlPinyinPopupSizeChangedObserver* aObserver);
       
    72 
       
    73     /**
       
    74      * Set the text buffer of the pane.
       
    75      *
       
    76      * @param aDes, the label will be filled with the first N characters from aDes,
       
    77      *                              where N=EMaxInputCharsNotIncludingToneMark
       
    78      *
       
    79      */
       
    80     void SetText(const TDesC& aDes);
       
    81 
       
    82     /**
       
    83      * Get the text buffer of the pane
       
    84      *
       
    85      * @output aText the buffer is filled with the contents of the candidate
       
    86      *              of the pane, up to the size of the buffer
       
    87      */
       
    88     void GetText(TDes& aText) const;
       
    89 
       
    90     /**
       
    91      * This function sets the highlighted status of the pane for rendering purposes.
       
    92      *
       
    93      * @param aHighlighted whether or not the input pane has the highlight
       
    94      */
       
    95     void SetHighlighted(TBool aHighlighted);
       
    96 
       
    97     /**
       
    98      * This function returns the highlighted status of the Pane.
       
    99      *
       
   100      * @return whether the pane is highlighted
       
   101      */
       
   102     TBool Highlighted() const;
       
   103 
       
   104     /**
       
   105      * This function sets the Tone Mark for the Pane.
       
   106      *
       
   107      * @param aToneMark descriptor containing the tone mark character
       
   108      */
       
   109     void SetToneMark(const TDesC& aToneMark);
       
   110 
       
   111     /**
       
   112      * This function gets the Tone Mark for the Pane.
       
   113      *
       
   114      * @output aToneMark descriptor containing the tone mark character
       
   115      */
       
   116     void GetToneMark(TDes& aToneMark) const;
       
   117 
       
   118     /**
       
   119      * This function sets the validity of the tonemark
       
   120      *
       
   121      * @param aValid if ETrue, tonemark will be displayed as valid
       
   122      *                          if EFalse, tonemark will be displayed as not valid
       
   123      */
       
   124     void SetToneMarkValidity(TBool aValid);
       
   125 
       
   126     /**
       
   127      * sets the layout index to use when accessing the 
       
   128      * layout dll
       
   129      */
       
   130     void SetLayoutIndex(TInt aIndex);
       
   131 
       
   132     /**
       
   133      * sets the font to be used, which will override the font from LAF
       
   134      *
       
   135      * @param aFontId the new font id, pass in 0 to use the one from LAF
       
   136      *
       
   137      */
       
   138     void SetOverrideFontId(TInt aFontId);
       
   139 
       
   140     /**
       
   141      * This function determines whether the current text is shown or not
       
   142      *
       
   143      * @param aValid if ETrue, text will be displayed
       
   144      *                          if EFalse, text will be displayed
       
   145      */
       
   146     void MakeTextVisible(TBool aVisible);
       
   147 	/**
       
   148 	*	This  function calculate the input pane's size for phrase input layout
       
   149 	*   @return input pane's size
       
   150 	*   
       
   151 	*/
       
   152 	TInt LabelTextWidthInPixels() const;
       
   153 
       
   154     /**
       
   155     * Set,clear and check phonetic change status (for phrase input)
       
   156     */
       
   157     inline void SetFlag(TInt aFlag);
       
   158     inline void ClearFlag(TInt aFlag);
       
   159     inline TBool IsFlagSet(TInt aFlag) const;
       
   160     
       
   161     void SetLayout( TInputPaneLayout aPaneLayout );
       
   162     
       
   163 
       
   164 public: // from CCoeControl
       
   165     /**
       
   166      * size changed
       
   167      */
       
   168     virtual void SizeChanged();
       
   169 
       
   170     /**
       
   171      * count component controls
       
   172      *
       
   173      * @return number of contained controls
       
   174      */
       
   175     TInt CountComponentControls() const;
       
   176 
       
   177     /**
       
   178      * Component control
       
   179      *
       
   180      * @param aIndex the control to return, must be between 0 and the number of controls
       
   181      * @return pointer to contained control, ownership is not passed
       
   182      * 
       
   183      */
       
   184     CCoeControl* ComponentControl(TInt aIndex) const;
       
   185 
       
   186     /**
       
   187      * draw
       
   188      *
       
   189      * @param aRect rectangle
       
   190      *
       
   191      */
       
   192     virtual void Draw(const TRect& aRect) const;
       
   193 
       
   194 protected:
       
   195 
       
   196     /**
       
   197      * second phase construction
       
   198      *
       
   199      * @param aParent parent window
       
   200      */
       
   201     void ConstructL(RWindow& aParent);
       
   202 
       
   203      /**
       
   204       * constructor
       
   205       *
       
   206       * @param aPaneLayout the required layout
       
   207       */
       
   208     CAknFepUICtrlInputPane(TInputPaneLayout aPaneLayout, CAknFepUiLayoutDataMgr* aLafDataMgr);
       
   209 
       
   210     /**
       
   211      * Update the contents of the label, by combining
       
   212      * the buffer with the tone mark
       
   213      */
       
   214     void UpdateLabelContents();
       
   215 
       
   216     /**
       
   217      * layout contained controls
       
   218      */
       
   219     void LayoutContainedControls();
       
   220 
       
   221     /**
       
   222      * layout the background frames
       
   223      *
       
   224      * @param aOuterRect filled with outer rect coords
       
   225      * @param aInnerRect filled with inner rect coords
       
   226      *
       
   227      */
       
   228     void CalculateFrameRects(TRect& aOuterRect, TRect& aInnerRect) const;
       
   229 	
       
   230 private:
       
   231 
       
   232     /**
       
   233      * Get dispalying input text
       
   234      *
       
   235      * @param aDes Input text
       
   236      */
       
   237     TInt CalculateMaxTextLength(const TDesC& aDes) const;
       
   238     
       
   239     /**
       
   240      * layout input text
       
   241      *
       
   242      * @param aDes Input text
       
   243      */
       
   244     TInt CalculateTextLength(const TDesC& aDes) const;
       
   245 	
       
   246 private:
       
   247     TBool iHighlighted;
       
   248     TInputPaneLayout iLayout;
       
   249     TInt iLayoutIndex;
       
   250     TInt iMaxInputChars;
       
   251     TAknLayoutRect iUnselectedStringHighlight;
       
   252     TBufC<EMaxToneMarkLength> iToneMarkBuffer;
       
   253     TBool iToneMarkValidity;
       
   254     TInt iFontId;
       
   255     TInt iFlags;
       
   256 private: // the following are owned
       
   257     HBufC* iBuffer;
       
   258     CEikLabel* iLabel;
       
   259     CEikLabel* iLabelToneMark;
       
   260 
       
   261 private: // the following are not owned
       
   262     CAknFepUiLayoutDataMgr* iLafDataMgr;
       
   263     MAknFepUICtrlPinyinPopupSizeChangedObserver* iSizeChangedObserver;
       
   264     };
       
   265 
       
   266 inline void CAknFepUICtrlInputPane::SetFlag(TInt aFlag)
       
   267     {
       
   268     iFlags |= aFlag;
       
   269     }
       
   270 
       
   271 inline void CAknFepUICtrlInputPane::ClearFlag(TInt aFlag)
       
   272     {
       
   273     iFlags &= ~aFlag;
       
   274     }
       
   275 
       
   276 inline TBool CAknFepUICtrlInputPane::IsFlagSet(TInt aFlag) const
       
   277     {
       
   278     return iFlags & aFlag;
       
   279     }
       
   280 
       
   281 #endif //__AKN_FEP_AVKON_INPUT_PANE_H__
       
   282 
       
   283 // End of file