1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * Declares portal button for WidgetManager |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef ___WMPORTALBUTTON_H__ |
|
20 #define ___WMPORTALBUTTON_H__ |
|
21 |
|
22 #include <aknbutton.h> // CAknButton |
|
23 #include <AknServerApp.h> //MAknServerAppExitObserver |
|
24 |
|
25 #include "wmcommon.h" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CWmMainContainer; |
|
29 class CFbsBitmap; |
|
30 class CWmConfiguration; |
|
31 class CWmProcessMonitor; |
|
32 class CBrowserLauncher; |
|
33 class CWmImageConverter; |
|
34 |
|
35 /** |
|
36 * Portal button ( ovi, operator ) class for Wm |
|
37 * |
|
38 * @class CWmPortalButton wmportalbutton.h |
|
39 */ |
|
40 NONSHARABLE_CLASS( CWmPortalButton ) : public CAknButton, |
|
41 public MCoeControlObserver, |
|
42 public MAknServerAppExitObserver |
|
43 { |
|
44 public: |
|
45 /* |
|
46 * Two-phased constructor. |
|
47 * |
|
48 * @param aParent button title text |
|
49 * @param aPortalButtonIndex index of this button (0 or 1) |
|
50 */ |
|
51 static CWmPortalButton* NewL( |
|
52 const CCoeControl* aParent, |
|
53 TInt aPortalButtonIndex = 0 ); |
|
54 |
|
55 /** Destructor */ |
|
56 virtual ~CWmPortalButton(); |
|
57 |
|
58 public: // Functions from base class |
|
59 |
|
60 /* |
|
61 * Draws the control. |
|
62 * |
|
63 * @see CCoeControl::Draw |
|
64 */ |
|
65 void Draw( const TRect& /*aRect*/ ) const; |
|
66 |
|
67 /** |
|
68 * Sets the control's extent, specifying a rectangle. |
|
69 * |
|
70 * @see CCoeControl::SizeChanged |
|
71 */ |
|
72 void SizeChanged(); |
|
73 |
|
74 /** |
|
75 * Executes action for button pressed |
|
76 */ |
|
77 void ExecuteL(); |
|
78 |
|
79 protected: // from MCoeControlObserver |
|
80 |
|
81 /** Observes the button's own activity */ |
|
82 void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ); |
|
83 |
|
84 protected: // from MAknServerAppExitObserver |
|
85 |
|
86 /** Observes when browser is exited */ |
|
87 void HandleServerAppExit( TInt aReason ); |
|
88 |
|
89 protected: // from CCoeControl |
|
90 |
|
91 /** Handles pointer events. */ |
|
92 void HandlePointerEventL( const TPointerEvent& aPointerEvent ); |
|
93 |
|
94 protected: // Constructors |
|
95 |
|
96 /** Constructor for performing 1st stage construction */ |
|
97 CWmPortalButton( const TInt aFlags, |
|
98 TInt aPortalButtonIndex ); |
|
99 |
|
100 /** 2nd phase constructor */ |
|
101 void ConstructL( |
|
102 CWmMainContainer* aParent, |
|
103 const TDesC& aText = KNullDesC, |
|
104 const TDesC& aIcon = KNullDesC ); |
|
105 |
|
106 private: |
|
107 |
|
108 /** size of button icon, defined in the layout */ |
|
109 TSize LayoutIconSize() const; |
|
110 |
|
111 /** Draws text over button */ |
|
112 void DrawText( CWindowGc& aGc, |
|
113 const TDesC& aText, |
|
114 TAknTextComponentLayout& aLayout, |
|
115 TInt aMargin ) const; |
|
116 |
|
117 /** Runs ovi store launcher */ |
|
118 void RunOviL( CWmConfiguration& aConf ); |
|
119 |
|
120 /** Starts browser */ |
|
121 void StartBrowserL( const TDesC& aUrl ); |
|
122 |
|
123 /** Starts operator application */ |
|
124 void RunOperatorApplicationL( CWmConfiguration& aConf ); |
|
125 |
|
126 /** Starts rprocess by given values */ |
|
127 void StartProcessL( TUid aUid, const TDesC& aParam ); |
|
128 |
|
129 /** |
|
130 * Opens cwrt/wrt widget to fullscreen. |
|
131 * @param aAppUid Uid of the widget |
|
132 * @param aParams Optional parameters |
|
133 * */ |
|
134 void StartWidgetL( TUid aAppUid, const TDesC& aParams ); |
|
135 |
|
136 private: //data members |
|
137 |
|
138 /** |
|
139 * the image converter utility |
|
140 */ |
|
141 CWmImageConverter* iImageConverter; |
|
142 |
|
143 /** |
|
144 * Parent control |
|
145 */ |
|
146 CWmMainContainer* iWmMainContainer; |
|
147 |
|
148 /** |
|
149 * Button index |
|
150 */ |
|
151 TInt iPortalButtonIndex; |
|
152 |
|
153 /** icon */ |
|
154 CFbsBitmap* iButtonIcon; |
|
155 |
|
156 /** icon mask */ |
|
157 CFbsBitmap* iButtonIconMask; |
|
158 |
|
159 /** |
|
160 * Monitors process |
|
161 */ |
|
162 CWmProcessMonitor* iProcessMonitor; |
|
163 |
|
164 /** |
|
165 * Broswer launcher. |
|
166 */ |
|
167 CBrowserLauncher* iBrowserLauncher; |
|
168 |
|
169 }; |
|
170 |
|
171 #endif //___WMPORTALBUTTON_H__ |
|
172 |
|
173 // End of File |
|