|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "RegisteredControl.h" |
|
17 |
|
18 CRegisteredControl::CRegisteredControl( const CCoeControl* aCoeControl, TUid const & aUid, TBool aNLayered) : |
|
19 iType(ECoeControl), |
|
20 iUid(aUid), |
|
21 iKey(aCoeControl), |
|
22 iNLayered(aNLayered), |
|
23 iRegistered(ETrue) |
|
24 { |
|
25 } |
|
26 |
|
27 CRegisteredControl::CRegisteredControl( const CCoeControl* aCoeControl, TVwsViewId const & aViewId, TUid aUid ) : |
|
28 iType(EView), |
|
29 iUid(aUid), |
|
30 iKey(aCoeControl), |
|
31 iViewId(aViewId), |
|
32 iRegistered(ETrue) |
|
33 { |
|
34 } |
|
35 |
|
36 CRegisteredControl::CRegisteredControl( const CCoeControl* aCoeControl, TUid aUid ) : |
|
37 iType(EDrawItemControl), |
|
38 iUid(aUid), |
|
39 iKey(aCoeControl), |
|
40 iRegistered(ETrue) |
|
41 { |
|
42 } |
|
43 |
|
44 CRegisteredControl::~CRegisteredControl() |
|
45 { |
|
46 iTransitions.Reset(); |
|
47 iTransitions.Close(); |
|
48 } |
|
49 |
|
50 void CRegisteredControl::ResetTransitions() |
|
51 { |
|
52 const TInt count = iTransitions.Count(); |
|
53 for(TInt i = 0; i < count; i++) |
|
54 { |
|
55 iTransitions[i]->Reset(); |
|
56 } |
|
57 #ifdef _DEBUG |
|
58 iTransitions.Compress(); // so that __UHEAP_MARK can be used |
|
59 #endif |
|
60 } |
|
61 |
|
62 TInt CRegisteredControl::AddTransition(CTransitionControl *aTransControl) |
|
63 { |
|
64 return iTransitions.Append(aTransControl); |
|
65 } |
|
66 |
|
67 void CRegisteredControl::RemoveTransition(CTransitionControl *aTransControl) |
|
68 { |
|
69 const TInt count = iTransitions.Count(); |
|
70 for(TInt i = 0; i < count; i++) |
|
71 { |
|
72 if(iTransitions[i] == aTransControl) |
|
73 { |
|
74 iTransitions.Remove(i); //not owning |
|
75 #ifdef _DEBUG |
|
76 iTransitions.Compress(); // so that __UHEAP_MARK can be used |
|
77 #endif |
|
78 return; |
|
79 } |
|
80 } |
|
81 } |