|
Nokia N97 SDK Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : guiengineappview.h 00004 * Part of : GuiEngine 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 00017 00018 #ifndef __GUIENGINEAPPVIEW_H__ 00019 #define __GUIENGINEAPPVIEW_H__ 00020 00021 00022 // INCLUDES 00023 #include <coecntrl.h> 00024 #include "ShapeListManager.h" 00025 00026 00027 // CONSTANTS 00028 static const TInt KBlackPointer = 1; 00029 static const TInt KBrushRadius = 5; 00030 static const TInt KBrushHeight = 10; 00031 static const TInt KBrushWidth = 10; 00032 00033 // FORWARD DECLARATIONS 00034 class CGuiEngineDocument; 00035 00036 // CLASS DECLARATION 00037 00038 /** 00039 * CGuiEngineAppView 00040 * An instance of class CGuiEngineAppView is the Application View object for the 00041 * GUI / Engine example 00042 */ 00043 class CGuiEngineAppView : public CCoeControl 00044 { 00045 public: // Constructors and destructor 00046 00047 00048 /** 00049 * TBrushShapeType 00050 * The shape type to be drawn 00051 * @param ECircle user last drew a circle 00052 * @param ERectangle user last drew a rectangle 00053 */ 00054 enum TBrushShapeType { ECircle = 0, 00055 ERectangle }; 00056 /** 00057 * NewL. 00058 * Two-phased constructor. 00059 * Create a CGuiEngineAppView object, which will draw itself to aRect 00060 * @param aRect A pointer to the rectangle that defines the size 00061 * and location of the displayable area for the view 00062 * @param aDocument the document 00063 * @return a pointer to the created instance of CGuiEngineAppView. 00064 */ 00065 static CGuiEngineAppView* NewL ( const TRect& aRect, 00066 CGuiEngineDocument* aDocument ); 00067 /** 00068 * NewLC 00069 * Two-phased constructor. 00070 * Create a CGuiEngineAppView object, which will draw itself to aRect 00071 * @param aRect A pointer to the rectangle that defines the size 00072 * and location of the displayable area for the view 00073 * @param aDocument the document 00074 * @return a pointer to the created instance of CGuiEngineAppView. 00075 */ 00076 static CGuiEngineAppView* NewLC( const TRect& aRect, 00077 CGuiEngineDocument* aDocument ); 00078 00079 /** 00080 * ~CGuiEngineAppView. 00081 * Virtual Destructor. 00082 */ 00083 virtual ~CGuiEngineAppView(); 00084 00085 00086 public: // New Functions 00087 00088 /** 00089 * Clear 00090 * Clear the view / model 00091 */ 00092 void Clear(); 00093 00094 /** 00095 * SetBrushShapeType 00096 * Set the type of shape that will be added to the list 00097 * @param aBrushShapeType the shape type of the brush 00098 */ 00099 void SetBrushShapeType( TBrushShapeType aBrushShapeType ); 00100 00101 /** 00102 * BrushShapeType 00103 * Get the type of shape that will be added to the list 00104 * @return Returns the type of shape that will be added. 00105 */ 00106 TBrushShapeType BrushShapeType() const; 00107 00108 /** 00109 * ExternalizeL 00110 * Save the view settings to a stream 00111 * @param aStream the stream to save the data to. 00112 */ 00113 void ExternalizeL( RWriteStream& aStream ) const; 00114 00115 /** 00116 * InternalizeL 00117 * Read the view settings from a stream 00118 * @param aStream the stream to read the data from. 00119 */ 00120 void InternalizeL( RReadStream& aStream ); 00121 00122 00123 public: // from CCoeControl 00124 00125 /** 00126 * Draw 00127 * Draw this to the screen. 00128 * @param aRect the rectangle of this view that needs updating 00129 */ 00130 void Draw( const TRect& aRect ) const; 00131 00132 /** 00133 * OfferKeyEventL 00134 * From CCoeControl, Handles key event. 00135 * @param aKeyEvent The key event. 00136 * @param aType The type of the event. 00137 * @return Indicates whether or not the key event was used 00138 * by this control. 00139 */ 00140 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 00141 TEventCode aType); 00142 00143 /** HandleResourceChange 00144 * From CCoeControl. Handles a change to the control's resources. 00145 * @param aType A message UID value 00146 */ 00147 void HandleResourceChange( TInt aType ); 00148 00149 00150 private: // Constructors and destructor 00151 00152 /** 00153 * CGuiEngineAppView. 00154 * C++ default constructor. 00155 * @param aDocument the model 00156 */ 00157 CGuiEngineAppView( CGuiEngineDocument* aDocument ); 00158 00159 /** 00160 * ConstructL. 00161 * 2nd phase constructor. 00162 * @param aRect Frame rectangle for container. 00163 */ 00164 void ConstructL( const TRect& aRect ); 00165 00166 private: // Data 00167 00168 00169 /** 00170 * iDocument, The current document 00171 * Not owned by CGuiEngineAppView object. 00172 */ 00173 CGuiEngineDocument* iDocument; 00174 00175 /** iBrushShapeType The type of shape currently selected for adding */ 00176 TBrushShapeType iBrushShapeType; 00177 00178 /** iPosition The current 'cursor' position */ 00179 TPoint iPosition; 00180 00181 }; 00182 00183 00184 #endif // __GUIENGINEAPPVIEW_H__ 00185 00186 00187 // End of File
|
© Nokia 2009 |