S60 3rd Edition SDK for Symbian OS
Example Applications Guide

SIPExGameContainer.h

00001 /*
00002 * ==============================================================================
00003 *  Name        : SIPExGameContainer.h
00004 *  Part of     : SIPEx
00005 *  Interface   : 
00006 *  Description : 
00007 *  Version     : 
00008 *
00009 *  Copyright (c) 2004-2006 Nokia Corporation.
00010 *  This material, including documentation and any related 
00011 *  computer programs, is protected by copyright controlled by 
00012 *  Nokia Corporation.
00013 * ==============================================================================
00014 */
00015 
00016 #ifndef __SIPEXGAMECONTAINER_H__
00017 #define __SIPEXGAMECONTAINER_H__
00018 
00019 // INCLUDES
00020 #include <coecntrl.h>
00021    
00022 // FORWARD DECLARATIONS
00023 class CSIPExEngine;
00024 class CAknsBasicBackgroundControlContext;
00025 
00026 // CLASS DECLARATION
00027 
00028 /**
00029 *  CSIPExGameContainer  container control class.
00030 *  
00031 */
00032 class CSIPExGameContainer : public CCoeControl, MCoeControlObserver
00033     {
00034     public: // Constructors and destructor
00035     
00036         /**
00037         * C++ default constructor
00038         * @param aEngine The reference to the application engine.
00039         */
00040         CSIPExGameContainer( CSIPExEngine& aEngine );
00041         
00042         /**
00043         * EPOC default constructor.
00044         * @param aRect Frame rectangle for container.
00045         */
00046         void ConstructL( const TRect& aRect );
00047 
00048         /**
00049         * Destructor.
00050         */
00051         ~CSIPExGameContainer();
00052 
00053    private: // Functions from base classes
00054 
00055        /**
00056         * From CoeControl,SizeChanged.
00057         */
00058         void SizeChanged();
00059 
00060        /**
00061         * From CoeControl,CountComponentControls.
00062         */
00063         TInt CountComponentControls() const;
00064 
00065        /**
00066         * From CCoeControl,ComponentControl.
00067         */
00068         CCoeControl* ComponentControl( TInt aIndex ) const;
00069 
00070        /**
00071         * From CCoeControl,Draw.
00072         */
00073         void Draw( const TRect& aRect ) const;
00074 
00075        /**
00076         * From CCoeControl, HandleControlEventL.
00077         */
00078         void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType );
00079         
00080         /**
00081         * From CCoeControl, OfferKeyEvent.
00082         */
00083         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
00084         
00085         /**
00086         * From CCoeControl, HandleResourceChange.
00087         */
00088         void HandleResourceChange( TInt aType );
00089   
00090         /**
00091         * From CCoeControl, MopSupplyObject.
00092         */
00093         TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
00094         
00095         
00096     private:
00097 
00098         /**
00099         * Drawing game. Decides if the cursor or board will be drawn.
00100         * @param aGc    The system's graphics context.
00101         * @param aRect  The rectangle where to draw.
00102         */
00103         void DrawGame(CWindowGc& aGc, const TRect& aRect) const;
00104 
00105         /**
00106         * Drawing the game board
00107         * @param aGc    The system's graphics context.
00108         * @param aRect  The rectangle where to draw.
00109         */
00110         void DrawBoard( CWindowGc& aGc, const TRect& aRect ) const;
00111 
00112         /**
00113         * Drawing the game cursor.
00114         * @param aGc    The system's graphics context.
00115         * @param aRect  The rectangle where to draw.
00116         */
00117         void DrawCursor(CWindowGc& aGc, const TRect& aRect) const;
00118         
00119         /**
00120         * Calculating game board dimensions.
00121         * @param aRect    The rectangle available to the game.
00122         */
00123         void CalculateBoardDimensions( const TRect& aRect );
00124         
00125         
00126     private: //data
00127     
00128         CSIPExEngine& iEngine;
00129         
00130         CAknsBasicBackgroundControlContext* iBgContext;
00131         
00132         TInt iXOffset;
00133         TInt iYOffset;
00134         TInt iBoxW;
00135         TInt iMidW;
00136     };
00137 
00138 #endif // __SIPEXGAMECONTAINER_H__
00139 
00140 // End of File

© Nokia 2006

Back to top