|
1 /* |
|
2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0"" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: control pool |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // System includes |
|
20 #include <peninputlayoutbasecontrol.h> |
|
21 |
|
22 // User includes |
|
23 #include "peninputctrlpool.h" |
|
24 |
|
25 |
|
26 // ======== MEMBER FUNCTIONS ======== |
|
27 |
|
28 // ------------------------------------------------------------------------ |
|
29 // CPeninputCtrlPool::NewL |
|
30 // (other items were commented in a header) |
|
31 // ------------------------------------------------------------------------ |
|
32 // |
|
33 EXPORT_C CPeninputCtrlPool* CPeninputCtrlPool::NewL() |
|
34 { |
|
35 CPeninputCtrlPool* self = NewLC(); |
|
36 CleanupStack::Pop( self ); |
|
37 |
|
38 return self; |
|
39 } |
|
40 |
|
41 // ------------------------------------------------------------------------ |
|
42 // CPeninputCtrlPool::NewLC |
|
43 // (other items were commented in a header) |
|
44 // ------------------------------------------------------------------------ |
|
45 // |
|
46 EXPORT_C CPeninputCtrlPool* CPeninputCtrlPool::NewLC() |
|
47 { |
|
48 CPeninputCtrlPool* self = new ( ELeave ) CPeninputCtrlPool(); |
|
49 CleanupStack::PushL( self ); |
|
50 self->Construct(); |
|
51 |
|
52 return self; |
|
53 } |
|
54 |
|
55 // ------------------------------------------------------------------------ |
|
56 // CPeninputCtrlPool::ConstructL |
|
57 // (other items were commented in a header) |
|
58 // ------------------------------------------------------------------------ |
|
59 // |
|
60 EXPORT_C void CPeninputCtrlPool::Construct() |
|
61 { |
|
62 } |
|
63 |
|
64 // ------------------------------------------------------------------------ |
|
65 // CPeninputCtrlPool::~CPeninputCtrlPool |
|
66 // (other items were commented in a header) |
|
67 // ------------------------------------------------------------------------ |
|
68 // |
|
69 EXPORT_C CPeninputCtrlPool::~CPeninputCtrlPool() |
|
70 { |
|
71 iControlList.ResetAndDestroy(); |
|
72 iControlList.Close(); |
|
73 } |
|
74 |
|
75 // ------------------------------------------------------------------------ |
|
76 // CPeninputCtrlPool::AddControl |
|
77 // (other items were commented in a header) |
|
78 // ------------------------------------------------------------------------ |
|
79 // |
|
80 EXPORT_C void CPeninputCtrlPool::AddControl( CFepUiBaseCtrl* aControl ) |
|
81 { |
|
82 iControlList.Append( aControl ); |
|
83 } |
|
84 |
|
85 // ------------------------------------------------------------------------ |
|
86 // CPeninputCtrlPool::RemoveControl |
|
87 // (other items were commented in a header) |
|
88 // ------------------------------------------------------------------------ |
|
89 // |
|
90 EXPORT_C void CPeninputCtrlPool::RemoveControl( const TInt aControlID ) |
|
91 { |
|
92 CFepUiBaseCtrl* ctrl = Control( aControlID ); |
|
93 const TInt index = iControlList.Find( ctrl ); |
|
94 delete ctrl; |
|
95 iControlList.Remove( index ); |
|
96 } |
|
97 |
|
98 // ------------------------------------------------------------------------ |
|
99 // CPeninputCtrlPool::Control |
|
100 // (other items were commented in a header) |
|
101 // ------------------------------------------------------------------------ |
|
102 // |
|
103 EXPORT_C CFepUiBaseCtrl* CPeninputCtrlPool::Control( |
|
104 const TInt aControlID ) const |
|
105 { |
|
106 const TInt count = iControlList.Count(); |
|
107 CFepUiBaseCtrl* ctrl = NULL; |
|
108 |
|
109 for ( TInt i = 0; i < count; i++ ) |
|
110 { |
|
111 if ( iControlList[i]->ControlId() == aControlID ) |
|
112 { |
|
113 ctrl = iControlList[i]; |
|
114 break; |
|
115 } |
|
116 } |
|
117 |
|
118 return ctrl; |
|
119 } |
|
120 |
|
121 // ------------------------------------------------------------------------ |
|
122 // CPeninputCtrlPool::ControlByIndex |
|
123 // (other items were commented in a header) |
|
124 // ------------------------------------------------------------------------ |
|
125 // |
|
126 EXPORT_C CFepUiBaseCtrl* CPeninputCtrlPool::ControlByIndex( |
|
127 const TInt aIndex ) const |
|
128 { |
|
129 CFepUiBaseCtrl* ctrl = NULL; |
|
130 const TInt count = iControlList.Count(); |
|
131 |
|
132 if ( ( aIndex < count ) && ( aIndex >= 0 ) ) |
|
133 { |
|
134 ctrl = iControlList[aIndex]; |
|
135 } |
|
136 |
|
137 return ctrl; |
|
138 } |
|
139 |
|
140 // ------------------------------------------------------------------------ |
|
141 // CPeninputCtrlPool::ControlCount |
|
142 // (other items were commented in a header) |
|
143 // ------------------------------------------------------------------------ |
|
144 // |
|
145 EXPORT_C TInt CPeninputCtrlPool::ControlCount() const |
|
146 { |
|
147 return iControlList.Count(); |
|
148 } |
|
149 |
|
150 // ------------------------------------------------------------------------ |
|
151 // CPeninputCtrlPool::Reset |
|
152 // (other items were commented in a header) |
|
153 // ------------------------------------------------------------------------ |
|
154 // |
|
155 EXPORT_C void CPeninputCtrlPool::Reset() |
|
156 { |
|
157 iControlList.ResetAndDestroy(); |
|
158 } |