00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __EIKSPANE_H__
00020 #define __EIKSPANE_H__
00021
00022 #include <eikspmod.h>
00023 #include <coecntrl.h>
00024 #include <coecobs.h>
00025
00026 class CCoeBrushAndPenContext;
00027 class CEikStatusPaneContainer;
00028 class TEikStatusPaneSyncDrawer;
00029 class CEikStatusPaneBaseExtension;
00030 class CAknStatuspaneClearer;
00031 class CAknDelayedForegroundObserver;
00032 class CAknStatusPaneDataSubscriber;
00033 class TAknsItemID;
00034
00035 const TInt KStatusPaneCapsPresentBit = 1;
00036 const TInt KStatusPaneCapsAppOwnedBit = 2;
00037 const TInt KStatusPaneCapsInCurrentLayoutBit = 4;
00038
00045 class MEikStatusPaneObserver
00046 {
00047 public:
00048 virtual void HandleStatusPaneSizeChange() = 0;
00049 };
00050
00054 class CEikStatusPaneBase : public CBase
00055 {
00056
00057 public:
00058
00062 class TPaneCapabilities
00063 {
00064
00065 public:
00066
00070 TPaneCapabilities();
00071
00078 inline TBool IsPresent() const;
00079
00087 inline TBool IsAppOwned() const;
00088
00094 inline TBool IsInCurrentLayout() const;
00095
00096 private:
00097
00098 inline void SetPresent();
00099 inline void SetAppOwned();
00100 inline void SetInCurrentLayout();
00101
00102 private:
00103
00104 TInt iFlags;
00105
00106 private:
00107
00108 friend class CEikStatusPaneBase;
00109 };
00110
00111 public:
00112
00116 IMPORT_C ~CEikStatusPaneBase();
00117
00125 IMPORT_C static CEikStatusPaneBase* Current();
00126
00132 inline void SetObserver( MEikStatusPaneObserver* aObserver );
00133
00145 IMPORT_C void ReduceRect( TRect& aBoundingRect ) const;
00146
00157 IMPORT_C void GetShapeL( TRegion& aRegion,
00158 TBool aIncludeAppPanes,
00159 TBool aIncludeServerPanes ) const;
00160
00188 IMPORT_C virtual void SwitchLayoutL( TInt aLayoutResourceId );
00189
00196 IMPORT_C virtual void MakeVisible( TBool aVisible );
00197
00204 IMPORT_C virtual void SetDimmed( TBool aDimmed );
00205
00211 IMPORT_C virtual void SetFaded( TBool aFaded );
00212
00220 IMPORT_C virtual void HandleResourceChange( TInt aType );
00221
00227 IMPORT_C virtual TBool OkToChangeStatusPaneNow();
00228
00236 IMPORT_C void SetFlags( TInt aFlags );
00237
00243 IMPORT_C TInt Flags() const;
00244
00250 IMPORT_C TBool IsVisible() const;
00251
00257 IMPORT_C TBool IsDimmed() const;
00258
00264 IMPORT_C TBool IsFaded() const;
00265
00272 IMPORT_C TPaneCapabilities PaneCapabilities( TPaneId aPaneId ) const;
00273
00283 IMPORT_C TRect PaneRectL( TPaneId aPaneId ) const;
00284
00293 IMPORT_C CCoeControl* ControlL( TPaneId aPaneId ) const;
00294
00308 IMPORT_C CCoeControl* SwapControlL( TPaneId aPaneId,
00309 CCoeControl* aNewControl );
00310
00323 IMPORT_C CCoeControl* ContainerControlL( TPaneId aPaneId ) const;
00324
00330 inline RWindowGroup* WindowGroup() const;
00331
00335 IMPORT_C void DrawNow();
00336
00343 IMPORT_C TInt CurrentLayoutResId() const;
00344
00348 enum TDrawCmd
00349 {
00351 ENoDraw,
00352
00354 EDrawNow,
00355
00357 EDrawDeferred
00358 };
00359
00370 void SetCbaAreaBackgroundID( const TAknsItemID& aBgID,
00371 CEikStatusPaneBase::TDrawCmd aDrawCmd );
00372
00380 TAknsItemID CbaAreaBackgroundID();
00381
00382 protected:
00383
00391 IMPORT_C CEikStatusPaneBase( CEikonEnv& aEikEnv, RWindowGroup* aParent );
00392
00398 IMPORT_C void BaseConstructL( TInt aCoreResId );
00399
00406 virtual CEikStatusPaneModelBase* CreateModelL( TInt aCoreResId ) const = 0;
00407
00411 void CreatePanesL();
00412
00418 void CreatePaneL( const TEikStatusPaneInit& aPaneInit );
00419
00426 CEikStatusPaneContainer* Find( TPaneId aPaneId ) const;
00427
00432 virtual TBool IsApp() const = 0;
00433
00439 inline TRect Rect() const;
00440
00447 void DoDrawNow( TDrawCmd aDraw );
00448
00454 CAknStatuspaneClearer* Clearer();
00455
00461 IMPORT_C void DisableClearer( TBool aDisabled );
00462
00467 IMPORT_C void CommonPrepareForAppExit();
00468
00469 private:
00470
00471 void DoSwitchLayoutL( TInt aLayoutResourceId, TDrawCmd aDraw );
00472 void ApplyLayoutL( CEikStatusPaneLayout* aLayout, TDrawCmd aDraw );
00473 void SetAllInvisible();
00474 void SetNotNeededInvisible();
00475
00476 public:
00477
00483 void ReportSizeChange();
00484
00485 private:
00486
00487 class TSetRectAndVisibility : public MEikStatusPaneLayoutTreeVisitor
00488 {
00489 public:
00490
00491 TSetRectAndVisibility( TBool aIsApp, CEikStatusPaneBase* aStatusPane );
00492 void VisitL( CEikStatusPaneLayoutTree* aNode );
00493
00494 private:
00495
00496 TBool iIsApp;
00497 CEikStatusPaneBase* iStatusPane;
00498 };
00499
00500 friend class TSetRectAndVisibility;
00501
00502 private:
00503
00504 void SetLastUsedResourceId( TInt aResourceId );
00505 TInt LastUsedResourceId();
00506 TInt ReadInitialUsedResourceIdL( TInt aCoreResId );
00507 TInt InitialUsedResourceId();
00508 TRect LargestBoundingRect( TRegion& aWholeRegion,
00509 TRegion& aRemovedRegion ) const;
00510
00511 protected:
00512
00518 CAknStatusPaneDataSubscriber* DataSubscriber() const;
00519
00526 void SetInitialUsedResourceId( TInt aResourceId );
00527
00538 void OptimizeClearerWindowShape( TInt aOldResourceId,
00539 TInt aNewResourceId,
00540 TRegion& aRegion );
00541
00548 void SetStoreHandler( RWindow* aWindow, TBool aOn );
00549
00550 protected:
00551
00556 CEikonEnv& iEikEnv;
00557
00562 CEikStatusPaneModelBase* iModel;
00563
00567 TInt iFlags;
00568
00569 protected:
00570
00571 typedef CArrayPtrFlat<CEikStatusPaneContainer> CContainerControls;
00572 CContainerControls* iControls;
00573
00574 private:
00575 MEikStatusPaneObserver* iObserver;
00576 RWindowGroup* iParentWindowGroup;
00577 CEikStatusPaneBaseExtension* iExtension;
00578 };
00579
00589 NONSHARABLE_CLASS(CEikStatusPane) : public CEikStatusPaneBase,
00590 public MCoeForegroundObserver
00591 {
00592 public:
00605 IMPORT_C static CEikStatusPane* NewL(
00606 CEikonEnv& aEikEnv,
00607 RWindowGroup* aParent,
00608 TInt aCoreStatusPaneModelResId,
00609 TInt aAppStatusPaneModelResId = EEikStatusPaneUseDefaults );
00610
00614 IMPORT_C ~CEikStatusPane();
00615
00620 IMPORT_C void ApplyCurrentSettingsL();
00621
00626 IMPORT_C void PrepareForAppExit();
00627
00635 IMPORT_C virtual void MakeVisible( TBool aVisible );
00636
00644 IMPORT_C virtual void SetDimmed( TBool aDimmed );
00645
00652 IMPORT_C virtual void SetFaded( TBool aFaded );
00653
00662 IMPORT_C virtual void HandleResourceChange( TInt aType );
00663
00670 IMPORT_C virtual TBool OkToChangeStatusPaneNow();
00671
00672 private:
00673 CEikStatusPane( CEikonEnv& aEikEnv,
00674 RWindowGroup* aParent,
00675 TInt aAppStatusPaneModelId );
00676
00677 void ConstructL( TInt aCoreStatusPaneModelResId );
00678
00679 virtual CEikStatusPaneModelBase* CreateModelL( TInt aCoreResId ) const;
00680 TBool IsApp() const;
00681
00682 void ApplyCurrentFlags();
00683 void HideAppPanes( TBool aHide );
00684
00685 private:
00686 void HandleGainingForeground();
00687 void HandleLosingForeground();
00688
00689 private:
00690 TInt ReadInitialUsedResourceIdL( TInt aCoreResId,
00691 TInt aAppStatusPaneModelResId );
00692 void DoHandleLosingForegroundL();
00693
00694 private:
00695 TInt iAppDeclId;
00696
00698 TEikStatusPaneSyncDrawer* iSyncDrawer;
00699
00701 CAknDelayedForegroundObserver*iDelayedForegroundObserver;
00702 };
00703
00709 inline TBool CEikStatusPaneBase::TPaneCapabilities::IsPresent() const
00710 { return iFlags & KStatusPaneCapsPresentBit; }
00711
00716 inline TBool CEikStatusPaneBase::TPaneCapabilities::IsAppOwned() const
00717 { return iFlags & KStatusPaneCapsAppOwnedBit; }
00718
00722 inline TBool CEikStatusPaneBase::TPaneCapabilities::IsInCurrentLayout() const
00723 { return iFlags & KStatusPaneCapsInCurrentLayoutBit; }
00724
00728 inline void CEikStatusPaneBase::SetObserver(MEikStatusPaneObserver* aObserver)
00729 { iObserver = aObserver; }
00730
00731 inline TRect CEikStatusPaneBase::Rect() const
00732 { return iModel->CurrentLayout()->Rect(); }
00733
00734 inline RWindowGroup* CEikStatusPaneBase::WindowGroup() const
00735 { return iParentWindowGroup; }
00736
00737
00738 #endif