1 /* |
|
2 * Copyright (c) 2006-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: Declares container control for application. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef BTUIMAINCONTAINER_H |
|
19 #define BTUIMAINCONTAINER_H |
|
20 |
|
21 #include <aknview.h> // AVKON components |
|
22 #include <aknlists.h> |
|
23 #include "btui.hrh" |
|
24 #include "BTUIMainView.h" |
|
25 #include "btengsettings.h" |
|
26 |
|
27 /** |
|
28 * This class handles main view dependent requests from user and |
|
29 * contains listbox for main view items. |
|
30 * |
|
31 *@lib BTUIPlugin.dll |
|
32 *@since S60 v3.0 |
|
33 */ |
|
34 class CBTUIMainContainer : public CCoeControl, |
|
35 public MCoeControlObserver, |
|
36 public MEikListBoxObserver |
|
37 { |
|
38 public: // Constructors and destructor |
|
39 |
|
40 /** |
|
41 * Symbian 2nd phase constructor. |
|
42 */ |
|
43 void ConstructL( const TRect& aRect, CBTUIMainView* aMainView ); |
|
44 |
|
45 /** |
|
46 * Destructor. |
|
47 */ |
|
48 virtual ~CBTUIMainContainer(); |
|
49 |
|
50 |
|
51 public: // New functions |
|
52 |
|
53 /** |
|
54 * Returns the current item index (highlight position) |
|
55 * for main setting list. |
|
56 * @param None. |
|
57 * @return Current item index. |
|
58 */ |
|
59 TInt CurrentItemIndex(); |
|
60 |
|
61 /** |
|
62 * From MBTUISettingsObserver Handles setting changes. |
|
63 * @param aListItem The changed setting item. |
|
64 * @return None. |
|
65 */ |
|
66 void SettingChanged( TBTMainListItemIndexes aListItem ); |
|
67 |
|
68 private: // Functions from base classes |
|
69 |
|
70 /** |
|
71 * From CoeControl Responds to size changes. |
|
72 * Sets the size and position of the contents of this control. |
|
73 * @param None. |
|
74 * @return None. |
|
75 */ |
|
76 void SizeChanged(); |
|
77 |
|
78 /** |
|
79 * From CoeControl Gets the number of controls contained |
|
80 * in a compound control. |
|
81 * @param None. |
|
82 * @return The number of component controls contained by this control. |
|
83 */ |
|
84 TInt CountComponentControls() const; |
|
85 |
|
86 /** |
|
87 * From CoeControl Gets the specified component of a compound control. |
|
88 * @param aIndex The index of the control to get. |
|
89 * @return Reference to the component control. |
|
90 */ |
|
91 CCoeControl* ComponentControl(TInt aIndex) const; |
|
92 |
|
93 /** |
|
94 * From CoeControl Draws the control. |
|
95 * @param aRect The region of the control to be redrawn. |
|
96 * @return None. |
|
97 */ |
|
98 void Draw(const TRect& aRect) const; |
|
99 |
|
100 /** |
|
101 * From CoeControl Handles key events. |
|
102 * @param aKeyEvent The key event that occurred. |
|
103 * @param aType The event type. |
|
104 * @return Response to the key event. |
|
105 */ |
|
106 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); |
|
107 |
|
108 /** |
|
109 * From MEikListBoxObserver Handles list box events. |
|
110 * @param aListBox The originating list box. |
|
111 * @param aEventType The event type. |
|
112 * @return None. |
|
113 */ |
|
114 void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); |
|
115 |
|
116 /** |
|
117 * From MCoeControlObserver Handles an event from an observed control. |
|
118 * @param aControl The control that sent the event. |
|
119 * @param aEventType The event type. |
|
120 * @return None. |
|
121 */ |
|
122 void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType); |
|
123 |
|
124 |
|
125 /** |
|
126 * From CoeControl Gets the control's help context. |
|
127 * @param aContext The control's help context |
|
128 * @return None. |
|
129 */ |
|
130 void GetHelpContext(TCoeHelpContext& aContext) const; |
|
131 |
|
132 /** |
|
133 * From CCoeControl |
|
134 */ |
|
135 void HandleResourceChange( TInt aType ); |
|
136 |
|
137 /** |
|
138 * From CCoeControl |
|
139 */ |
|
140 void FocusChanged(TDrawNow /*aDrawNow*/); |
|
141 |
|
142 |
|
143 private: // Data |
|
144 |
|
145 /** |
|
146 * Friend class for generating format string for main list. |
|
147 */ |
|
148 class TMainListItemArray : public MDesCArray |
|
149 { |
|
150 public: // Constructors and destructor |
|
151 |
|
152 /** |
|
153 * C++ default constructor. |
|
154 */ |
|
155 TMainListItemArray( CDesCArray* aBtAllItemsArray, CBTUIMainView* aMainView, |
|
156 CBTEngSettings* aBtEngSettings ); |
|
157 |
|
158 public: // New functions |
|
159 |
|
160 /** |
|
161 * Returns number of items in array / main list. |
|
162 * @param None. |
|
163 * @return Number of items. |
|
164 */ |
|
165 TInt MdcaCount() const; |
|
166 |
|
167 /** |
|
168 * Returns the current format string for the given item. |
|
169 * @param aIndex Index of the item. |
|
170 * @return Pointer to the format string. |
|
171 */ |
|
172 TPtrC MdcaPoint(TInt aIndex) const; |
|
173 private: |
|
174 static void GetSapStatusL( TInt& aStatus ); |
|
175 |
|
176 private: // Data |
|
177 |
|
178 // Local BT name format string |
|
179 __MUTABLE TBuf<KBTUIMaxFormattedNameLength> iItemText; |
|
180 |
|
181 // No ownership (reference) |
|
182 CDesCArray& iArray; |
|
183 CBTUIMainView* iMainView; |
|
184 CBTEngSettings* iBtEngSettingsRef; |
|
185 |
|
186 }; |
|
187 |
|
188 CAknSettingStyleListBox* iBtMainListBox; // The setting items list (scrollable) |
|
189 CDesCArray* iBtAllItemsArray; // All format string combinations (ownership) |
|
190 TMainListItemArray* iBtListItemArray; // Format strings for list items |
|
191 TInt iCurrentItemIndex; // Current highlighted main list item |
|
192 CBTUIMainView* iMainView; |
|
193 CBTEngSettings* iBtEngSettingsRef; |
|
194 |
|
195 |
|
196 |
|
197 private: // Friend classes |
|
198 |
|
199 friend class TMainListItemArray; |
|
200 |
|
201 |
|
202 |
|
203 }; |
|
204 |
|
205 #endif |
|