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 CEikStatusPaneBaseExtension;
00029 class CAknStatuspaneClearer;
00030 class CAknDelayedForegroundObserver;
00031 class CAknStatusPaneDataSubscriber;
00032 class TAknsItemID;
00033
00038 const TInt KStatusPaneCapsPresentBit = 1;
00039
00044 const TInt KStatusPaneCapsAppOwnedBit = 2;
00045
00050 const TInt KStatusPaneCapsInCurrentLayoutBit = 4;
00051
00058 class MEikStatusPaneObserver
00059 {
00060 public:
00061 virtual void HandleStatusPaneSizeChange() = 0;
00062 };
00063
00067 class CEikStatusPaneBase : public CBase
00068 {
00069
00070 public:
00071
00075 class TPaneCapabilities
00076 {
00077
00078 public:
00079
00083 TPaneCapabilities();
00084
00091 inline TBool IsPresent() const;
00092
00100 inline TBool IsAppOwned() const;
00101
00107 inline TBool IsInCurrentLayout() const;
00108
00109 private:
00110
00111 inline void SetPresent();
00112 inline void SetAppOwned();
00113 inline void SetInCurrentLayout();
00114
00115 private:
00116
00117 TInt iFlags;
00118
00119 private:
00120
00121 friend class CEikStatusPaneBase;
00122 };
00123
00124 public:
00125
00129 IMPORT_C ~CEikStatusPaneBase();
00130
00138 IMPORT_C static CEikStatusPaneBase* Current();
00139
00145 inline void SetObserver( MEikStatusPaneObserver* aObserver );
00146
00158 IMPORT_C void ReduceRect( TRect& aBoundingRect ) const;
00159
00171 IMPORT_C void GetShapeL( TRegion& aRegion,
00172 TBool aIncludeAppPanes,
00173 TBool aIncludeServerPanes ) const;
00174
00202 IMPORT_C virtual void SwitchLayoutL( TInt aLayoutResourceId );
00203
00210 IMPORT_C virtual void MakeVisible( TBool aVisible );
00211
00218 IMPORT_C virtual void SetDimmed( TBool aDimmed );
00219
00225 IMPORT_C virtual void SetFaded( TBool aFaded );
00226
00234 IMPORT_C virtual void HandleResourceChange( TInt aType );
00235
00241 IMPORT_C virtual TBool OkToChangeStatusPaneNow();
00242
00250 IMPORT_C void SetFlags( TInt aFlags );
00251
00257 IMPORT_C TInt Flags() const;
00258
00264 IMPORT_C TBool IsVisible() const;
00265
00271 IMPORT_C TBool IsDimmed() const;
00272
00278 IMPORT_C TBool IsFaded() const;
00279
00287 IMPORT_C TPaneCapabilities PaneCapabilities( TPaneId aPaneId ) const;
00288
00300 IMPORT_C TRect PaneRectL( TPaneId aPaneId ) const;
00301
00312 IMPORT_C CCoeControl* ControlL( TPaneId aPaneId ) const;
00313
00329 IMPORT_C CCoeControl* SwapControlL( TPaneId aPaneId,
00330 CCoeControl* aNewControl );
00331
00346 IMPORT_C CCoeControl* ContainerControlL( TPaneId aPaneId ) const;
00347
00353 inline RWindowGroup* WindowGroup() const;
00354
00358 IMPORT_C void DrawNow();
00359
00366 IMPORT_C TInt CurrentLayoutResId() const;
00367
00371 enum TDrawCmd
00372 {
00374 ENoDraw,
00375
00377 EDrawNow,
00378
00380 EDrawDeferred
00381 };
00382
00393 void SetCbaAreaBackgroundID( const TAknsItemID& aBgID,
00394 CEikStatusPaneBase::TDrawCmd aDrawCmd );
00395
00403 TAknsItemID CbaAreaBackgroundID();
00404
00405 protected:
00406
00414 IMPORT_C CEikStatusPaneBase( CEikonEnv& aEikEnv, RWindowGroup* aParent );
00415
00421 IMPORT_C void BaseConstructL( TInt aCoreResId );
00422
00430 virtual CEikStatusPaneModelBase* CreateModelL( TInt aCoreResId ) const = 0;
00431
00435 void CreatePanesL();
00436
00442 void CreatePaneL( const TEikStatusPaneInit& aPaneInit );
00443
00451 CEikStatusPaneContainer* Find( TPaneId aPaneId ) const;
00452
00460 virtual TBool IsApp() const = 0;
00461
00467 inline TRect Rect() const;
00468
00475 void DoDrawNow( TDrawCmd aDraw );
00476
00482 CAknStatuspaneClearer* Clearer();
00483
00489 IMPORT_C void DisableClearer( TBool aDisabled );
00490
00495 IMPORT_C void CommonPrepareForAppExit();
00496
00497 private:
00498
00499 void DoSwitchLayoutL( TInt aLayoutResourceId, TDrawCmd aDraw );
00500 void ApplyLayoutL( CEikStatusPaneLayout* aLayout, TDrawCmd aDraw );
00501 void SetAllInvisible();
00502 void SetNotNeededInvisible();
00503
00504 public:
00505
00511 void ReportSizeChange();
00512
00513 private:
00514
00515 class TSetRectAndVisibility : public MEikStatusPaneLayoutTreeVisitor
00516 {
00517 public:
00518
00519 TSetRectAndVisibility( TBool aIsApp, CEikStatusPaneBase* aStatusPane );
00520 void VisitL( CEikStatusPaneLayoutTree* aNode );
00521
00522 private:
00523
00524 TBool iIsApp;
00525 CEikStatusPaneBase* iStatusPane;
00526 };
00527
00528 friend class TSetRectAndVisibility;
00529
00530 private:
00531
00532 void SetLastUsedResourceId( TInt aResourceId );
00533 TInt LastUsedResourceId();
00534 TInt ReadInitialUsedResourceIdL( TInt aCoreResId );
00535 TInt InitialUsedResourceId();
00536 TRect LargestBoundingRect( TRegion& aWholeRegion,
00537 TRegion& aRemovedRegion ) const;
00538
00539 protected:
00540
00546 CAknStatusPaneDataSubscriber* DataSubscriber() const;
00547
00554 void SetInitialUsedResourceId( TInt aResourceId );
00555
00566 void OptimizeClearerWindowShape( TInt aOldResourceId,
00567 TInt aNewResourceId,
00568 TRegion& aRegion );
00569
00576 void SetStoreHandler( RWindow* aWindow, TBool aOn );
00577
00578 protected:
00579
00584 CEikonEnv& iEikEnv;
00585
00590 CEikStatusPaneModelBase* iModel;
00591
00595 TInt iFlags;
00596
00597 protected:
00598
00599 typedef CArrayPtrFlat<CEikStatusPaneContainer> CContainerControls;
00600 CContainerControls* iControls;
00601
00602 private:
00603
00604 MEikStatusPaneObserver* iObserver;
00605 RWindowGroup* iParentWindowGroup;
00606 CEikStatusPaneBaseExtension* iExtension;
00607 };
00608
00618 NONSHARABLE_CLASS( CEikStatusPane ) : public CEikStatusPaneBase,
00619 public MCoeForegroundObserver
00620 {
00621 public:
00622
00636 IMPORT_C static CEikStatusPane* NewL(
00637 CEikonEnv& aEikEnv,
00638 RWindowGroup* aParent,
00639 TInt aCoreStatusPaneModelResId,
00640 TInt aAppStatusPaneModelResId = EEikStatusPaneUseDefaults );
00641
00645 IMPORT_C ~CEikStatusPane();
00646
00651 IMPORT_C void ApplyCurrentSettingsL();
00652
00657 IMPORT_C void PrepareForAppExit();
00658
00666 IMPORT_C virtual void MakeVisible( TBool aVisible );
00667
00675 IMPORT_C virtual void SetDimmed( TBool aDimmed );
00676
00683 IMPORT_C virtual void SetFaded( TBool aFaded );
00684
00693 IMPORT_C virtual void HandleResourceChange( TInt aType );
00694
00701 IMPORT_C virtual TBool OkToChangeStatusPaneNow();
00702
00703 private:
00704
00715 CEikStatusPane( CEikonEnv& aEikEnv,
00716 RWindowGroup* aParent,
00717 TInt aAppStatusPaneModelId );
00718
00724 void ConstructL( TInt aCoreStatusPaneModelResId );
00725
00731 virtual CEikStatusPaneModelBase* CreateModelL( TInt aCoreResId ) const;
00732
00739 TBool IsApp() const;
00740
00744 void ApplyCurrentFlags();
00745
00750 void HideAppPanes( TBool aHide );
00751
00752 private:
00753
00757 void HandleGainingForeground();
00758
00762 void HandleLosingForeground();
00763
00764 private:
00765
00773 TInt ReadInitialUsedResourceIdL( TInt aCoreResId,
00774 TInt aAppStatusPaneModelResId );
00775
00779 void DoHandleLosingForegroundL();
00780
00781 private:
00782
00783 TInt iAppDeclId;
00784
00786 TAny* iSpare;
00787
00789 CAknDelayedForegroundObserver* iDelayedForegroundObserver;
00790 };
00791
00797 inline TBool CEikStatusPaneBase::TPaneCapabilities::IsPresent() const
00798 {
00799 return iFlags & KStatusPaneCapsPresentBit;
00800 }
00801
00806 inline TBool CEikStatusPaneBase::TPaneCapabilities::IsAppOwned() const
00807 {
00808 return iFlags & KStatusPaneCapsAppOwnedBit;
00809 }
00810
00814 inline TBool CEikStatusPaneBase::TPaneCapabilities::IsInCurrentLayout() const
00815 {
00816 return iFlags & KStatusPaneCapsInCurrentLayoutBit;
00817 }
00818
00822 inline void CEikStatusPaneBase::SetObserver( MEikStatusPaneObserver* aObserver )
00823 {
00824 iObserver = aObserver;
00825 }
00826
00830 inline TRect CEikStatusPaneBase::Rect() const
00831 {
00832 return iModel->CurrentLayout()->Rect();
00833 }
00834
00838 inline RWindowGroup* CEikStatusPaneBase::WindowGroup() const
00839 {
00840 return iParentWindowGroup;
00841 }
00842
00843 #endif // __EIKSPANE_H__