epoc32/include/mw/aknsfld.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/aknsfld.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,441 @@
     1.4 +/*
     1.5 +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*  Search Field support. 
    1.19 +*
    1.20 +*
    1.21 +*/
    1.22 +
    1.23 +
    1.24 +#ifndef __AKNSFLD_H__
    1.25 +#define __AKNSFLD_H__
    1.26 +
    1.27 +// INCLUDES
    1.28 +#include <AknControl.h>
    1.29 +#include <gulicon.h>
    1.30 +#include <eikgted.h>
    1.31 +#include <aknappui.h>
    1.32 +#include <e32property.h>  // for subscriber/publisher
    1.33 +
    1.34 +// FORWARD DECLARATIONS
    1.35 +class CEikEdwin;
    1.36 +class CGlobalText;
    1.37 +class CAknInputFrame;
    1.38 +class CAknSearchFieldIndicator;
    1.39 +class CAknsListBoxBackgroundControlContext;
    1.40 +class CAknsFrameBackgroundControlContext;
    1.41 +class CEikListBox;
    1.42 +class CAknAdaptiveSearch;
    1.43 +class MAdaptiveSearchTextObserver; 
    1.44 +class CAknSearchField;
    1.45 +class CHwKbSubscriber;
    1.46 +
    1.47 +/** 
    1.48 + * Adaptive search text observer will be notified when adaptive search 
    1.49 + * text/language are changed. Notify about text changing when adaptive search 
    1.50 + * grid is opened for the first time (empty search text is generated) or when 
    1.51 + * user taps the grid so that new character is inputted. Notify about language
    1.52 + * chnging when got information from CenRep.  
    1.53 + * 
    1.54 + * @since 5.0 
    1.55 + */ 
    1.56 +class MAdaptiveSearchTextObserver 
    1.57 +    { 
    1.58 +    public: 
    1.59 +       /** 
    1.60 +        * Notification and handling of an adaptive search text change. 
    1.61 +        * 
    1.62 +        * @param aSearchField The source search field of this message. 
    1.63 +        */ 
    1.64 +        virtual void AdaptiveSearchTextChanged( CAknSearchField* aSearchField ) = 0; 
    1.65 +    }; 
    1.66 +
    1.67 + 
    1.68 +// CLASS DECLARATION
    1.69 +
    1.70 +/**
    1.71 + * The CAknSearchField class implements a Search field control. There are 
    1.72 + * different styles for the search field defined by a TSearchFieldStyle.
    1.73 + *
    1.74 + * @since Series 60 0.9
    1.75 + */
    1.76 +NONSHARABLE_CLASS(CAknSearchField) : public CAknControl,
    1.77 +		                             public MCoeControlObserver,			
    1.78 +                		             public MEikCommandObserver
    1.79 +{
    1.80 +public:
    1.81 +   /**
    1.82 +    * Search field style.
    1.83 +    */
    1.84 +    enum TSearchFieldStyle 
    1.85 +        {
    1.86 +        /** Use only ESearch in Series 60 */
    1.87 +        ESearch,
    1.88 +        /** (Not used) */        
    1.89 +        EInput,
    1.90 +        /** (Not used) */
    1.91 +        EUrl,  
    1.92 +        /** (Not used) */
    1.93 +        EPhone,
    1.94 +        /** (Not used) */
    1.95 +        EPlain,
    1.96 +        /** Use as popup search field. */
    1.97 +        EPopup,         
    1.98 +        /** Use as pinb search field. */
    1.99 +        EPinb,          
   1.100 +        /** For Clock application/list_single_heading_pane. */
   1.101 +        EClockApp,      
   1.102 +        /** Same as ESearch, but using CreateWindowL(). */
   1.103 +        EFixed,         
   1.104 +        /** Layout where no line is used. */
   1.105 +        ESearchWithoutLine, 
   1.106 +        /** Popup window layout. */
   1.107 +        EPopupWindow,
   1.108 +	    /** For adaptive search grid */
   1.109 +	    /** @since 5.0 */
   1.110 +	    EAdaptiveSearch,
   1.111 +	    /** For adaptive search grid */
   1.112 +	    /** Same as EAdaptiveSearch, but using CreateWindowL(). */
   1.113 +	    /** @since 5.0 */
   1.114 +	    EAdaptive,
   1.115 +        /** For adaptive search grid */
   1.116 +	    /** Same as EAdaptiveSearch, but using popup find pane. */
   1.117 +	    /** @since 5.0 */
   1.118 +	    EPopupAdaptiveSearch,
   1.119 +        /** For adaptive search grid */
   1.120 +	    /** Popup window layout */
   1.121 +	    /** @since 5.0 */
   1.122 +	    EPopupAdaptiveSearchWindow
   1.123 +        };
   1.124 +  
   1.125 +public:
   1.126 +
   1.127 +   /**
   1.128 +    * Destructor.
   1.129 +    */
   1.130 +    IMPORT_C ~CAknSearchField();
   1.131 +
   1.132 +   /**
   1.133 +    * Two-phased constructor.
   1.134 +    * @param aParent Reference to parent control.
   1.135 +    * @param aFieldStyle Defines the UI style.
   1.136 +    * @param aIcon A pointer to the icon to be shown in the search box frame.
   1.137 +    *              Takes ownerships. Can be @c NULL.
   1.138 +    * @param aTextLimit Defines the maximum text length.
   1.139 +    * @return A pointer to contructed @c CAknSearchField object.
   1.140 +    */
   1.141 +    IMPORT_C static CAknSearchField* NewL( const CCoeControl& aParent, TSearchFieldStyle aFieldStyle, CGulIcon* aIcon, TInt aTextLimit );
   1.142 +
   1.143 +public:                 // for search string manipulation
   1.144 +   /**
   1.145 +    * Returns the length of search text.
   1.146 +    * @return The length of search text.
   1.147 +    */
   1.148 +    IMPORT_C TInt TextLength() const;
   1.149 +
   1.150 +   /**
   1.151 +    * Returns the text of search field by writing it into the 
   1.152 +    * buffer aSearchTxt.
   1.153 +    * @param aSearchTxt Reference to the text buffer. Buffer size must be same
   1.154 +    *                   or greater than maximum text length, which is given in 
   1.155 +    *                   constructor.
   1.156 +    */
   1.157 +    IMPORT_C void GetSearchText( TDes& aSearchTxt ) const;
   1.158 +
   1.159 +   /**
   1.160 +    * Sets text into search field.
   1.161 +    * @param aSearchTxt Reference to the text buffer.
   1.162 +    */
   1.163 +    IMPORT_C void SetSearchTextL( const TDesC& aSearchTxt );
   1.164 +
   1.165 +   /**
   1.166 +    * Selects the whole search text.
   1.167 +    */
   1.168 +    IMPORT_C void SelectSearchTextL();
   1.169 +
   1.170 +   /**
   1.171 +    * Clears text in the search field.
   1.172 +    */
   1.173 +    IMPORT_C void ResetL();
   1.174 +
   1.175 +   /**
   1.176 +    * Sets additional info text to the search field.
   1.177 +    * @param aText Reference to the text buffer.
   1.178 +    */
   1.179 +    IMPORT_C void SetInfoTextL( const TDesC& aText );
   1.180 +
   1.181 +   /**
   1.182 +    * Calls editor's @c ClipboardL() function.
   1.183 +    * @param aClipboardFunc Clipboard function.
   1.184 +    */
   1.185 +    IMPORT_C void ClipboardL( CEikEdwin::TClipboardFunc aClipboardFunc );
   1.186 +
   1.187 +   /**
   1.188 +    * Return search field style
   1.189 +    * @since 5.0
   1.190 +    * @return style of search field 
   1.191 +    */   
   1.192 +    IMPORT_C CAknSearchField::TSearchFieldStyle SearchFieldStyle() const;
   1.193 +
   1.194 +public: // new methods for Avkon Skins support
   1.195 +
   1.196 +   /**
   1.197 +    * Sets whether skins are enabled on this control. The default value is 
   1.198 +    * determined from global setting from @c CAknAppUi.
   1.199 +    * @since Series 60 2.0 
   1.200 +    * @param aEnabled @c ETrue if skins are enabled, @c EFalse if not.
   1.201 +    */
   1.202 +    IMPORT_C void SetSkinEnabledL( const TBool aEnabled );
   1.203 +
   1.204 +public: // from MCoeControlObserver
   1.205 +
   1.206 +   /**
   1.207 +    * From @c MCoeControlObserver, Acts upon changes in the hosted control's state.
   1.208 +    * This class's implementation is trivial and should be able to be safely 
   1.209 +    * re-implemented in directly client-derived classes. For non-base setting
   1.210 +    * page classes, a call to the base class should be made.
   1.211 +    * @param aControl Control that caused the event. (not used in default implementation)
   1.212 +    * @param aEventType Type of the event. 
   1.213 +    */
   1.214 +    void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType );
   1.215 +
   1.216 +public: // From CCoeControl
   1.217 +
   1.218 +   /**
   1.219 +    * From @c CCoeControl, Handles key event.
   1.220 +    * @param aKeyEvent The key event. 
   1.221 +    * @param aType The type of the event.
   1.222 +    * @return Indicates whether the key event was used by this control or not.
   1.223 +    */
   1.224 +    IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,TEventCode aType );
   1.225 +
   1.226 +   /**
   1.227 +    * From @c CCoeControl, Handles pointer event.
   1.228 +    * @since 5.0
   1.229 +    * @param aPointerEvent The pointer event. 
   1.230 +    *	Invert adaptive search grid by tapping search field.    
   1.231 +    */
   1.232 +    void HandlePointerEventL( const TPointerEvent& aPointerEvent );
   1.233 +
   1.234 +   /**
   1.235 +    * From @c CCoeControl, Returns minimum size. Minimum size depends on 
   1.236 +    * zoom factor. 
   1.237 +    * @return Minimum size.
   1.238 +    */
   1.239 +    IMPORT_C TSize MinimumSize();
   1.240 +
   1.241 +   /**
   1.242 +    * Sets this control as visible or invisible.
   1.243 +    *
   1.244 +    * @since S60 3.2
   1.245 +    * @param aVisible ETrue to make the control visible, EFalse to make
   1.246 +    *                 it invisible.
   1.247 +    */
   1.248 +    IMPORT_C void MakeVisible( TBool aVisible );
   1.249 +    
   1.250 +    /**
   1.251 +     * From @c CCoeControl, Resource change handling.
   1.252 +     *
   1.253 +     * @param aType Message type.
   1.254 +     */
   1.255 +    void HandleResourceChange( TInt aType );
   1.256 +
   1.257 +public:
   1.258 +
   1.259 +   /**
   1.260 +    * Sets position of the line on main pane.
   1.261 +    * @since Series 60 2.0
   1.262 +    * @param aLinePos The position as defined in @c TAknSeparatorLinePos
   1.263 +    */
   1.264 +    IMPORT_C void SetLinePos( TInt aLinePos );
   1.265 +
   1.266 +   /**
   1.267 +    * Access to the edwin owned by the search field.
   1.268 +    * @since Series 60 2.6
   1.269 +    * @return Reference to the edwin owned by the search field.
   1.270 +    */
   1.271 +    IMPORT_C CEikEdwin& Editor() const;
   1.272 +
   1.273 +   /**
   1.274 +    * Set adaptive search grid characters.
   1.275 +    * @since 5.0
   1.276 +    * @param aGridChars The characters for adaptive search grid.
   1.277 +    */
   1.278 +    IMPORT_C void SetAdaptiveGridChars( const TDesC& aGridChars ) const;
   1.279 +
   1.280 +   /**
   1.281 +    * Show adaptive search grid. 
   1.282 +    * Application can activate adaptive search grid from the option menu.
   1.283 +    * @since 5.0
   1.284 +    */
   1.285 +    IMPORT_C void ShowAdaptiveSearchGrid() const;   
   1.286 +    
   1.287 +   /**
   1.288 +    * Set column filter flag for adaptive search grid  
   1.289 +    * @since 5.0
   1.290 +    * @param aFlag The bit flag shows which columns take into account
   1.291 +    * during filtering.
   1.292 +    */
   1.293 +    IMPORT_C void SetListColumnFilterFlags( const TBitFlags32 aFlag );
   1.294 +
   1.295 +   /**
   1.296 +    * Send column filter flag for adaptive search grid  
   1.297 +    * @since 5.0
   1.298 +    * @return aFlag The bit flag shows which columns take into account
   1.299 +    * during filtering.
   1.300 +    */
   1.301 +    IMPORT_C TBitFlags32 ListColumnFilterFlags() const;
   1.302 +
   1.303 +   /** 
   1.304 +    * Adds an adaptive search text observer. Duplicates are not checked 
   1.305 +    * (i.e. adding the same observer multiple times is not prevented). 
   1.306 +    * @since 5.0 
   1.307 +    * @param aObserver Must be non-NULL. 
   1.308 +    */ 
   1.309 +    IMPORT_C void AddAdaptiveSearchTextObserverL( MAdaptiveSearchTextObserver* aObserver );
   1.310 +
   1.311 +   /** 
   1.312 +    * Removes an adaptive search text observer. 
   1.313 +    * @since 5.0 
   1.314 +    * @param aObserver The observer to be removed. 
   1.315 +    * @return ETrue if removal ok, EFalse if observer was not removed (not 
   1.316 +    * found from the list of observers). 
   1.317 +    */ 
   1.318 +    IMPORT_C TBool RemoveAdaptiveSearchTextObserver( MAdaptiveSearchTextObserver* aObserver );
   1.319 +
   1.320 +   /** 
   1.321 +    * Returns information whether adaptive search is enabled or not
   1.322 +    * @since 5.0   
   1.323 +    * @return ETrue if adaptive search is enabled, EFalse otherwise.
   1.324 +    */ 
   1.325 +    IMPORT_C TBool AdaptiveSearchEnabled();
   1.326 +
   1.327 +   /** 
   1.328 +    * Notify client if input language changed in settings, for adaptive search
   1.329 +    * @since 5.0       
   1.330 +    * @return ETrue if language has changed, EFalse otherwise.
   1.331 +    */
   1.332 +    IMPORT_C TBool LanguageChanged() const;
   1.333 +
   1.334 +private: // from MObjectProvider
   1.335 +    TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
   1.336 +private:
   1.337 +    TInt CountComponentControls() const;
   1.338 +    CCoeControl* ComponentControl( TInt aIndex ) const;
   1.339 +    void SizeChanged();
   1.340 +    void FocusChanged( TDrawNow aDrawNow );
   1.341 +private:
   1.342 +    void ConstructL( const CCoeControl& aParent, TSearchFieldStyle aFieldStyle, CGulIcon* aIcon, TInt aTextLimit );
   1.343 +    CAknSearchField(); 
   1.344 +private:
   1.345 +    void ZoomEditorL();
   1.346 +private: // from MEikCommandObserver
   1.347 +    IMPORT_C void ProcessCommandL( TInt aCommandId );
   1.348 +private:
   1.349 +    void UpdatePopupCBAL();
   1.350 +    void RestorePopupCBA();
   1.351 +    void SetupSkinContextL();
   1.352 +public:
   1.353 +
   1.354 +   /**
   1.355 +    * Sets a list box for this control.
   1.356 +    * @since Series 60 2.6
   1.357 +    * @param aListBox A pointer to a list box object.
   1.358 +    */
   1.359 +    void SetListbox( CEikListBox* aListBox );
   1.360 +
   1.361 +   /**
   1.362 +    * Sets the parent control for this control.
   1.363 +    * @since Series 60 2.6
   1.364 +    * @param aParent A pointer to the parent control.
   1.365 +    */
   1.366 +    void SetParentCtrl( CCoeControl* aParent );
   1.367 +
   1.368 +   /**
   1.369 +    * Indicates that is the control popup or not.
   1.370 +    * @since Series 60 2.6
   1.371 +    * @return @c ETrue if it is a popup, @c EFalse if not.
   1.372 +    */
   1.373 +    TBool IsPopup();
   1.374 +
   1.375 +   /**
   1.376 +    * Sets index, where listbox focus should return when popup findbox is
   1.377 +    * canceled.
   1.378 +    * @since Series 60 3.1
   1.379 +    * @internal
   1.380 +    */
   1.381 +    void SetOldItemIndex( TInt aOldItemIndex );
   1.382 +
   1.383 +   /**
   1.384 +    * Returns index, where listbox focus should return when popup findbox is
   1.385 +    * canceled
   1.386 +    * @since Series 60 3.1
   1.387 +    * @internal
   1.388 +    */
   1.389 +    TInt OldItemIndex();
   1.390 +
   1.391 +   /** 
   1.392 +    * Set the language changed flag, for adaptive search
   1.393 +    * @since 5.0       
   1.394 +    * @param aLanguageChanged ETrue if language has changed, EFalse otherwise.
   1.395 +    */
   1.396 +    void SetLanguageChangedFlag( TBool aLanguageChanged );
   1.397 +    
   1.398 +    /**
   1.399 +     * Handle HW keyboard active/deactive event.
   1.400 +     * @since 5.0
   1.401 +     */
   1.402 +    void HandleHWKeyboardModeChangeL();
   1.403 +
   1.404 +    /**
   1.405 +     * A helper methord used in ContructL().
   1.406 +     * Get Adaptive Search setting and subscribe hardware 
   1.407 +     * keyboard layout changing.
   1.408 +     *
   1.409 +     * @param aShowIndicator, ETrue if indicator need be shown
   1.410 +     * @return ETrue if Adaptive is enabled in cenrep/
   1.411 +     * @since 5.0
   1.412 +     */
   1.413 +    TBool GetASStatusAndSubKbLayoutL( TBool& aShowIndicator );
   1.414 +
   1.415 +private:	
   1.416 +    // The bit flag shows which collumns take into account during filltering  
   1.417 +    TBitFlags32 iColumnFlag;
   1.418 +    CEikEdwin* iEditor;   
   1.419 +    CGlobalText* iGlobalText;
   1.420 +    CAknInputFrame* iInputFrame;
   1.421 +    CAknSearchFieldIndicator* iIndicator; 
   1.422 +    CAknsListBoxBackgroundControlContext* iSkinContext;
   1.423 +    TInt iFlags;  
   1.424 +    TInt iLinePos;
   1.425 +    CAknsFrameBackgroundControlContext* iInputContext;
   1.426 +    TBool iIsPopup;
   1.427 +    TBool iCBAObserverUpdated;
   1.428 +    CEikListBox *iListBox; // not owned
   1.429 +    CCoeControl *iParent; // not owned
   1.430 +    CEikButtonGroupContainer *iCba; // this is only for checking whether cba changed 
   1.431 +    TInt iOldItemIndex;
   1.432 +    CAknAppUi* iBackedAppUi;
   1.433 +    CAknAdaptiveSearch* iAdaptiveSearch; 
   1.434 +    TSearchFieldStyle iStyle;    
   1.435 +    TBool iLanguageChanged; // flag shows was input language changed or not
   1.436 +
   1.437 +    // For hybird keyborad
   1.438 +    RProperty iHwKeyboardPro;
   1.439 +    CHwKbSubscriber* iHwKbSub;
   1.440 +    };
   1.441 + 
   1.442 +#endif
   1.443 +
   1.444 +