|
1 /* |
|
2 * Copyright (c) 1997-1999 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 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "EIKKWIN.H" |
|
20 |
|
21 EXPORT_C CEikKeyWindow::CEikKeyWindow() |
|
22 { |
|
23 __DECLARE_NAME(_S("CEikKeyWindow")); |
|
24 } |
|
25 |
|
26 EXPORT_C CEikKeyWindow::~CEikKeyWindow() |
|
27 { |
|
28 if (DrawableWindow()) |
|
29 Window().RemoveAllKeyRects(); |
|
30 } |
|
31 |
|
32 EXPORT_C void CEikKeyWindow::ConstructL(const TPoint& aPoint,const TSize& aSize,TInt aDeadSpaceAtStart, TInt aDeadSpaceAtEnd,TInt aScanCode,TInt aNumOfButtons,TType aType,RWindowGroup* aParent) |
|
33 { |
|
34 CreateWindowL(aParent); |
|
35 SetExtent(aPoint,aSize); |
|
36 TSize unit=aSize; |
|
37 TPoint tl; |
|
38 // dead space adjustments |
|
39 TInt* pBreadth=(aType==EHorizontal)? &(unit.iHeight) : &(unit.iWidth); |
|
40 (*pBreadth)-=(aDeadSpaceAtStart+aDeadSpaceAtEnd); |
|
41 TInt* pAdjust=(aType==EHorizontal)? &(tl.iY) : &(tl.iX); |
|
42 (*pAdjust)+=aDeadSpaceAtStart; |
|
43 // |
|
44 TInt* pMove=(&tl.iX); |
|
45 TInt* pLength=(&unit.iWidth); |
|
46 if (aType==EVertical) |
|
47 { |
|
48 pMove=(&tl.iY); |
|
49 pLength=(&unit.iHeight); |
|
50 } |
|
51 TInt length=(*pLength); |
|
52 TInt remainder=length%aNumOfButtons; |
|
53 length/=aNumOfButtons; |
|
54 *pLength=length; |
|
55 for (TInt ii=0; ii<aNumOfButtons; ii++) |
|
56 { |
|
57 User::LeaveIfError(Window().AddKeyRect(TRect(tl,unit),aScanCode++,ETrue)); |
|
58 *pMove+=length; |
|
59 if (remainder) |
|
60 { |
|
61 (*pMove)++; |
|
62 remainder--; |
|
63 } |
|
64 } |
|
65 Window().SetShadowDisabled(ETrue); |
|
66 Window().Activate(); |
|
67 } |
|
68 |
|
69 EXPORT_C void CEikKeyWindow::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
70 { |
|
71 CAknControl::HandlePointerEventL(aPointerEvent); |
|
72 } |
|
73 |
|
74 EXPORT_C void* CEikKeyWindow::ExtensionInterface( TUid /*aInterface*/ ) |
|
75 { |
|
76 return NULL; |
|
77 } |