sl@0
|
1 |
// Copyright (c) 1996-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 the License "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 |
// e32test\window\t_colour.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <e32test.h>
|
sl@0
|
19 |
#include <e32twin.h>
|
sl@0
|
20 |
#include <e32debug.h>
|
sl@0
|
21 |
|
sl@0
|
22 |
class ColorTest
|
sl@0
|
23 |
{
|
sl@0
|
24 |
public:
|
sl@0
|
25 |
void ModesAndText(TVideoMode aMode);
|
sl@0
|
26 |
void Colors();
|
sl@0
|
27 |
RConsole con;
|
sl@0
|
28 |
};
|
sl@0
|
29 |
|
sl@0
|
30 |
void ColorTest::ModesAndText(TVideoMode aMode)
|
sl@0
|
31 |
{
|
sl@0
|
32 |
|
sl@0
|
33 |
TInt r=con.SetMode(aMode);
|
sl@0
|
34 |
con.SetCursorPosAbs(TPoint(1,4));
|
sl@0
|
35 |
if(r!=KErrNone)
|
sl@0
|
36 |
{
|
sl@0
|
37 |
con.Write(_L("Not supported."));
|
sl@0
|
38 |
TConsoleKey key;
|
sl@0
|
39 |
con.Read(key);
|
sl@0
|
40 |
}
|
sl@0
|
41 |
else
|
sl@0
|
42 |
{
|
sl@0
|
43 |
con.Write(_L("Normal text..."));
|
sl@0
|
44 |
con.SetCursorPosAbs(TPoint(1,6));
|
sl@0
|
45 |
con.SetTextAttribute(ETextAttributeBold);
|
sl@0
|
46 |
con.Write(_L("Bold text..."));
|
sl@0
|
47 |
con.SetCursorPosAbs(TPoint(1,8));
|
sl@0
|
48 |
con.SetTextAttribute(ETextAttributeInverse);
|
sl@0
|
49 |
con.Write(_L("Inverted text..."));
|
sl@0
|
50 |
con.SetCursorPosAbs(TPoint(1,10));
|
sl@0
|
51 |
con.SetTextAttribute(ETextAttributeHighlight);
|
sl@0
|
52 |
con.Write(_L("Highlighted text..."));
|
sl@0
|
53 |
Colors();
|
sl@0
|
54 |
}
|
sl@0
|
55 |
con.ClearScreen();
|
sl@0
|
56 |
con.SetTextAttribute(ETextAttributeNormal);
|
sl@0
|
57 |
con.SetCursorPosAbs(TPoint(3,2));
|
sl@0
|
58 |
}
|
sl@0
|
59 |
|
sl@0
|
60 |
void ColorTest::Colors()
|
sl@0
|
61 |
{
|
sl@0
|
62 |
RConsole col;
|
sl@0
|
63 |
|
sl@0
|
64 |
col.Create();
|
sl@0
|
65 |
col.Control(_L("-Vis"));
|
sl@0
|
66 |
col.Init(_L("Colours"),TSize(18,18));
|
sl@0
|
67 |
col.Control(_L("+Max"));
|
sl@0
|
68 |
col.SetWindowPosAbs(TPoint(1,0));
|
sl@0
|
69 |
col.Control(_L("+Vis -Cursor"));
|
sl@0
|
70 |
for(TInt t=0;t<256;t++)
|
sl@0
|
71 |
{
|
sl@0
|
72 |
if(!(t%16))
|
sl@0
|
73 |
col.SetCursorPosAbs(TPoint(1,1+t/16));
|
sl@0
|
74 |
col.SetTextColors(0,t);
|
sl@0
|
75 |
col.Write(_L(" "));
|
sl@0
|
76 |
}
|
sl@0
|
77 |
TConsoleKey key;
|
sl@0
|
78 |
col.Read(key);
|
sl@0
|
79 |
col.Destroy();
|
sl@0
|
80 |
}
|
sl@0
|
81 |
|
sl@0
|
82 |
GLDEF_C TInt E32Main()
|
sl@0
|
83 |
{
|
sl@0
|
84 |
ColorTest t;
|
sl@0
|
85 |
|
sl@0
|
86 |
TInt r = t.con.Init(_L("Colour Test"),TSize(28,12));
|
sl@0
|
87 |
if (r != KErrNone)
|
sl@0
|
88 |
{
|
sl@0
|
89 |
RDebug::Printf("Could not create text console: %d", r);
|
sl@0
|
90 |
return r;
|
sl@0
|
91 |
}
|
sl@0
|
92 |
|
sl@0
|
93 |
t.con.Control(_L("+Max"));
|
sl@0
|
94 |
t.con.SetCursorPosAbs(TPoint(3,2));
|
sl@0
|
95 |
t.con.Write(_L("Testing mode EMono:"));
|
sl@0
|
96 |
t.ModesAndText(EMono);
|
sl@0
|
97 |
t.con.Write(_L("Testing mode EGray4:"));
|
sl@0
|
98 |
t.ModesAndText(EGray4);
|
sl@0
|
99 |
t.con.Write(_L("Testing mode EGray16:"));
|
sl@0
|
100 |
t.ModesAndText(EGray16);
|
sl@0
|
101 |
t.con.Write(_L("Testing mode EColor256:"));
|
sl@0
|
102 |
t.ModesAndText(EColor256);
|
sl@0
|
103 |
|
sl@0
|
104 |
return(0);
|
sl@0
|
105 |
}
|