00001
00002
00003
00004
00005
00006 #if !defined(__EIKSPMOD_H__)
00007 #define __EIKSPMOD_H__
00008
00009 #if !defined(__E32BASE_H__)
00010 #include <e32base.h>
00011 #endif
00012
00013 #if !defined(__EIKON_HRH__)
00014 #include <uikon.hrh>
00015 #endif
00016
00017 #if !defined(__EIKSRVC_H__)
00018 #include <eiksrvc.h>
00019 #endif
00020
00021
00022 class TResourceReader;
00023 class CEikStatusPaneLayoutTree;
00024 class CEikonEnv;
00025 class CAknSgcClient;
00026 class CEikStatusPaneLayout;
00027 namespace AknLayout { class CInstance; }
00028 namespace AknLayoutScalable_Avkon { class CInstance; }
00029
00030
00031 const TInt KEikStatusPaneDirectionBit = 0x04;
00032 const TInt KEikStatusPaneHiddenBit = 0x08;
00033 const TInt KEikStatusPaneInitInitializedBit = 0x80000000;
00034
00035
00036 typedef TUid TPaneId;
00037
00044 class TEikStatusPaneInit
00045 {
00046 public:
00050 TEikStatusPaneInit();
00051
00055 TEikStatusPaneInit(const TEikStatusPaneInit& aCopy);
00056
00060 TEikStatusPaneInit& operator=(const TEikStatusPaneInit& aCopy);
00061
00066 inline TPaneId Id() const;
00067
00076 void LoadDefaults(TResourceReader& aResource);
00077
00083 inline TBool AppOwned() const;
00084
00089 inline TInt ControlTypeId() const;
00090
00095 inline TInt ControlResourceId() const;
00096
00100 inline void SetHidden();
00101
00105 inline void ClearHidden();
00106
00111 inline TBool IsHidden() const;
00112
00113 private:
00118 inline TBool Initialized();
00119
00123 inline void SetInitialized();
00124
00125 private:
00126 TPaneId iId;
00127 TInt iControlId;
00128 TInt iControlResource;
00129 TInt iFlags;
00130 };
00131
00132
00138 NONSHARABLE_CLASS(CEikStatusPaneSetInit) : public CArrayFixFlat<TEikStatusPaneInit>
00139 {
00140 public:
00141
00145 static CEikStatusPaneSetInit* NewL();
00146
00150 ~CEikStatusPaneSetInit();
00151
00159 void LoadDefaultsL(TResourceReader& aResource);
00160
00166 TEikStatusPaneInit& FindL(const TPaneId& aPaneId);
00167
00168 private:
00169
00173 CEikStatusPaneSetInit();
00174 };
00175
00176
00182 class MEikStatusPaneLayoutTreeVisitor
00183 {
00184 public:
00191 virtual void VisitL(CEikStatusPaneLayoutTree* aNode) = 0;
00192 };
00193
00194
00195
00202 NONSHARABLE_CLASS(CEikStatusPaneLayoutTree) : public CBase
00203 {
00204 public:
00205 enum TDirection
00206 {
00208 EHorizontal,
00210 EVertical
00211 };
00212
00213 public:
00217 ~CEikStatusPaneLayoutTree();
00218
00225 static CEikStatusPaneLayoutTree* NewL(CEikStatusPaneLayout* aLayout, TResourceReader& aResource, TDirection aDefaultDirection = EHorizontal);
00226
00233 CEikStatusPaneLayoutTree* Find(const TPaneId& aPaneId);
00234
00240 void AcceptL(MEikStatusPaneLayoutTreeVisitor* aVisitor);
00241
00246 inline TPaneId Id() const;
00247
00252 inline TRect Rect() const;
00253
00265 TRect AknLayoutRect(TInt aLayoutResourceId, TPaneId aPaneId);
00266
00267 private:
00268
00274 CEikStatusPaneLayoutTree(CEikStatusPaneLayout* aLayout, TDirection aDefaultDirection);
00275
00280 void ConstructL(TResourceReader& aResource);
00281
00286 void SetRect(const TRect& aRect);
00287
00292 inline TDirection Direction();
00293
00298 void SetDirection(TDirection aDirection);
00299
00304 inline TInt Size();
00305
00310 inline TBool Stretchable();
00311
00316 void SetStretchable(TBool aStretchable);
00317
00322 void Layout();
00323
00336 void Layout(TInt aLayoutResourceId);
00337
00346 void SetAknLayoutUsed(TBool aAknLayoutUsed);
00347
00356 TBool AknLayoutUsed();
00357
00358 private:
00359 TPaneId iId;
00360 TInt iFlags;
00361 TRect iRect;
00362 TInt iSize;
00363
00364 typedef CArrayPtrFlat<CEikStatusPaneLayoutTree> CSubPaneArray;
00365 CSubPaneArray* iSubPanes;
00366
00367 CEikStatusPaneLayout* iLayout;
00368
00369 private:
00370 friend class CEikStatusPaneLayout;
00371 };
00372
00373
00380 NONSHARABLE_CLASS(CEikStatusPaneLayout) : public CBase
00381 {
00382 public:
00388 static CEikStatusPaneLayout* NewL(TResourceReader& aResource, const TRect& aScreenRect);
00389
00396 static CEikStatusPaneLayout* NewL(TResourceReader& aResource, const TRect& aScreenRect, TInt aLayoutId);
00397
00401 ~CEikStatusPaneLayout();
00402
00408 inline CEikStatusPaneLayoutTree* Find(const TPaneId& aPaneId) const;
00409
00414 inline void AcceptL(MEikStatusPaneLayoutTreeVisitor* aVisitor);
00415
00420 inline TRect Rect() const;
00421
00430 void AknLayoutRefresh(TInt aLayoutResourceId);
00431
00441 TBool AknLayoutUsed();
00442
00454 TRect AknLayoutRect(TInt aLayoutResourceId, TPaneId aPaneId);
00455
00456 private:
00457
00461 CEikStatusPaneLayout();
00462
00466 void ConstructL(TResourceReader& aResource, const TRect& aScreenRect, TInt aLayoutId);
00467
00468 private:
00469 CEikStatusPaneLayoutTree* iRoot;
00470
00471 private:
00472
00477 void UpdateLayoutData(TInt aLayoutResId);
00478
00479 private:
00480 friend class CEikStatusPaneLayoutTree;
00481 const AknLayout::CInstance& iAknLayout;
00482 const AknLayoutScalable_Avkon::CInstance& iAknLayoutScalable_Avkon;
00483 TRect iScreenRect;
00484 TRect iMainPaneRect;
00485 TRect iUsualStatusPaneRect;
00486 TRect iApplicationWindowRect;
00487 TRect iStaconLayout1Rect;
00488 TRect iStaconLayout2Rect;
00489 TRect iSmallStatusPaneRect;
00490 };
00491
00492
00498 class CEikStatusPaneModelBase : public CBase
00499 {
00500 public:
00501
00505 IMPORT_C ~CEikStatusPaneModelBase();
00506
00511 inline CEikStatusPaneSetInit* PaneInits() const;
00512
00518 IMPORT_C virtual void SetLayoutL(TInt aLayoutResId, TBool aChangeStatusPaneNow = ETrue);
00519
00524 inline CEikStatusPaneLayout* CurrentLayout() const;
00525
00530 IMPORT_C TInt CurrentLayoutResId() const;
00531
00540 void AknLayoutRefresh();
00541
00552 TBool AknLayoutUsed(TInt aLayoutId);
00553
00554 protected:
00555
00560 NONSHARABLE_CLASS(CIdLayoutPair) : public CBase
00561 {
00562 public:
00568 CIdLayoutPair(TInt aResId, CEikStatusPaneLayout* aLayout);
00572 ~CIdLayoutPair();
00573 public:
00574 TInt iResId;
00575 CEikStatusPaneLayout* iLayout;
00576 };
00577 typedef CArrayPtrFlat<CIdLayoutPair> CLayoutIdSet;
00578 typedef CArrayFixFlat<TInt> CIdSet;
00579
00580 protected:
00581
00586 IMPORT_C CEikStatusPaneModelBase(CEikonEnv& aEikEnv);
00587
00592 IMPORT_C void BaseConstructL(TInt aCoreResId);
00593
00598 IMPORT_C CEikStatusPaneLayout* LoadLayoutL(TInt aLayoutResId);
00599
00604 inline CIdSet* LegalIds() const;
00605
00611 TBool IsLegalId(TInt aLayoutResId) const;
00612
00613 private:
00618 CEikStatusPaneLayout* Layout(TInt aLayoutResId);
00619
00624 void CheckLayoutL(CEikStatusPaneLayout* aLayout);
00625
00626 private:
00627 IMPORT_C virtual void Reserved_1();
00628
00629 private:
00630 NONSHARABLE_CLASS(TLayoutChecker) : public MEikStatusPaneLayoutTreeVisitor
00631 {
00632 public:
00633 TLayoutChecker(CEikStatusPaneSetInit* aPanes);
00634 void VisitL(CEikStatusPaneLayoutTree* aNode);
00635 private:
00636 CEikStatusPaneSetInit* iPanes;
00637 };
00638
00639 protected:
00640 CLayoutIdSet* iLayouts;
00641 TInt iCurrentResId;
00642 CEikonEnv& iEikEnv;
00643
00644 private:
00645 CEikStatusPaneSetInit* iPanes;
00646 CEikStatusPaneLayout* iCurrentLayout;
00647 CIdSet* iLegalIds;
00648 };
00649
00650
00656 NONSHARABLE_CLASS(CEikAppStatusPaneModel) : public CEikStatusPaneModelBase
00657 {
00658 public:
00668 static CEikAppStatusPaneModel* NewL(CEikonEnv& aEikEnv, TInt aCoreResId, TInt aAppResId = EEikStatusPaneUseDefaults, TBool aChangeStatusPaneNow = ETrue);
00669
00673 ~CEikAppStatusPaneModel();
00674
00678 void ApplyCurrentLayoutL();
00679
00680 public:
00684 void SetLayoutL(TInt aLayoutResId, TBool aChangeStatusPaneNow = ETrue);
00685 public:
00689 void SetLayoutL(TInt aLayoutResId, TBool aChangeStatusPaneNow, TBool aNotfiyServerSide);
00690
00691 private:
00692 CEikAppStatusPaneModel(CEikonEnv& aEikEnv);
00693 void ConstructL(TInt aCoreResId, TInt aAppResId, TBool aChangeStatusPaneNow = ETrue);
00694 };
00695
00696
00697 inline TPaneId TEikStatusPaneInit::Id() const { return iId; }
00698 inline TBool TEikStatusPaneInit::AppOwned() const { return iFlags & EEikStatusPaneAppOwned; }
00699 inline TInt TEikStatusPaneInit::ControlTypeId() const { return iControlId; }
00700 inline TInt TEikStatusPaneInit::ControlResourceId() const { return iControlResource; }
00701 inline void TEikStatusPaneInit::SetHidden() {iFlags|=KEikStatusPaneHiddenBit;}
00702 inline void TEikStatusPaneInit::ClearHidden() {iFlags&=~KEikStatusPaneHiddenBit;}
00703 inline TBool TEikStatusPaneInit::IsHidden() const {return iFlags&KEikStatusPaneHiddenBit;}
00704
00705 inline CEikStatusPaneLayoutTree* CEikStatusPaneLayout::Find(const TPaneId& aPaneId) const { return iRoot->Find(aPaneId); }
00706 inline void CEikStatusPaneLayout::AcceptL(MEikStatusPaneLayoutTreeVisitor* aVisitor) { iRoot->AcceptL(aVisitor); }
00707 inline TRect CEikStatusPaneLayout::Rect() const { return iRoot->Rect(); }
00708
00709 inline TPaneId CEikStatusPaneLayoutTree::Id() const { return iId; }
00710 inline TRect CEikStatusPaneLayoutTree::Rect() const { return iRect; }
00711
00712
00713 inline CEikStatusPaneSetInit* CEikStatusPaneModelBase::PaneInits() const { return iPanes; }
00714 inline CEikStatusPaneLayout* CEikStatusPaneModelBase::CurrentLayout() const { return iCurrentLayout; }
00715 inline CEikStatusPaneModelBase::CIdSet* CEikStatusPaneModelBase::LegalIds() const { return iLegalIds; }
00716
00717 #endif