browserui/browser/BrowserAppInc/BrowserGotoPane.h
changeset 0 84ad3b177aa3
child 1 57d5b8e231c4
equal deleted inserted replaced
-1:000000000000 0:84ad3b177aa3
       
     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 the License "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:  Browser Goto pane.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef WML_GOTO_PANE_BASE_H
       
    20 #define WML_GOTO_PANE_BASE_H
       
    21 
       
    22 // DEFINES
       
    23 #define GOTOPANE_POPUPLIST_DISABLE 0
       
    24 #define GOTOPANE_POPUPLIST_ENABLE 1
       
    25 
       
    26 // INCLUDE FILES
       
    27 #include <coecntrl.h>
       
    28 #include <eikedwin.h>
       
    29 #include <Avkon.mbg>
       
    30 
       
    31 // FORWARD DECLARATION
       
    32 class CAknInputFrame;
       
    33 class CBrowserGotoPane;
       
    34 class CBrowserAdaptiveListPopup;
       
    35 class CBrowserContentView;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 /**
       
    39 * Mixin class for handling Goto Pane events.
       
    40 *  
       
    41 * @lib Browser.app
       
    42 * @since Series60 1.2
       
    43 */
       
    44 class MGotoPaneObserver
       
    45     {
       
    46 
       
    47     public:     // types
       
    48 
       
    49         enum TEvent                 /// Goto Pane events.
       
    50             {
       
    51             EEventEnterKeyPressed   ///< Enter (OK) key pressed.
       
    52             };
       
    53 
       
    54     public:     // new methods
       
    55 
       
    56         /**
       
    57         * Handle Goto Pane event. Derived classes must implement.
       
    58         * @since Series60 1.2
       
    59         * @param aGotoPane The Goto Pane in which the event occurred
       
    60         * @param aEvent Goto Pane event
       
    61         */
       
    62         virtual void HandleGotoPaneEventL( CBrowserGotoPane* aGotoPane, TEvent aEvent ) = 0;
       
    63     };
       
    64 
       
    65 
       
    66 /**
       
    67 * Key event handled. Has higher priority than FEP,
       
    68 * to be able to catch up/down key event and forward
       
    69 * them to goto pane's editor.
       
    70 *
       
    71 * @lib Browser.app
       
    72 * @since Series 60 1.2        
       
    73 */
       
    74 class CBrowserKeyEventHandled : public CCoeControl, public MEikEdwinObserver
       
    75     {
       
    76     public:
       
    77         
       
    78         /**
       
    79         * public constructor
       
    80         * @param aGotoPane pointer to goto pane that key events are controled
       
    81         */
       
    82         CBrowserKeyEventHandled( CBrowserGotoPane& aGotoPane );
       
    83 
       
    84         /**
       
    85         * Catches key events before FEP could do it.
       
    86         * @since Series60 1.2
       
    87         * @param aKeyEvent
       
    88         * @param aType
       
    89         * @return
       
    90         */
       
    91         virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
       
    92 
       
    93         /**
       
    94         * Catches EEventTextUpdate event.
       
    95         * @since Series60 1.2
       
    96         * @param aKeyEvent
       
    97         * @param aType
       
    98         * @return
       
    99         */
       
   100         virtual void HandleEdwinEventL(CEikEdwin* aEdwin,TEdwinEvent aEventType);
       
   101 
       
   102         /**
       
   103         * Put control to control stack or remove it from there.
       
   104         * @since Series60 1.2
       
   105         * @param aEnable ETrue puts control to the control stack with higher 
       
   106         * priority than FEP has. EFalse removes control from the stack.
       
   107         */
       
   108         void EnableL( TBool aEnable );
       
   109 
       
   110         /**
       
   111         * Set iFirstKeyEvent to TRUE.
       
   112         * @since Series60 1.2
       
   113         */
       
   114         void Reset();
       
   115 
       
   116         /**
       
   117         * Get LeftRightEvent.
       
   118         * @since Series60 1.2
       
   119         */
       
   120 
       
   121         TBool IsLeftRightEvent() { return iLeftRightEvent; }
       
   122 
       
   123         /**
       
   124         * SetFirstKey.
       
   125         * @since Series60 3.2
       
   126         */
       
   127         void SetFirstKeyEvent(TBool aFirstKeyEvent) {iFirstKeyEvent = aFirstKeyEvent;}
       
   128 
       
   129 
       
   130     protected:
       
   131         
       
   132         // key event catching enable flag
       
   133         TBool   iEnabled;   
       
   134         
       
   135         // only first key event is catched
       
   136         TBool   iFirstKeyEvent; 
       
   137         
       
   138         //
       
   139         TBool iLeftRightEvent;
       
   140         
       
   141         // goto pane control of which key events are catched
       
   142         CBrowserGotoPane& iGotoPane;                                        
       
   143     };
       
   144 
       
   145 /**
       
   146 * Goto Pane Base for the WML Browser & Bookmarks. 
       
   147 * It looks just like a search field.
       
   148 * 
       
   149 * @lib Browser.app
       
   150 * @since Series 60 1.2
       
   151 */
       
   152 class CBrowserGotoPane:
       
   153         public CCoeControl, public MCoeControlObserver, public MCoeFepObserver
       
   154     {
       
   155     public:
       
   156         /**
       
   157         * Two-phased constructor. Leaves on failure.
       
   158         * @since Series60 1.2
       
   159         * @param aParent Parent control
       
   160         * @param aIconBitmapId Id of the icon to display
       
   161         * @param aIconMaskId Id of the icon`s mask
       
   162         * @param aPopupListStatus True if the pane uses popuplist,
       
   163         *                         otherwise false.
       
   164         * @param aContentView Pointer to content view
       
   165         * @param aFindKeywordMode Set true if the pane is a find keyword pane.
       
   166         * @return The constructed Goto Pane control
       
   167         */
       
   168         static CBrowserGotoPane* NewL
       
   169               ( 
       
   170               const CCoeControl* aParent, 
       
   171               TInt aIconBitmapId = EMbmAvkonQgn_indi_find_goto, 
       
   172               TInt aIconMaskId  = EMbmAvkonQgn_indi_find_goto_mask, 
       
   173               TBool aPopupListStatus = GOTOPANE_POPUPLIST_ENABLE,
       
   174               CBrowserContentView* aContentView = NULL,
       
   175               TBool aFindKeywordMode = EFalse
       
   176               );
       
   177 
       
   178         /**
       
   179         * Destructor.
       
   180         */
       
   181         virtual ~CBrowserGotoPane();
       
   182 
       
   183         /**
       
   184         * Makes goto pane (un)visible.
       
   185         * @since Series60 1.2
       
   186         * @param ETrue to set visible
       
   187         */
       
   188         virtual void MakeVisibleL( TBool aVisible );
       
   189 
       
   190         /**
       
   191         * Non-leaving version of MakeVisibleL.
       
   192         * @since Series60 1.2
       
   193         * @param ETrue to set visible
       
   194         */
       
   195 		virtual void MakeVisible( TBool aVisible );
       
   196 
       
   197         /**
       
   198         * See description in calslbs.h.
       
   199         */
       
   200         void HandleFindSizeChanged();
       
   201 
       
   202         /**
       
   203         * Enable key event handler.
       
   204         * @since Series60 1.2
       
   205         * @param aEnable TRUE to enable
       
   206         */
       
   207         void EnableKeyEventHandlerL( TBool aEnable );
       
   208 
       
   209     public:	// from MCoeControlObserver
       
   210 
       
   211         /**
       
   212         * Handle control event.
       
   213         * @since Series60 1.2
       
   214         * @param aControl The control
       
   215         * @param aEventType Event type
       
   216         */
       
   217 	    void HandleControlEventL
       
   218             ( CCoeControl* aControl, TCoeEvent aEventType );
       
   219 
       
   220     public: // from CCoeControl
       
   221 
       
   222         /**
       
   223         * Handle key event.
       
   224         * @since Series60 1.2
       
   225         * @param aKeyEvent The key event
       
   226         * @param aType Key event type
       
   227         * @return Response (was the key event consumed?)
       
   228         */
       
   229         virtual TKeyResponse OfferKeyEventL
       
   230             ( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   231 
       
   232         /**
       
   233         * HandlePointerEventL
       
   234         * From CCoeControl
       
   235         *
       
   236         */
       
   237         void HandlePointerEventL(const TPointerEvent& /*aPointerEvent*/);
       
   238 
       
   239     public:     // from CCoeControl
       
   240 
       
   241         /**
       
   242         * Count component controls.
       
   243         * @since Series60 1.2
       
   244         * @return Number of component controls
       
   245         */
       
   246         virtual TInt CountComponentControls() const;
       
   247 
       
   248         /**
       
   249         * Get a component control by index.
       
   250         * @since Series60 1.2
       
   251         * @param aIndex Index of component control to be returned
       
   252         * @return Component control or NULL
       
   253         */
       
   254         virtual CCoeControl* ComponentControl( TInt aIndex ) const;
       
   255 
       
   256         /**
       
   257         * Sets the OrdinalPosition of GotoPane
       
   258         * @param aPos The OrdinalPosition
       
   259         */
       
   260         void SetOrdinalPosition( TInt aPos );
       
   261 
       
   262     public:     // Text manipulation
       
   263 
       
   264         /**
       
   265         * Lengt of the text in the editor.
       
   266         * @since Series60 1.2
       
   267         * @return The text length
       
   268         */
       
   269         TInt TextLength() const;
       
   270 
       
   271         /**
       
   272         * Get text from the editor.
       
   273         * @since Series60 1.2
       
   274         * @return text from the editor
       
   275         */
       
   276         HBufC* GetTextL() const;
       
   277 
       
   278         /**
       
   279         * Set text.
       
   280         * @since Series60 1.2
       
   281         * @param aTxt Text to set
       
   282         * appended if needed.
       
   283         */
       
   284         virtual void SetTextL( const TDesC& aTxt );
       
   285 
       
   286         /**
       
   287         * Selects all text in the editor.
       
   288         * See CEikEdwin's SelectAllL();
       
   289         * @since Series60 1.2
       
   290         */
       
   291         void SelectAllL();
       
   292 
       
   293         /**
       
   294         * Set info text.
       
   295         * @since Series60 1.2
       
   296         * @param aText Text to be displayed as info
       
   297         */
       
   298         void SetInfoTextL( const TDesC& aText );
       
   299 
       
   300         /**
       
   301         * Perform clipboard functionality.
       
   302         * @since Series60 1.2
       
   303         * @param aClipboardFunc Function to perform
       
   304         */
       
   305         void ClipboardL( CEikEdwin::TClipboardFunc aClipboardFunc );
       
   306 
       
   307         /**
       
   308         * Returns editor control of goto pane.
       
   309         * @since Series60 1.2
       
   310         * @return editor control of goto pane
       
   311         */
       
   312         CEikEdwin* Editor() const;
       
   313 
       
   314     public:     // observer support
       
   315 
       
   316         /**
       
   317         * Set observer. Pass NULL pointer to unset. Panics if already set.
       
   318         * @since Series60 1.2
       
   319         */
       
   320         void SetGPObserver( MGotoPaneObserver* aObserver );
       
   321 
       
   322          /**
       
   323         * Gives back a pointer to adaptivepopuplist
       
   324         */
       
   325         CBrowserAdaptiveListPopup* PopupList();
       
   326 
       
   327          /**
       
   328         * Handles resource change
       
   329         */        
       
   330 		void HandleResourceChange( TInt aType );
       
   331 		
       
   332          /**
       
   333         * Handles the completion of a FEP transaction
       
   334         */		
       
   335 		void HandleCompletionOfTransactionL();
       
   336 
       
   337          /**
       
   338         * Handles the start of a FEP transaction
       
   339         */		
       
   340 		void HandleStartOfTransactionL();		
       
   341 
       
   342     protected:  // Construct / destruct
       
   343         /**
       
   344         * Constructor.
       
   345         * @param 
       
   346         */
       
   347         CBrowserGotoPane( CBrowserContentView* aContentView, TBool aFindKeywordMode );
       
   348 
       
   349         /**
       
   350         * Second-phase constructor. Leaves on failure.
       
   351         * @param aParent Parent control
       
   352         */
       
   353         void ConstructL( const CCoeControl* aParent, TInt aIconBitmapId, TInt aIconMaskId, TBool aPopupListStatus );
       
   354 
       
   355     protected:  // from CCoeControl
       
   356 
       
   357         /**
       
   358         * Handle size change, lay out and draw components.
       
   359         */
       
   360         virtual void SizeChanged();
       
   361 
       
   362         /**
       
   363         * Handle focus change.
       
   364         * @since Series60 1.2
       
   365         * @param aDrawNow Draw now?
       
   366         */
       
   367         virtual void FocusChanged( TDrawNow aDrawNow );
       
   368 
       
   369     private:
       
   370 
       
   371         /**
       
   372         * Set the text and redraw.
       
   373         * @since Series60 1.2
       
   374         */
       
   375         void DoSetTextL( const TDesC& aTxt );
       
   376         
       
   377         void ActivateVKB();
       
   378 
       
   379 
       
   380     protected:    // data
       
   381     
       
   382 		CBrowserContentView* iContentView; //Not owned.
       
   383 		
       
   384 		// If the control is in find keyword pane mode.
       
   385 		TBool iFindKeywordMode;
       
   386 		
       
   387 		// HandleFEPFind
       
   388 		TBool iHandleFEPFind;
       
   389 		
       
   390 		// The previously typed text into iEditor
       
   391 		HBufC* iPrevKeyword;
       
   392 					
       
   393         // Editor. Owned.
       
   394         CEikEdwin* iEditor;  
       
   395         
       
   396         // Input frame. Owned.
       
   397         CAknInputFrame* iInputFrame;
       
   398         
       
   399         // Observer (may be NULL). Not owned.
       
   400         MGotoPaneObserver* iGPObserver;
       
   401 		
       
   402         
       
   403         CBrowserKeyEventHandled *iGotoKeyHandled;
       
   404 
       
   405         /// adaptive popuplist
       
   406         CBrowserAdaptiveListPopup* iBAdaptiveListPopup;
       
   407     };
       
   408 
       
   409 #endif