Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Location: mtudcbas.h
Link against: mtur.lib

Class CBaseMtmUiData

CBaseMtmUiData

Support

Supported from 5.0

Description

Base class for UI Data MTM components.

CBaseMtmUiData-derived classes allow message client applications to customise dynamically their user interfaces for a particular message type. For example, if a message client application currently had a fax entry selected, then it could use the fax MTM’s concrete class to get information on the menus and icons that it should display.

Specifically, functionality falls into the following three areas:

Message client applications use the class to access such functionality polymorphically. MTM implementers implement this class to provide such functionality for their message protocol.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CBaseMtmUiDataBase class for UI Data MTM components

Defined in CBaseMtmUiData:
CBaseMtmUiData(), CBitmapArray, CanCancelL(), CanCloseEntryL(), CanCopyMoveFromEntryL(), CanCopyMoveToEntryL(), CanCreateEntryL(), CanDeleteFromEntryL(), CanDeleteServiceL(), CanEditEntryL(), CanForwardEntryL(), CanOpenEntryL(), CanReplyToEntryL(), CanUnDeleteFromEntryL(), CanViewEntryL(), ConstructL(), ContextIcon(), CreateBitmapsL(), FunctionRecognised(), GetResourceFileName(), MtmSpecificFunctions(), OperationSupportedL(), PopulateArraysL(), QueryCapability(), ReadFunctionsFromResourceFileL(), StatusTextL(), Type(), iCoeEnv, iIconArrays, iMtmSpecificFunctions, ~CBaseMtmUiData()

Inherited from CBase:
operator new()


Construction, initialisation, and destruction


CBaseMtmUiData()

protected: CBaseMtmUiData(CRegisteredMtmDll& aRegisteredMtmDll);

Description

Creates a CBaseMtmUiData and initialises its private member variables. Client applications do not use this function. It is relevant only to implementers of derived classes.

Derived classes can implement a constructor to perform any additional MTM-specific setup that can be safely carried out in a constructor. Such constructors must call the base class constructor function.

Parameters

CRegisteredMtmDll& aRegisteredMtmDll

Registration data for the DLL.


ConstructL()

protected: void ConstructL();

Description

Implements two-phase construction functions (NewL(), ConstructL()) to create a new instance of the object. Client applications do not use this function. It is relevant only to implementers of derived classes.

The function should perform any necessary dynamic allocation. ConstructL() should be called from the NewL() function of the derived class.

The default implementation of this function initiates the loading of required resources:

Derived classes can implement this function to perform any additional MTM-specific second stage construction tasks that they require. Implementations must call the base class ConstructL() function.

Concrete MTMs must also implement a factory function by which a MTM registry can request an instance of the class:

Leave codes

 

Dependent on the implementation, this function may leave with system error codes.

See also:


PopulateArraysL()

protected: virtual void PopulateArraysL() = 0;

Description

Initialises bitmaps and function information. Client applications do not use this function. It is relevant only to implementers of derived classes.

Requirements:

This function is called by the base class ConstructL() function. Implementations should provide this function to:

Leave codes

 

Dependent on the implementation, this function may leave with system error codes.


GetResourceFileName()

protected: virtual void GetResourceFileName(TFileName& aFileName) const = 0;

Description

Gets the resource file name. Client applications do not use this function. It is relevant only to implementers of derived classes.

Requirements:

Each UI Data MTM can have a resource file associated with it. Implementations should set aFilename to the full path and name of this resource file. The function is called by CBaseMtmUiData::ConstructL(), which then loads the resource file.

Parameters

TFileName& aFileName

Filename buffer to be filled with the resource file path and name


~CBaseMtmUiData()

virtual ~CBaseMtmUiData();

Description

Cleans up the base class. CBaseMtmUiData-derived objects must be deleted by client applications when they are no longer required. Clean up includes:

Derived classes can implement a destructor to do any additional clean up tasks that they require.

[Top]


Accessors


Type()

TUid Type() const;

Description

Gets the Type UID of the message type associated with the UI Data MTM.

Return value

TUid

UID of the message type associated with the MTM

[Top]


Context-specific icons


ContextIcon()

virtual const CBitmapArray& ContextIcon(const TMsvEntry& aContext) const = 0;

Support

Withdrawn in 5.1

Description

Gets an array of bitmaps relevant to the passed context entry. The bitmaps within the array should be representations of the same bitmap at various sizes.

Requirements:

Implementations should check the type of the context, using TMsvEntry::iType::iUid, and on this basis return the appropriate bitmap array for that context type.

Parameters

const TMsvEntry& aContext

Context entry to return the icons for.

Return value

CBitmapArray&

Bitmap array for the given context..


ContextIcon()

virtual const CBitmapArray& ContextIcon(const TMsvEntry& aContext, TInt aStateFlags) const = 0;

Support

Supported from 5.1

Description

Gets an array of bitmaps relevant to the passed context entry. The bitmaps within the array should be representations of the same bitmap at various sizes.

The aStateFlags argument indicates the user interface state, for example, "open", of the entry.

Requirements:

Implementations should check the type of the context, using TMsvEntry::iType::iUid, and the passed state, and return an appropriate bitmap array.

Parameters

const TMsvEntry& aContext

Context entry to return the icons for.

TInt aStateFlags

Flasgs indicating the user interface state of the entry.

Return value

CBitmapArray&

Bitmap array for the given context..

See also:

[Top]


MTM-specific function information


MtmSpecificFunctions()

const CArrayFix<TMtmUiFunction>& MtmSpecificFunctions() const;

Description

Gets an array of MTM-specific operations that can be carried out through the associated User Interface MTM’s CBaseMtmUi::InvokeSyncFunctionL()/InvokeAsyncFunctionL() functions.

It is intended that message client applications will use this function to add dynamically user interface features, such as menu items, dependent on the MTM type of the entry currently selected within the application. Message client applications can also use OperationSupportedL() to check dynamically if a particular operation is appropriate to a particular entry.

Implementers should note that this function returns a pointer to the iMtmSpecificFunctions data member.

Return value

CArrayFix<TMtmUiFunction>&

Array of operations relevant to the MTM and context.


FunctionRecognised()

TBool FunctionRecognised(TInt aFunctionId) const;

Description

Tests if an operation with the specified ID is recognised by the UI Data MTM.

Implementers should note that this function searches the iMtmSpecificFunctions array for the aFunctionId.

Parameters

TInt aFunctionId

The operation to check

Return value

TBool

ETrue: operation aFunctionId is supported by this UI Data MTM. EFalse: operation aFunctionId is not supported by this UI Data MTM.

[Top]


Context-specific information


CanCancelL()

virtual TBool CanCancelL(const TMsvEntry& aContext, TInt& aReasonResourceId) const = 0;

Support

Supported from 6.0

Description

Tests if the current operation on the entry can be cancelled.

Parameters

const TMsvEntry& aContext

The entry to which the operation applies.

TInt& aReasonResourceId

On return, a resource string ID, or 0 if operation is supported.

Return value

TBool

KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry.


CanCloseEntryL()

virtual TBool CanCloseEntryL(const TMsvEntry& aContext, TInt& aReasonResourceId) const = 0;

Description

Tests if a close operation is supported.

Parameters

const TMsvEntry& aContext

The entry to which the operation applies.

TInt& aReasonResourceId

On return, a resource string ID, or 0 if operation is supported.

Return value

TBool

KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry.


CanCopyMoveFromEntryL()

virtual TBool CanCopyMoveFromEntryL(const TMsvEntry& aContext, TInt& aReasonResourceId) const = 0;

Description

Tests whether a copy from or move from operation is supported.

Parameters

const TMsvEntry& aContext

The entry to which the operation applies.

TInt& aReasonResourceId

On return, a resource string ID or 0.

Return value

TBool

KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry.


CanCopyMoveToEntryL()

virtual TBool CanCopyMoveToEntryL(const TMsvEntry& aContext, TInt& aReasonResourceId) const = 0;

Description

Tests if a copy from or move to operation is supported.

Parameters

const TMsvEntry& aContext

The entry to which the operation applies.

TInt& aReasonResourceId

On return, a resource string ID or 0.

Return value

TBool

KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry.


CanCreateEntryL()

virtual TBool CanCreateEntryL(const TMsvEntry& aParent, const TMsvEntry& aNewEntry, TInt& aReasonResourceId) const = 0;

Description

Tests if an entry can be created as a child.

Parameters

const TMsvEntry& aParent

The entry under which aNewEntry should be created.

const TMsvEntry& aNewEntry

The entry to which the operation applies.

TInt& aReasonResourceId

On return, a resource string ID or 0.

Return value

TBool

KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry.


CanDeleteFromEntryL()

virtual TBool CanDeleteFromEntryL(const TMsvEntry& aContext, TInt& aReasonResourceId) const = 0;

Description

Tests if a delete operation is supported.

Parameters

const TMsvEntry& aContext

The entry to which the operation applies.

TInt& aReasonResourceId

On return, a resource string ID or 0.

Return value

TBool

KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry.


CanDeleteServiceL()

virtual TBool CanDeleteServiceL(const TMsvEntry& aService, TInt& aReasonResourceId) const = 0;

Description

Tests if the service entry can be deleted.

Parameters

const TMsvEntry& aService

The service entry to which the operation applies.

TInt& aReasonResourceId

On return, a resource string ID or 0.

Return value

TBool

KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry.


CanEditEntryL()

virtual TBool CanEditEntryL(const TMsvEntry& aContext, TInt& aReasonResourceId) const = 0;

Description

Tests if the entry can be edited.

Parameters

const TMsvEntry& aContext

The entry to which the operation applies.

TInt& aReasonResourceId

On return, a resource string ID or 0.

Return value

TBool

KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry.


CanForwardEntryL()

virtual TBool CanForwardEntryL(const TMsvEntry& aContext, TInt& aReasonResourceId) const = 0;

Description

Tests if an entry can be forwarded.

Parameters

const TMsvEntry& aContext

The entry to which the operation applies.

TInt& aReasonResourceId

On return, a resource string ID or 0.

Return value

TBool

KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry.


CanOpenEntryL()

virtual TBool CanOpenEntryL(const TMsvEntry& aContext, TInt& aReasonResourceId) const = 0;

Description

Tests if an entry can be opened.

Parameters

const TMsvEntry& aContext

The entry to which the operation applies.

TInt& aReasonResourceId

On return, a resource string ID or 0.

Return value

TBool

KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry.


CanReplyToEntryL()

virtual TBool CanReplyToEntryL(const TMsvEntry& aContext, TInt& aReasonResourceId) const = 0;

Description

Tests if an entry can be replied to.

Parameters

const TMsvEntry& aContext

The entry to which the operation applies.

TInt& aReasonResourceId

On return, a resource string ID or 0.

Return value

TBool

KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry.


CanViewEntryL()

virtual TBool CanViewEntryL(const TMsvEntry& aContext, TInt& aReasonResourceId) const = 0;

Description

Tests if an entry can be viewed.

Parameters

const TMsvEntry& aContext

The entry to which the operation applies.

TInt& aReasonResourceId

On return, a resource string ID or 0.

Return value

TBool

KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry.


CanUnDeleteFromEntryL()

virtual TBool CanUnDeleteFromEntryL(const TMsvEntry& aContext, TInt& aReasonResourceId) const;

Support

Supported from 6.0

Description

Tests if the entry can be undeleted.

Parameters

const TMsvEntry& aContext

The entry to which the operation applies.

TInt& aReasonResourceId

On return, a resource string ID or 0.

Return value

TBool

KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry.

[Top]


MTM-specific functionality


OperationSupportedL()

virtual TInt OperationSupportedL(TInt aOperationId, const TMsvEntry& aContext) const = 0;

Description

Tests if an MTM-specific operation is appropriate to the specified entry. The operation specified must have been obtained from a call to MtmSpecificFunctions().

It is intended that client applications will use this function to select dynamically the MTM-specific user interface features available dependent on the entry currently selected within the application.

Requirements:

Implementations should check the type of the context, using TMsvEntry::iType::iUid, and use any other information required available from the context, to determine if the operation is supported.

Parameters

TInt aOperationId

ID of operation to query.

const TMsvEntry& aContext

The entry to which the operation applies.

Return value

TInt

KErrNone: operation is appropriate to User Interface MTM and entry. Other: if the operation is not appropriate on the entry, then this is the ID of a string in the UI Data MTM’s resource file that explains why not.


QueryCapability()

virtual TInt QueryCapability(TUid aFunctionId, TInt& aResponse) const = 0;

Description

Queries if the MTM supports a particular capability, specified by a UID.

Requirements:

Implementations should check aCapability for the standard capability values and return a suitable response in aResponse. If aFunctionId is unknown, return KErrNotSupported.

Parameters

TUid aFunctionId

UID of capability to be queried

TInt& aResponse

Response value. The format of the response varies according to the capability.

Return value

TInt

KErrNone: aFunctionId is a recognised value and a response is returned KErrNotSupported: aFunctionId is not a recognised value

See also:


StatusTextL()

virtual HBufC* StatusTextL(const TMsvEntry& aContext) const = 0;

Support

Supported from 6.0

Description

Provides status text for the sending state of the entry.

Parameters

const TMsvEntry& aContext

Entry to query

Return value

HBufC*

Descriptor containing status text.

[Top]


Utility


ReadFunctionsFromResourceFileL()

protected: void ReadFunctionsFromResourceFileL(TInt aResourceId);

Description

Implementers of derived classes can call this class to fill the iMtmSpecificFunctions array with MTM-specific operation definitions from the UI Data MTM’s resource file. Client applications do not use this function. It is relevant only to implementers of derived classes.

For each MTM-specific operation definition in the resource file, it adds a corresponding TMtmUiFunction object to iMtmSpecificFunctions.

The function is typically called from PopulateArraysL().

Parameters

TInt aResourceId

Resource ID of MTM-specific operation definition array

Leave codes

 

This function may leave with system error codes.


CreateBitmapsL()

protected: void CreateBitmapsL(TInt aNumZoomStates, const TDesC& aBitmapFile, TInt aStartBitmap, TInt aEndBitmap);

Description

Fills the iIconArrays array with icon bitmaps from an EPOC mbm file. Client applications do not use this function. It is relevant only to implementers of derived classes.

The bitmaps to load must be contiguous within the file between the positions indicated by aStartBitmap and aEndBitmap.

The function is typically called from PopulateArraysL().

Parameters

TInt aNumZoomStates

Number of zoom states for each icon. This is used as the array size of each element in iIconArrays.

const TDesC& aBitmapFile

Filename of .mbm format bitmap array file.

TInt aStartBitmap

First bitmap within the file for this MTM.

TInt aEndBitmap

Final bitmap within the file for this MTM.

Leave codes

 

This function may leave with system error codes.

[Top]


Protected data members


iCoeEnv

CCoeEnv* iCoeEnv

Description

CONE environment object. It is set by the constructor.


iIconArrays

CArrayPtr<CBitmapArray>* iIconArrays

Description

The array that stores the arrays of icon bitmaps for the UI Data MTM. Items are added to the array by PopulateArraysL().


iMtmSpecificFunctions

CArrayFix<TMtmUiFunction>* iMtmSpecificFunctions

Description

The array that stores MTM-specific function information for the UI Data MTM. Items are added to the array by ReadFunctionsFromResourceFileL().

[Top]


Typedefs


Typedef CBitmapArray

typedef CArrayPtr<CFbsBitmap> CBitmapArray;

Support

Supported from 5.0

Description

Defines an array of icon bitmaps for the UI Data MTM. It is used in the definition of CBaseMtmUiData::iIconArrays.

[Top]


Class CBaseMtmUiData::TMtmUiFunction

CBaseMtmUiData::TMtmUiFunction

Support

Supported from 5.0

Description

Provides the interface for clients to access MTM-specific functions, and present these functions to the user. A message client application can use this information to customise the UI.

The class encapsulates information relating to an MTM-specific operation:

Defined in CBaseMtmUiData::CBaseMtmUiData::TMtmUiFunction:
Anonymous, ECaptionMaxLen, TMtmUiFunction(), iCaption, iFlags, iFunctionId, iFunctionType, iPreferredHotKeyKeyCode, iPreferredHotKeyModifiers

See also:


Constructors

TMtmUiFunction()


TMtmUiFunction(const TDesC& aCaption, TInt aFunctionId, TInt aHotKey, TInt aModifiers, TInt aFlags=0);

Support

Withdrawn in 5.1

Description

Creates a TMtmUiFunction with the specified values.

Parameters

const TDesC& aCaption

String, suitable for a menu, describing the operation

TInt aFunctionId

The ID that can be used to invoke the operation

TInt aHotKey

Character code for a suggested hotkey for the operation

TInt aModifiers

Suggested key modifiers for the hotkey.

TInt aFlags=0

Flags setting characteristics of the operation: for details

See also:

TMtmUiFunction()


TMtmUiFunction(const TMtmUiFunction& aFunc);        

Support

Supported from 5.1

Description

Creates a TMtmUiFunction by copying another TMtmUiFunction. Its action is the same as the default copy constructor, except that it will panic in debug builds if multiple location flags are set in aFunc.

Parameters

TMtmUiFunction& aFunc

TMtmUiFunction to copy

TMtmUiFunction()


TMtmUiFunction(TResourceReader& aResourceReader);        

Description

Creates a TMtmUiFunction with its values read from the resource file location specified by TResourceReader. This position should be at a MTUD_FUNCTION resource.

Parameters

TResourceReader& aResourceReader

Position in UI Data MTM resource file to read operation


Data members

iCaption


TBuf<ECaptionMaxLen> iCaption

Description

String, suitable for a menu, describing the operation

iPreferredHotKeyKeyCode


TInt iPreferredHotKeyKeyCode

Description

Character code for a suggested hotkey for the operation

iPreferredHotKeyModifiers


TInt iPreferredHotKeyModifiers

Description

Suggested key modifiers for the hotkey.

iFunctionId


TInt iFunctionId

Description

The ID that can be used to invoke the operation

iFlags


TInt iFlags

Description

Flags setting characteristics of the operation

iFunctionType


TUint8 iFunctionType

Support

Supported from 5.1

Description

Flags setting location characteristics of the operation


Enum Anonymous

Anonymous

Description

Enum to define UI Data base class constants.

ECaptionMaxLen

Maximum length for operation caption. Used in defining iCaption.