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