Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: apgdoor.h
Link against: apgrfx.lib

Class CApaDoor

CApaDoor

Support

Supported from 5.0

Description

A wrapper for an embedded document that can be displayed in a user interface as an icon or a glass door.

Derivation

CApaDoorA wrapper for an embedded document that can be displayed in a user interface as an icon or a glass door
CApaDoorBaseThe base class for the graphic representation of an embedded document
CBaseBase class for all classes to be instantiated on the heap
CPictureAbstract base class for: drawing a picture to a graphics context, storing and restoring the picture

Defined in CApaDoor:
AppUidL(), Capability(), Caption(), DetachFromStoreL(), DocumentL(), Draw(), GetCropInTwips(), GetOriginalSizeInTwips(), NewL(), NewLC(), RestoreL(), ScaleFactorHeight(), ScaleFactorWidth(), SetCropInTwips(), SetFormatToGlassL(), SetFormatToIconL(), SetFormatToTemporaryIconL(), SetScaleFactor(), StoreL(), ~CApaDoor()

Inherited from CApaDoorBase:
EGlassDoor, EIconic, ETemporarilyIconic, ExternalizeBaseStreamL(), Format(), GlassDoorSize(), InternalizeBaseStreamL(), SetSource(), Source(), TFormat

Inherited from CBase:
operator new()

Inherited from CPicture:
AddCropInPixels(), EDetachDraw, EDetachFull, ExternalizeL(), GetSizeInPixels(), GetSizeInTwips(), LineBreakPossible(), ResetToOriginal(), SetSizeInPixels(), SetSizeInTwips(), TDetach


Construction and destruction


NewL()

static CApaDoor* NewL(RFs& aFs,CApaDocument& aDoc,const TSize& aDefaultIconSizeInTwips);

Support

Supported from 6.0

Description

Creates a new wrapper for the specified embedded document.

The door is of the specified size.

The wrapper takes ownership of the document; if creation of the wrapper fails, the document object is destroyed.

Parameters

CApaDocument& aDoc

The document for which the wrapper is to be created.

const TSize& aDefaultIconSizeInTwips

The size of the door in twips.

RFs&

A file server session.

Return value

CApaDoor*

The new embedded document wrapper object.


NewLC()

static CApaDoor* NewLC(RFs& aFs,CApaDocument& aDoc,const TSize& aDefaultIconSizeInTwips);

Support

Supported from 6.0

Description

Creates a new wrapper for the specified embedded document and places a pointer to it onto the cleanup stack.

The door is of the specified size.

The wrapper takes ownership of the document; if creation of the wrapper fails, the document object is destroyed.

Parameters

CApaDocument& aDoc

The document for which the door is to be created.

const TSize& aDefaultIconSizeInTwips

The size of the door in twips.

RFs&

A file server session.

Return value

CApaDoor*

The new embedded document wrapper object.


NewL()

static CApaDoor* NewL(CApaDocument& aDoc,const TSize& aDefaultIconSizeInTwips);

Support

Withdrawn in 6.0

Description

Creates a new wrapper for the specified embedded document.

The door is of the specified size.

The wrapper takes ownership of the document; if creation of the wrapper fails, the document object is destroyed.

Parameters

CApaDocument& aDoc

The document for which the door is to be created

const TSize& aDefaultIconSizeInTwips

The size of the door in twips.

Return value

CApaDoor*

The new embedded document wrapper object.


NewLC()

static CApaDoor* NewLC(CApaDocument& aDoc,const TSize& aDefaultIconSizeInTwips);

Support

Withdrawn in 6.0

Description

Creates a new wrapper for the specified embedded document and places a pointer to it onto the cleanup stack.

The door is of the specified size.

The wrapper takes ownership of the document; if creation of the wrapper fails, the document object is destroyed.

Parameters

CApaDocument& aDoc

The document for which the door is to be created.

const TSize& aDefaultIconSizeInTwips

The size of the door in twips.

Return value

CApaDoor*

The new embedded document wrapper object.


~CApaDoor()

~CApaDoor();

Description

Destructor.

Frees all resources owned by the object, prior to its destruction. In particular, it destroys the document, removing all references to it from the application process.

[Top]


Format changing


SetFormatToGlassL()

void SetFormatToGlassL();

Description

Sets the format of the door to glass.

The function asks the document to create a fresh copy of the door and destroys any existing copy. If the process of creating the door completes without leaving, but returns a zero pointer, then the function raises an APGRFX 17 panic.

The function leaves with:

If the function leaves, the format remains unchanged.

See also:


SetFormatToIconL()

void SetFormatToIconL();

Description

Sets the format of the door to iconic.

The application's icon is used, or, if this cannot be found, the default icon is used instead. The function leaves only if construction of the default icon object fails.


SetFormatToTemporaryIconL()

void SetFormatToTemporaryIconL(TBool aEnabled=ETrue);

Description

Switches the format of the door between temporarily iconic and glass.

If the door is iconic, then the function does nothing.

Parameters

TBool aEnabled

If ETrue and the format is currently glass, then the format switches to temporarily iconic; this is the default. If EFalse and the format is currently temporarily iconic, then the format switches to glass.

[Top]


Document and application information


DocumentL()

CApaDocument* DocumentL(TBool aCheckPassword=EFalse);

Description

Returns a pointer to the embedded document represented by this wrapper.

If necessary, the document is restored from its embedded store.

Note that if the wrapper does not have a reference to the embedded document store, then the function raises a APGRFX 13 panic. Constructing this wrapper through a TApaPictureFactory or storing the embedded document through CApaDoor::StoreL() ensures that this wrapper has a reference to the embedded document store.

Parameters

TBool aCheckPassword

If ETrue, any password is checked before returning a pointer to the document. If EFalse, the password is not checked.

Return value

CApaDocument*

A pointer to the embedded document.

See also:


AppUidL()

TUid AppUidL() const;

Description

Gets the application specific UID associated with the embedded document.

Return value

TUid

The application specific UID.


Caption()

TDesC* Caption() const;

Description

Gets the name of the application with which the embedded document is associated.

Return value

TDesC*

A pointer to a descriptor containing the name of the application.

[Top]


Persistence


StoreL()

TStreamId StoreL(CStreamStore& aStore) const;

Description

Stores the embedded document in the specified store as an embedded store.

This function saves the format of the door. It also stores the document, if the document exists in memory, otherwise, it simply copies the stream containing the embedded document into the specified store.

Parameters

CStreamStore& aStore

The store into which the embedded document is to be stored.

Return value

TStreamId

The stream ID of the head stream for the embedded document. This stream contains the stream dictionary through which the embedded document and its door can be restored.


RestoreL()

void RestoreL(const CStreamStore& aStore,TStreamId aHeadStreamId);

Description

Restores the embedded document from the specified store.

The format of the door is set to iconic if the embedded document is password protected.

Parameters

const CStreamStore& aStore

The store from which the embedded document is to be restored.

TStreamId aHeadStreamId

The stream ID of the head stream for the embedded document. This stream contains the stream dictionary through which the embedded document and its door can be restored.


DetachFromStoreL()

void DetachFromStoreL(TDetach aDegree=EDetachFull);

Description

Detaches the door from its store, restoring any unrestored elements of the picture, if necessary.

Parameters

TDetach aDegree=EDetachFull

Degree to which picture is detached.

See also:

[Top]


Drawing


Draw()

void Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,MGraphicsDeviceMap* aMap) const;

Description

Draws the door either as glass or as an icon depending on the format.

Parameters

CGraphicsContext& aGc

The graphics context.

const TPoint& aTopLeft

The co-ordinates where the top left corner pixel of the picture should be placed. Note that whether this is actually drawn depends on the clipping area defined.

const TRect& aClipRect

A clipping rectangle.

MGraphicsDeviceMap* aMap

The device map for the graphics device.

[Top]


Picture scaling


SetScaleFactor()

void SetScaleFactor(TInt aScaleFactorWidth,TInt aScaleFactorHeight);

Description

Sets the door's scale factors.

Parameters

TInt aScaleFactorWidth

The width scale factor, in percent.

TInt aScaleFactorHeight

The height scale factor, in percent.


ScaleFactorWidth()

TInt ScaleFactorWidth() const;

Description

Gets the door's width scale factor.

Return value

TInt

The width scale factor, in percent.


ScaleFactorHeight()

TInt ScaleFactorHeight() const;

Description

Gets the door's height scale factor.

Return value

TInt

The height scale factor, in percent.


GetOriginalSizeInTwips()

void GetOriginalSizeInTwips(TSize& aSize) const;

Description

Get the door's original size, in twips.

Parameters

TSize& aSize

The size, in twips.

[Top]


Picture cropping


SetCropInTwips()

void SetCropInTwips(const TMargins& aMargins);

Description

Sets the cropping margins of a picture in twips.

These are relative to the original unscaled size of the picture.

Parameters

const TMargins& aMargins

The cropping margins, in twips.


GetCropInTwips()

void GetCropInTwips(TMargins& aMargins) const;

Description

Gets the cropping margins of the door in twips.

These margins are relative to the original unscaled size of the picture.

Parameters

TMargins& aMargins

The cropping margins, in twips.

[Top]


Status


Capability()

TPictureCapability Capability() const;

Description

Gets the picture's capabilities.

These include whether it is scalable and croppable.

Return value

TPictureCapability

The capabilities of the picture.