os/graphics/graphicscomposition/surfaceupdate/tsrc/twindows.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#include "twindows.h"
sl@0
    17
#include <w32std.h>
sl@0
    18
sl@0
    19
//could you useful for visual checking 
sl@0
    20
//define DRAW_WINDOW
sl@0
    21
sl@0
    22
CTWindow * CTWindow::NewL(RWsSession & aWs, CTWindowTreeNode& aGroup, CWindowGc& aGc)
sl@0
    23
	{
sl@0
    24
	CTWindow * self = new (ELeave) CTWindow(aGc);
sl@0
    25
	CleanupStack::PushL(self);
sl@0
    26
	self->ConstructL(aWs, aGroup);
sl@0
    27
	CleanupStack::Pop(self);
sl@0
    28
	return self;
sl@0
    29
	}
sl@0
    30
sl@0
    31
CTWindow::CTWindow(CWindowGc& aGc) :
sl@0
    32
iGc(aGc)
sl@0
    33
	{
sl@0
    34
	}
sl@0
    35
	
sl@0
    36
void CTWindow::ConstructL(RWsSession & aWs, CTWindowTreeNode& aGroup)
sl@0
    37
	{
sl@0
    38
	iWin = new (ELeave) RWindow(aWs);
sl@0
    39
	Window()->Construct(*aGroup.WindowTreeNode(), TUint32(this));
sl@0
    40
	Window()->SetRequiredDisplayMode(EColor16MAP);
sl@0
    41
	Window()->SetShadowHeight(0);
sl@0
    42
	Window()->SetShadowDisabled(ETrue);
sl@0
    43
	}
sl@0
    44
	
sl@0
    45
CTWindow::~CTWindow()
sl@0
    46
	{
sl@0
    47
	iWin->Close();
sl@0
    48
	delete iWin;
sl@0
    49
	}
sl@0
    50
sl@0
    51
void CTWindow::Event(TWsEvent & /*aEvent*/)
sl@0
    52
	{
sl@0
    53
	}
sl@0
    54
sl@0
    55
void CTWindow::Redraw(TWsRedrawEvent & /*aEvent*/)
sl@0
    56
	{
sl@0
    57
	Window()->BeginRedraw();
sl@0
    58
	iGc.Activate(*Window());
sl@0
    59
	Draw();
sl@0
    60
	iGc.Deactivate();
sl@0
    61
	Window()->EndRedraw();
sl@0
    62
	}
sl@0
    63
sl@0
    64
void CTWindow::Draw()
sl@0
    65
	{
sl@0
    66
#ifdef DRAW_WINDOW	
sl@0
    67
	TSize size = Window()->Size();
sl@0
    68
	
sl@0
    69
	TInt l = size.iWidth / 3;
sl@0
    70
	TInt r = size.iWidth * 2 / 3;
sl@0
    71
	TInt t = size.iHeight / 3;
sl@0
    72
	TInt b = size.iHeight * 2 / 3;
sl@0
    73
sl@0
    74
	iGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
sl@0
    75
	iGc.SetBrushColor(KRgbRed);
sl@0
    76
	iGc.SetPenStyle(CGraphicsContext::ESolidPen);
sl@0
    77
	iGc.SetPenColor(KRgbBlue);
sl@0
    78
	iGc.DrawLine(TPoint(-400, -400),               TPoint(size.iWidth + 400, size.iHeight + 400));	
sl@0
    79
	iGc.DrawLine(TPoint(-400, size.iHeight + 400), TPoint(size.iWidth + 400, -400));	
sl@0
    80
	iGc.SetPenColor(KRgbGreen);
sl@0
    81
	iGc.DrawRect(TRect(TPoint(l,0), TPoint(r, size.iHeight)));
sl@0
    82
	iGc.DrawRect(TRect(TPoint(0,t), TPoint(size.iWidth, b)));
sl@0
    83
#endif	
sl@0
    84
	}
sl@0
    85
sl@0
    86
CTWindowGroup * CTWindowGroup::NewL(RWsSession & aWs, CWsScreenDevice* aScreenDevice)
sl@0
    87
	{
sl@0
    88
	CTWindowGroup * self = new (ELeave) CTWindowGroup;
sl@0
    89
	CleanupStack::PushL(self);
sl@0
    90
	self->ConstructL(aWs, aScreenDevice);
sl@0
    91
	CleanupStack::Pop(self);
sl@0
    92
	return self;
sl@0
    93
	}
sl@0
    94
sl@0
    95
CTWindowGroup::CTWindowGroup()
sl@0
    96
	{
sl@0
    97
	}
sl@0
    98
sl@0
    99
void CTWindowGroup::ConstructL(RWsSession & aWs, CWsScreenDevice* aScreenDevice)
sl@0
   100
	{
sl@0
   101
	iWin = new (ELeave) RWindowGroup(aWs);
sl@0
   102
	WindowGroup()->Construct(TUint32(this), aScreenDevice);
sl@0
   103
	}
sl@0
   104
sl@0
   105
CTWindowGroup::~CTWindowGroup()
sl@0
   106
	{
sl@0
   107
	iWin->Close();
sl@0
   108
	delete iWin;
sl@0
   109
	}
sl@0
   110
sl@0
   111
void CTWindowGroup::Event(TWsEvent & /*aEvent*/)
sl@0
   112
	{
sl@0
   113
	}
sl@0
   114
sl@0
   115
void CTWindowGroup::Redraw(TWsRedrawEvent & /*aEvent*/)
sl@0
   116
	{
sl@0
   117
	}
sl@0
   118