examples/Graphics/WS/VectorSprite/Base.h

00001 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
00002 // All rights reserved.
00003 // This component and the accompanying materials are made available
00004 // under the terms of "Eclipse Public License v1.0"
00005 // which accompanies this distribution, and is available
00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00007 //
00008 // Initial Contributors:
00009 // Nokia Corporation - initial contribution.
00010 //
00011 // Contributors:
00012 //
00013 // Description:
00014 //
00015 
00016 
00017 #if !defined(__VECTORSPRITES_H__)
00018 #define __VECTORSPRITES_H__
00019 
00020 // Forward declarations
00021 class CWsRedrawer;
00022 class CWindow;
00023 
00025 //                                              Declaration of CWsClient
00027 
00028 class CWsClient : public CActive
00029         {
00030 public:
00031         void ConstructL();
00032         // destruct
00033         ~CWsClient();
00034         // main window
00035         virtual void ConstructMainWindowL();
00036         // terminate cleanly
00037         void Exit();
00038         // active object protocol
00039         void IssueRequest(); // request an event
00040         void DoCancel(); // cancel the request
00041         virtual void RunL() = 0; // handle completed request
00042         virtual void HandleKeyEventL (TKeyEvent& aKeyEvent) = 0;
00043 protected:
00044         //construct
00045         CWsClient();
00046         CWsScreenDevice* iScreen;
00047         CWsRedrawer* iRedrawer;
00048         RWsSession iWs;
00049         TWsEvent iWsEvent;
00050 private:
00051         RWindowGroup iGroup;
00052         CWindowGc* iGc;
00053         friend class CWsRedrawer; // needs to get at session
00054         friend class CWindow; // needs to get at session
00055         friend class CSprite;
00056         friend class CPointerCursor;
00057         };
00058 
00059 
00060 
00062 //                                              CWsRedrawer declaration
00064 
00065 class CWsRedrawer : public CActive
00066         {
00067 public:
00068         // construct/destruct
00069         CWsRedrawer();
00070         void ConstructL(CWsClient* aClient);
00071         ~CWsRedrawer();
00072         // drawing
00073         void IssueRequest();
00074         void DoCancel();
00075         void RunL();
00076 protected:
00077         CWsClient* iClient;
00078         };
00079 
00080 
00082 //                                                      CWindow declaration
00084 
00085 class CWindow : public CBase
00086         {
00087 public:
00088         enum {KPointerMoveBufferSize=32};
00089         CWindow(CWsClient* aClient);
00090         void ConstructL (const TRect& aRect, const TRgb& aColor, CWindow* aParent=0);
00091         ~CWindow();
00092         // access
00093         RWindow& Window(); // our own window
00094         CWindowGc* SystemGc(); // system graphics context
00095         CWsScreenDevice* Screen();
00096         CFont* Font();
00097         // drawing
00098         virtual void Draw(const TRect& aRect) = 0;
00099         virtual void HandlePointerEvent (TPointerEvent& aPointerEvent) = 0;
00100 protected:
00101         RWindow iWindow; // window server window
00102         TRect iRect; // window's extent
00103 private:
00104         CWsClient* iClient; // client including session and group
00105         CFont*  iFont;
00106         };
00107 
00108 
00109 #endif

Generated by  doxygen 1.6.2