|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "hwrmuiplugin.h" |
|
17 |
|
18 CHwrmUiPlugin* CHwrmUiPlugin::NewL() |
|
19 { |
|
20 CHwrmUiPlugin* self = new (ELeave)CHwrmUiPlugin(); |
|
21 CleanupStack::PushL(self); |
|
22 self->ConstructL(); |
|
23 CleanupStack::Pop(self); |
|
24 return self; |
|
25 } |
|
26 |
|
27 CHwrmUiPlugin::CHwrmUiPlugin() |
|
28 { |
|
29 } |
|
30 |
|
31 void CHwrmUiPlugin::ConstructL() |
|
32 { |
|
33 CCoeEnv* env = CCoeEnv::Static(); |
|
34 if ( env ) |
|
35 {//register for notification with CONE |
|
36 env->AddForegroundObserverL(*this); |
|
37 } |
|
38 } |
|
39 |
|
40 CHwrmUiPlugin::~CHwrmUiPlugin() |
|
41 { |
|
42 CCoeEnv* env = CCoeEnv::Static(); |
|
43 if ( env ) |
|
44 { |
|
45 env->RemoveForegroundObserver(*this); |
|
46 } |
|
47 } |
|
48 |
|
49 void CHwrmUiPlugin::AddForegroundObserverL(MHwrmForegroundObserver* aObserver) |
|
50 { |
|
51 iHwrmForegroundObserver = aObserver; |
|
52 } |
|
53 |
|
54 TBool CHwrmUiPlugin::InForeground() const |
|
55 { |
|
56 CCoeEnv* env = CCoeEnv::Static(); |
|
57 if ( env ) |
|
58 { |
|
59 return (env->WsSession().GetFocusWindowGroup() == env->RootWin().Identifier() ); |
|
60 } |
|
61 return EFalse; |
|
62 } |
|
63 |
|
64 void CHwrmUiPlugin::HandleGainingForeground() |
|
65 { |
|
66 if(iHwrmForegroundObserver) |
|
67 { |
|
68 iHwrmForegroundObserver->HandleGainingForeground(); |
|
69 } |
|
70 } |
|
71 |
|
72 void CHwrmUiPlugin::HandleLosingForeground() |
|
73 { |
|
74 if(iHwrmForegroundObserver) |
|
75 { |
|
76 iHwrmForegroundObserver->HandleLosingForeground(); |
|
77 } |
|
78 } |