|
1 /* |
|
2 * Copyright (c) 2002-2007 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: Base class for Psln's view containers. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_PSLNBASECONTAINER_H |
|
20 #define C_PSLNBASECONTAINER_H |
|
21 |
|
22 #include <coeccntx.h> |
|
23 #include <eikclb.h> |
|
24 |
|
25 class CPslnModel; |
|
26 class MPslnFWMSKObserver; |
|
27 |
|
28 /** |
|
29 * Base class for Psln's view containers. |
|
30 * |
|
31 */ |
|
32 class CPslnBaseContainer : public CCoeControl |
|
33 { |
|
34 public: |
|
35 |
|
36 /** |
|
37 * Symbian default constructor. |
|
38 */ |
|
39 CPslnBaseContainer(); |
|
40 |
|
41 /** |
|
42 * Symbian two-phase constructor. |
|
43 * @param aRect Listbox's rect. |
|
44 */ |
|
45 virtual void ConstructL( const TRect& aRect ) = 0; |
|
46 |
|
47 /** |
|
48 * Constructs all common parts of the container. |
|
49 * @param aRect Listbox control's rect. |
|
50 * @param aResLbxId Resource id for listbox. |
|
51 */ |
|
52 void BaseConstructL( const TRect& aRect, TInt aResLbxId ); |
|
53 |
|
54 /** |
|
55 * Constructs all common parts of the container. |
|
56 * @param aRect Listbox control's rect. |
|
57 * @param aResTitleId Resource id for title. |
|
58 * @param aResLbxId Resource id for listbox. |
|
59 */ |
|
60 void BaseConstructL( |
|
61 const TRect& aRect, |
|
62 TInt aResTitleId, |
|
63 TInt aResLbxId ); |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 */ |
|
68 ~CPslnBaseContainer(); |
|
69 |
|
70 /** |
|
71 * Sets listbox observer. |
|
72 * @param aObserver observer object. |
|
73 */ |
|
74 void SetListBoxObserver( MEikListBoxObserver* aObserver ); |
|
75 |
|
76 /** |
|
77 * Returns currently selected item index. |
|
78 * @return currently selected item index. |
|
79 */ |
|
80 virtual TInt CurrentItemIndex() const; |
|
81 |
|
82 /** |
|
83 * Sets current item index and draws container. If index is invalid, |
|
84 * it is set to zero (=first item). |
|
85 * @param aNewIndex new current index. |
|
86 */ |
|
87 virtual void SetCurrentItemIndexAndDraw( TInt aNewIndex ); |
|
88 |
|
89 /** |
|
90 * Sets current item index. If index is invalid, |
|
91 * it is set to zero (=first item). |
|
92 * @param aNewIndex new current index. |
|
93 */ |
|
94 virtual void SetCurrentItemIndex( TInt aNewIndex ); |
|
95 |
|
96 /** |
|
97 * Defines observer for the middle softkey label changes. |
|
98 * Can only be set once. Further attempts are ignored. |
|
99 * @since S60 v3.1 |
|
100 */ |
|
101 virtual void SetMiddleSoftkeyObserver( MPslnFWMSKObserver* aObserver ); |
|
102 |
|
103 /** |
|
104 * Returns MSK Observer, if any. |
|
105 * @return observer for MSK label changes, or NULL if it is not defined. |
|
106 * @since S60 v3.2 |
|
107 */ |
|
108 MPslnFWMSKObserver* GetMiddleSoftkeyObserver(); |
|
109 |
|
110 protected: |
|
111 |
|
112 /** |
|
113 * Updates listbox or specific one item. |
|
114 */ |
|
115 virtual void UpdateListBoxL(); |
|
116 |
|
117 /** |
|
118 * Constructs listbox. |
|
119 * @param aResLbxId Resource id for listbox. |
|
120 */ |
|
121 virtual void ConstructListBoxL( TInt aResLbxId ) = 0; |
|
122 |
|
123 /** |
|
124 * Processes key events. |
|
125 * @param aKeyEvent |
|
126 * @param aType |
|
127 * @return response |
|
128 */ |
|
129 TKeyResponse OfferKeyEventL( |
|
130 const TKeyEvent& aKeyEvent, |
|
131 TEventCode aType ); |
|
132 |
|
133 /** |
|
134 * Creates list box items. |
|
135 */ |
|
136 virtual void CreateListBoxItemsL() = 0; |
|
137 |
|
138 private: |
|
139 |
|
140 /* From CCoeControl. */ |
|
141 void SizeChanged(); |
|
142 |
|
143 /* From CCoeControl. */ |
|
144 TInt CountComponentControls() const; |
|
145 |
|
146 /* From CCoeControl. */ |
|
147 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
148 |
|
149 /* From CCoeControl. */ |
|
150 virtual void HandleResourceChange( TInt aType ); |
|
151 |
|
152 /* Handles focus change events in list item. */ |
|
153 void FocusChanged( TDrawNow aDrawNow ); |
|
154 |
|
155 protected: |
|
156 |
|
157 /** |
|
158 * Model reference. |
|
159 * Not own. |
|
160 */ |
|
161 CPslnModel* iModel; |
|
162 |
|
163 /** |
|
164 * Listbox. |
|
165 * Own. |
|
166 */ |
|
167 CEikTextListBox* iListBox; |
|
168 |
|
169 /** |
|
170 * List of items in listbox. |
|
171 * Not own (owned by listbox). |
|
172 */ |
|
173 CDesCArray* iItemArray; |
|
174 |
|
175 /** |
|
176 * Middle softkey label observer. |
|
177 * Own. |
|
178 */ |
|
179 MPslnFWMSKObserver* iMSKObserver; |
|
180 }; |
|
181 |
|
182 #endif // C_PSLNBASECONTAINER_H |
|
183 |
|
184 // End of File |