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: Class is used to find out from java is midlet foreground or not |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMMAFOREGROUND_H |
|
20 #define CMMAFOREGROUND_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 #include "mmmaeventposter.h" |
|
25 #include "cmmadeleterefevent.h" |
|
26 #include "cmmaforegroundevent.h" |
|
27 |
|
28 // xm-radio fix |
|
29 //#include "CMIDToolkit.h" |
|
30 //#include "lcdui.h" |
|
31 |
|
32 #include <coemain.h> |
|
33 #include <eikenv.h> |
|
34 |
|
35 // CLASS DECLARATION |
|
36 /** |
|
37 * |
|
38 * Class is used to find out from java is midlet foreground or not |
|
39 */ |
|
40 NONSHARABLE_CLASS(CMMAForeground) : public CBase/*, public MMIDEnvObserver, public MCoeForegroundObserver*/ |
|
41 { |
|
42 public: |
|
43 |
|
44 /** |
|
45 * Creates and returns a new instance of this class. |
|
46 * @param aEventPoster for posting event to java side |
|
47 * @param aForegroundListener java side foreground object |
|
48 * @param aJavaMethod java side method id |
|
49 * @return New instance from this class. |
|
50 */ |
|
51 static CMMAForeground* NewL(MMMAEventPoster* aEventPoster, |
|
52 jobject aForegroundListener, |
|
53 jmethodID aJavaMethod/*, |
|
54 CMIDToolkit* aToolkit*/); // xm-radio fix |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 ~CMMAForeground(); |
|
59 |
|
60 protected: |
|
61 |
|
62 /** |
|
63 * C++ constructor |
|
64 */ |
|
65 CMMAForeground(); |
|
66 |
|
67 /** |
|
68 * Second phase constructor |
|
69 * @param aEventPoster for posting event to java side |
|
70 * @param aForegroundListener java side foreground object |
|
71 * @param aJavaMethod java side method id |
|
72 */ |
|
73 void ConstructL(MMMAEventPoster* aEventPoster, |
|
74 jobject aForegroundListener, |
|
75 jmethodID aJavaMethod/*, |
|
76 CMIDToolkit* aToolkit*/); // xm-radio fix |
|
77 |
|
78 public: // New methods |
|
79 |
|
80 |
|
81 /** |
|
82 * Tells is midlet foreground or not |
|
83 * @return boolean |
|
84 */ |
|
85 TBool IsForeground(); |
|
86 |
|
87 /** |
|
88 * Sets member boolean iIsForeground |
|
89 */ |
|
90 void SetForeground(TBool aIsForeground); |
|
91 |
|
92 public: // from MMIDEnvObserver |
|
93 |
|
94 // void HandleSwitchOnL(TBool /*aSwitchOn*/); |
|
95 |
|
96 /** |
|
97 * Handles the case when the MIDlet is brought to the foreground. |
|
98 */ |
|
99 // void HandleForegroundL(TBool /*aForeground*/); |
|
100 |
|
101 /** |
|
102 * Handles a change to resources which are shared accross the environment. |
|
103 */ |
|
104 // void HandleResourceChangeL(TInt /*aType*/); |
|
105 |
|
106 public: |
|
107 /** Handles the application coming to the foreground. */ |
|
108 void HandleGainingForeground(); |
|
109 |
|
110 /** Handles the application going into the background. */ |
|
111 void HandleLosingForeground(); |
|
112 |
|
113 private: // Member data |
|
114 |
|
115 CActiveSchedulerWait* iActiveScheduler; // owned |
|
116 MMMAEventPoster* iEventPoster; // not owned |
|
117 CMMAForegroundEvent* iForegroundEvent; // owned |
|
118 |
|
119 //Event is used to destroy reference to associated java object, |
|
120 //when foreground is destroyed. |
|
121 CMMADeleteRefEvent* iDeleteRefEvent; // owned |
|
122 |
|
123 jobject iForegroundListener; |
|
124 jmethodID iJavaMethod; |
|
125 |
|
126 TBool iIsForeground; |
|
127 // xm-radio fix |
|
128 //CMIDToolkit* iToolkit; |
|
129 //MMIDEnv* iMidEnv; |
|
130 }; |
|
131 |
|
132 #endif // CMMAFOREGROUND_H |
|