williamr@2: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2: // All rights reserved.
williamr@2: // This component and the accompanying materials are made available
williamr@4: // under the terms of "Eclipse Public License v1.0"
williamr@2: // which accompanies this distribution, and is available
williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2: //
williamr@2: // Initial Contributors:
williamr@2: // Nokia Corporation - initial contribution.
williamr@2: //
williamr@2: // Contributors:
williamr@2: //
williamr@2: // Description:
williamr@2: //
williamr@2:
williamr@2: /**
williamr@2: Gets the most recent standard event that was received by the application.
williamr@2:
williamr@2: Note: standard events are all events except redraw events and priority key events.
williamr@2:
williamr@2: @return The last event.
williamr@2: */
williamr@2: inline const TWsEvent& CCoeEnv::LastEvent() const
williamr@2: { return(iLastEvent); }
williamr@2:
williamr@2: /** Gets the application UI owned by this application.
williamr@2:
williamr@2: @return Pointer to the app UI owned by the application. */
williamr@2: inline CCoeAppUi* CCoeEnv::AppUi() const
williamr@2: { return(iAppUi); }
williamr@2:
williamr@2: /** Gets the file server session owned by this CCoeEnv.
williamr@2:
williamr@2: This session is normally only used for accessing the application's resource
williamr@2: file.
williamr@2:
williamr@2: @return The file server session owned by this CCoeEnv. */
williamr@2: inline RFs& CCoeEnv::FsSession() const
williamr@2: { return((RFs&)iFsSession); }
williamr@2:
williamr@2: /** Gets the window server session owned by the application.
williamr@2:
williamr@2: This provides access to window server functions not directly accessible via
williamr@2: the UI control framework.
williamr@2:
williamr@2: @return The window server session opened by the application. */
williamr@2: inline RWsSession& CCoeEnv::WsSession() const
williamr@2: { return((RWsSession&)iWsSession); }
williamr@2:
williamr@2: /** Gets the application's window group.
williamr@2:
williamr@2: Note: a window group is an invisible window which acts as the parent window for
williamr@2: all other windows in an application. Typically, each application has one window
williamr@2: group. In the window server, window groups are also the unit of keyboard focus.
williamr@2:
williamr@2: @return The application's window group. */inline RWindowGroup& CCoeEnv::RootWin() const
williamr@2: { return((RWindowGroup&)iRootWin); }
williamr@2:
williamr@2: /** Gets the system graphics context.
williamr@2:
williamr@2: This is the graphics context typically used for drawing controls, but an
williamr@2: alternative graphics context can be created if required using CreateGcL().
williamr@2:
williamr@2: @return The system graphics context. */
williamr@2: inline CWindowGc& CCoeEnv::SystemGc() const
williamr@2: { return((CWindowGc&)*iSystemGc); }
williamr@2:
williamr@2: /** Gets the normal environment font.
williamr@2:
williamr@2: This is the font created during construction of the control environment.
williamr@2:
williamr@2: @return Pointer to the normal environment font.
williamr@2: @see InitSystemFontsL() */
williamr@2: inline const CFont* CCoeEnv::NormalFont() const
williamr@2: { return(iNormalFont); }
williamr@2:
williamr@2: /** Gets the default screen device owned by this CCoeEnv.
williamr@2:
williamr@2: This is typically used as the standard screen device for the CCoeEnv's application.
williamr@2:
williamr@2: @return The default screen device owned by this CCoeEnv. */
williamr@2: inline CWsScreenDevice* CCoeEnv::ScreenDevice() const
williamr@2: { return(iScreen); }
williamr@2:
williamr@2: /** Gets the current error message text.
williamr@2:
williamr@2: @return The current error message text. */
williamr@2: inline TDes& CCoeEnv::ErrorText()
williamr@2: { return *iErrorText; }
williamr@2:
williamr@2: /** Gets the current error context text.
williamr@2:
williamr@2: @return The current error context text. */
williamr@2: inline TDes& CCoeEnv::ErrorContextText()
williamr@2: { return *iErrorContextText; }
williamr@2:
williamr@2: #if defined(_UNICODE)
williamr@2: /** Reads a resource into a descriptor.
williamr@2:
williamr@2: The descriptor must be long enough to contain the entire resource. No memory
williamr@2: is allocated by this function. If the read fails, the function sets an error
williamr@2: condition and performs any cleanup required. The error condition causes the
williamr@2: GUI to launch an alert window.
williamr@2:
williamr@2: Deprecated - Use CCoeEnv::ReadResourceL() instead.
williamr@2:
williamr@2: @deprecated
williamr@2: @param aDes On return, contains the resource data.
williamr@2: @param aResourceId The numeric ID of the resource to be read.
williamr@2: @see RResourceFile::ReadL()
williamr@2: @see KErrCoeFailedToReadFromProgDisk */
williamr@2: inline void CCoeEnv::ReadResource(TDes& aDes,TInt aResourceId) const
williamr@2: { ReadResourceAsDes16(aDes,aResourceId); }
williamr@2:
williamr@2: /** Reads a resource into a descriptor.
williamr@2:
williamr@2: The descriptor must be long enough to contain the entire resource.
williamr@2: No memory is allocated by this function.
williamr@2:
williamr@2: @param aDes On return, contains the resource data.
williamr@2: @param aResourceId The numeric ID of the resource to be read.
williamr@2: @return Pointer to a heap descriptor containing the resource. */
williamr@2: inline void CCoeEnv::ReadResourceL(TDes& aDes,TInt aResourceId) const
williamr@2: { ReadResourceAsDes16L(aDes,aResourceId); }
williamr@2:
williamr@2: /** Reads a resource into a heap descriptor, allocating memory for it.
williamr@2:
williamr@2: Note: the calling program must destroy the heap descriptor when it is no longer
williamr@2: needed.
williamr@2:
williamr@2: @param aResourceId The numeric ID of the resource to be read.
williamr@2: @return Pointer to a heap descriptor containing the resource data.
williamr@2: @see RResourceFile::AllocReadL() */
williamr@2: inline HBufC* CCoeEnv::AllocReadResourceL(TInt aResourceId) const
williamr@2: { return AllocReadResourceAsDes16L(aResourceId); }
williamr@2:
williamr@2: /** Reads a specified resource into a heap descriptor, allocating memory for it,
williamr@2: and pushing the descriptor onto the cleanup stack.
williamr@2:
williamr@2: The calling program should pop and destroy the heap descriptor when it is
williamr@2: no longer needed.
williamr@2:
williamr@2: @param aResourceId The numeric ID of the resource to be read.
williamr@2: @return Pointer to a heap descriptor containing the resource data.
williamr@2: @see RResourceFile::AllocReadLC() */
williamr@2: inline HBufC* CCoeEnv::AllocReadResourceLC(TInt aResourceId) const
williamr@2: { return AllocReadResourceAsDes16LC(aResourceId); }
williamr@2:
williamr@2: /** Reads a resource into a Unicode descriptor array.
williamr@2:
williamr@2: @param aResourceId The numeric ID of the resource to be read.
williamr@2: @return A pointer to the descriptor array containing the resource data.
williamr@2: @see TResourceReader::ReadDesCArrayL() */
williamr@2: inline CDesCArrayFlat* CCoeEnv::ReadDesCArrayResourceL(TInt aResourceId)
williamr@2: { return ReadDesC16ArrayResourceL(aResourceId); }
williamr@2: #else // not UNICODE
williamr@2:
williamr@2: /** Deprecated - use CCoeEnv::ReadResourceL() instead.
williamr@2:
williamr@2: @deprecated */
williamr@2: inline void CCoeEnv::ReadResource(TDes& aDes,TInt aResourceId) const
williamr@2: { ReadResourceAsDes8(aDes,aResourceId); }
williamr@2:
williamr@2: inline void CCoeEnv::ReadResourceL(TDes& aDes,TInt aResourceId) const
williamr@2: { ReadResourceAsDes8L(aDes,aResourceId); }
williamr@2: inline HBufC* CCoeEnv::AllocReadResourceL(TInt aResourceId) const
williamr@2: { return AllocReadResourceAsDes8L(aResourceId); }
williamr@2: inline HBufC* CCoeEnv::AllocReadResourceLC(TInt aResourceId) const
williamr@2: { return AllocReadResourceAsDes8LC(aResourceId); }
williamr@2: inline CDesCArrayFlat* CCoeEnv::ReadDesCArrayResourceL(TInt aResourceId)
williamr@2: { return ReadDesC8ArrayResourceL(aResourceId); }
williamr@2: #endif // UNICODE
williamr@2:
williamr@2: //
williamr@2: // Tests if the Active Scheduler is started in the CCoeEnv::ExecuteD
williamr@2: //
williamr@2: // @return "TBool"
williamr@2: // ETrue
if Active Scheduler is started in
williamr@2: // CCoeEnv::ExecuteD()
williamr@2: // EFalse
if Active Scheduler is not started in
williamr@2: // CCoeEnv::ExecuteD()
williamr@2: //
williamr@2: inline TBool CCoeEnv::IsSchedulerRunning() const
williamr@2: {return iEnvFlags&ESchedulerIsRunning;}