epoc32/include/mw/aknsfld.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
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.
williamr@4
     1
/*
williamr@4
     2
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
williamr@4
     3
* All rights reserved.
williamr@4
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@4
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@4
     8
*
williamr@4
     9
* Initial Contributors:
williamr@4
    10
* Nokia Corporation - initial contribution.
williamr@4
    11
*
williamr@4
    12
* Contributors:
williamr@4
    13
*
williamr@4
    14
* Description: 
williamr@4
    15
*  Search Field support. 
williamr@4
    16
*
williamr@4
    17
*
williamr@4
    18
*/
williamr@4
    19
williamr@4
    20
williamr@4
    21
#ifndef __AKNSFLD_H__
williamr@4
    22
#define __AKNSFLD_H__
williamr@4
    23
williamr@4
    24
// INCLUDES
williamr@4
    25
#include <AknControl.h>
williamr@4
    26
#include <gulicon.h>
williamr@4
    27
#include <eikgted.h>
williamr@4
    28
#include <aknappui.h>
williamr@4
    29
#include <e32property.h>  // for subscriber/publisher
williamr@4
    30
williamr@4
    31
// FORWARD DECLARATIONS
williamr@4
    32
class CEikEdwin;
williamr@4
    33
class CGlobalText;
williamr@4
    34
class CAknInputFrame;
williamr@4
    35
class CAknSearchFieldIndicator;
williamr@4
    36
class CAknsListBoxBackgroundControlContext;
williamr@4
    37
class CAknsFrameBackgroundControlContext;
williamr@4
    38
class CEikListBox;
williamr@4
    39
class CAknAdaptiveSearch;
williamr@4
    40
class MAdaptiveSearchTextObserver; 
williamr@4
    41
class CAknSearchField;
williamr@4
    42
class CHwKbSubscriber;
williamr@4
    43
williamr@4
    44
/** 
williamr@4
    45
 * Adaptive search text observer will be notified when adaptive search 
williamr@4
    46
 * text/language are changed. Notify about text changing when adaptive search 
williamr@4
    47
 * grid is opened for the first time (empty search text is generated) or when 
williamr@4
    48
 * user taps the grid so that new character is inputted. Notify about language
williamr@4
    49
 * chnging when got information from CenRep.  
williamr@4
    50
 * 
williamr@4
    51
 * @since 5.0 
williamr@4
    52
 */ 
williamr@4
    53
class MAdaptiveSearchTextObserver 
williamr@4
    54
    { 
williamr@4
    55
    public: 
williamr@4
    56
       /** 
williamr@4
    57
        * Notification and handling of an adaptive search text change. 
williamr@4
    58
        * 
williamr@4
    59
        * @param aSearchField The source search field of this message. 
williamr@4
    60
        */ 
williamr@4
    61
        virtual void AdaptiveSearchTextChanged( CAknSearchField* aSearchField ) = 0; 
williamr@4
    62
    }; 
williamr@4
    63
williamr@4
    64
 
williamr@4
    65
// CLASS DECLARATION
williamr@4
    66
williamr@4
    67
/**
williamr@4
    68
 * The CAknSearchField class implements a Search field control. There are 
williamr@4
    69
 * different styles for the search field defined by a TSearchFieldStyle.
williamr@4
    70
 *
williamr@4
    71
 * @since Series 60 0.9
williamr@4
    72
 */
williamr@4
    73
NONSHARABLE_CLASS(CAknSearchField) : public CAknControl,
williamr@4
    74
		                             public MCoeControlObserver,			
williamr@4
    75
                		             public MEikCommandObserver
williamr@4
    76
{
williamr@4
    77
public:
williamr@4
    78
   /**
williamr@4
    79
    * Search field style.
williamr@4
    80
    */
williamr@4
    81
    enum TSearchFieldStyle 
williamr@4
    82
        {
williamr@4
    83
        /** Use only ESearch in Series 60 */
williamr@4
    84
        ESearch,
williamr@4
    85
        /** (Not used) */        
williamr@4
    86
        EInput,
williamr@4
    87
        /** (Not used) */
williamr@4
    88
        EUrl,  
williamr@4
    89
        /** (Not used) */
williamr@4
    90
        EPhone,
williamr@4
    91
        /** (Not used) */
williamr@4
    92
        EPlain,
williamr@4
    93
        /** Use as popup search field. */
williamr@4
    94
        EPopup,         
williamr@4
    95
        /** Use as pinb search field. */
williamr@4
    96
        EPinb,          
williamr@4
    97
        /** For Clock application/list_single_heading_pane. */
williamr@4
    98
        EClockApp,      
williamr@4
    99
        /** Same as ESearch, but using CreateWindowL(). */
williamr@4
   100
        EFixed,         
williamr@4
   101
        /** Layout where no line is used. */
williamr@4
   102
        ESearchWithoutLine, 
williamr@4
   103
        /** Popup window layout. */
williamr@4
   104
        EPopupWindow,
williamr@4
   105
	    /** For adaptive search grid */
williamr@4
   106
	    /** @since 5.0 */
williamr@4
   107
	    EAdaptiveSearch,
williamr@4
   108
	    /** For adaptive search grid */
williamr@4
   109
	    /** Same as EAdaptiveSearch, but using CreateWindowL(). */
williamr@4
   110
	    /** @since 5.0 */
williamr@4
   111
	    EAdaptive,
williamr@4
   112
        /** For adaptive search grid */
williamr@4
   113
	    /** Same as EAdaptiveSearch, but using popup find pane. */
williamr@4
   114
	    /** @since 5.0 */
williamr@4
   115
	    EPopupAdaptiveSearch,
williamr@4
   116
        /** For adaptive search grid */
williamr@4
   117
	    /** Popup window layout */
williamr@4
   118
	    /** @since 5.0 */
williamr@4
   119
	    EPopupAdaptiveSearchWindow
williamr@4
   120
        };
williamr@4
   121
  
williamr@4
   122
public:
williamr@4
   123
williamr@4
   124
   /**
williamr@4
   125
    * Destructor.
williamr@4
   126
    */
williamr@4
   127
    IMPORT_C ~CAknSearchField();
williamr@4
   128
williamr@4
   129
   /**
williamr@4
   130
    * Two-phased constructor.
williamr@4
   131
    * @param aParent Reference to parent control.
williamr@4
   132
    * @param aFieldStyle Defines the UI style.
williamr@4
   133
    * @param aIcon A pointer to the icon to be shown in the search box frame.
williamr@4
   134
    *              Takes ownerships. Can be @c NULL.
williamr@4
   135
    * @param aTextLimit Defines the maximum text length.
williamr@4
   136
    * @return A pointer to contructed @c CAknSearchField object.
williamr@4
   137
    */
williamr@4
   138
    IMPORT_C static CAknSearchField* NewL( const CCoeControl& aParent, TSearchFieldStyle aFieldStyle, CGulIcon* aIcon, TInt aTextLimit );
williamr@4
   139
williamr@4
   140
public:                 // for search string manipulation
williamr@4
   141
   /**
williamr@4
   142
    * Returns the length of search text.
williamr@4
   143
    * @return The length of search text.
williamr@4
   144
    */
williamr@4
   145
    IMPORT_C TInt TextLength() const;
williamr@4
   146
williamr@4
   147
   /**
williamr@4
   148
    * Returns the text of search field by writing it into the 
williamr@4
   149
    * buffer aSearchTxt.
williamr@4
   150
    * @param aSearchTxt Reference to the text buffer. Buffer size must be same
williamr@4
   151
    *                   or greater than maximum text length, which is given in 
williamr@4
   152
    *                   constructor.
williamr@4
   153
    */
williamr@4
   154
    IMPORT_C void GetSearchText( TDes& aSearchTxt ) const;
williamr@4
   155
williamr@4
   156
   /**
williamr@4
   157
    * Sets text into search field.
williamr@4
   158
    * @param aSearchTxt Reference to the text buffer.
williamr@4
   159
    */
williamr@4
   160
    IMPORT_C void SetSearchTextL( const TDesC& aSearchTxt );
williamr@4
   161
williamr@4
   162
   /**
williamr@4
   163
    * Selects the whole search text.
williamr@4
   164
    */
williamr@4
   165
    IMPORT_C void SelectSearchTextL();
williamr@4
   166
williamr@4
   167
   /**
williamr@4
   168
    * Clears text in the search field.
williamr@4
   169
    */
williamr@4
   170
    IMPORT_C void ResetL();
williamr@4
   171
williamr@4
   172
   /**
williamr@4
   173
    * Sets additional info text to the search field.
williamr@4
   174
    * @param aText Reference to the text buffer.
williamr@4
   175
    */
williamr@4
   176
    IMPORT_C void SetInfoTextL( const TDesC& aText );
williamr@4
   177
williamr@4
   178
   /**
williamr@4
   179
    * Calls editor's @c ClipboardL() function.
williamr@4
   180
    * @param aClipboardFunc Clipboard function.
williamr@4
   181
    */
williamr@4
   182
    IMPORT_C void ClipboardL( CEikEdwin::TClipboardFunc aClipboardFunc );
williamr@4
   183
williamr@4
   184
   /**
williamr@4
   185
    * Return search field style
williamr@4
   186
    * @since 5.0
williamr@4
   187
    * @return style of search field 
williamr@4
   188
    */   
williamr@4
   189
    IMPORT_C CAknSearchField::TSearchFieldStyle SearchFieldStyle() const;
williamr@4
   190
williamr@4
   191
public: // new methods for Avkon Skins support
williamr@4
   192
williamr@4
   193
   /**
williamr@4
   194
    * Sets whether skins are enabled on this control. The default value is 
williamr@4
   195
    * determined from global setting from @c CAknAppUi.
williamr@4
   196
    * @since Series 60 2.0 
williamr@4
   197
    * @param aEnabled @c ETrue if skins are enabled, @c EFalse if not.
williamr@4
   198
    */
williamr@4
   199
    IMPORT_C void SetSkinEnabledL( const TBool aEnabled );
williamr@4
   200
williamr@4
   201
public: // from MCoeControlObserver
williamr@4
   202
williamr@4
   203
   /**
williamr@4
   204
    * From @c MCoeControlObserver, Acts upon changes in the hosted control's state.
williamr@4
   205
    * This class's implementation is trivial and should be able to be safely 
williamr@4
   206
    * re-implemented in directly client-derived classes. For non-base setting
williamr@4
   207
    * page classes, a call to the base class should be made.
williamr@4
   208
    * @param aControl Control that caused the event. (not used in default implementation)
williamr@4
   209
    * @param aEventType Type of the event. 
williamr@4
   210
    */
williamr@4
   211
    void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType );
williamr@4
   212
williamr@4
   213
public: // From CCoeControl
williamr@4
   214
williamr@4
   215
   /**
williamr@4
   216
    * From @c CCoeControl, Handles key event.
williamr@4
   217
    * @param aKeyEvent The key event. 
williamr@4
   218
    * @param aType The type of the event.
williamr@4
   219
    * @return Indicates whether the key event was used by this control or not.
williamr@4
   220
    */
williamr@4
   221
    IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,TEventCode aType );
williamr@4
   222
williamr@4
   223
   /**
williamr@4
   224
    * From @c CCoeControl, Handles pointer event.
williamr@4
   225
    * @since 5.0
williamr@4
   226
    * @param aPointerEvent The pointer event. 
williamr@4
   227
    *	Invert adaptive search grid by tapping search field.    
williamr@4
   228
    */
williamr@4
   229
    void HandlePointerEventL( const TPointerEvent& aPointerEvent );
williamr@4
   230
williamr@4
   231
   /**
williamr@4
   232
    * From @c CCoeControl, Returns minimum size. Minimum size depends on 
williamr@4
   233
    * zoom factor. 
williamr@4
   234
    * @return Minimum size.
williamr@4
   235
    */
williamr@4
   236
    IMPORT_C TSize MinimumSize();
williamr@4
   237
williamr@4
   238
   /**
williamr@4
   239
    * Sets this control as visible or invisible.
williamr@4
   240
    *
williamr@4
   241
    * @since S60 3.2
williamr@4
   242
    * @param aVisible ETrue to make the control visible, EFalse to make
williamr@4
   243
    *                 it invisible.
williamr@4
   244
    */
williamr@4
   245
    IMPORT_C void MakeVisible( TBool aVisible );
williamr@4
   246
    
williamr@4
   247
    /**
williamr@4
   248
     * From @c CCoeControl, Resource change handling.
williamr@4
   249
     *
williamr@4
   250
     * @param aType Message type.
williamr@4
   251
     */
williamr@4
   252
    void HandleResourceChange( TInt aType );
williamr@4
   253
williamr@4
   254
public:
williamr@4
   255
williamr@4
   256
   /**
williamr@4
   257
    * Sets position of the line on main pane.
williamr@4
   258
    * @since Series 60 2.0
williamr@4
   259
    * @param aLinePos The position as defined in @c TAknSeparatorLinePos
williamr@4
   260
    */
williamr@4
   261
    IMPORT_C void SetLinePos( TInt aLinePos );
williamr@4
   262
williamr@4
   263
   /**
williamr@4
   264
    * Access to the edwin owned by the search field.
williamr@4
   265
    * @since Series 60 2.6
williamr@4
   266
    * @return Reference to the edwin owned by the search field.
williamr@4
   267
    */
williamr@4
   268
    IMPORT_C CEikEdwin& Editor() const;
williamr@4
   269
williamr@4
   270
   /**
williamr@4
   271
    * Set adaptive search grid characters.
williamr@4
   272
    * @since 5.0
williamr@4
   273
    * @param aGridChars The characters for adaptive search grid.
williamr@4
   274
    */
williamr@4
   275
    IMPORT_C void SetAdaptiveGridChars( const TDesC& aGridChars ) const;
williamr@4
   276
williamr@4
   277
   /**
williamr@4
   278
    * Show adaptive search grid. 
williamr@4
   279
    * Application can activate adaptive search grid from the option menu.
williamr@4
   280
    * @since 5.0
williamr@4
   281
    */
williamr@4
   282
    IMPORT_C void ShowAdaptiveSearchGrid() const;   
williamr@4
   283
    
williamr@4
   284
   /**
williamr@4
   285
    * Set column filter flag for adaptive search grid  
williamr@4
   286
    * @since 5.0
williamr@4
   287
    * @param aFlag The bit flag shows which columns take into account
williamr@4
   288
    * during filtering.
williamr@4
   289
    */
williamr@4
   290
    IMPORT_C void SetListColumnFilterFlags( const TBitFlags32 aFlag );
williamr@4
   291
williamr@4
   292
   /**
williamr@4
   293
    * Send column filter flag for adaptive search grid  
williamr@4
   294
    * @since 5.0
williamr@4
   295
    * @return aFlag The bit flag shows which columns take into account
williamr@4
   296
    * during filtering.
williamr@4
   297
    */
williamr@4
   298
    IMPORT_C TBitFlags32 ListColumnFilterFlags() const;
williamr@4
   299
williamr@4
   300
   /** 
williamr@4
   301
    * Adds an adaptive search text observer. Duplicates are not checked 
williamr@4
   302
    * (i.e. adding the same observer multiple times is not prevented). 
williamr@4
   303
    * @since 5.0 
williamr@4
   304
    * @param aObserver Must be non-NULL. 
williamr@4
   305
    */ 
williamr@4
   306
    IMPORT_C void AddAdaptiveSearchTextObserverL( MAdaptiveSearchTextObserver* aObserver );
williamr@4
   307
williamr@4
   308
   /** 
williamr@4
   309
    * Removes an adaptive search text observer. 
williamr@4
   310
    * @since 5.0 
williamr@4
   311
    * @param aObserver The observer to be removed. 
williamr@4
   312
    * @return ETrue if removal ok, EFalse if observer was not removed (not 
williamr@4
   313
    * found from the list of observers). 
williamr@4
   314
    */ 
williamr@4
   315
    IMPORT_C TBool RemoveAdaptiveSearchTextObserver( MAdaptiveSearchTextObserver* aObserver );
williamr@4
   316
williamr@4
   317
   /** 
williamr@4
   318
    * Returns information whether adaptive search is enabled or not
williamr@4
   319
    * @since 5.0   
williamr@4
   320
    * @return ETrue if adaptive search is enabled, EFalse otherwise.
williamr@4
   321
    */ 
williamr@4
   322
    IMPORT_C TBool AdaptiveSearchEnabled();
williamr@4
   323
williamr@4
   324
   /** 
williamr@4
   325
    * Notify client if input language changed in settings, for adaptive search
williamr@4
   326
    * @since 5.0       
williamr@4
   327
    * @return ETrue if language has changed, EFalse otherwise.
williamr@4
   328
    */
williamr@4
   329
    IMPORT_C TBool LanguageChanged() const;
williamr@4
   330
williamr@4
   331
private: // from MObjectProvider
williamr@4
   332
    TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
williamr@4
   333
private:
williamr@4
   334
    TInt CountComponentControls() const;
williamr@4
   335
    CCoeControl* ComponentControl( TInt aIndex ) const;
williamr@4
   336
    void SizeChanged();
williamr@4
   337
    void FocusChanged( TDrawNow aDrawNow );
williamr@4
   338
private:
williamr@4
   339
    void ConstructL( const CCoeControl& aParent, TSearchFieldStyle aFieldStyle, CGulIcon* aIcon, TInt aTextLimit );
williamr@4
   340
    CAknSearchField(); 
williamr@4
   341
private:
williamr@4
   342
    void ZoomEditorL();
williamr@4
   343
private: // from MEikCommandObserver
williamr@4
   344
    IMPORT_C void ProcessCommandL( TInt aCommandId );
williamr@4
   345
private:
williamr@4
   346
    void UpdatePopupCBAL();
williamr@4
   347
    void RestorePopupCBA();
williamr@4
   348
    void SetupSkinContextL();
williamr@4
   349
public:
williamr@4
   350
williamr@4
   351
   /**
williamr@4
   352
    * Sets a list box for this control.
williamr@4
   353
    * @since Series 60 2.6
williamr@4
   354
    * @param aListBox A pointer to a list box object.
williamr@4
   355
    */
williamr@4
   356
    void SetListbox( CEikListBox* aListBox );
williamr@4
   357
williamr@4
   358
   /**
williamr@4
   359
    * Sets the parent control for this control.
williamr@4
   360
    * @since Series 60 2.6
williamr@4
   361
    * @param aParent A pointer to the parent control.
williamr@4
   362
    */
williamr@4
   363
    void SetParentCtrl( CCoeControl* aParent );
williamr@4
   364
williamr@4
   365
   /**
williamr@4
   366
    * Indicates that is the control popup or not.
williamr@4
   367
    * @since Series 60 2.6
williamr@4
   368
    * @return @c ETrue if it is a popup, @c EFalse if not.
williamr@4
   369
    */
williamr@4
   370
    TBool IsPopup();
williamr@4
   371
williamr@4
   372
   /**
williamr@4
   373
    * Sets index, where listbox focus should return when popup findbox is
williamr@4
   374
    * canceled.
williamr@4
   375
    * @since Series 60 3.1
williamr@4
   376
    * @internal
williamr@4
   377
    */
williamr@4
   378
    void SetOldItemIndex( TInt aOldItemIndex );
williamr@4
   379
williamr@4
   380
   /**
williamr@4
   381
    * Returns index, where listbox focus should return when popup findbox is
williamr@4
   382
    * canceled
williamr@4
   383
    * @since Series 60 3.1
williamr@4
   384
    * @internal
williamr@4
   385
    */
williamr@4
   386
    TInt OldItemIndex();
williamr@4
   387
williamr@4
   388
   /** 
williamr@4
   389
    * Set the language changed flag, for adaptive search
williamr@4
   390
    * @since 5.0       
williamr@4
   391
    * @param aLanguageChanged ETrue if language has changed, EFalse otherwise.
williamr@4
   392
    */
williamr@4
   393
    void SetLanguageChangedFlag( TBool aLanguageChanged );
williamr@4
   394
    
williamr@4
   395
    /**
williamr@4
   396
     * Handle HW keyboard active/deactive event.
williamr@4
   397
     * @since 5.0
williamr@4
   398
     */
williamr@4
   399
    void HandleHWKeyboardModeChangeL();
williamr@4
   400
williamr@4
   401
    /**
williamr@4
   402
     * A helper methord used in ContructL().
williamr@4
   403
     * Get Adaptive Search setting and subscribe hardware 
williamr@4
   404
     * keyboard layout changing.
williamr@4
   405
     *
williamr@4
   406
     * @param aShowIndicator, ETrue if indicator need be shown
williamr@4
   407
     * @return ETrue if Adaptive is enabled in cenrep/
williamr@4
   408
     * @since 5.0
williamr@4
   409
     */
williamr@4
   410
    TBool GetASStatusAndSubKbLayoutL( TBool& aShowIndicator );
williamr@4
   411
williamr@4
   412
private:	
williamr@4
   413
    // The bit flag shows which collumns take into account during filltering  
williamr@4
   414
    TBitFlags32 iColumnFlag;
williamr@4
   415
    CEikEdwin* iEditor;   
williamr@4
   416
    CGlobalText* iGlobalText;
williamr@4
   417
    CAknInputFrame* iInputFrame;
williamr@4
   418
    CAknSearchFieldIndicator* iIndicator; 
williamr@4
   419
    CAknsListBoxBackgroundControlContext* iSkinContext;
williamr@4
   420
    TInt iFlags;  
williamr@4
   421
    TInt iLinePos;
williamr@4
   422
    CAknsFrameBackgroundControlContext* iInputContext;
williamr@4
   423
    TBool iIsPopup;
williamr@4
   424
    TBool iCBAObserverUpdated;
williamr@4
   425
    CEikListBox *iListBox; // not owned
williamr@4
   426
    CCoeControl *iParent; // not owned
williamr@4
   427
    CEikButtonGroupContainer *iCba; // this is only for checking whether cba changed 
williamr@4
   428
    TInt iOldItemIndex;
williamr@4
   429
    CAknAppUi* iBackedAppUi;
williamr@4
   430
    CAknAdaptiveSearch* iAdaptiveSearch; 
williamr@4
   431
    TSearchFieldStyle iStyle;    
williamr@4
   432
    TBool iLanguageChanged; // flag shows was input language changed or not
williamr@4
   433
williamr@4
   434
    // For hybird keyborad
williamr@4
   435
    RProperty iHwKeyboardPro;
williamr@4
   436
    CHwKbSubscriber* iHwKbSub;
williamr@4
   437
    };
williamr@4
   438
 
williamr@4
   439
#endif
williamr@4
   440
williamr@4
   441