os/graphics/graphicscomposition/surfaceupdate/tsrc/twindows.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicscomposition/surfaceupdate/tsrc/twindows.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,118 @@
     1.4 +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#include "twindows.h"
    1.20 +#include <w32std.h>
    1.21 +
    1.22 +//could you useful for visual checking 
    1.23 +//define DRAW_WINDOW
    1.24 +
    1.25 +CTWindow * CTWindow::NewL(RWsSession & aWs, CTWindowTreeNode& aGroup, CWindowGc& aGc)
    1.26 +	{
    1.27 +	CTWindow * self = new (ELeave) CTWindow(aGc);
    1.28 +	CleanupStack::PushL(self);
    1.29 +	self->ConstructL(aWs, aGroup);
    1.30 +	CleanupStack::Pop(self);
    1.31 +	return self;
    1.32 +	}
    1.33 +
    1.34 +CTWindow::CTWindow(CWindowGc& aGc) :
    1.35 +iGc(aGc)
    1.36 +	{
    1.37 +	}
    1.38 +	
    1.39 +void CTWindow::ConstructL(RWsSession & aWs, CTWindowTreeNode& aGroup)
    1.40 +	{
    1.41 +	iWin = new (ELeave) RWindow(aWs);
    1.42 +	Window()->Construct(*aGroup.WindowTreeNode(), TUint32(this));
    1.43 +	Window()->SetRequiredDisplayMode(EColor16MAP);
    1.44 +	Window()->SetShadowHeight(0);
    1.45 +	Window()->SetShadowDisabled(ETrue);
    1.46 +	}
    1.47 +	
    1.48 +CTWindow::~CTWindow()
    1.49 +	{
    1.50 +	iWin->Close();
    1.51 +	delete iWin;
    1.52 +	}
    1.53 +
    1.54 +void CTWindow::Event(TWsEvent & /*aEvent*/)
    1.55 +	{
    1.56 +	}
    1.57 +
    1.58 +void CTWindow::Redraw(TWsRedrawEvent & /*aEvent*/)
    1.59 +	{
    1.60 +	Window()->BeginRedraw();
    1.61 +	iGc.Activate(*Window());
    1.62 +	Draw();
    1.63 +	iGc.Deactivate();
    1.64 +	Window()->EndRedraw();
    1.65 +	}
    1.66 +
    1.67 +void CTWindow::Draw()
    1.68 +	{
    1.69 +#ifdef DRAW_WINDOW	
    1.70 +	TSize size = Window()->Size();
    1.71 +	
    1.72 +	TInt l = size.iWidth / 3;
    1.73 +	TInt r = size.iWidth * 2 / 3;
    1.74 +	TInt t = size.iHeight / 3;
    1.75 +	TInt b = size.iHeight * 2 / 3;
    1.76 +
    1.77 +	iGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
    1.78 +	iGc.SetBrushColor(KRgbRed);
    1.79 +	iGc.SetPenStyle(CGraphicsContext::ESolidPen);
    1.80 +	iGc.SetPenColor(KRgbBlue);
    1.81 +	iGc.DrawLine(TPoint(-400, -400),               TPoint(size.iWidth + 400, size.iHeight + 400));	
    1.82 +	iGc.DrawLine(TPoint(-400, size.iHeight + 400), TPoint(size.iWidth + 400, -400));	
    1.83 +	iGc.SetPenColor(KRgbGreen);
    1.84 +	iGc.DrawRect(TRect(TPoint(l,0), TPoint(r, size.iHeight)));
    1.85 +	iGc.DrawRect(TRect(TPoint(0,t), TPoint(size.iWidth, b)));
    1.86 +#endif	
    1.87 +	}
    1.88 +
    1.89 +CTWindowGroup * CTWindowGroup::NewL(RWsSession & aWs, CWsScreenDevice* aScreenDevice)
    1.90 +	{
    1.91 +	CTWindowGroup * self = new (ELeave) CTWindowGroup;
    1.92 +	CleanupStack::PushL(self);
    1.93 +	self->ConstructL(aWs, aScreenDevice);
    1.94 +	CleanupStack::Pop(self);
    1.95 +	return self;
    1.96 +	}
    1.97 +
    1.98 +CTWindowGroup::CTWindowGroup()
    1.99 +	{
   1.100 +	}
   1.101 +
   1.102 +void CTWindowGroup::ConstructL(RWsSession & aWs, CWsScreenDevice* aScreenDevice)
   1.103 +	{
   1.104 +	iWin = new (ELeave) RWindowGroup(aWs);
   1.105 +	WindowGroup()->Construct(TUint32(this), aScreenDevice);
   1.106 +	}
   1.107 +
   1.108 +CTWindowGroup::~CTWindowGroup()
   1.109 +	{
   1.110 +	iWin->Close();
   1.111 +	delete iWin;
   1.112 +	}
   1.113 +
   1.114 +void CTWindowGroup::Event(TWsEvent & /*aEvent*/)
   1.115 +	{
   1.116 +	}
   1.117 +
   1.118 +void CTWindowGroup::Redraw(TWsRedrawEvent & /*aEvent*/)
   1.119 +	{
   1.120 +	}
   1.121 +