examples/Graphics/WS/BackedUp/Base.h

00001 /*
00002 Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
00003 
00004 Redistribution and use in source and binary forms, with or without
00005 modification, are permitted provided that the following conditions are met:
00006 
00007 * Redistributions of source code must retain the above copyright notice, this
00008   list of conditions and the following disclaimer.
00009 * Redistributions in binary form must reproduce the above copyright notice,
00010   this list of conditions and the following disclaimer in the documentation
00011   and/or other materials provided with the distribution.
00012 * Neither the name of Nokia Corporation nor the names of its contributors
00013   may be used to endorse or promote products derived from this software
00014   without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00017 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00020 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00021 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00022 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00023 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00024 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00025 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 
00027 Description:  
00028 */
00029 
00030 
00031 
00032 
00033 #if !defined(__WSBACKED_H__)
00034 #define __WSBACKED_H__
00035 
00036 // Forward declarations
00037 class CWsRedrawer;
00038 class CWindow;
00039 class CBackedUpWindow;
00040 
00042 //                                              Declaration of CWsClient
00044 
00045 class CWsClient : public CActive
00046         {
00047 protected:
00048         //construct
00049         CWsClient();
00050         CWsScreenDevice* iScreen;
00051         CWsRedrawer* iRedrawer;
00052         RWsSession iWs;
00053         TWsEvent iWsEvent;
00054 public:
00055         void ConstructL();
00056         // destruct
00057         ~CWsClient();
00058         // main window
00059         virtual void ConstructMainWindowL();
00060         // terminate cleanly
00061         void Exit();
00062         // active object protocol
00063         void IssueRequest(); // request an event
00064         void DoCancel(); // cancel the request
00065         virtual void RunL() = 0; // handle completed request
00066         virtual void HandleKeyEventL (TKeyEvent& aKeyEvent) = 0;
00067 private:
00068         RWindowGroup iGroup;
00069         CWindowGc* iGc;
00070         friend class CWsRedrawer; // needs to get at session
00071         friend class CWindow; // needs to get at session
00072         friend class CBackedUpWindow;
00073         };
00074 
00075 
00076 
00078 //                                              CWsRedrawer declaration
00080 
00081 class CWsRedrawer : public CActive
00082         {
00083 public:
00084         // construct/destruct
00085         CWsRedrawer();
00086         void ConstructL(CWsClient* aClient);
00087         ~CWsRedrawer();
00088         // drawing
00089         void IssueRequest();
00090         void DoCancel();
00091         void RunL();
00092 protected:
00093         CWsClient* iClient;
00094         };
00095 
00096 
00098 //                                                      CWindow declaration
00100 
00101 class CWindow : public CBase
00102         {
00103 public:
00104         enum {KPointerMoveBufferSize=32};
00105         CWindow(CWsClient* aClient);
00106         void ConstructL (const TRect& aRect, const TRgb& aColor, CBackedUpWindow* aParent=0);
00107         ~CWindow();
00108         // access
00109         RWindow& Window(); // our own window
00110         CWindowGc* SystemGc(); // system graphics context
00111         CWsScreenDevice* Screen();
00112         CFont* Font();
00113         // drawing
00114         virtual void Draw(const TRect& aRect) = 0;
00115         virtual void HandlePointerEvent (TPointerEvent& aPointerEvent) = 0;
00116         virtual void HandlePointerMoveBufferReady () = 0;
00117 protected:
00118         RWindow iWindow; // window server window
00119         TRect iRect; // window's extent
00120 private:
00121         CWsClient* iClient; // client including session and group
00122         CFont*  iFont;
00123         };
00124 
00125 class CBackedUpWindow : public CBase
00126         {
00127 public:
00128         enum {KPointerMoveBufferSize=32};
00129         CBackedUpWindow(CWsClient* aClient);
00130         void ConstructL (const TRect& aRect, CWindow* aParent=0);
00131         ~CBackedUpWindow();
00132         // access
00133         RBackedUpWindow& Window(); // our own window
00134         CWindowGc* SystemGc(); // system graphics context
00135         CWsScreenDevice* Screen();
00136         CFont* Font();
00137         // drawing
00138         virtual void Draw(const TRect& aRect) = 0;
00139         virtual void HandlePointerEvent (TPointerEvent& aPointerEvent) = 0;
00140         virtual void HandlePointerMoveBufferReady () = 0;
00141 protected:
00142         RBackedUpWindow iWindow; // window server window
00143         TRect iRect; // window's extent
00144 private:
00145         CWsClient* iClient; // client including session and group
00146         CFont*  iFont;
00147         };
00148 
00149 #endif

Generated by  doxygen 1.6.2