examples/Graphics/WS/BitmapSprite/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 // @file
00015 //
00016 
00017 
00018 #if !defined(__WSPRITE2_H__)
00019 #define __WSPRITE2_H__
00020 
00021 
00022 // Forward declarations
00023 class CWsRedrawer;
00024 class CWindow;
00025 
00026 
00028 //                                              Declaration of CWsClient
00030 
00031 class CWsClient : public CActive
00032         {
00033 public:
00034         void ConstructL();
00035         // destruct
00036         ~CWsClient();
00037         // main window
00038         virtual void ConstructMainWindowL();
00039         // terminate cleanly
00040         void Exit();
00041         // active object protocol
00042         void IssueRequest(); // request an event
00043         void DoCancel(); // cancel the request
00044         virtual void RunL() = 0; // handle completed request
00045         virtual void HandleKeyEventL (TKeyEvent& aKeyEvent) = 0;
00046 protected:
00047         //construct
00048         CWsClient();
00049         CWsScreenDevice* iScreen;
00050         CWsRedrawer* iRedrawer;
00051         RWsSession iWs;
00052         TWsEvent iWsEvent;
00053 private:
00054         RWindowGroup iGroup;
00055         CWindowGc* iGc;
00056         friend class CWsRedrawer; // needs to get at session
00057         friend class CWindow; // needs to get at session
00058         friend class CSprite;
00059         friend class CPointerCursor;
00060         };
00061 
00062 
00063 
00065 //                                              CWsRedrawer declaration
00067 
00068 class CWsRedrawer : public CActive
00069         {
00070 public:
00071         // construct/destruct
00072         CWsRedrawer();
00073         void ConstructL(CWsClient* aClient);
00074         ~CWsRedrawer();
00075         // drawing
00076         void IssueRequest();
00077         void DoCancel();
00078         void RunL();
00079 protected:
00080         CWsClient* iClient;
00081         };
00082 
00083 
00085 //                                                      CWindow declaration
00087 
00088 class CWindow : public CBase
00089         {
00090 protected:
00091         RWindow iWindow; // window server window
00092         TRect iRect; // window's extent
00093 public:
00094         enum {KPointerMoveBufferSize=32};
00095         CWindow(CWsClient* aClient);
00096         void ConstructL (const TRect& aRect, const TRgb& aColor, CWindow* aParent=0);
00097         ~CWindow();
00098         // access
00099         RWindow& Window(); // our own window
00100         CWindowGc* SystemGc(); // system graphics context
00101         CWsScreenDevice* Screen();
00102         CFont* Font();
00103         // drawing
00104         virtual void Draw(const TRect& aRect) = 0;
00105         virtual void HandlePointerEvent (TPointerEvent& aPointerEvent) = 0;
00106 private:
00107         CWsClient* iClient; // client including session and group
00108         CFont*  iFont;
00109         };
00110 
00111 #endif

Generated by  doxygen 1.6.2