1 // Copyright (c) 1996-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
21 CPriorityKey::CPriorityKey(CWsClient *aOwner) : CEventBase(aOwner) |
21 CPriorityKey::CPriorityKey(CWsClient *aOwner) : CEventBase(aOwner) |
22 { |
22 { |
23 __DECLARE_NAME(_S("CPriorityKey")); |
23 __DECLARE_NAME(_S("CPriorityKey")); |
24 } |
24 } |
25 |
25 |
26 void CPriorityKey::PriorityKey(TInt aHandle, const TKeyEvent &aKeyEvent) |
26 void CPriorityKey::PriorityKey(TInt aHandle, const TKeyData &aKey, TInt aScanCode) |
27 // |
27 // |
28 // Called when a priority key is pressed |
28 // Called when a priority key is pressed |
29 // |
29 // |
30 { |
30 { |
31 if (!iEventMsg.IsNull()) |
31 if (!iEventMsg.IsNull()) |
32 { |
32 { |
33 iPriorityKeyHandle=aHandle; |
33 iPriorityKeyHandle=aHandle; |
34 iPriorityKey = aKeyEvent; |
34 iPriorityKey=aKey; |
|
35 iScanCode=aScanCode; |
35 SignalEvent(); |
36 SignalEvent(); |
36 } |
37 } |
37 } |
38 } |
38 |
39 |
39 void CPriorityKey::GetData() |
40 void CPriorityKey::GetData() |
40 // |
41 // |
41 // If there is an outstanding abort event in the queue, reply with it's data, else send a null abort event |
42 // If there is an outstanding abort event in the queue, reply with it's data, else send a null abort event |
42 // |
43 // |
43 { |
44 { |
44 TWsPriorityKeyEvent event; |
45 TWsPriorityKeyEvent event; |
45 *event.Key() = iPriorityKey; |
46 TKeyEvent *key=event.Key(); |
46 event.Key()->iRepeats = 0; |
47 key->iScanCode=iScanCode; |
|
48 key->iCode=iPriorityKey.iKeyCode; |
|
49 key->iModifiers=iPriorityKey.iModifiers; |
|
50 key->iRepeats=0; |
47 event.SetHandle(iPriorityKeyHandle); |
51 event.SetHandle(iPriorityKeyHandle); |
48 CEventBase::GetData(&event,sizeof(event)); |
52 CEventBase::GetData(&event,sizeof(event)); |
49 iPriorityKeyHandle=0; |
53 iPriorityKeyHandle=0; |
50 } |
54 } |
51 |
55 |
59 TInt TPriorityKey::Equals(TUint aKeycode,TUint aModifierMask,TUint aModifiers) |
63 TInt TPriorityKey::Equals(TUint aKeycode,TUint aModifierMask,TUint aModifiers) |
60 { |
64 { |
61 return(iKeyCode==aKeycode && iModifierMask==aModifierMask && iModifiers==aModifiers); |
65 return(iKeyCode==aKeycode && iModifierMask==aModifierMask && iModifiers==aModifiers); |
62 } |
66 } |
63 |
67 |
64 TInt TPriorityKey::KeyMatches(const TKeyEvent &aKeyEvent) |
68 TInt TPriorityKey::KeyMatches(const TKeyData &aKey) |
65 { |
69 { |
66 return(iKeyCode == aKeyEvent.iCode && (iModifierMask & aKeyEvent.iModifiers) == iModifiers); |
70 return(iKeyCode==aKey.iKeyCode && (iModifierMask&aKey.iModifiers)==iModifiers); |
67 } |
71 } |