|
1 /* |
|
2 * Copyright (c) 2008 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: AppUi class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "alfshareddisplaycoecontrol.h" |
|
21 #include <uiacceltk/HuiDisplay.h> |
|
22 #include <uiacceltk/HuiEvent.h> |
|
23 |
|
24 // --------------------------------------------------------------------------- |
|
25 // constructor |
|
26 // --------------------------------------------------------------------------- |
|
27 // |
|
28 CAlfSharedDisplayCoeControl::CAlfSharedDisplayCoeControl(){} |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // destructor |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 CAlfSharedDisplayCoeControl::~CAlfSharedDisplayCoeControl() { iDisplays.Close(); } |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // ConstructL |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 void CAlfSharedDisplayCoeControl::ConstructL() |
|
41 { |
|
42 CreateWindowL(); |
|
43 SetExtentToWholeScreen(); |
|
44 |
|
45 // Since display creation went ok, we know that this rectangle size can be handled. |
|
46 iPrevRect = Rect(); |
|
47 |
|
48 EnableDragEvents(); |
|
49 Window().EnableAdvancedPointers(); |
|
50 ActivateL(); |
|
51 |
|
52 // Set pointer grab, so we will get pointer up events also from other´ |
|
53 // window groups |
|
54 DrawableWindow()->SetPointerGrab(ETrue); |
|
55 } |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // Draw |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 void CAlfSharedDisplayCoeControl::Draw(const TRect& /*aRect*/) const |
|
62 { |
|
63 for ( TInt i = 0 ; i < iDisplays.Count() ; i++ ) |
|
64 { |
|
65 iDisplays[i]->SetDirty(); |
|
66 } |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------------------------- |
|
70 // SizeChanged |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 void CAlfSharedDisplayCoeControl::SizeChanged() |
|
74 { |
|
75 TSize size = Rect().Size(); |
|
76 |
|
77 for ( TInt i = 0 ; i < iDisplays.Count() ; i++ ) |
|
78 { |
|
79 // Change the size of the display. |
|
80 TRAPD(err, iDisplays[i]->SetSizeL(size)); |
|
81 if(err != KErrNone) |
|
82 { |
|
83 // Switching to new size failed. Maintain old size. |
|
84 size = iPrevRect.Size(); |
|
85 } |
|
86 else |
|
87 { |
|
88 iPrevRect = Rect(); |
|
89 } |
|
90 |
|
91 // Redefine the portion of the drawing surface that is used by |
|
92 // the display. |
|
93 iDisplays[i]->SetVisibleArea(TRect(TPoint(0, 0), size)); |
|
94 } |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // HandlePointerEventL |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 void CAlfSharedDisplayCoeControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
102 { |
|
103 // passing the event to hui |
|
104 THuiEvent event(iDisplays[0], aPointerEvent); |
|
105 // Send events received here only to the primary display |
|
106 if (iDisplays[0]) |
|
107 { |
|
108 iDisplays[0]->Roster().HandleEventL(event); |
|
109 } |
|
110 } |
|
111 |
|
112 // end of file |