|
1 // Copyright (c) 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 "twindows.h" |
|
17 #include <w32std.h> |
|
18 |
|
19 //could you useful for visual checking |
|
20 //define DRAW_WINDOW |
|
21 |
|
22 CTWindow * CTWindow::NewL(RWsSession & aWs, CTWindowTreeNode& aGroup, CWindowGc& aGc) |
|
23 { |
|
24 CTWindow * self = new (ELeave) CTWindow(aGc); |
|
25 CleanupStack::PushL(self); |
|
26 self->ConstructL(aWs, aGroup); |
|
27 CleanupStack::Pop(self); |
|
28 return self; |
|
29 } |
|
30 |
|
31 CTWindow::CTWindow(CWindowGc& aGc) : |
|
32 iGc(aGc) |
|
33 { |
|
34 } |
|
35 |
|
36 void CTWindow::ConstructL(RWsSession & aWs, CTWindowTreeNode& aGroup) |
|
37 { |
|
38 iWin = new (ELeave) RWindow(aWs); |
|
39 Window()->Construct(*aGroup.WindowTreeNode(), TUint32(this)); |
|
40 Window()->SetRequiredDisplayMode(EColor16MAP); |
|
41 Window()->SetShadowHeight(0); |
|
42 Window()->SetShadowDisabled(ETrue); |
|
43 } |
|
44 |
|
45 CTWindow::~CTWindow() |
|
46 { |
|
47 iWin->Close(); |
|
48 delete iWin; |
|
49 } |
|
50 |
|
51 void CTWindow::Event(TWsEvent & /*aEvent*/) |
|
52 { |
|
53 } |
|
54 |
|
55 void CTWindow::Redraw(TWsRedrawEvent & /*aEvent*/) |
|
56 { |
|
57 Window()->BeginRedraw(); |
|
58 iGc.Activate(*Window()); |
|
59 Draw(); |
|
60 iGc.Deactivate(); |
|
61 Window()->EndRedraw(); |
|
62 } |
|
63 |
|
64 void CTWindow::Draw() |
|
65 { |
|
66 #ifdef DRAW_WINDOW |
|
67 TSize size = Window()->Size(); |
|
68 |
|
69 TInt l = size.iWidth / 3; |
|
70 TInt r = size.iWidth * 2 / 3; |
|
71 TInt t = size.iHeight / 3; |
|
72 TInt b = size.iHeight * 2 / 3; |
|
73 |
|
74 iGc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
75 iGc.SetBrushColor(KRgbRed); |
|
76 iGc.SetPenStyle(CGraphicsContext::ESolidPen); |
|
77 iGc.SetPenColor(KRgbBlue); |
|
78 iGc.DrawLine(TPoint(-400, -400), TPoint(size.iWidth + 400, size.iHeight + 400)); |
|
79 iGc.DrawLine(TPoint(-400, size.iHeight + 400), TPoint(size.iWidth + 400, -400)); |
|
80 iGc.SetPenColor(KRgbGreen); |
|
81 iGc.DrawRect(TRect(TPoint(l,0), TPoint(r, size.iHeight))); |
|
82 iGc.DrawRect(TRect(TPoint(0,t), TPoint(size.iWidth, b))); |
|
83 #endif |
|
84 } |
|
85 |
|
86 CTWindowGroup * CTWindowGroup::NewL(RWsSession & aWs, CWsScreenDevice* aScreenDevice) |
|
87 { |
|
88 CTWindowGroup * self = new (ELeave) CTWindowGroup; |
|
89 CleanupStack::PushL(self); |
|
90 self->ConstructL(aWs, aScreenDevice); |
|
91 CleanupStack::Pop(self); |
|
92 return self; |
|
93 } |
|
94 |
|
95 CTWindowGroup::CTWindowGroup() |
|
96 { |
|
97 } |
|
98 |
|
99 void CTWindowGroup::ConstructL(RWsSession & aWs, CWsScreenDevice* aScreenDevice) |
|
100 { |
|
101 iWin = new (ELeave) RWindowGroup(aWs); |
|
102 WindowGroup()->Construct(TUint32(this), aScreenDevice); |
|
103 } |
|
104 |
|
105 CTWindowGroup::~CTWindowGroup() |
|
106 { |
|
107 iWin->Close(); |
|
108 delete iWin; |
|
109 } |
|
110 |
|
111 void CTWindowGroup::Event(TWsEvent & /*aEvent*/) |
|
112 { |
|
113 } |
|
114 |
|
115 void CTWindowGroup::Redraw(TWsRedrawEvent & /*aEvent*/) |
|
116 { |
|
117 } |
|
118 |