epoc32/include/mw/aknmultilinequerycontrol.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2002 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 *   Implementation of the query control for multiline queries
    16 *
    17 */
    18 
    19 
    20   
    21 #ifndef __AKN_MULTILINE_QUERY_CONTROL_H
    22 #define __AKN_MULTILINE_QUERY_CONTROL_H 
    23 
    24 //  INCLUDES
    25 #include <coecntrl.h>
    26 #include <aknQueryControl.h>
    27 
    28 enum TLinePosition  
    29     {   
    30     EFirstLine = 0, 
    31     ESecondLine 
    32     };  
    33 
    34 class TAknWindowLineLayout;
    35 
    36 /**
    37  * Multiline query control class.
    38  */
    39 class CAknMultilineQueryControl : public CAknQueryControl 
    40     {
    41     public: // Constructors and destructor
    42         /**
    43          * C++ Constructor.
    44          */
    45         IMPORT_C CAknMultilineQueryControl();
    46 
    47         /**
    48          * C++ Destructor.
    49          */
    50         IMPORT_C virtual ~CAknMultilineQueryControl();
    51 
    52     public://new API functions
    53         /**
    54         * Set number of prompt lines to controls. 
    55         * This have to call before setting sizs of the components
    56         *
    57         * @param aNbrOfPromptLinesFirstLine     Numbers of lines in first prompt text
    58         * @param aNbrOfPromptLinesSecondLine    Numbers of lines in Second prompt text
    59         */
    60         IMPORT_C void SetNbrOfPromptLines(TInt aNbrOfPromptLinesFirstLine, TInt aNbrOfPromptLinesSecondLine);
    61     
    62         /**
    63          * Return true if control is the first query in the dialog
    64          */
    65         IMPORT_C TBool IsFirst() const;
    66 
    67         /**
    68          * Return true if control is the second query in the dialog
    69          */
    70         IMPORT_C TBool IsSecond() const;
    71 
    72     public: //Functions from CAknQueryControl
    73 
    74         /**
    75         * Get pointer to query controls control (editor)
    76         *
    77         * @param aLayout    Controls layout (for multiline queries use
    78         *                   EMultiDataFirstEdwin, EMultiDataSecondEdwin...)
    79         * @return           Pointer to control, NULL if not found 
    80         */
    81         IMPORT_C virtual CCoeControl* ControlByLayoutOrNull(TInt aLayout);
    82 
    83     public: // Functions from CCoeControl
    84 
    85         /**
    86         * From CCoeControl  Give the control a mimimum size. 
    87         * 
    88         * @return           The minimum size required by the control.
    89         */
    90         IMPORT_C TSize MinimumSize();
    91 
    92         /**
    93         * From CCoeControl.     
    94         * Handles pointer events
    95         * @param aPointerEvent     The pointer event.
    96         */
    97     	IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
    98     	
    99 	    
   100 	    IMPORT_C void HandleResourceChange(TInt aType); 
   101 
   102     public:
   103         /**
   104          * LAF indexing 
   105          *
   106          * Manage indexes into LAF tables
   107          */
   108         class TIndex 
   109         {   
   110         public: 
   111             TIndex(const TLinePosition& aLinePos, TInt aFirstQueryPromptLines,TInt aSecondQueryPromptLines);
   112         
   113         public: 
   114             TInt MainPanePQDCWindow() const;    
   115             TInt CDCQPWindowLine1() const;  
   116             TInt CDCQPWindowLine2() const;  
   117             TInt CDCQPWindowLine3() const;  
   118             TInt CDCQPWindowRectangles() const; 
   119             TInt CDCQPWindowLine5() const;  
   120 
   121             TInt CDCQPWindowTextsLine1(TInt aLineNum) const;
   122             TInt CDCQPWindowTextsLine2() const; 
   123             TInt CDCQPWindowTextsLine3(TInt aLineNum) const;
   124             TInt CDCQPWindowTextsLine4() const; 
   125 
   126             TInt CDCPQWindowGraphicsLine5() const;  
   127 
   128         public:
   129             const TInt LinePos() const { return iLinePos; }
   130         
   131         private:    
   132             TInt FirstQueryPromptLines() const;
   133             TInt SecondQueryPromptLines() const;
   134 
   135             void SelfTest() const;
   136     
   137         private:
   138             TLinePosition  iLinePos;    
   139             TInt           iFirstQueryPromptLines;  
   140             TInt           iSecondQueryPromptLines;
   141         };
   142         
   143     protected: // From CAknQueryControl
   144         /**
   145         * Set line widths for query prompt
   146         */
   147         void SetLineWidthsL();
   148 
   149         /**
   150         * Read the query data from resource file
   151         */
   152         void ConstructQueryL(TResourceReader& aRes);
   153 
   154         /**
   155          * Layout rectangle (shift up and left by margins)
   156          */
   157         TRect LayoutRect();
   158 
   159     private://From CCoeControl
   160         void SizeChanged();
   161         void Draw(const TRect& aRect) const;
   162     private:
   163         /**
   164         * From CAknControl
   165         */
   166         IMPORT_C void* ExtensionInterface( TUid aInterface );
   167 
   168     private:    //Layout methods
   169         void LayoutPrompt(const TLayoutMethod& aLayoutM);
   170         void LayoutSeparator(const TLayoutMethod& aLayoutM);
   171         
   172         void LayoutEditor(const TLayoutMethod& aLayoutM);
   173         void LayoutEditorFrame(const TLayoutMethod& aLayoutM);
   174         void LayoutEditorIndicator(const TLayoutMethod& aLayoutM);
   175 
   176         /**
   177         * Return window layout depending on Layout 
   178         * Window layout is done by the dialog
   179         */
   180         void WindowLayout( TAknWindowLineLayout& aLayout ) const;
   181 
   182     private: //Implementation methods
   183         void   SetLinePosition();
   184         TInt16 FirstLineHeight() const;
   185         TInt16 SecondLineHeight() const;
   186 
   187     private:
   188         TAknLayoutRect iLayoutLineBetweenEntryFields; /// Layout rect for line between two entry fields
   189         TLinePosition  iLinePos;    
   190         TInt           iFirstQueryPromptLines;  
   191         TInt           iSecondQueryPromptLines; 
   192     };
   193 
   194 
   195 
   196 /**
   197  * Derived Multiline query control class.
   198  * 
   199  * @since 2.1
   200  */
   201  class CAknExtMultilineQueryControl : public CAknExtQueryControl
   202     {
   203     public: // Constructors and destructor
   204         /**
   205          * C++ Constructor.
   206          */
   207         IMPORT_C CAknExtMultilineQueryControl();
   208 
   209         /**
   210          * C++ Destructor.
   211          */
   212         IMPORT_C virtual ~CAknExtMultilineQueryControl();
   213 
   214     public://new API functions
   215         /**
   216         * Set number of prompt lines to controls. 
   217         * This have to call before setting sizs of the components
   218         *
   219         * @param aNbrOfPromptLinesFirstLine     Numbers of lines in first prompt text
   220         * @param aNbrOfPromptLinesSecondLine    Numbers of lines in Second prompt text
   221         */
   222         IMPORT_C void SetNbrOfPromptLines(TInt aNbrOfPromptLinesFirstLine, TInt aNbrOfPromptLinesSecondLine);
   223     
   224         /**
   225          * Return true if control is the first query in the dialog
   226          */
   227         IMPORT_C TBool IsFirst() const;
   228 
   229         /**
   230          * Return true if control is the second query in the dialog
   231          */
   232         IMPORT_C TBool IsSecond() const;
   233 
   234     public: //Functions from CAknQueryControl
   235 
   236         /**
   237         * Get pointer to query controls control (editor)
   238         *
   239         * @param aLayout    Controls layout (for multiline queries use
   240         *                   EMultiDataFirstIpEd, EMultiDataSecondIpEd...)
   241         * @return           Pointer to control, NULL if not found 
   242         */
   243         IMPORT_C virtual CCoeControl* ControlByLayoutOrNull(TInt aLayout);
   244 
   245     public: // Functions from CCoeControl
   246 
   247         /**
   248         * From CCoeControl  Give the control a mimimum size. 
   249         * 
   250         * @return           The minimum size required by the control.
   251         */
   252         IMPORT_C TSize MinimumSize();
   253 
   254         /**
   255         * From CCoeControl.     
   256         * Handles pointer events
   257         * @param aPointerEvent     The pointer event.
   258         */
   259 	    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
   260 	    
   261 	    IMPORT_C void HandleResourceChange(TInt aType);   
   262 
   263     public:
   264         /**
   265          * LAF indexing 
   266          *
   267          * Manage indexes into LAF tables
   268          */
   269         class TIndex 
   270         {   
   271         public: 
   272             TIndex(const TLinePosition& aLinePos, TInt aFirstQueryPromptLines,TInt aSecondQueryPromptLines);
   273         
   274         public: 
   275             TInt MainPanePQDCWindow() const;    
   276             TInt CDCQPWindowLine1() const;  
   277             TInt CDCQPWindowLine2() const;  
   278             TInt CDCQPWindowLine3() const;  
   279             TInt CDCQPWindowRectangles() const; 
   280             TInt CDCQPWindowLine5() const;  
   281 
   282             TInt CDCQPWindowTextsLine1(TInt aLineNum) const;
   283             TInt CDCQPWindowTextsLine2() const; 
   284             TInt CDCQPWindowTextsLine3(TInt aLineNum) const;
   285             TInt CDCQPWindowTextsLine4() const; 
   286 
   287             TInt CDCPQWindowGraphicsLine5() const;  
   288 
   289         public:
   290             const TInt LinePos() const { return iLinePos; }
   291         
   292         private:    
   293             TInt FirstQueryPromptLines() const;
   294             TInt SecondQueryPromptLines() const;
   295 
   296             void SelfTest() const;
   297     
   298         private:
   299             TLinePosition  iLinePos;    
   300             TInt           iFirstQueryPromptLines;  
   301             TInt           iSecondQueryPromptLines;
   302         };
   303         
   304     protected: // From CAknQueryControl
   305         /**
   306         * Set line widths for query prompt
   307         */
   308         void SetLineWidthsL();
   309 
   310         /**
   311         * Read the query data from resource file
   312         */
   313         void ConstructQueryL(TResourceReader& aRes);
   314 
   315         /**
   316          * Layout rectangle (shift up and left by margins)
   317          */
   318         TRect LayoutRect();
   319 
   320     private://From CCoeControl
   321         void SizeChanged();
   322         void Draw(const TRect& aRect) const;
   323     private:
   324         /**
   325         * From CAknControl
   326         */
   327         IMPORT_C void* ExtensionInterface( TUid aInterface );
   328 
   329     private:    //Layout methods
   330         void LayoutPrompt(const TLayoutMethod& aLayoutM);
   331         void LayoutSeparator(const TLayoutMethod& aLayoutM);
   332         
   333         void LayoutEditor(const TLayoutMethod& aLayoutM);
   334         void LayoutEditorFrame(const TLayoutMethod& aLayoutM);
   335         void LayoutEditorIndicator(const TLayoutMethod& aLayoutM);
   336 
   337         /**
   338         * Return window layout depending on Layout 
   339         * Window layout is done by the dialog
   340         */
   341         void WindowLayout( TAknWindowLineLayout& aLayout ) const;
   342 
   343     private: //Implementation methods
   344         void   SetLinePosition();
   345         TInt16 FirstLineHeight() const;
   346 		TInt16 SecondLineHeight() const;
   347     private:
   348         TAknLayoutRect iLayoutLineBetweenEntryFields; /// Layout rect for line between two entry fields
   349         TLinePosition  iLinePos;    
   350         TInt           iFirstQueryPromptLines;  
   351         TInt           iSecondQueryPromptLines;
   352         TAny*          iSpare_1;
   353 
   354 
   355     };
   356 
   357 #endif