class CCoeControlArray : public CBase |
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.
Private Member Functions | |
---|---|
CCoeControlArray ( CCoeControl &) | |
IMPORT_C CCoeControl * | CtrlById ( TInt ) |
TInt | IndexById ( TInt ) |
Public Member Enumerations | |
---|---|
enum | TEvent { EControlAdded , EControlRemoved } |
Private Attributes | |
---|---|
RArray < TCoeControlWithId > | iControls |
TInt | iFlags |
CCoeControl & | iOwner |
IMPORT_C | CCoeControlArray | ( | CCoeControl & | aOwner | ) | [private] |
Constructor
CCoeControl & aOwner | The control that owns the new array |
IMPORT_C | ~CCoeControlArray | ( | ) |
The destructor will delete the controls in the array only if the EControlsOwnedExternally flag is not set.
IMPORT_C TCursor | AppendLC | ( | CCoeControl * | aControl, |
TInt | aControlId = KCoeNoControlId | |||
) |
Appends a control at the end of the array.
CCoeControl * aControl | The control to add |
TInt aControlId = KCoeNoControlId | The id for the new control |
IMPORT_C TCoeControlWithId | At | ( | TInt | aIndex | ) |
Gets the element at the given index.
TInt aIndex | The index of the control |
IMPORT_C const TCoeControlWithId | At | ( | TInt | aIndex | ) | const |
Gets the element at the given index.
TInt aIndex | The index of the control |
IMPORT_C TCursor | Begin | ( | ) | 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() .
T * | ControlById | ( | TInt | aControlId | ) |
Gets the control with the given id.
TInt aControlId | The id of the desired control. |
const T * | ControlById | ( | TInt | aControlId | ) | const |
Gets the control with the given id.
TInt aControlId | The id of the desired control. |
IMPORT_C TBool | ControlsOwnedExternally | ( | ) | 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.
IMPORT_C CCoeControl * | CtrlById | ( | TInt | aControlId | ) | const [private] |
Gets the control with the given id or NULL if there is no control with the given id.
TInt aControlId | The id of the control |
IMPORT_C TCursor | End | ( | ) | 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.
IMPORT_C TCursor | Find | ( | 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.
const CCoeControl * aControl | The control to find. |
IMPORT_C TCursor | Find | ( | TInt | aControlId | ) | 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.
TInt aControlId | The id of the control to find. |
IMPORT_C TInt | Id | ( | const CCoeControl & | aControl | ) | const |
Gets the id of the control.
const CCoeControl & aControl | The control |
TInt | IndexById | ( | TInt | aControlId | ) | const [private] |
Gets the index of the control with the given id or KErrNotFound if there is no control that has that id.
TInt aControlId | The id of the control |
IMPORT_C TCursor | InsertAfterLC | ( | TInt | aInsertAfterId, |
CCoeControl * | aControl, | |||
TInt | aControlId = 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.
TInt aInsertAfterId | The 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. |
CCoeControl * aControl | The new control we want to add. |
TInt aControlId = KCoeNoControlId | The id of the new control. |
IMPORT_C TCursor | InsertLC | ( | TCursor & | aInsertAt, |
CCoeControl * | aControl, | |||
TInt | aControlId = 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.
TCursor & aInsertAt | The position at which we want to insert the new control. |
CCoeControl * aControl | The new control we want to add. |
TInt aControlId = KCoeNoControlId | The id of the new control. |
IMPORT_C TBool | IsArrayLocked | ( | ) | 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.
IMPORT_C CCoeControlArray * | NewL | ( | CCoeControl & | aOwner | ) | [static] |
Creates a new CCoeControlArray .
CCoeControl & aOwner | The control that owns the new array |
IMPORT_C TInt | Remove | ( | 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.
const CCoeControl * aControl | The control to remove |
IMPORT_C CCoeControl * | Remove | ( | TCursor | aRemoveAt | ) |
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.
TCursor aRemoveAt | The position of the control to remove |
IMPORT_C CCoeControl * | RemoveById | ( | TInt | aControlId | ) |
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.
TInt aControlId | The id of the control to remove |
IMPORT_C TInt | Replace | ( | CCoeControl * | aOriginalControl, |
CCoeControl * | aNewControl | |||
) |
Replaces a control in the array with another control.
CCoeControl * aOriginalControl | The control that must be replaced |
CCoeControl * aNewControl | The new control |
IMPORT_C void | ResetAndDestroy | ( | ) |
Removes all the controls from the array and deletes them.
IMPORT_C void | SetArrayLocked | ( | ) |
Locks the array. If an array is locked any attempt to add or remove controls will fail with KErrLocked.
IMPORT_C void | SetControlsOwnedExternally | ( | TBool | aOwnedExternally | ) |
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.
TBool aOwnedExternally | ETrue if the controls are owned externally, EFalse if they are owned by the array. |
IMPORT_C void | Sort | ( | TLinearOrder < TCoeControlWithId > | aOrder | ) |
This function provides a pluggable implementation to sort the array of controls.
TLinearOrder < TCoeControlWithId > aOrder | The user defined static method which implements the algorithm for sorting. |
Defines the possible events related to a change to the contents of the array.
EControlAdded |
A control has been added to the array |
EControlRemoved |
A control has been removed from the array |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.