epoc32/include/mw/eikspane.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-2010 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:  EIKON Status Pane control.
williamr@4
    15
*
williamr@4
    16
*/
williamr@4
    17
williamr@4
    18
williamr@4
    19
#ifndef __EIKSPANE_H__
williamr@4
    20
#define __EIKSPANE_H__
williamr@4
    21
williamr@4
    22
#include <eikspmod.h>
williamr@4
    23
#include <coecntrl.h>
williamr@4
    24
#include <coecobs.h>
williamr@4
    25
williamr@4
    26
class CCoeBrushAndPenContext;
williamr@4
    27
class CEikStatusPaneContainer;
williamr@4
    28
class CEikStatusPaneBaseExtension;
williamr@4
    29
class CAknStatuspaneClearer;
williamr@4
    30
class CAknDelayedForegroundObserver;
williamr@4
    31
class CAknStatusPaneDataSubscriber;
williamr@4
    32
class TAknsItemID;
williamr@4
    33
williamr@4
    34
/**
williamr@4
    35
* Status pane flag indicating that a sub-pane exists
williamr@4
    36
* in the status pane.
williamr@4
    37
*/
williamr@4
    38
const TInt KStatusPaneCapsPresentBit         = 1;
williamr@4
    39
williamr@4
    40
/**
williamr@4
    41
* Status pane flag indicating that a sub-pane is owned
williamr@4
    42
* by the application side status pane.
williamr@4
    43
*/
williamr@4
    44
const TInt KStatusPaneCapsAppOwnedBit        = 2;
williamr@4
    45
williamr@4
    46
/**
williamr@4
    47
* Status pane flag indicating that a sub-pane is part of
williamr@4
    48
* a specific status pane layout.
williamr@4
    49
*/
williamr@4
    50
const TInt KStatusPaneCapsInCurrentLayoutBit = 4;
williamr@4
    51
williamr@4
    52
/**
williamr@4
    53
 * The @c MEikStatusPaneObserver interface allows a status pane observer to
williamr@4
    54
 * pick up changes in the size or position of the status pane. Such events
williamr@4
    55
 * will be as a result of layout changes which cause an actual change in the
williamr@4
    56
 * status pane rectangle.
williamr@4
    57
 */
williamr@4
    58
class MEikStatusPaneObserver
williamr@4
    59
	{
williamr@4
    60
public:
williamr@4
    61
	virtual void HandleStatusPaneSizeChange() = 0;
williamr@4
    62
	};
williamr@4
    63
williamr@4
    64
/**
williamr@4
    65
 * The base class for status panes.
williamr@4
    66
 */
williamr@4
    67
class CEikStatusPaneBase : public CBase
williamr@4
    68
	{
williamr@4
    69
	
williamr@4
    70
public:
williamr@4
    71
williamr@4
    72
    /**
williamr@4
    73
     * Describes the capabilities of a subpane.
williamr@4
    74
     */
williamr@4
    75
    class TPaneCapabilities
williamr@4
    76
        {
williamr@4
    77
williamr@4
    78
    public:
williamr@4
    79
        
williamr@4
    80
        /**
williamr@4
    81
        * Constructor.
williamr@4
    82
        */
williamr@4
    83
        TPaneCapabilities();
williamr@4
    84
        
williamr@4
    85
        /**
williamr@4
    86
        * Tests whether the subpane exists in the status pane.
williamr@4
    87
        * 
williamr@4
    88
        * @return @c ETrue if the subpane exists and can be used by the
williamr@4
    89
        *            application, even if the subpane is not visible.
williamr@4
    90
        */
williamr@4
    91
        inline TBool IsPresent() const;
williamr@4
    92
        
williamr@4
    93
        /**
williamr@4
    94
        * Tests whether the pane is owned by the application or the server.
williamr@4
    95
        * Applications can only interact directly with application owned
williamr@4
    96
        * subpanes.
williamr@4
    97
        *
williamr@4
    98
        * @return @c ETrue if the subpane is owned by the application.
williamr@4
    99
        */
williamr@4
   100
        inline TBool IsAppOwned() const;
williamr@4
   101
        
williamr@4
   102
        /**
williamr@4
   103
        * Tests if this pane is part of the current status pane layout.
williamr@4
   104
        *
williamr@4
   105
        * @return @c ETrue if pane is part of the current status pane layout.
williamr@4
   106
        */
williamr@4
   107
        inline TBool IsInCurrentLayout() const;
williamr@4
   108
williamr@4
   109
    private:
williamr@4
   110
williamr@4
   111
        inline void SetPresent();
williamr@4
   112
        inline void SetAppOwned();
williamr@4
   113
        inline void SetInCurrentLayout();
williamr@4
   114
williamr@4
   115
    private:
williamr@4
   116
williamr@4
   117
        TInt iFlags;
williamr@4
   118
williamr@4
   119
    private:
williamr@4
   120
williamr@4
   121
        friend class CEikStatusPaneBase;
williamr@4
   122
        };
williamr@4
   123
williamr@4
   124
public:
williamr@4
   125
williamr@4
   126
    /**
williamr@4
   127
    * Destructor.
williamr@4
   128
    */
williamr@4
   129
    IMPORT_C ~CEikStatusPaneBase();
williamr@4
   130
williamr@4
   131
    /**
williamr@4
   132
    * Gets a pointer to the thread's currently active status pane
williamr@4
   133
    * without transferring ownership. 
williamr@4
   134
    *
williamr@4
   135
    * @return Pointer to currently active status pane.
williamr@4
   136
    *         Returns @c NULL if no such pane exists.
williamr@4
   137
    */
williamr@4
   138
    IMPORT_C static CEikStatusPaneBase* Current();
williamr@4
   139
	
williamr@4
   140
    /**
williamr@4
   141
    * Sets the status pane observer.
williamr@4
   142
    *
williamr@4
   143
    * @param  aObserver  Pointer to status pane observer.
williamr@4
   144
    */
williamr@4
   145
    inline void SetObserver( MEikStatusPaneObserver* aObserver );
williamr@4
   146
	
williamr@4
   147
    /**
williamr@4
   148
    * Modifies the bounding rectangle so that it lies next to the
williamr@4
   149
    * status pane rectangle.
williamr@4
   150
    *
williamr@4
   151
    * The status pane always places itself along the edge of the screen, so 
williamr@4
   152
    * that it is consistent across applications and the server. It is 
williamr@4
   153
    * assumed that the given bounding rectangle does not extend beyond 
williamr@4
   154
    * the screen area.
williamr@4
   155
    *
williamr@4
   156
    * @param[in,out]  aBoundingRect  The bounding rectangle.
williamr@4
   157
    */
williamr@4
   158
    IMPORT_C void ReduceRect( TRect& aBoundingRect ) const;
williamr@4
   159
	
williamr@4
   160
    /**
williamr@4
   161
    * Adds and removes pane rectangles from @c aRegion.
williamr@4
   162
    *
williamr@4
   163
    * @param  aRegion              The two-dimensional area from where
williamr@4
   164
    *                              rectangles are removed from or where
williamr@4
   165
    *                              rectangles are added to.
williamr@4
   166
    * @param  aIncludeAppPanes     If @c ETrue, app panes are added, otherwise
williamr@4
   167
    *                              removed.
williamr@4
   168
    * @param  aIncludeServerPanes  If @c ETrue, server panes are added, 
williamr@4
   169
    *                              otherwise removed.
williamr@4
   170
    */
williamr@4
   171
    IMPORT_C void GetShapeL( TRegion& aRegion, 
williamr@4
   172
                             TBool aIncludeAppPanes, 
williamr@4
   173
                             TBool aIncludeServerPanes ) const;
williamr@4
   174
williamr@4
   175
    /**
williamr@4
   176
    * Switches to the specified status pane layout.
williamr@4
   177
    *
williamr@4
   178
    * The actual layout to which this method switches may not be the
williamr@4
   179
    * same as specified in @c aLayoutResourceId parameter.
williamr@4
   180
    * Eg. if landscape mode status pane layout is set with this method,
williamr@4
   181
    * while in portrait mode, it's mapped to the corresponding layout
williamr@4
   182
    * in the portrait mode. This should be noted when using
williamr@4
   183
    * @c CEikStatusPaneBase::CurrentLayoutResId().
williamr@4
   184
    *
williamr@4
   185
    * From release 3.2 on the old status pane layouts are also mapped
williamr@4
   186
    * to the new layouts, ie.
williamr@4
   187
    *  @c R_AVKON_STATUS_PANE_LAYOUT_USUAL ->
williamr@4
   188
    *      @c R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT
williamr@4
   189
    *
williamr@4
   190
    *  @c R_AVKON_STATUS_PANE_LAYOUT_IDLE  ->
williamr@4
   191
    *      @c R_AVKON_STATUS_PANE_LAYOUT_IDLE_EXT
williamr@4
   192
    *
williamr@4
   193
    * @param aLayoutResourceId Layout resource ID. This must be one of the
williamr@4
   194
    *                          layouts identified in the status pane
williamr@4
   195
    *                          resource structures, otherwise the function
williamr@4
   196
    *                          leaves @c KErrNotFound.
williamr@4
   197
    *                          @see avkon.rsg
williamr@4
   198
    *
williamr@4
   199
    * @leave KErrNotFound      The specified layout does not exist in the
williamr@4
   200
    *                          status pane resource structures.
williamr@4
   201
    */
williamr@4
   202
    IMPORT_C virtual void SwitchLayoutL( TInt aLayoutResourceId );
williamr@4
   203
	
williamr@4
   204
    /**
williamr@4
   205
    * Sets the visibility of the status pane and it's contents.
williamr@4
   206
    *
williamr@4
   207
    * @param  aVisible  If @c ETrue the status pane and it's contents are set
williamr@4
   208
    *                   visible.
williamr@4
   209
    */
williamr@4
   210
    IMPORT_C virtual void MakeVisible( TBool aVisible );
williamr@4
   211
	
williamr@4
   212
    /**
williamr@4
   213
    * Sets the status pane and it's contents to dimmed state.
williamr@4
   214
    *
williamr@4
   215
    * @param  aDimmed  If @c ETrue the status pane and it's contents are
williamr@4
   216
    *                  set to dimmed state.
williamr@4
   217
    */
williamr@4
   218
    IMPORT_C virtual void SetDimmed( TBool aDimmed );
williamr@4
   219
	
williamr@4
   220
    /**
williamr@4
   221
    * Not implemented.
williamr@4
   222
    *
williamr@4
   223
    * @param aFaded Not used.
williamr@4
   224
    */
williamr@4
   225
    IMPORT_C virtual void SetFaded( TBool aFaded );
williamr@4
   226
	
williamr@4
   227
    /**
williamr@4
   228
    * Handles changes in resources which are shared across the environment.
williamr@4
   229
    * This function responds to the changes in resources by propagating them
williamr@4
   230
    * to sub-parts of the status pane.
williamr@4
   231
    *
williamr@4
   232
    * @param  aType  A message type.
williamr@4
   233
    */
williamr@4
   234
    IMPORT_C virtual void HandleResourceChange( TInt aType );
williamr@4
   235
	
williamr@4
   236
    /**
williamr@4
   237
    * Returns always @c ETrue. 
williamr@4
   238
    *
williamr@4
   239
    * @return @c ETrue.
williamr@4
   240
    */
williamr@4
   241
    IMPORT_C virtual TBool OkToChangeStatusPaneNow();
williamr@4
   242
williamr@4
   243
    /**
williamr@4
   244
    * Sets all the visual flags at once
williamr@4
   245
    * (@c KEikStatusPaneBaseVisibleBit and
williamr@4
   246
    *  @c KEikStatusPaneBaseDimmedBit).
williamr@4
   247
    * 
williamr@4
   248
    * @param  aFlags  Flags to be set.
williamr@4
   249
    */
williamr@4
   250
    IMPORT_C void SetFlags( TInt aFlags );
williamr@4
   251
	
williamr@4
   252
    /**
williamr@4
   253
    * Gets status pane settings.
williamr@4
   254
    *
williamr@4
   255
    * @return Flags used by status pane base class.
williamr@4
   256
    */
williamr@4
   257
    IMPORT_C TInt Flags() const;
williamr@4
   258
	
williamr@4
   259
    /**
williamr@4
   260
    * Gets the visibility of the status pane.
williamr@4
   261
    * 
williamr@4
   262
    * @return @c ETrue if the status pane is visible.
williamr@4
   263
    */
williamr@4
   264
    IMPORT_C TBool IsVisible() const;
williamr@4
   265
	
williamr@4
   266
    /**
williamr@4
   267
    * Gets the dimmed state of the status pane.
williamr@4
   268
    * 
williamr@4
   269
    * @return @c ETrue if the status pane is dimmed.
williamr@4
   270
    */
williamr@4
   271
    IMPORT_C TBool IsDimmed() const;
williamr@4
   272
	
williamr@4
   273
    /**
williamr@4
   274
    * Gets the fade status of the status pane.
williamr@4
   275
    * 
williamr@4
   276
    * @return @c ETrue if status pane is faded.
williamr@4
   277
    */
williamr@4
   278
    IMPORT_C TBool IsFaded() const;
williamr@4
   279
williamr@4
   280
    /**
williamr@4
   281
    * Gets the capabilities of a sub-pane in the status pane.
williamr@4
   282
    * 
williamr@4
   283
    * @param   aPaneId  Sub-pane ID.
williamr@4
   284
    *
williamr@4
   285
    * @return Capabilities of the pane.
williamr@4
   286
    */
williamr@4
   287
    IMPORT_C TPaneCapabilities PaneCapabilities( TPaneId aPaneId ) const;
williamr@4
   288
	
williamr@4
   289
    /**
williamr@4
   290
    * Provides the screen rectangle of a sub-pane.
williamr@4
   291
    * This can be used to set the size of a new control which you want
williamr@4
   292
    * to place in the status pane.
williamr@4
   293
    * 
williamr@4
   294
    * @param   aPaneId  Sub-pane ID.
williamr@4
   295
    *
williamr@4
   296
    * @return The sub-pane rectangle.
williamr@4
   297
    *
williamr@4
   298
    * @leave  KErrNotFound The sub-pane ID is not valid.
williamr@4
   299
    */
williamr@4
   300
    IMPORT_C TRect PaneRectL( TPaneId aPaneId ) const;
williamr@4
   301
	
williamr@4
   302
    /**
williamr@4
   303
    * Provides the control currently inside a sub-pane.
williamr@4
   304
    * This gives the application direct access to the contents of a pane.
williamr@4
   305
    *
williamr@4
   306
    * @param   aPaneId  Sub-pane ID.
williamr@4
   307
    *
williamr@4
   308
    * @return Pointer to the control instance inside the sub-pane.
williamr@4
   309
    *
williamr@4
   310
    * @leave  KErrNotFound The sub-pane ID is not valid.
williamr@4
   311
    */
williamr@4
   312
    IMPORT_C CCoeControl* ControlL( TPaneId aPaneId ) const;
williamr@4
   313
	
williamr@4
   314
    /**
williamr@4
   315
    * Swaps the control currently inside a sub-pane.
williamr@4
   316
    * The new control must be a fully constructed control.
williamr@4
   317
    * It will be placed inside the status pane, and the current
williamr@4
   318
    * content will be returned to the caller. 
williamr@4
   319
    * 
williamr@4
   320
    * @param  aPaneId      ID of the sub-pane.
williamr@4
   321
    * @param  aNewControl  A fully constructed control to
williamr@4
   322
    *                      place at @c aPaneId.
williamr@4
   323
    *
williamr@4
   324
    * @return The control  which was at @c aPaneId.
williamr@4
   325
    *
williamr@4
   326
    * @leave  KErrNotFound This can occur before ownership of the new
williamr@4
   327
    *                      control is taken, if the subpane ID is not valid.
williamr@4
   328
    */
williamr@4
   329
    IMPORT_C CCoeControl* SwapControlL( TPaneId aPaneId,
williamr@4
   330
                                        CCoeControl* aNewControl );
williamr@4
   331
	
williamr@4
   332
    /**
williamr@4
   333
    * Provides access to the container control of a sub-pane.
williamr@4
   334
    * You will need access to the container of a sub pane if you want 
williamr@4
   335
    * to swap in a new control. The container control should be set as the
williamr@4
   336
    * parent window of the new control.
williamr@4
   337
    * It also provides a fast way to get the rectangle of the sub-pane 
williamr@4
   338
    * (@see PaneRect()).
williamr@4
   339
    *
williamr@4
   340
    * @param   aPaneId  ID of the sub-pane.
williamr@4
   341
    *
williamr@4
   342
    * @return Pointer to the new container control for the sub-pane.
williamr@4
   343
    *
williamr@4
   344
    * @leave  KErrNotFound The sub-pane ID is not valid.
williamr@4
   345
    */
williamr@4
   346
    IMPORT_C CCoeControl* ContainerControlL( TPaneId aPaneId ) const;
williamr@4
   347
	
williamr@4
   348
    /**
williamr@4
   349
    * Provides access to a server-side window group.
williamr@4
   350
    *
williamr@4
   351
    * @return Pointer to the window group.
williamr@4
   352
    */
williamr@4
   353
    inline RWindowGroup* WindowGroup() const;
williamr@4
   354
	
williamr@4
   355
    /**
williamr@4
   356
    * Draws the control.
williamr@4
   357
    */
williamr@4
   358
    IMPORT_C void DrawNow();
williamr@4
   359
	
williamr@4
   360
    /**
williamr@4
   361
    * Gets the resource ID of the current layout.
williamr@4
   362
    *
williamr@4
   363
    * @return The resource ID of the current layout.
williamr@4
   364
    *         @see avkon.rsg
williamr@4
   365
    */
williamr@4
   366
    IMPORT_C TInt CurrentLayoutResId() const;
williamr@4
   367
    
williamr@4
   368
    /**
williamr@4
   369
    * Status pane drawing commands.
williamr@4
   370
    */
williamr@4
   371
    enum TDrawCmd 
williamr@4
   372
        { 
williamr@4
   373
        /** Do not draw. */
williamr@4
   374
        ENoDraw, 
williamr@4
   375
williamr@4
   376
        /** Draw immediately. */
williamr@4
   377
        EDrawNow, 
williamr@4
   378
        
williamr@4
   379
        /** Draw with low priority. */
williamr@4
   380
        EDrawDeferred 
williamr@4
   381
        };
williamr@4
   382
williamr@4
   383
    /**
williamr@4
   384
    * Sets the skin background ID of sub-panes which
williamr@4
   385
    * are in the CBA area.
williamr@4
   386
    * @internal This method is not exported.
williamr@4
   387
    *
williamr@4
   388
    * @param  aBgID     The skin background ID to be set.
williamr@4
   389
    * @param  aDrawCmd  Whether the status pane is drawn
williamr@4
   390
    *                   when updating the background context,
williamr@4
   391
    *                   (@see @c TDrawCmd).
williamr@4
   392
    */
williamr@4
   393
    void SetCbaAreaBackgroundID( const TAknsItemID& aBgID,
williamr@4
   394
                                 CEikStatusPaneBase::TDrawCmd aDrawCmd );
williamr@4
   395
    
williamr@4
   396
    /**
williamr@4
   397
    * Returns the current skin background ID of the sub-panes
williamr@4
   398
    * which are in the CBA area.
williamr@4
   399
    * @internal This method is not exported.
williamr@4
   400
    *
williamr@4
   401
    * @return  The skin background ID.
williamr@4
   402
    */
williamr@4
   403
    TAknsItemID CbaAreaBackgroundID();
williamr@4
   404
williamr@4
   405
protected:
williamr@4
   406
williamr@4
   407
    /**
williamr@4
   408
    * C++ default constructor.
williamr@4
   409
    *
williamr@4
   410
    * @param  aEikEnv  An environment for creating controls and utility 
williamr@4
   411
    *                  functions for manipulating them.
williamr@4
   412
    * @param  aParent  Pointer to the parent window group.
williamr@4
   413
    */
williamr@4
   414
    IMPORT_C CEikStatusPaneBase( CEikonEnv& aEikEnv, RWindowGroup* aParent );
williamr@4
   415
	
williamr@4
   416
    /**
williamr@4
   417
    * Initializes the status pane with standard values. 
williamr@4
   418
    * 
williamr@4
   419
    * @param  aCoreResId  ID of the status pane resource.
williamr@4
   420
    */
williamr@4
   421
    IMPORT_C void BaseConstructL( TInt aCoreResId );
williamr@4
   422
williamr@4
   423
    /**
williamr@4
   424
    * Creates a new model for the status pane.
williamr@4
   425
    *
williamr@4
   426
    * @param  aCoreResId  ID of the status pane resource.
williamr@4
   427
    *
williamr@4
   428
    * @return Pointer to the new status pane model instance.
williamr@4
   429
    */
williamr@4
   430
    virtual CEikStatusPaneModelBase* CreateModelL( TInt aCoreResId ) const = 0;
williamr@4
   431
	
williamr@4
   432
    /**
williamr@4
   433
    * Creates the sub-panes to the status pane.
williamr@4
   434
    */
williamr@4
   435
    void CreatePanesL();
williamr@4
   436
	
williamr@4
   437
    /**
williamr@4
   438
    * Creates a sub-pane.
williamr@4
   439
    *
williamr@4
   440
    * @param[in]  aPaneInit  Initial values for the sub-pane.
williamr@4
   441
    */
williamr@4
   442
    void CreatePaneL( const TEikStatusPaneInit& aPaneInit );
williamr@4
   443
	
williamr@4
   444
    /**
williamr@4
   445
    * Gets a container of a specified sub-pane.
williamr@4
   446
    *
williamr@4
   447
    * @param  aPaneId  The sub-pane ID.
williamr@4
   448
    *
williamr@4
   449
    * @return Pointer to the container of the sub-pane with a given ID.
williamr@4
   450
    */
williamr@4
   451
    CEikStatusPaneContainer* Find( TPaneId aPaneId ) const;
williamr@4
   452
williamr@4
   453
    /**
williamr@4
   454
    * Can be used to determine whether or not the status pane is on
williamr@4
   455
    * application side or server side.
williamr@4
   456
    *
williamr@4
   457
    * @return @c ETrue if the status pane resides in the application side,
williamr@4
   458
    *         @c EFalse if it's on the server side.
williamr@4
   459
    */
williamr@4
   460
    virtual TBool IsApp() const = 0;
williamr@4
   461
	
williamr@4
   462
    /**
williamr@4
   463
    * Gets the rectangle of the status pane.
williamr@4
   464
    *
williamr@4
   465
    * @return The rectangle used by the status pane.
williamr@4
   466
    */
williamr@4
   467
    inline TRect Rect() const;
williamr@4
   468
	
williamr@4
   469
    /**
williamr@4
   470
    * Calls @c CCoeControl's @c DrawNow() or @c DrawDeferred() to draw the 
williamr@4
   471
    * status pane. If @c aDraw is @c ENoDraw status pane is not drawed.
williamr@4
   472
    * 
williamr@4
   473
    * @param  aDraw  Status pane drawing command.
williamr@4
   474
    */
williamr@4
   475
    void DoDrawNow( TDrawCmd aDraw );
williamr@4
   476
	
williamr@4
   477
    /**
williamr@4
   478
    * Gets the status pane clearer.
williamr@4
   479
    *
williamr@4
   480
    * @return Pointer to the status pane clearer instance.
williamr@4
   481
    */
williamr@4
   482
    CAknStatuspaneClearer* Clearer();
williamr@4
   483
	
williamr@4
   484
    /**
williamr@4
   485
    * Disables the status pane clearer. 
williamr@4
   486
    *
williamr@4
   487
    * @param  aDisabled  Disabled if @c ETrue.
williamr@4
   488
    */
williamr@4
   489
    IMPORT_C void DisableClearer( TBool aDisabled );
williamr@4
   490
	
williamr@4
   491
    /**
williamr@4
   492
    * Prepares the status pane for the application exit.
williamr@4
   493
    * Clears the status pane.
williamr@4
   494
    */
williamr@4
   495
    IMPORT_C void CommonPrepareForAppExit();
williamr@4
   496
williamr@4
   497
private:
williamr@4
   498
williamr@4
   499
    void DoSwitchLayoutL( TInt aLayoutResourceId, TDrawCmd aDraw );
williamr@4
   500
    void ApplyLayoutL( CEikStatusPaneLayout* aLayout, TDrawCmd aDraw );
williamr@4
   501
    void SetAllInvisible();
williamr@4
   502
    void SetNotNeededInvisible();
williamr@4
   503
williamr@4
   504
public:
williamr@4
   505
    
williamr@4
   506
    /**
williamr@4
   507
    * Notifies the command button area and status pane observer about the
williamr@4
   508
    * status pane size change. If the status pane is an embedded application,
williamr@4
   509
    * also this application is notified.
williamr@4
   510
    */
williamr@4
   511
    void ReportSizeChange();
williamr@4
   512
williamr@4
   513
private:
williamr@4
   514
williamr@4
   515
    class TSetRectAndVisibility : public MEikStatusPaneLayoutTreeVisitor
williamr@4
   516
        {    
williamr@4
   517
    public:
williamr@4
   518
    
williamr@4
   519
        TSetRectAndVisibility( TBool aIsApp, CEikStatusPaneBase* aStatusPane );
williamr@4
   520
        void VisitL( CEikStatusPaneLayoutTree* aNode );
williamr@4
   521
    
williamr@4
   522
    private:
williamr@4
   523
    
williamr@4
   524
        TBool iIsApp;
williamr@4
   525
        CEikStatusPaneBase* iStatusPane;
williamr@4
   526
        };
williamr@4
   527
	
williamr@4
   528
	friend class TSetRectAndVisibility;
williamr@4
   529
williamr@4
   530
private:
williamr@4
   531
williamr@4
   532
    void  SetLastUsedResourceId( TInt aResourceId );
williamr@4
   533
    TInt  LastUsedResourceId();
williamr@4
   534
    TInt  ReadInitialUsedResourceIdL( TInt aCoreResId );    
williamr@4
   535
    TInt  InitialUsedResourceId();
williamr@4
   536
    TRect LargestBoundingRect( TRegion& aWholeRegion,
williamr@4
   537
                               TRegion& aRemovedRegion ) const;
williamr@4
   538
    void SetCombinedPaneVisibilityL( TBool aVisible );
williamr@4
   539
williamr@4
   540
protected:
williamr@4
   541
williamr@4
   542
    /**
williamr@4
   543
    * Gets the status pane data subscriber.
williamr@4
   544
    *
williamr@4
   545
    * @return Pointer to the status pane data subscriber.
williamr@4
   546
    */
williamr@4
   547
	CAknStatusPaneDataSubscriber* DataSubscriber() const;
williamr@4
   548
williamr@4
   549
    /**
williamr@4
   550
    * Sets the initial status pane resource ID to an extension class 
williamr@4
   551
    * @c CEikStatusPaneBaseExtension.
williamr@4
   552
    *
williamr@4
   553
    * @param  aResourceId  The initial status pane resource ID.
williamr@4
   554
    */
williamr@4
   555
    void SetInitialUsedResourceId( TInt aResourceId );
williamr@4
   556
    
williamr@4
   557
    /**
williamr@4
   558
    * Optimizes the status pane region which cleared during
williamr@4
   559
    * status pane layout change.
williamr@4
   560
    *
williamr@4
   561
    * @param         aOldResourceId  Old status pane resource ID.
williamr@4
   562
    * @param         aNewResourceId  New status pane resource ID.
williamr@4
   563
    * @param[in,out] aRegion         Status pane region.
williamr@4
   564
    *                                On return contains only
williamr@4
   565
    *                                the region that needs to be cleared.
williamr@4
   566
    */
williamr@4
   567
	void OptimizeClearerWindowShape( TInt aOldResourceId,
williamr@4
   568
	                                 TInt aNewResourceId,
williamr@4
   569
	                                 TRegion& aRegion );
williamr@4
   570
williamr@4
   571
	/**
williamr@4
   572
	* Sets redraw storing state of the window.
williamr@4
   573
	*
williamr@4
   574
	* @param  aWindow  The window whose redraw storing state is to be set.
williamr@4
   575
	* @param  aOn      @c ETrue to turn redraw storing on.
williamr@4
   576
	*/	
williamr@4
   577
	void SetStoreHandler( RWindow* aWindow, TBool aOn );
williamr@4
   578
williamr@4
   579
protected:
williamr@4
   580
williamr@4
   581
    /**
williamr@4
   582
    * An environment for creating controls and utility functions for 
williamr@4
   583
    * manipulating them.
williamr@4
   584
    */
williamr@4
   585
    CEikonEnv& iEikEnv;
williamr@4
   586
	
williamr@4
   587
    /**
williamr@4
   588
    * Status pane model class. <br>
williamr@4
   589
    * Own.
williamr@4
   590
    */
williamr@4
   591
    CEikStatusPaneModelBase* iModel;
williamr@4
   592
williamr@4
   593
    /**
williamr@4
   594
    * Flags for the status pane.
williamr@4
   595
    */
williamr@4
   596
    TInt iFlags;
williamr@4
   597
williamr@4
   598
protected:
williamr@4
   599
williamr@4
   600
	typedef CArrayPtrFlat<CEikStatusPaneContainer> CContainerControls;
williamr@4
   601
	CContainerControls* iControls;
williamr@4
   602
	
williamr@4
   603
private:
williamr@4
   604
williamr@4
   605
	MEikStatusPaneObserver* iObserver;
williamr@4
   606
	RWindowGroup* iParentWindowGroup;
williamr@4
   607
	CEikStatusPaneBaseExtension* iExtension;
williamr@4
   608
	};
williamr@4
   609
williamr@4
   610
/**
williamr@4
   611
 * Application side status pane class.
williamr@4
   612
 *
williamr@4
   613
 * @c CEikStatusPane is the interface through which applications use the
williamr@4
   614
 * status pane. This class synchronises the status pane layout with the
williamr@4
   615
 * server side status pane object. To do this, the @c ApplyCurrentSettingsL()
williamr@4
   616
 * method must be called whenever the owner application switches to the
williamr@4
   617
 * foreground.
williamr@4
   618
 */
williamr@4
   619
NONSHARABLE_CLASS( CEikStatusPane ) : public CEikStatusPaneBase,
williamr@4
   620
                                      public MCoeForegroundObserver
williamr@4
   621
	{
williamr@4
   622
public:
williamr@4
   623
williamr@4
   624
    /**
williamr@4
   625
    * Two-phased constructor.
williamr@4
   626
    *
williamr@4
   627
    * @param  aEikEnv                    An environment for creating controls
williamr@4
   628
    *                                    and utility functions for
williamr@4
   629
    *                                    manipulating them.
williamr@4
   630
    * @param  aParent                    Pointer to the parent window group.
williamr@4
   631
    * @param  aCoreStatusPaneModelResId  Status pane core resource ID.
williamr@4
   632
    * @param  aAppStatusPaneModelResId   Resource ID of the application's
williamr@4
   633
    *                                    status pane.
williamr@4
   634
    *
williamr@4
   635
    * @return Pointer to the created @c CEikStatusPane object.
williamr@4
   636
    */
williamr@4
   637
	IMPORT_C static CEikStatusPane* NewL(
williamr@4
   638
        CEikonEnv& aEikEnv,
williamr@4
   639
        RWindowGroup* aParent,
williamr@4
   640
        TInt aCoreStatusPaneModelResId,
williamr@4
   641
        TInt aAppStatusPaneModelResId = EEikStatusPaneUseDefaults );
williamr@4
   642
williamr@4
   643
    /**
williamr@4
   644
    * Destructor.
williamr@4
   645
    */
williamr@4
   646
	IMPORT_C ~CEikStatusPane();
williamr@4
   647
    
williamr@4
   648
    /**
williamr@4
   649
    * Synchronises the server status pane layout with the
williamr@4
   650
    * application status pane.
williamr@4
   651
    */
williamr@4
   652
	IMPORT_C void ApplyCurrentSettingsL();
williamr@4
   653
	
williamr@4
   654
	/**
williamr@4
   655
    * Prepares the status pane for the application exit.
williamr@4
   656
    * Clears the status pane.
williamr@4
   657
    */
williamr@4
   658
	IMPORT_C void PrepareForAppExit();
williamr@4
   659
williamr@4
   660
	/**
williamr@4
   661
    * Sets the visiblility of the status pane and its contents.
williamr@4
   662
    * From @c CEikStatusPaneBase.
williamr@4
   663
    *
williamr@4
   664
    * @param aVisible If @c ETrue the status pane and its
williamr@4
   665
    *                 contents are set visible.
williamr@4
   666
    */
williamr@4
   667
	IMPORT_C virtual void MakeVisible( TBool aVisible );
williamr@4
   668
	
williamr@4
   669
	/**
williamr@4
   670
    * Sets the status pane and its contents to dimmed state.
williamr@4
   671
    * From @c CEikStatusPaneBase.
williamr@4
   672
    *
williamr@4
   673
    * @param aDimmed If @c ETrue the status pane and its
williamr@4
   674
    *                contents are set to dimmed state.
williamr@4
   675
    */
williamr@4
   676
	IMPORT_C virtual void SetDimmed( TBool aDimmed );
williamr@4
   677
	
williamr@4
   678
	/**
williamr@4
   679
    * Not implemented.
williamr@4
   680
    * From @c CEikStatusPaneBase.
williamr@4
   681
    *
williamr@4
   682
    * @param aFaded Not used.
williamr@4
   683
    */
williamr@4
   684
	IMPORT_C virtual void SetFaded( TBool aFaded );
williamr@4
   685
	
williamr@4
   686
	/**
williamr@4
   687
    * Handles changes in resources which are shared across the environment.
williamr@4
   688
    * This function responds to the changes in resources by propagating them
williamr@4
   689
    * to sub-parts of the status pane.
williamr@4
   690
    * From @c CEikStatusPaneBase.
williamr@4
   691
    *
williamr@4
   692
    * @param  aType  A message type.
williamr@4
   693
    */
williamr@4
   694
	IMPORT_C virtual void HandleResourceChange( TInt aType );
williamr@4
   695
	
williamr@4
   696
	/**
williamr@4
   697
    * Returns always @c ETrue. 
williamr@4
   698
    * From @c CEikStatusPaneBase.
williamr@4
   699
    *
williamr@4
   700
    * @return @c ETrue.
williamr@4
   701
    */
williamr@4
   702
	IMPORT_C virtual TBool OkToChangeStatusPaneNow();
williamr@4
   703
williamr@4
   704
private:
williamr@4
   705
williamr@4
   706
    /**
williamr@4
   707
    * Default C++ constructor.
williamr@4
   708
    *
williamr@4
   709
    * @param  aEikEnv                    An environment for creating controls
williamr@4
   710
    *                                    and utility functions for
williamr@4
   711
    *                                    manipulating them.
williamr@4
   712
    * @param  aParent                    Pointer to the parent window group.
williamr@4
   713
    * @param  aAppStatusPaneModelResId   Resource ID of the application's
williamr@4
   714
    *                                    status pane.
williamr@4
   715
    */
williamr@4
   716
	CEikStatusPane( CEikonEnv& aEikEnv,
williamr@4
   717
	                RWindowGroup* aParent,
williamr@4
   718
	                TInt aAppStatusPaneModelId );
williamr@4
   719
williamr@4
   720
    /**
williamr@4
   721
    * Second-phase constructor.
williamr@4
   722
    *
williamr@4
   723
    * @param  aCoreStatusPaneModelResId  Status pane core resource ID.
williamr@4
   724
    */
williamr@4
   725
	void ConstructL( TInt aCoreStatusPaneModelResId );
williamr@4
   726
williamr@4
   727
    /**
williamr@4
   728
    * Creates the application side status pane model.
williamr@4
   729
    *
williamr@4
   730
    * @param  aCoreResId  Status pane core resource ID.
williamr@4
   731
    */
williamr@4
   732
	virtual CEikStatusPaneModelBase* CreateModelL( TInt aCoreResId ) const;
williamr@4
   733
	
williamr@4
   734
	/**
williamr@4
   735
    * Can be used to determine whether or not the status pane is on
williamr@4
   736
    * application side or server side.
williamr@4
   737
    *
williamr@4
   738
    * @return @c ETrue
williamr@4
   739
    */
williamr@4
   740
	TBool IsApp() const;
williamr@4
   741
williamr@4
   742
    /**
williamr@4
   743
    * Applies the current status pane flags.
williamr@4
   744
    */
williamr@4
   745
	void ApplyCurrentFlags();
williamr@4
   746
	
williamr@4
   747
	/**
williamr@4
   748
	* Hides all the sub-panes owned by the application
williamr@4
   749
	* side status pane.
williamr@4
   750
	*/
williamr@4
   751
	void HideAppPanes( TBool aHide );
williamr@4
   752
williamr@4
   753
private: // From base class @c MCoeForegroundObserver.
williamr@4
   754
williamr@4
   755
    /**
williamr@4
   756
    * Handles foreground gain events.
williamr@4
   757
    */
williamr@4
   758
	void HandleGainingForeground();
williamr@4
   759
	
williamr@4
   760
	/**
williamr@4
   761
    * Handles foreground lose events.
williamr@4
   762
    */
williamr@4
   763
	void HandleLosingForeground();
williamr@4
   764
	
williamr@4
   765
private:
williamr@4
   766
	
williamr@4
   767
	/**
williamr@4
   768
    * Reads the initial status pane layout from the status pane resources.
williamr@4
   769
    *
williamr@4
   770
    * @param  aCoreResId                Status pane core resource ID.
williamr@4
   771
    * @param  aAppStatusPaneModelResId  Resource ID specified by the
williamr@4
   772
    *                                   application.
williamr@4
   773
    */
williamr@4
   774
    TInt ReadInitialUsedResourceIdL( TInt aCoreResId,
williamr@4
   775
                                     TInt aAppStatusPaneModelResId );
williamr@4
   776
williamr@4
   777
    /**
williamr@4
   778
    * Handles foreground lose events.
williamr@4
   779
    */
williamr@4
   780
    void DoHandleLosingForegroundL();
williamr@4
   781
williamr@4
   782
private:
williamr@4
   783
williamr@4
   784
	TInt iAppDeclId;
williamr@4
   785
	
williamr@4
   786
	/** Formerly TEikStatusPaneSyncDrawer* iSyncDrawer */
williamr@4
   787
	TAny* iSpare;
williamr@4
   788
	
williamr@4
   789
	/** Formerly iServerSpWgId */
williamr@4
   790
	CAknDelayedForegroundObserver* iDelayedForegroundObserver;
williamr@4
   791
	};
williamr@4
   792
williamr@4
   793
/**
williamr@4
   794
* Checks if the pane exists in this status pane.
williamr@4
   795
* Note: this will return @c ETrue if the pane can be used,
williamr@4
   796
* even if it is not visible.
williamr@4
   797
*/
williamr@4
   798
inline TBool CEikStatusPaneBase::TPaneCapabilities::IsPresent() const
williamr@4
   799
    {
williamr@4
   800
    return iFlags & KStatusPaneCapsPresentBit;
williamr@4
   801
    }
williamr@4
   802
    
williamr@4
   803
/**
williamr@4
   804
* Checks if this pane is owned by application rather than the server.
williamr@4
   805
* Applications can only interact directly with application owned panes.
williamr@4
   806
*/
williamr@4
   807
inline TBool CEikStatusPaneBase::TPaneCapabilities::IsAppOwned() const
williamr@4
   808
    {
williamr@4
   809
    return iFlags & KStatusPaneCapsAppOwnedBit;
williamr@4
   810
    }
williamr@4
   811
    
williamr@4
   812
/**
williamr@4
   813
* Checks if this pane is part of the current status pane layout.
williamr@4
   814
*/
williamr@4
   815
inline TBool CEikStatusPaneBase::TPaneCapabilities::IsInCurrentLayout() const
williamr@4
   816
    {
williamr@4
   817
    return iFlags & KStatusPaneCapsInCurrentLayoutBit;
williamr@4
   818
    }
williamr@4
   819
williamr@4
   820
/**
williamr@4
   821
* Set the status pane observer.
williamr@4
   822
*/
williamr@4
   823
inline void CEikStatusPaneBase::SetObserver( MEikStatusPaneObserver* aObserver )
williamr@4
   824
    {
williamr@4
   825
    iObserver = aObserver;
williamr@4
   826
    }
williamr@4
   827
williamr@4
   828
/**
williamr@4
   829
* Gets the status pane rectangle.
williamr@4
   830
*/
williamr@4
   831
inline TRect CEikStatusPaneBase::Rect() const
williamr@4
   832
    {
williamr@4
   833
    return iModel->CurrentLayout()->Rect();
williamr@4
   834
    }
williamr@4
   835
williamr@4
   836
/**
williamr@4
   837
* Gets the window group that this status pane belongs to.
williamr@4
   838
*/
williamr@4
   839
inline RWindowGroup* CEikStatusPaneBase::WindowGroup() const
williamr@4
   840
    {
williamr@4
   841
    return iParentWindowGroup;
williamr@4
   842
    }
williamr@4
   843
williamr@4
   844
#endif // __EIKSPANE_H__