classicui_plat/misc_controls_api/inc/EIKCAPC.H
author hgs
Fri, 23 Jul 2010 17:08:56 +0800
changeset 45 667edd0b8678
permissions -rw-r--r--
201029
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
45
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description:
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
hgs
parents:
diff changeset
    19
#if !defined(__EIKCAPC_H__)
hgs
parents:
diff changeset
    20
#define __EIKCAPC_H__
hgs
parents:
diff changeset
    21
hgs
parents:
diff changeset
    22
#if !defined(__COECNTRL_H__)
hgs
parents:
diff changeset
    23
#include <coecntrl.h>
hgs
parents:
diff changeset
    24
#endif
hgs
parents:
diff changeset
    25
hgs
parents:
diff changeset
    26
#if !defined(__FEPBASE_H__)
hgs
parents:
diff changeset
    27
#include <fepbase.h>
hgs
parents:
diff changeset
    28
#endif
hgs
parents:
diff changeset
    29
hgs
parents:
diff changeset
    30
#if !defined(__EIKLABEL_H__)
hgs
parents:
diff changeset
    31
#include <eiklabel.h>
hgs
parents:
diff changeset
    32
#endif
hgs
parents:
diff changeset
    33
hgs
parents:
diff changeset
    34
#include <eikdialg.h>
hgs
parents:
diff changeset
    35
#include <eikdpage.h>
hgs
parents:
diff changeset
    36
hgs
parents:
diff changeset
    37
#include <AknControl.h>
hgs
parents:
diff changeset
    38
#include <aknsconstants.h>
hgs
parents:
diff changeset
    39
hgs
parents:
diff changeset
    40
class CEikImage ;
hgs
parents:
diff changeset
    41
class CEikDialogPage;
hgs
parents:
diff changeset
    42
// Forward declaration of types used in layout routines.
hgs
parents:
diff changeset
    43
class CAknPopupField;
hgs
parents:
diff changeset
    44
class CAknSlider;
hgs
parents:
diff changeset
    45
class CEikEdwin;
hgs
parents:
diff changeset
    46
class CEikMfne; 
hgs
parents:
diff changeset
    47
class CEikSecretEditor;
hgs
parents:
diff changeset
    48
class CEikCapCLabel ;
hgs
parents:
diff changeset
    49
class CEikCapCExtension;
hgs
parents:
diff changeset
    50
class MPointerEventObserver;
hgs
parents:
diff changeset
    51
class MAknsControlContext;
hgs
parents:
diff changeset
    52
hgs
parents:
diff changeset
    53
/** CaptionedControl
hgs
parents:
diff changeset
    54
 *
hgs
parents:
diff changeset
    55
 * CaptionedControl is part of the dialogs. All dialogs and forms use captionedcontrol
hgs
parents:
diff changeset
    56
 * as a control for one DLG_LINE. Each DLG_LINE has one captionedcontrol in it.
hgs
parents:
diff changeset
    57
 * 
hgs
parents:
diff changeset
    58
 * Rectangle of the captionedcontrol is single form field / form line or DLG_LINE's
hgs
parents:
diff changeset
    59
 * rectangle dependent on the dialog type.
hgs
parents:
diff changeset
    60
 */
hgs
parents:
diff changeset
    61
class CEikCaptionedControl : public CAknControl, public MCoeCaptionRetrieverForFep, public MCoeControlObserver
hgs
parents:
diff changeset
    62
    {
hgs
parents:
diff changeset
    63
    friend class CEikCapCExtension;
hgs
parents:
diff changeset
    64
public:
hgs
parents:
diff changeset
    65
    enum TSpaceSharingFlags
hgs
parents:
diff changeset
    66
        {
hgs
parents:
diff changeset
    67
        EIfTooSmallCtlGetsWidthLast         =0x0,
hgs
parents:
diff changeset
    68
        EIfTooSmallCtlGetsWidthFirst        =0x1,
hgs
parents:
diff changeset
    69
        EIfTooSmallCtlGetsEqualShareOfWidth =0x2,
hgs
parents:
diff changeset
    70
        EIfTooBigCtlStaysMinHeight          =0x4,
hgs
parents:
diff changeset
    71
        EIfTooBigCtlStaysMinWidth           =0x8,
hgs
parents:
diff changeset
    72
        EIfTooBigCtlStaysMinSize            =0xc,
hgs
parents:
diff changeset
    73
        EIfTooSmallDontStrech               =0x10
hgs
parents:
diff changeset
    74
        };
hgs
parents:
diff changeset
    75
    enum TCaptionExpandingState
hgs
parents:
diff changeset
    76
        {
hgs
parents:
diff changeset
    77
        EInitial = 0,
hgs
parents:
diff changeset
    78
        EExtended =1,
hgs
parents:
diff changeset
    79
        ERetracted =2
hgs
parents:
diff changeset
    80
        };
hgs
parents:
diff changeset
    81
hgs
parents:
diff changeset
    82
public:
hgs
parents:
diff changeset
    83
 	/** Constructor
hgs
parents:
diff changeset
    84
 	 */	
hgs
parents:
diff changeset
    85
    IMPORT_C CEikCaptionedControl();
hgs
parents:
diff changeset
    86
    /** Destructor
hgs
parents:
diff changeset
    87
     */
hgs
parents:
diff changeset
    88
    IMPORT_C ~CEikCaptionedControl();
hgs
parents:
diff changeset
    89
public: // new functions
hgs
parents:
diff changeset
    90
	/** SetUsesEars() sets a flag Uses Ears.
hgs
parents:
diff changeset
    91
	 */
hgs
parents:
diff changeset
    92
    IMPORT_C void SetUsesEars();
hgs
parents:
diff changeset
    93
    /** SetSpaceSharingFlags() sets flags for space sharing
hgs
parents:
diff changeset
    94
     */
hgs
parents:
diff changeset
    95
    IMPORT_C void SetSpaceSharingFlags(TInt aFlags);
hgs
parents:
diff changeset
    96
    /** SetExtraAscent() modifies layout to include extra ascent for fonts
hgs
parents:
diff changeset
    97
     */
hgs
parents:
diff changeset
    98
    IMPORT_C void SetExtraAscent();
hgs
parents:
diff changeset
    99
    /** SetCaptionL() Sets label of the DLG_LINE
hgs
parents:
diff changeset
   100
     * @param aText Descriptor
hgs
parents:
diff changeset
   101
     */
hgs
parents:
diff changeset
   102
    IMPORT_C void SetCaptionL(const TDesC& aText);
hgs
parents:
diff changeset
   103
    /** SetTrailerL() Sets trailer
hgs
parents:
diff changeset
   104
     * Should not be used
hgs
parents:
diff changeset
   105
     * @param aText Descriptor
hgs
parents:
diff changeset
   106
     */
hgs
parents:
diff changeset
   107
    IMPORT_C void SetTrailerL(const TDesC& aText);
hgs
parents:
diff changeset
   108
	/** Sets the captionedcontrol to be currently focused or not
hgs
parents:
diff changeset
   109
     * @param aSelected whether captionedcontrol is focused
hgs
parents:
diff changeset
   110
	 */
hgs
parents:
diff changeset
   111
    IMPORT_C void SetCurrent(TBool aSelected);
hgs
parents:
diff changeset
   112
	/** Updates captionedcontrol's dimmed state
hgs
parents:
diff changeset
   113
	 */
hgs
parents:
diff changeset
   114
    IMPORT_C void CheckDimmedDisplayState();
hgs
parents:
diff changeset
   115
	/** Sets minimumsizes to zero
hgs
parents:
diff changeset
   116
	 */
hgs
parents:
diff changeset
   117
    IMPORT_C void ResetMinimumSizes();
hgs
parents:
diff changeset
   118
	/** Whether captionedcontrol is latent
hgs
parents:
diff changeset
   119
	 *
hgs
parents:
diff changeset
   120
	 * @return true if is latent
hgs
parents:
diff changeset
   121
	 */
hgs
parents:
diff changeset
   122
    IMPORT_C TBool IsLatent() const;
hgs
parents:
diff changeset
   123
	/** Sets captionedcontrol latent status
hgs
parents:
diff changeset
   124
	 */
hgs
parents:
diff changeset
   125
    IMPORT_C void SetLatent(TBool aLatent);
hgs
parents:
diff changeset
   126
	/** Whether captionedcontrol has latent group following it
hgs
parents:
diff changeset
   127
     * @returns true if has latent group following
hgs
parents:
diff changeset
   128
	 */
hgs
parents:
diff changeset
   129
    IMPORT_C TBool LatentGroupLineFollows() const;
hgs
parents:
diff changeset
   130
	/** Sets latent group following flag
hgs
parents:
diff changeset
   131
     * @param aLglf true if latent group following
hgs
parents:
diff changeset
   132
	 */
hgs
parents:
diff changeset
   133
    IMPORT_C void SetLatentGroupLineFollows(TBool aLglf);
hgs
parents:
diff changeset
   134
	/** Whether there is a divider after the captionedcontrol
hgs
parents:
diff changeset
   135
	 */
hgs
parents:
diff changeset
   136
    IMPORT_C TBool DividerAfter() const;
hgs
parents:
diff changeset
   137
    /** Sets divider after the captionedcontrol
hgs
parents:
diff changeset
   138
     */
hgs
parents:
diff changeset
   139
    IMPORT_C void SetDividerAfter(TBool aDividerAfter);
hgs
parents:
diff changeset
   140
    /** Whether captionedcontrol consumes enter key
hgs
parents:
diff changeset
   141
     */
hgs
parents:
diff changeset
   142
    IMPORT_C TBool TakesEnterKey() const;
hgs
parents:
diff changeset
   143
    /** Sets captionedcontrol to take enter key
hgs
parents:
diff changeset
   144
     * @param aTakesEnter true if takes enter key, false if not
hgs
parents:
diff changeset
   145
     */
hgs
parents:
diff changeset
   146
    IMPORT_C void SetTakesEnterKey(TBool aTakesEnter);
hgs
parents:
diff changeset
   147
    /** Whether offers hot keys
hgs
parents:
diff changeset
   148
     * @return boolean true if offers hotkeys
hgs
parents:
diff changeset
   149
     */
hgs
parents:
diff changeset
   150
    IMPORT_C TBool OfferHotKeys() const;
hgs
parents:
diff changeset
   151
    /** Sets captionedcontrol to offer hotkeys
hgs
parents:
diff changeset
   152
     */
hgs
parents:
diff changeset
   153
    IMPORT_C void SetOfferHotKeys(TBool aOffer);
hgs
parents:
diff changeset
   154
    
hgs
parents:
diff changeset
   155
hgs
parents:
diff changeset
   156
    /**
hgs
parents:
diff changeset
   157
     * From MCoeControlObserver:
hgs
parents:
diff changeset
   158
     * Acts upon changes in the hosted control's state. 
hgs
parents:
diff changeset
   159
     * 
hgs
parents:
diff changeset
   160
     * This class's implementation handles events from MFNE editor editing
hgs
parents:
diff changeset
   161
     * buttons in touch enabled builds
hgs
parents:
diff changeset
   162
     *
hgs
parents:
diff changeset
   163
     * @param	aControl	The control changing its state (not used)
hgs
parents:
diff changeset
   164
     * @param	aEventType	The type of control event 
hgs
parents:
diff changeset
   165
     */
hgs
parents:
diff changeset
   166
	IMPORT_C virtual void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
hgs
parents:
diff changeset
   167
	
hgs
parents:
diff changeset
   168
public:
hgs
parents:
diff changeset
   169
    TInt MaximumNumberOfControlLinesOnVisiblePage() const;
hgs
parents:
diff changeset
   170
	TInt NumberOfLines() const;
hgs
parents:
diff changeset
   171
	TInt NumberOfLinesForScrollBar() const;
hgs
parents:
diff changeset
   172
public:
hgs
parents:
diff changeset
   173
    TBool ControlIsAnEdwin(TInt aControlType) const;
hgs
parents:
diff changeset
   174
    TBool ControlIsAMfne(TInt aControlType) const;
hgs
parents:
diff changeset
   175
    TBool ControlIsAPopfield(TInt aControlType) const;
hgs
parents:
diff changeset
   176
    TBool ControlIsASecretEditor(TInt aControlType) const;
hgs
parents:
diff changeset
   177
    TBool ControlIsASlider(TInt aControlType) const;
hgs
parents:
diff changeset
   178
    TBool ControlIsAColourSelGrid(TInt aControlType) const;
hgs
parents:
diff changeset
   179
	TInt ControlType() const;
hgs
parents:
diff changeset
   180
hgs
parents:
diff changeset
   181
public: // from CCoeControl
hgs
parents:
diff changeset
   182
    /** MinimumSize() returns minimum size of the control
hgs
parents:
diff changeset
   183
     */
hgs
parents:
diff changeset
   184
    IMPORT_C TSize MinimumSize();
hgs
parents:
diff changeset
   185
    /** ConstructFromResourceL() constructs the captionedcontrol from DLG_LINE resource
hgs
parents:
diff changeset
   186
     *
hgs
parents:
diff changeset
   187
     * usually called with the following code:
hgs
parents:
diff changeset
   188
     * TResourceReader reader;
hgs
parents:
diff changeset
   189
     * iCoeEnv->CreateResourceReaderLC(reader, resId);
hgs
parents:
diff changeset
   190
     * control->ConstructFromResourceL(reader);
hgs
parents:
diff changeset
   191
     * CleanupStack::PopAndDestroy();
hgs
parents:
diff changeset
   192
     */
hgs
parents:
diff changeset
   193
    IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
hgs
parents:
diff changeset
   194
    /** OfferKeyEventL() handles key events
hgs
parents:
diff changeset
   195
     */
hgs
parents:
diff changeset
   196
    IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
hgs
parents:
diff changeset
   197
    /** GetColorUseListL() gets color use list
hgs
parents:
diff changeset
   198
     */
hgs
parents:
diff changeset
   199
    IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const; // not available before Release 005u
hgs
parents:
diff changeset
   200
    /** HandleResourceChange handles several kinds of resource change event
hgs
parents:
diff changeset
   201
     */
hgs
parents:
diff changeset
   202
    IMPORT_C virtual void HandleResourceChange(TInt aType);         // not available before Release 005u
hgs
parents:
diff changeset
   203
    /** Provides ability to get input capabilities needed for fep
hgs
parents:
diff changeset
   204
     */
hgs
parents:
diff changeset
   205
    IMPORT_C TCoeInputCapabilities InputCapabilities() const;
hgs
parents:
diff changeset
   206
    /** SetDimmed sets captionedcontrol to dimmed state
hgs
parents:
diff changeset
   207
     */
hgs
parents:
diff changeset
   208
    IMPORT_C void SetDimmed(TBool aDimmed);
hgs
parents:
diff changeset
   209
    /** HandlePointerEventL handles touch pointer events
hgs
parents:
diff changeset
   210
     */
hgs
parents:
diff changeset
   211
    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
hgs
parents:
diff changeset
   212
public:
hgs
parents:
diff changeset
   213
    void RegisterPageWithCaptionControl(CEikDialogPage* aPage);
hgs
parents:
diff changeset
   214
hgs
parents:
diff changeset
   215
public: // internal layout properties
hgs
parents:
diff changeset
   216
	//void SetProperties(const TRegion &aRegion, const RArray<TCapCProperty> &aProperties);
hgs
parents:
diff changeset
   217
	//TRect Line(TInt aLineIndex); // text line rectangles
hgs
parents:
diff changeset
   218
	//TInt LineIndex(TPoint aPoint);
hgs
parents:
diff changeset
   219
	//TPoint LineControlPoint(TInt aLineIndex);
hgs
parents:
diff changeset
   220
	//RArray<TInt> LineIndexesIntersecting(TRect aRect);
hgs
parents:
diff changeset
   221
	//void SetProperty(TInt aLine, TCapCProperty &aProperty);
hgs
parents:
diff changeset
   222
	//void ClearProperty(TInt aLine, TCapCProperty &aProperty);
hgs
parents:
diff changeset
   223
	//TCapCProperty Properties(TInt aLine);
hgs
parents:
diff changeset
   224
	//void LineRegions(TRegion &aRegion);
hgs
parents:
diff changeset
   225
	//void SetVisibleArea(TRect aRect);
hgs
parents:
diff changeset
   226
	//void RemoveVisibleArea();
hgs
parents:
diff changeset
   227
private: // from CCoeControl
hgs
parents:
diff changeset
   228
    IMPORT_C TInt CountComponentControls() const;
hgs
parents:
diff changeset
   229
    IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
hgs
parents:
diff changeset
   230
    IMPORT_C void SizeChanged();
hgs
parents:
diff changeset
   231
    IMPORT_C void FocusChanged(TDrawNow aDrawNow);
hgs
parents:
diff changeset
   232
protected: // from CCoeControl
hgs
parents:
diff changeset
   233
    IMPORT_C void Draw(const TRect& aRect) const;
hgs
parents:
diff changeset
   234
    IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
hgs
parents:
diff changeset
   235
private: // from CCoeControl
hgs
parents:
diff changeset
   236
    IMPORT_C void Reserved_2();
hgs
parents:
diff changeset
   237
    // from MCoeCaptionRetrieverForFep
hgs
parents:
diff changeset
   238
    IMPORT_C virtual void GetCaptionForFep(TDes& aCaption) const;
hgs
parents:
diff changeset
   239
    IMPORT_C virtual void MCoeCaptionRetrieverForFep_Reserved_1();
hgs
parents:
diff changeset
   240
    IMPORT_C virtual void MCoeCaptionRetrieverForFep_Reserved_2();
hgs
parents:
diff changeset
   241
private:
hgs
parents:
diff changeset
   242
    /**
hgs
parents:
diff changeset
   243
    * From CAknControl
hgs
parents:
diff changeset
   244
    */
hgs
parents:
diff changeset
   245
    IMPORT_C void* ExtensionInterface( TUid aInterface );
hgs
parents:
diff changeset
   246
hgs
parents:
diff changeset
   247
protected: // from MObjectProvider
hgs
parents:
diff changeset
   248
    IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
hgs
parents:
diff changeset
   249
hgs
parents:
diff changeset
   250
public:
hgs
parents:
diff changeset
   251
    /** SetToolTipTextL() sets tooltip text
hgs
parents:
diff changeset
   252
     * @param aText descriptor for tooltip text
hgs
parents:
diff changeset
   253
     */
hgs
parents:
diff changeset
   254
      
hgs
parents:
diff changeset
   255
    IMPORT_C void SetToolTipTextL( const TDesC& aText ) ;
hgs
parents:
diff changeset
   256
    /** Ability to query tooltip text string
hgs
parents:
diff changeset
   257
     */
hgs
parents:
diff changeset
   258
    IMPORT_C const TDesC* ToolTipText() const ;
hgs
parents:
diff changeset
   259
    /** SetBitmapFromFileL() sets icon contents for the captionedcontrol
hgs
parents:
diff changeset
   260
     */
hgs
parents:
diff changeset
   261
    IMPORT_C void SetBitmapFromFileL( const TDesC& aFilename,TInt aMainId,TInt aMaskId =-1 ) ;
hgs
parents:
diff changeset
   262
    /** SetEditable sets captionedcontrol to editable state
hgs
parents:
diff changeset
   263
     */
hgs
parents:
diff changeset
   264
    IMPORT_C void SetEditableL( TBool aEditable, TBool aShowEmptyFields = ETrue ) ;
hgs
parents:
diff changeset
   265
    
hgs
parents:
diff changeset
   266
    IMPORT_C void SetFormFlags( TInt aFlags ) ;
hgs
parents:
diff changeset
   267
    void GetAknLayoutValuesL() ;  // Visible within DLL only.
hgs
parents:
diff changeset
   268
    TBool HasSeparator() const;
hgs
parents:
diff changeset
   269
    /** GetFullCaptionText() gets caption descriptor
hgs
parents:
diff changeset
   270
     *
hgs
parents:
diff changeset
   271
     */
hgs
parents:
diff changeset
   272
    IMPORT_C const TPtrC GetFullCaptionText() const;
hgs
parents:
diff changeset
   273
    TBool   IsDisplayable() const;
hgs
parents:
diff changeset
   274
    /** 
hgs
parents:
diff changeset
   275
     * Allows clients of CEikCaptionedControl to turn off drawing 
hgs
parents:
diff changeset
   276
     * of white background of captionedcontrol.
hgs
parents:
diff changeset
   277
     *
hgs
parents:
diff changeset
   278
     * @since 2.1
hgs
parents:
diff changeset
   279
     */
hgs
parents:
diff changeset
   280
    IMPORT_C void SetDrawNoWhiteBackground(TBool aEnabled); // for list queries with find.
hgs
parents:
diff changeset
   281
hgs
parents:
diff changeset
   282
    /**
hgs
parents:
diff changeset
   283
    * In case of an editor control residing in a form,
hgs
parents:
diff changeset
   284
    * sets up a pictograph animation callback to redraw the form highlight
hgs
parents:
diff changeset
   285
    * control when pictograph animations are updated.
hgs
parents:
diff changeset
   286
    */
hgs
parents:
diff changeset
   287
    void SetPictographCallBack();
hgs
parents:
diff changeset
   288
    
hgs
parents:
diff changeset
   289
    /**
hgs
parents:
diff changeset
   290
    * Sets icon and sets its size.
hgs
parents:
diff changeset
   291
    * @param aBitmap a bitmap which has already been loaded. Must not be NULL.
hgs
parents:
diff changeset
   292
    * @param aMask a mask bitmap which has already been loaded. Can be NULL.
hgs
parents:
diff changeset
   293
    * Takes ownership of the bitmap objects.
hgs
parents:
diff changeset
   294
    * @since 2.8
hgs
parents:
diff changeset
   295
    */
hgs
parents:
diff changeset
   296
    IMPORT_C void SetIconL( CFbsBitmap* aBitmap, CFbsBitmap* aMask ); 
hgs
parents:
diff changeset
   297
hgs
parents:
diff changeset
   298
    /**
hgs
parents:
diff changeset
   299
     * Sets one of the two small indicator icons
hgs
parents:
diff changeset
   300
     * @param aIcon a index 0 or 1 depending on which icon to set
hgs
parents:
diff changeset
   301
     * @param aBitmap a bitmap pointer or NULL
hgs
parents:
diff changeset
   302
     * @param aMask a mask pointer or NULL
hgs
parents:
diff changeset
   303
     */
hgs
parents:
diff changeset
   304
	IMPORT_C void SetIndicatorIconL( TInt aIcon, CFbsBitmap *aBitmap, CFbsBitmap *aMask );
hgs
parents:
diff changeset
   305
hgs
parents:
diff changeset
   306
    /** SetPointerEventObserver
hgs
parents:
diff changeset
   307
     * Low level observer for touch related pointer events.
hgs
parents:
diff changeset
   308
     * This can be used to receive low level pointer events.
hgs
parents:
diff changeset
   309
     */
hgs
parents:
diff changeset
   310
	IMPORT_C void SetPointerEventObserver(MPointerEventObserver *aObserver);
hgs
parents:
diff changeset
   311
	MPointerEventObserver *PointerEventObserver() const;
hgs
parents:
diff changeset
   312
	
hgs
parents:
diff changeset
   313
    /** Sets the captionedcontrol to be currently focused or not.
hgs
parents:
diff changeset
   314
     * @param aSelected whether captionedcontrol is focused
hgs
parents:
diff changeset
   315
     * @param aRedraw whether redraw is needed or not
hgs
parents:
diff changeset
   316
     */    
hgs
parents:
diff changeset
   317
    void SetCurrent(TBool aSelected, TBool aRedraw );
hgs
parents:
diff changeset
   318
    
hgs
parents:
diff changeset
   319
protected:
hgs
parents:
diff changeset
   320
    TRect ViewRect() const;
hgs
parents:
diff changeset
   321
    TRect EditRect() const;
hgs
parents:
diff changeset
   322
hgs
parents:
diff changeset
   323
private:
hgs
parents:
diff changeset
   324
    enum TWhichEars
hgs
parents:
diff changeset
   325
        {
hgs
parents:
diff changeset
   326
        ENoEar=0x00,
hgs
parents:
diff changeset
   327
        ELeftEar=0x01,
hgs
parents:
diff changeset
   328
        ERightEar=0x02,
hgs
parents:
diff changeset
   329
        EBothEars=0x03
hgs
parents:
diff changeset
   330
        };
hgs
parents:
diff changeset
   331
private: // new functions
hgs
parents:
diff changeset
   332
    TInt WidthForEars(TInt aWidthRemaining) const;
hgs
parents:
diff changeset
   333
    void DrawEarsNow(TWhichEars aEar) const;
hgs
parents:
diff changeset
   334
    void DrawEars(TWhichEars aEar) const;
hgs
parents:
diff changeset
   335
    void DrawSingleEar(TWhichEars aEar,TBool aPressed) const;
hgs
parents:
diff changeset
   336
    TRect EarRect(TWhichEars aEar) const;
hgs
parents:
diff changeset
   337
    void FireEarL(TWhichEars aEar,TInt aEarRepeat);
hgs
parents:
diff changeset
   338
    TInt SquashComponentWidth(TInt& aTotalWidth,const TInt aComponentWidthHint);
hgs
parents:
diff changeset
   339
    void StretchComponents();
hgs
parents:
diff changeset
   340
    void SetVertEdgeSpacing( TInt aVertEdgeSpacing );
hgs
parents:
diff changeset
   341
    void SetHorzEdgeSpacing( TInt aHorzEdgeSpacing );
hgs
parents:
diff changeset
   342
    void SquashComponents();
hgs
parents:
diff changeset
   343
    void CalculateNumberOfLinesForControl( TInt aLines ) ;
hgs
parents:
diff changeset
   344
    void SizeDialogComponents() ;
hgs
parents:
diff changeset
   345
    void PositionDialogComponents() ;
hgs
parents:
diff changeset
   346
    static TInt PictographAnimationCallBack( TAny* aPtr );
hgs
parents:
diff changeset
   347
    /**
hgs
parents:
diff changeset
   348
    * Sets a size for a bitmap that has already been loaded.
hgs
parents:
diff changeset
   349
    * @since 2.8
hgs
parents:
diff changeset
   350
    */    
hgs
parents:
diff changeset
   351
    void SetIconSizeL(CFbsBitmap* aBitmap);
hgs
parents:
diff changeset
   352
    /**
hgs
parents:
diff changeset
   353
    * Gets control context for the given control
hgs
parents:
diff changeset
   354
    * @param aDialog a dialog to get context for
hgs
parents:
diff changeset
   355
    * If aDialog provided does not exist, TODO
hgs
parents:
diff changeset
   356
    */
hgs
parents:
diff changeset
   357
    MAknsControlContext* GetDialogControlContext(const CCoeControl* aDialog) const;
hgs
parents:
diff changeset
   358
hgs
parents:
diff changeset
   359
    /**
hgs
parents:
diff changeset
   360
     * Searches recursively for control's parents until it finds a window owning control
hgs
parents:
diff changeset
   361
     */
hgs
parents:
diff changeset
   362
    const CCoeControl* WindowOwningParent() const;
hgs
parents:
diff changeset
   363
hgs
parents:
diff changeset
   364
public:
hgs
parents:
diff changeset
   365
    /**
hgs
parents:
diff changeset
   366
     * Positions form components in accordance with dialog page flags. 
hgs
parents:
diff changeset
   367
     * If the dialog instance is not registered, them flags set with SetFormFlags() are used. 
hgs
parents:
diff changeset
   368
     */	
hgs
parents:
diff changeset
   369
    void PositionFormComponents();
hgs
parents:
diff changeset
   370
    void ScrollBackEditor();
hgs
parents:
diff changeset
   371
    
hgs
parents:
diff changeset
   372
public:
hgs
parents:
diff changeset
   373
    void DrawClosingLine() const;
hgs
parents:
diff changeset
   374
	const CEikDialogPage* DialogPage() const { return iDialogPage; }
hgs
parents:
diff changeset
   375
	void SetPartiallyVisible( TBool aPVisible );
hgs
parents:
diff changeset
   376
    TBool PressedDownState() const;
hgs
parents:
diff changeset
   377
	void SetPressedDownState( TBool aPressed );
hgs
parents:
diff changeset
   378
private:
hgs
parents:
diff changeset
   379
    TSize EditorControlSize() const ;
hgs
parents:
diff changeset
   380
    void SetElementBrushColorsL( TRgb aColor ) ;
hgs
parents:
diff changeset
   381
    void SetElementTextColorsL( TRgb aColor ) ;
hgs
parents:
diff changeset
   382
hgs
parents:
diff changeset
   383
    TBool ShowBitmap() const;
hgs
parents:
diff changeset
   384
    void  LayoutBitmap(const TRect& aRect);
hgs
parents:
diff changeset
   385
    void  LayoutCaption(const TRect& aRect);
hgs
parents:
diff changeset
   386
    void DoFormCaptionSettingsL(const TDesC& aText);
hgs
parents:
diff changeset
   387
private:
hgs
parents:
diff changeset
   388
    static void FormLayoutControlBitmap(CEikImage* aBitmap, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines);
hgs
parents:
diff changeset
   389
    void FormLayoutControlEdwin(CEikEdwin* aEdwin, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent, TBool aIsFocused);
hgs
parents:
diff changeset
   390
    void FormLayoutControlLabel(CEikLabel* aSlider, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aLayoutWithBitmap, TBool aIsFocused, TInt aIconCount);
hgs
parents:
diff changeset
   391
    void FormLayoutControlMfne(CEikMfne* aMfne,  const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent, TBool aIsFocused );
hgs
parents:
diff changeset
   392
    void FormLayoutControlPopfield(CAknPopupField* aPopfield, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent, TBool aIsFocused);
hgs
parents:
diff changeset
   393
    void FormLayoutControlSecretEditor(CEikSecretEditor* aSecretEd, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent, TBool aIsFocused );
hgs
parents:
diff changeset
   394
    static void FormLayoutControlSlider(CAknSlider* aSlider, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent);
hgs
parents:
diff changeset
   395
    static void ConvertViewRectToEditRect(TRect& aRect);
hgs
parents:
diff changeset
   396
    static void ConvertEditRectToViewRect(TRect& aRect);
hgs
parents:
diff changeset
   397
hgs
parents:
diff changeset
   398
    /*	
hgs
parents:
diff changeset
   399
    *
hgs
parents:
diff changeset
   400
    * Access method for use in a CAknForm context. 
hgs
parents:
diff changeset
   401
    *
hgs
parents:
diff changeset
   402
    * @return   Enumeration for layout for the CAknForm
hgs
parents:
diff changeset
   403
    *           Layout value is received from owning CEikDialogPage, if it is not defined then EEikFormUseDoubleSpacedFormat flag is checked.
hgs
parents:
diff changeset
   404
    *           Default value is CEikDialogPage::ESingle
hgs
parents:
diff changeset
   405
    */
hgs
parents:
diff changeset
   406
    CEikDialogPage::TFormLayoutSelection FormLayout() const;
hgs
parents:
diff changeset
   407
hgs
parents:
diff changeset
   408
    /**
hgs
parents:
diff changeset
   409
    * Draws the separator between (at the top of current ) caption control(s)
hgs
parents:
diff changeset
   410
    *
hgs
parents:
diff changeset
   411
    * @param    gc  Current graphics contect
hgs
parents:
diff changeset
   412
    */
hgs
parents:
diff changeset
   413
    void DrawFormSeparator( CWindowGc& gc ) const;
hgs
parents:
diff changeset
   414
hgs
parents:
diff changeset
   415
    /**
hgs
parents:
diff changeset
   416
    * Constructs the extension object.
hgs
parents:
diff changeset
   417
    * There is no base constructL, so it is necessary to call this in several places
hgs
parents:
diff changeset
   418
    */
hgs
parents:
diff changeset
   419
    void ConstructExtensionL() ;
hgs
parents:
diff changeset
   420
hgs
parents:
diff changeset
   421
    void DrawAsSkinnedForm( CWindowGc& aGc, const TRect& aRect ) const;
hgs
parents:
diff changeset
   422
    void LayoutSkinControlContexts();
hgs
parents:
diff changeset
   423
    TBool DrawingSkins() const;
hgs
parents:
diff changeset
   424
    void DrawAsForm( const TRect& aRect ) const;
hgs
parents:
diff changeset
   425
    void DrawAsEikonDialog( const TRect& aRect ) const;
hgs
parents:
diff changeset
   426
    void DrawAsFormInEditMode( const TRect& aRect ) const;
hgs
parents:
diff changeset
   427
    void DrawAsFormInViewMode( const TRect& aRect ) const;
hgs
parents:
diff changeset
   428
    void DrawAsFormUnFocusedLine( const TRect& aRect ) const;
hgs
parents:
diff changeset
   429
    
hgs
parents:
diff changeset
   430
    /**
hgs
parents:
diff changeset
   431
     * Returns correct text color index.
hgs
parents:
diff changeset
   432
     *
hgs
parents:
diff changeset
   433
     * @since S60 5.2
hgs
parents:
diff changeset
   434
     * @return Text color index.
hgs
parents:
diff changeset
   435
     */
hgs
parents:
diff changeset
   436
    TAknsQsnTextColorsIndex TextColorIndex() const;
hgs
parents:
diff changeset
   437
hgs
parents:
diff changeset
   438
public:
hgs
parents:
diff changeset
   439
    CCoeControl* iControl;
hgs
parents:
diff changeset
   440
    CEikCapCLabel* iCaption;
hgs
parents:
diff changeset
   441
    HBufC* iCaptionText;
hgs
parents:
diff changeset
   442
hgs
parents:
diff changeset
   443
    CEikLabel* iTrailer;
hgs
parents:
diff changeset
   444
    TInt iId;
hgs
parents:
diff changeset
   445
    TInt iControlType;
hgs
parents:
diff changeset
   446
    TAny* iReturnValue;
hgs
parents:
diff changeset
   447
    TBool iIsFormControl ;
hgs
parents:
diff changeset
   448
    CEikImage* iBitmap ;
hgs
parents:
diff changeset
   449
    TBool iIsEditable ;
hgs
parents:
diff changeset
   450
hgs
parents:
diff changeset
   451
private:
hgs
parents:
diff changeset
   452
    TBool iHasAppendedEditIndicator;
hgs
parents:
diff changeset
   453
    TSize iMinSize;
hgs
parents:
diff changeset
   454
    TInt  iCapCFlags;
hgs
parents:
diff changeset
   455
    TInt  iCaptionWidth;
hgs
parents:
diff changeset
   456
    TInt  iFullWidth;
hgs
parents:
diff changeset
   457
    TSize iNormalSize ;
hgs
parents:
diff changeset
   458
    HBufC*iToolTipText ;
hgs
parents:
diff changeset
   459
    TBool iDoNotDisplay ;
hgs
parents:
diff changeset
   460
hgs
parents:
diff changeset
   461
    TInt iVertEdgeSpacing ;
hgs
parents:
diff changeset
   462
    TInt iHorzEdgeSpacing ;
hgs
parents:
diff changeset
   463
    TInt iOriginalHeight ;
hgs
parents:
diff changeset
   464
hgs
parents:
diff changeset
   465
    TSize iEditorControlSize ;
hgs
parents:
diff changeset
   466
    TInt iNumberOfLines ;
hgs
parents:
diff changeset
   467
hgs
parents:
diff changeset
   468
    friend class CEikCapCArray;
hgs
parents:
diff changeset
   469
hgs
parents:
diff changeset
   470
    enum { ENotSupplied = -1 } ;
hgs
parents:
diff changeset
   471
    TInt iFlags ;
hgs
parents:
diff changeset
   472
hgs
parents:
diff changeset
   473
    TBool iRefresh ;
hgs
parents:
diff changeset
   474
hgs
parents:
diff changeset
   475
    TInt iCaptionFontId ;
hgs
parents:
diff changeset
   476
    TInt iEditorFontId ;
hgs
parents:
diff changeset
   477
    TInt iVerticalLineXPosition; //iAknTopSpacing ;         
hgs
parents:
diff changeset
   478
    CCoeControl* iHighlightControl;
hgs
parents:
diff changeset
   479
    CEikCapCExtension* iExtension ;  // BC extension for additional Data members.
hgs
parents:
diff changeset
   480
    TInt iAknFormControlHeight ;
hgs
parents:
diff changeset
   481
    TInt iAknFormControlWidth ;
hgs
parents:
diff changeset
   482
    TInt iPenColor ;
hgs
parents:
diff changeset
   483
    TInt iShadowColor ;
hgs
parents:
diff changeset
   484
    TBool iIsCurrentLine;
hgs
parents:
diff changeset
   485
    CEikDialogPage* iDialogPage;
hgs
parents:
diff changeset
   486
hgs
parents:
diff changeset
   487
hgs
parents:
diff changeset
   488
    };
hgs
parents:
diff changeset
   489
hgs
parents:
diff changeset
   490
hgs
parents:
diff changeset
   491
/*
hgs
parents:
diff changeset
   492
 * Special Label Class which appends colon to label text
hgs
parents:
diff changeset
   493
 */
hgs
parents:
diff changeset
   494
hgs
parents:
diff changeset
   495
NONSHARABLE_CLASS(CEikCapCLabel) : public CEikLabel
hgs
parents:
diff changeset
   496
    {
hgs
parents:
diff changeset
   497
public :
hgs
parents:
diff changeset
   498
    CEikCapCLabel() ;
hgs
parents:
diff changeset
   499
    ~CEikCapCLabel() ;
hgs
parents:
diff changeset
   500
hgs
parents:
diff changeset
   501
    TBool ColonEnabled() const ;
hgs
parents:
diff changeset
   502
    void EnableColon( TBool aEnable ) ;
hgs
parents:
diff changeset
   503
hgs
parents:
diff changeset
   504
protected :
hgs
parents:
diff changeset
   505
    void Draw(const TRect& aRect) const ;
hgs
parents:
diff changeset
   506
    void DrawL(const TRect& aRect) ;
hgs
parents:
diff changeset
   507
hgs
parents:
diff changeset
   508
private:
hgs
parents:
diff changeset
   509
    TBool iIsColonEnabled ;
hgs
parents:
diff changeset
   510
    } ;
hgs
parents:
diff changeset
   511
hgs
parents:
diff changeset
   512
class MPointerEventObserver
hgs
parents:
diff changeset
   513
	{
hgs
parents:
diff changeset
   514
public:
hgs
parents:
diff changeset
   515
	virtual bool PointerEvent(CEikCaptionedControl *aControl, const TPointerEvent& aPointerEvent)=0;
hgs
parents:
diff changeset
   516
	};
hgs
parents:
diff changeset
   517
hgs
parents:
diff changeset
   518
#endif