CCoeControlArray Class Reference

#include <mw/coecontrolarray.h>

Link against: cone.lib

class CCoeControlArray : public CBase

Inherits from

  • CCoeControlArray

    Nested Classes and Structures

    Detailed Description

    Class that represents an array of controls.

    The CCoeControlArray class is used to store the child controls of a container control. The method CCoeControl::InitComponentArrayL() must be used to create the array and the method CCoeControlArray& CCoeControl::Components() can be used to get this array.

    Member Enumeration Documentation

    Enum TEvent

    Defines the possible events related to a change to the contents of the array.

    EnumeratorValueDescription
    EControlAdded

    A control has been added to the array

    EControlRemoved

    A control has been removed from the array

    Constructor & Destructor Documentation

    ~CCoeControlArray ( )

    IMPORT_C~CCoeControlArray()

    The destructor will delete the controls in the array only if the EControlsOwnedExternally flag is not set.

    Member Function Documentation

    AppendLC ( CCoeControl *, TInt )

    IMPORT_C TCursorAppendLC(CCoeControl *aControl,
    TIntaControlId =  KCoeNoControlId
    )

    Appends a control at the end of the array.

    ParameterDescription
    aControlThe control to add
    aControlIdThe id for the new control

    Returns: A cursor to the added control

    At ( TInt )

    IMPORT_C TCoeControlWithIdAt(TIntaIndex)

    Gets the element at the given index.

    ParameterDescription
    aIndexThe index of the control

    Returns: The control and its id

    At ( TInt )

    IMPORT_C const TCoeControlWithIdAt(TIntaIndex)const

    Gets the element at the given index.

    ParameterDescription
    aIndexThe index of the control

    Returns: The control and its id

    Begin ( )

    IMPORT_C TCursorBegin()const

    Gets a cursor that points to the first element of the array. Note that if the array is empty this is actually equivalent to a call to End().

    Returns: A cursor that points to the first control in the array.

    ControlById ( TInt )

    T *ControlById(TIntaControlId)

    Gets the control with the given id.

    ParameterDescription
    aControlIdThe id of the desired control.

    Returns: The control with the given id.

    ControlById ( TInt )

    const T *ControlById(TIntaControlId)const

    Gets the control with the given id.

    ParameterDescription
    aControlIdThe id of the desired control.

    Returns: The control with the given id.

    ControlsOwnedExternally ( )

    IMPORT_C TBoolControlsOwnedExternally()const

    This function checks if the controls are owned by the array or not. If the controls are owned by the array they will be deleted when the array is destroyed else they will not.

    Returns: ETrue if the array does NOT own the controls, EFalse if the array owns the controls.

    Count ( )

    IMPORT_C TIntCount()const

    Gets the number of elements in the array.

    Returns: The number of elements in the array

    End ( )

    IMPORT_C TCursorEnd()const

    Gets a cursor to the position right after the last element in the array. To get the last element use Prev(). This cursor is useful as argument to the insertion function to add the new control at the end of the array.

    Returns: A cursor that points right after the last element

    Find ( const CCoeControl * )

    IMPORT_C TCursorFind(const CCoeControl *aControl)const

    Gets a cursor to the control, if the control is found in the array. Use the TCursor::IsValid function to check that the search found something or not.

    ParameterDescription
    aControlThe control to find.

    Returns: A cursor to the control. This may be an invalid cursor if we didn't find the requested control. Use TCursor::IsValid() to check if the cursor is valid.

    Find ( TInt )

    IMPORT_C TCursorFind(TIntaControlId)const

    Gets a cursor to the control, if the control with the given id is found in the array. Use the TCusror::IsValid function to check that the search found something or not.

    ParameterDescription
    aControlIdThe id of the control to find.

    Returns: A cursor to the control. This may be an invalid cursor if we didn't find the requested control. Use TCursor::IsValid() to check if the cursor is valid.

    Id ( const CCoeControl & )

    IMPORT_C TIntId(const CCoeControl &aControl)const

    Gets the id of the control.

    ParameterDescription
    aControlThe control

    Returns: The id of the control or KErrNotFound if the control can't be found.

    InsertAfterLC ( TInt, CCoeControl *, TInt )

    IMPORT_C TCursorInsertAfterLC(TIntaInsertAfterId,
    CCoeControl *aControl,
    TIntaControlId =  KCoeNoControlId
    )

    Inserts a control after the control with the given id.

    Each array has an owner (an instance of the CCoeControl class) which is the container of all the child controls. Each control has a parent and for the child controls this parent must be the container. This function will automatically update the parent of aControl.

    The function will also result in the CCoeControl::HandleControlArrayEventL method being called on the owner of the array. The event being generated is EControlAdded.

    leave
    KErrLocked if the array has been locked using the CCoeControlArray::SetArrayLocked() function.
    leave
    KErrNotFound if the array doesn't contain a control identified by aInsertAfterId.
    ParameterDescription
    aInsertAfterIdThe id of the control after which we want to insert the new control. If a control with this id can't be found in the array the function will leave with KErrNotFound.
    aControlThe new control we want to add.
    aControlIdThe id of the new control.

    Returns: A cursor to the added control

    InsertLC ( TCursor &, CCoeControl *, TInt )

    IMPORT_C TCursorInsertLC(TCursor &aInsertAt,
    CCoeControl *aControl,
    TIntaControlId =  KCoeNoControlId
    )

    Inserts a control at the given position.

    Each array has an owner (an instance of the CCoeControl class) which is the container of all the child controls. Each control has a parent and for the child controls this parent must be the container. This function will automatically update the parent of aControl.

    The function will also result in the CCoeControl::HandleControlArrayEventL method being called on the owner of the array. The event being generated is EControlAdded.

    leave
    KErrLocked if the array has been locked using the CCoeControlArray::SetArrayLocked() function.
    ParameterDescription
    aInsertAtThe position at which we want to insert the new control.
    aControlThe new control we want to add.
    aControlIdThe id of the new control.

    Returns: A cursor to the added control

    IsArrayLocked ( )

    IMPORT_C TBoolIsArrayLocked()const

    Checks whether the array is locked or not. If an array is locked any attempt to add or remove controls will fail with KErrLocked.

    Returns: ETrue if the array is locked, EFalse otherwise

    NewL ( CCoeControl & )

    IMPORT_C CCoeControlArray *NewL(CCoeControl &aOwner)[static]

    Creates a new CCoeControlArray.

    ParameterDescription
    aOwnerThe control that owns the new array

    Returns: A new CCoeControlArray instance

    Remove ( const CCoeControl * )

    IMPORT_C TIntRemove(const CCoeControl *aControl)

    Removes a control but does NOT delete the control itself. The ownership of the control is transferred to the caller.

    The function will also result in the CCoeControl::HandleControlArrayEventL method being called on the owner of the array. The event being generated is EControlRemoved.

    ParameterDescription
    aControlThe control to remove

    Returns: KErrNone if the control was removed successfully, KErrNotFound if the control could not be found.

    Remove ( TCursor )

    IMPORT_C CCoeControl *Remove(TCursoraRemoveAt)

    Removes a control but does NOT delete the control itself. The ownership of the control is transferred to the caller.

    The function will also result in the CCoeControl::HandleControlArrayEventL method being called on the owner of the array. The event being generated is EControlRemoved.

    ParameterDescription
    aRemoveAtThe position of the control to remove

    Returns: A pointer to the control that has been removed. This can be used by the caller to delete the control.

    RemoveById ( TInt )

    IMPORT_C CCoeControl *RemoveById(TIntaControlId)

    Removes a control but does NOT delete the control itself. The ownership of the control is transferred to the caller.

    The function will also result in the CCoeControl::HandleControlArrayEventL method being called on the owner of the array. The event being generated is EControlRemoved.

    ParameterDescription
    aControlIdThe id of the control to remove

    Returns: A pointer to the control that has been removed. This can be used by the caller to delete the control. The function returns NULL if no control with the given aControlId has been found.

    Replace ( CCoeControl *, CCoeControl * )

    IMPORT_C TIntReplace(CCoeControl *aOriginalControl,
    CCoeControl *aNewControl
    )

    Replaces a control in the array with another control.

    ParameterDescription
    aOriginalControlThe control that must be replaced
    aNewControlThe new control

    Returns: A standard error code

    Reset ( )

    IMPORT_C voidReset()

    Removes all the controls from the array but doesn't delete them.

    ResetAndDestroy ( )

    IMPORT_C voidResetAndDestroy()

    Removes all the controls from the array and deletes them.

    SetArrayLocked ( )

    IMPORT_C voidSetArrayLocked()

    Locks the array. If an array is locked any attempt to add or remove controls will fail with KErrLocked.

    SetControlsOwnedExternally ( TBool )

    IMPORT_C voidSetControlsOwnedExternally(TBoolaOwnedExternally)

    Is used to set whether the array owns the controls or not. If the controls are owned by the array they will be deleted when the array is destroyed else they will not.

    ParameterDescription
    aOwnedExternallyETrue if the controls are owned externally, EFalse if they are owned by the array.

    Sort ( TLinearOrder< TCoeControlWithId > )

    IMPORT_C voidSort(TLinearOrder< TCoeControlWithId >aOrder)

    This function provides a pluggable implementation to sort the array of controls.

    ParameterDescription
    aOrderThe user defined static method which implements the algorithm for sorting.

    SortById ( )

    IMPORT_C voidSortById()

    Sorts the controls using their index as the key.