applications/Symbian_MiniGUI_TestApp/grid.cpp
changeset 46 b6935a90ca64
child 67 57a5a30dc911
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/applications/Symbian_MiniGUI_TestApp/grid.cpp	Mon Mar 08 18:45:03 2010 +0000
@@ -0,0 +1,83 @@
+#include <w32std.h> 
+#include "profiler.h"
+
+const TSize KSize(64,60);
+const TInt KRow = 4;
+const TInt KCol = 5; 
+
+void MainL()	
+	{	
+	RWsSession ws;
+	ws.Connect();
+ 	CWsScreenDevice* scr = new(ELeave) CWsScreenDevice(ws);
+	scr->Construct();
+ 	CWindowGc* gc = new(ELeave) CWindowGc(scr);
+	gc->Construct();
+ 	RWindowGroup grp(ws);
+	grp.Construct(0xc0decafe, ETrue);
+ 	RWindow win(ws);
+	win.Construct(grp, 0xbeefcafe);
+	win.SetExtent(TPoint(20,160), TSize(320,240));
+	win.Activate();
+ 	win.Invalidate();
+	win.BeginRedraw();
+	gc->Activate(win);
+ 	gc->SetPenStyle(CGraphicsContext::ENullPen);
+	gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
+ 	TBool color = EFalse;
+
+if (Profiler::Start() == KErrNotFound)
+	{
+	_LIT(KProfiler,"profiler");
+	_LIT(KStart,"start -noui -drive=S");
+	RProcess p;
+	if (p.Create(KProfiler,KStart) == KErrNone)
+		{
+		p.Resume();
+		p.Close();
+		}
+	}
+
+	for (TInt col=0; col<KCol; ++col)
+		{
+		color = !color;		
+		for (TInt row=0; row<KRow; ++row)
+			{
+			TRect rect;
+			rect.iTl.iX = col * KSize.iWidth;
+			rect.iTl.iY = row * KSize.iHeight;
+			rect.SetSize(KSize);
+			color = !color;
+			gc->SetBrushColor(color? KRgbGray : KRgbBlack);
+			gc->DrawRect(rect);
+			}
+	}
+	gc->Deactivate();
+	win.EndRedraw();
+	ws.Flush();
+ 	User::After(3000000);
+ 	win.Close();
+	grp.Close();
+	delete gc;
+	delete scr;
+	ws.Close();
+
+	Profiler::Stop();
+	Profiler::Close();
+	Profiler::Unload();
+
+	} 
+
+
+GLDEF_C TInt E32Main()	
+{	
+
+	CTrapCleanup* tc = CTrapCleanup::New();	
+	if (!tc)
+		{		
+		return KErrNoMemory;
+		}
+	TRAPD(err, MainL());
+	delete tc;
+ 	return err;	
+}
\ No newline at end of file