sl@0: // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include "twindows.h" sl@0: #include sl@0: sl@0: //could you useful for visual checking sl@0: //define DRAW_WINDOW sl@0: sl@0: CTWindow * CTWindow::NewL(RWsSession & aWs, CTWindowTreeNode& aGroup, CWindowGc& aGc) sl@0: { sl@0: CTWindow * self = new (ELeave) CTWindow(aGc); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aWs, aGroup); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: CTWindow::CTWindow(CWindowGc& aGc) : sl@0: iGc(aGc) sl@0: { sl@0: } sl@0: sl@0: void CTWindow::ConstructL(RWsSession & aWs, CTWindowTreeNode& aGroup) sl@0: { sl@0: iWin = new (ELeave) RWindow(aWs); sl@0: Window()->Construct(*aGroup.WindowTreeNode(), TUint32(this)); sl@0: Window()->SetRequiredDisplayMode(EColor16MAP); sl@0: Window()->SetShadowHeight(0); sl@0: Window()->SetShadowDisabled(ETrue); sl@0: } sl@0: sl@0: CTWindow::~CTWindow() sl@0: { sl@0: iWin->Close(); sl@0: delete iWin; sl@0: } sl@0: sl@0: void CTWindow::Event(TWsEvent & /*aEvent*/) sl@0: { sl@0: } sl@0: sl@0: void CTWindow::Redraw(TWsRedrawEvent & /*aEvent*/) sl@0: { sl@0: Window()->BeginRedraw(); sl@0: iGc.Activate(*Window()); sl@0: Draw(); sl@0: iGc.Deactivate(); sl@0: Window()->EndRedraw(); sl@0: } sl@0: sl@0: void CTWindow::Draw() sl@0: { sl@0: #ifdef DRAW_WINDOW sl@0: TSize size = Window()->Size(); sl@0: sl@0: TInt l = size.iWidth / 3; sl@0: TInt r = size.iWidth * 2 / 3; sl@0: TInt t = size.iHeight / 3; sl@0: TInt b = size.iHeight * 2 / 3; sl@0: sl@0: iGc.SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: iGc.SetBrushColor(KRgbRed); sl@0: iGc.SetPenStyle(CGraphicsContext::ESolidPen); sl@0: iGc.SetPenColor(KRgbBlue); sl@0: iGc.DrawLine(TPoint(-400, -400), TPoint(size.iWidth + 400, size.iHeight + 400)); sl@0: iGc.DrawLine(TPoint(-400, size.iHeight + 400), TPoint(size.iWidth + 400, -400)); sl@0: iGc.SetPenColor(KRgbGreen); sl@0: iGc.DrawRect(TRect(TPoint(l,0), TPoint(r, size.iHeight))); sl@0: iGc.DrawRect(TRect(TPoint(0,t), TPoint(size.iWidth, b))); sl@0: #endif sl@0: } sl@0: sl@0: CTWindowGroup * CTWindowGroup::NewL(RWsSession & aWs, CWsScreenDevice* aScreenDevice) sl@0: { sl@0: CTWindowGroup * self = new (ELeave) CTWindowGroup; sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aWs, aScreenDevice); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: CTWindowGroup::CTWindowGroup() sl@0: { sl@0: } sl@0: sl@0: void CTWindowGroup::ConstructL(RWsSession & aWs, CWsScreenDevice* aScreenDevice) sl@0: { sl@0: iWin = new (ELeave) RWindowGroup(aWs); sl@0: WindowGroup()->Construct(TUint32(this), aScreenDevice); sl@0: } sl@0: sl@0: CTWindowGroup::~CTWindowGroup() sl@0: { sl@0: iWin->Close(); sl@0: delete iWin; sl@0: } sl@0: sl@0: void CTWindowGroup::Event(TWsEvent & /*aEvent*/) sl@0: { sl@0: } sl@0: sl@0: void CTWindowGroup::Redraw(TWsRedrawEvent & /*aEvent*/) sl@0: { sl@0: } sl@0: