|
1 /* |
|
2 * Copyright (c) 2006 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 view in GS Sensor Plugin. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef GSSENSORBASEVIEW_H |
|
20 #define GSSENSORBASEVIEW_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <aknview.h> |
|
24 #include <eikclb.h> |
|
25 #include "gssensormskobserver.h" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CGSBaseContainer; |
|
29 class CAknViewAppUi; |
|
30 |
|
31 /** |
|
32 * Base view class for GS Sensor plug-in views |
|
33 * |
|
34 * @lib gssensorplugin.lib |
|
35 * @since S60 5.0 |
|
36 */ |
|
37 class CGSSensorBaseView : public CAknView, |
|
38 public MEikListBoxObserver, |
|
39 public MGSSensorMskObserver |
|
40 { |
|
41 public: |
|
42 |
|
43 // Panic code used in this class |
|
44 enum TGSViewPanicCodes |
|
45 { |
|
46 EGSViewPanicNullPtr = 1 |
|
47 }; |
|
48 |
|
49 /** |
|
50 * C++ Constructor |
|
51 */ |
|
52 CGSSensorBaseView(); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 virtual ~CGSSensorBaseView(); |
|
58 |
|
59 /** |
|
60 * This function is used to set the current item in the listbox. |
|
61 * @param aIndex Current item. Default value is 0 i.e. the first item of the list. |
|
62 */ |
|
63 virtual void SetCurrentItem( TInt aIndex = 0 ); |
|
64 |
|
65 protected: |
|
66 |
|
67 /** |
|
68 * From CAknView. Handles client rect change. |
|
69 */ |
|
70 void HandleClientRectChange(); |
|
71 |
|
72 /** |
|
73 * From CAknView. Handles a view activation. |
|
74 * |
|
75 * @param aPrevViewId Specifies the view previously active. |
|
76 * @param aCustomMessageId Specifies the message type. |
|
77 * @param aCustomMessage The activation message. |
|
78 */ |
|
79 void DoActivateL( const TVwsViewId& aPrevViewId, |
|
80 TUid aCustomMessageId, |
|
81 const TDesC8& aCustomMessage ); |
|
82 |
|
83 /** |
|
84 * From CAknView. Deactivates current view. |
|
85 */ |
|
86 void DoDeactivate(); |
|
87 |
|
88 /** |
|
89 * From MEikListBoxObserver. Handles listbox events. |
|
90 * |
|
91 * @param aListBox Listbox where the event occurred. |
|
92 * @param aEventType Event type. |
|
93 */ |
|
94 void HandleListBoxEventL( CEikListBox* aListBox, |
|
95 TListBoxEvent aEventType ); |
|
96 /** |
|
97 * Creates new container. Subclasses must implement this function |
|
98 */ |
|
99 virtual void NewContainerL() = 0; |
|
100 |
|
101 /** |
|
102 * Creates new container. This is called from DoActivateL and this one |
|
103 * calls NewContainerL from subclass. |
|
104 */ |
|
105 virtual void CreateContainerL(); |
|
106 |
|
107 /** |
|
108 * Removes current label from MSK |
|
109 */ |
|
110 void RemoveCommandFromMSK(); |
|
111 |
|
112 /** |
|
113 * Adds new label for MSK |
|
114 * |
|
115 * @param aResourceId Text of the new label |
|
116 * @param aCommandId Command id of the MSK |
|
117 */ |
|
118 void SetMiddleSoftKeyLabelL( const TInt aResourceId, const TInt aCommandId ); |
|
119 |
|
120 |
|
121 private: |
|
122 |
|
123 /** |
|
124 * Handles selection of list box. Called by HandleListBoxEventL. |
|
125 */ |
|
126 virtual void HandleListBoxSelectionL() = 0; |
|
127 |
|
128 protected: // Member variables |
|
129 |
|
130 /** |
|
131 * Application UI |
|
132 */ |
|
133 CAknViewAppUi* iAppUi; |
|
134 |
|
135 /** |
|
136 * Currently selected listbox item |
|
137 */ |
|
138 TInt iCurrentItem; |
|
139 |
|
140 /** |
|
141 * Pointer to the container |
|
142 */ |
|
143 CGSBaseContainer* iContainer; |
|
144 }; |
|
145 |
|
146 #endif //GSSENSORBASEVIEW_H |