|
1 /* |
|
2 * Copyright (c) 2008-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: Key monitoring control |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #include "glxkeymonitor.h" |
|
23 #include <alf/alfevent.h> |
|
24 #include "glxviewbase.h" |
|
25 #include "glxkeyeventreceiver.h" |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // Constructor |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 EXPORT_C CGlxKeyMonitor::CGlxKeyMonitor() |
|
32 : CAlfControl() |
|
33 { |
|
34 } |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // Destructor |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 EXPORT_C CGlxKeyMonitor::~CGlxKeyMonitor() |
|
41 { |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // OfferEventL |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 EXPORT_C TBool CGlxKeyMonitor::OfferEventL(const TAlfEvent &aEvent) |
|
49 { |
|
50 TBool consumed = EFalse; |
|
51 |
|
52 if ( aEvent.IsKeyEvent() && iEventReceiver ) |
|
53 { |
|
54 TKeyResponse resp = iEventReceiver->OfferKeyEventL(aEvent.KeyEvent(), aEvent.Code()); |
|
55 consumed = (resp == EKeyWasConsumed); |
|
56 } |
|
57 |
|
58 return consumed; |
|
59 } |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // SetView |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 EXPORT_C void CGlxKeyMonitor::SetReceiver(MGlxKeyEventReceiver* aEventReceiver) |
|
66 { |
|
67 iEventReceiver = aEventReceiver; |
|
68 } |