00001 /* 00002 * ============================================================================ 00003 * Name : AknEnv.h 00004 * Part of : Avkon 00005 * 00006 * Description: 00007 * Version: 00008 * 00009 * Copyright © 2002 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. All rights are reserved. Copying, 00013 * including reproducing, storing, adapting or translating, any 00014 * or all of this material requires the prior written consent of 00015 * Nokia Corporation. This material also contains confidential 00016 * information which may not be disclosed to others without the 00017 * prior written consent of Nokia Corporation. 00018 * ============================================================================ 00019 */ 00020 #if !defined(__AVKON_ENV_H__) 00021 #define __AVKON_ENV_H__ 00022 00023 // INCLUDES 00024 #include <eikenv.h> 00025 #include <eiksbfrm.h> 00026 #include <eikcba.h> 00027 #include <eikmobs.h> 00028 #include <eikmenub.h> 00029 #include <eikappui.h> 00030 #include <aknlayout2id.h> // for TAknLayoutId 00031 #include <akndef.h> // for TAknUiZoom 00032 00033 // FORWARD DECLARATIONS 00034 namespace AknLayout { class CInstance; } 00035 #start_since SINCE_3_1_SDK 00036 00039 namespace LayoutPack { class CInstance; } 00040 #end_since SINCE_3_1_SDK 00041 00042 class CCdlEngineRef; 00043 class MAknEditingStateIndicator; 00044 class MAknIntermediateState; 00045 class CAknAppUi; 00046 class CAknWaitDialog; 00047 class CEikListBox; 00048 class CAknSettingCache; 00049 class CAknFontRegistry; 00050 class CLafSystemFont; 00051 #start_since SINCE_3_1_SDK 00052 class TAknLayoutConfigScreenMode; 00053 class CCdlRefs; 00054 #end_since SINCE_3_1_SDK 00055 // Since there is no include of aknsystemfont.h we need the typedef CLafSystemFont here as well 00056 // Hence this requires parallel maintenance. 00057 typedef CLafSystemFont CAknSystemFont; 00058 00059 // MACROS 00060 // Color Macros 00067 // Color macros 00068 #define AKN_LAF_COLOR_ENV(env,nn) CAknEnv::AvkonColor(nn) 00069 #define AKN_LAF_COLOR(nn) CAknEnv::AvkonColor(nn) 00070 #define AKN_LAF_COLOR_STATIC(nn) CAknEnv::AvkonColor(nn) 00071 00072 // Avkon layout 00073 // IMPORT_C const AknLayout::CInstance& AknLayout() const; 00074 00075 00076 // CLASS DECLARATION 00077 00085 class CAknEnv : public CBase 00086 { 00087 public: 00097 IMPORT_C static CAknEnv* Static(); 00098 00102 IMPORT_C ~CAknEnv(); 00103 public: 00104 // this one creates an empty dialog. for list queries and popup lists with 00105 // "No Data" in it. 00113 IMPORT_C void ExecuteEmptyPopupListL(const TDesC *aEmptyText=0); 00114 00126 IMPORT_C void ExecuteEmptyPopupListL(const TDesC *aEmptyText, 00127 const TDesC *aTitle, 00128 TInt aSoftkeyId=0); 00129 00130 public: 00136 IMPORT_C void SetFepMenuObserver(MEikMenuObserver* aObserver); 00137 00143 IMPORT_C MEikMenuObserver* FepMenuObserver(); 00144 00150 IMPORT_C MAknEditingStateIndicator* EditingStateIndicator(); 00151 00152 00159 IMPORT_C MAknEditingStateIndicator* SwapEditingStateIndicator( 00160 MAknEditingStateIndicator* aIndicator); 00161 00165 IMPORT_C static void ExitForegroundAppL(); 00166 00167 public: // Intermediate states support 00175 IMPORT_C void RegisterIntermediateStateL(MAknIntermediateState *aState); 00176 00184 IMPORT_C void UnRegisterIntermediateState(MAknIntermediateState *aState); 00185 00189 IMPORT_C void CloseAllIntermediateStates(); 00190 00191 public: 00195 IMPORT_C static void RunAppShutter(); 00196 00204 IMPORT_C static CAknAppUi* AppWithShutterRunning(); 00205 00211 IMPORT_C static void StopSchedulerWaitWithBusyMessage( 00212 CActiveSchedulerWait& aWait); 00213 00214 public: 00220 IMPORT_C void CreateCbaObserverL(CEikButtonGroupContainer *aCba, 00221 CEikListBox *aListBox); 00222 00226 IMPORT_C void RemoveCbaObserver(); 00227 00228 00233 IMPORT_C void InformCbaDeletion(CEikButtonGroupContainer *aCba); 00234 00235 public: 00241 IMPORT_C void GetCurrentLayoutId(TAknLayoutId& aCurrentLayoutId) const; 00242 00248 IMPORT_C void GetCurrentGlobalUiZoom(TAknUiZoom& aCurrentGlobalUiZoom) const; 00249 00250 public: 00257 IMPORT_C TInt StatusPaneResIdForCurrentLayout(TInt aResId) const; 00258 00259 public: 00279 IMPORT_C TInt RequestWsBuffer( TInt aRequestedBufferSize ); 00280 00292 IMPORT_C void CancelWsBufferRequest( TInt aRequestID ); 00293 00294 public: 00298 IMPORT_C CAknSettingCache& SettingCache() const; 00299 00309 CAknFontRegistry& FontRegistry() const; 00310 00320 CArrayPtr<CAknSystemFont>* SystemFontArray() const; 00321 00322 void UpdateSystemFontsL(); 00323 00324 public: // layout 00325 00333 IMPORT_C TBool LoadAknLayoutL(); 00334 #start_since SINCE_3_1_SDK 00335 00343 IMPORT_C TBool LoadAknLayoutL(const TAknLayoutConfigScreenMode& aScreenMode); 00344 #end_since SINCE_3_1_SDK 00345 // Avkon layout 00352 IMPORT_C const AknLayout::CInstance& AknLayout() const; 00353 00354 public: // color support 00363 IMPORT_C static TRgb AvkonColor( TInt ); 00364 00365 public: // split view support 00371 IMPORT_C TBool SplitViewActive() const; 00372 00378 void SplitViewActive( const TBool aSplitViewActive ); 00379 00380 private: 00381 00382 void SetWsBufferSize(); 00383 void SetWsBufferSize( TInt aRequestedBufferSize ); 00384 00385 // Only these can use run info array, so it cannot get messed up 00386 // by simultaneous use. 00387 friend class AknBidiTextUtils; 00388 friend class TAknTextWrapper; 00389 00397 TBidirectionalState::TRunInfo* RunInfoArray( TInt& aLength ) const; 00398 00407 TInt PrepareRunInfoArray( const TDesC& aLogicalText ); 00408 00417 TInt SetRequiredRunInfoArraySize( TInt aLength ); 00418 00419 void SetLayoutRequirementsL(); 00420 void AssertLayoutLoaded(); 00421 TBool LoadAknLayoutL(TAknLayoutId aId, const TAknLayoutConfigScreenMode& aScreenMode, TAknUiZoom aUiZoom); 00422 TAknUiZoom ResolveCurrentUiZoom(); 00423 void FindAknLayoutL(TAknLayoutId aId, const TAknLayoutConfigScreenMode& aScreenMode, TAknUiZoom aUiZoom, CCdlRefs* aRefs, LayoutPack::CInstance*& aBestPack, TBool aStrict); 00424 00428 void SetConeFontSizeArrayL() const; 00429 00430 private: 00431 static TInt RealCloseIntermediateStates(TAny *aEnv); 00432 static TInt SchedulerStoppedCallBack(TAny* aWaitNote); 00433 void DoSchedulerStoppedCallBack(); 00434 00435 private: 00436 friend class LafEnv; 00437 00438 IMPORT_C static void InstallAknEnvAsExtensionL(CEikonEnv* aEnv); 00439 IMPORT_C CAknEnv(); 00440 IMPORT_C void ConstructL(); 00441 00442 private: 00443 MEikMenuObserver* iFepMenuObserver; 00444 MAknEditingStateIndicator* iEditStateIndicator; 00445 private: 00446 CArrayPtr<MAknIntermediateState> *iStateArray; 00447 CArrayPtr<CBase> *iDeleteArray; 00448 CIdle *iIdle; 00449 CAknWaitDialog* iBusyMsgDialog; 00450 TInt iBusyMsgCount; 00451 MEikCommandObserver *iCbaCommandObserver; 00452 CAknSettingCache* iSettingCache; 00453 TBidirectionalState::TRunInfo* iRunInfoArray; 00454 TInt iRunInfoArrayLength; 00455 00456 struct TWsBufferRequest 00457 { 00458 TInt iRequestID; 00459 TInt iRequestedSize; 00460 }; 00461 00462 RArray<TWsBufferRequest> iWsBufferRequestArray; 00463 TInt iRequestIdCounter; 00464 TInt iCurrentWsBufferRequest; 00465 00466 // cache for layout parameters 00467 TAknLayoutId iLastLayoutId; 00468 TInt iLastScreenMode; 00469 TAknUiZoom iLastZoom; 00470 00471 CEikonEnv* iCoeEnv; 00472 CAknFontRegistry* iFontRegistry; // Owned register of CAknLayoutFont pointers 00473 CCdlEngineRef* iCdlEngRef; 00474 const AknLayout::CInstance* iLayout; 00475 CArrayPtr<CAknSystemFont>* iSystemFontArray; // Not owned. System Font array is owned by CEikonEnv 00476 TBool iSplitViewActive; 00477 HBufC* iLastLayoutDll; 00478 CTransitionManager* iTransitionManager; 00479 }; 00480 00481 00482 #define iAvkonEnv (STATIC_CAST(CAknEnv*,iEikonEnv->Extension())) 00483 #define AVKONENV (STATIC_CAST(CAknEnv*, CEikonEnv::Static()->Extension())) 00484 00485 #endif