Nokia N97 SDK
Example Applications Guide

tactileexampleappview.h

00001 /*
00002 * ============================================================================
00003 *  Name        : tactileexampleappview.h
00004 *  Part of     : Tactile Example
00005 *  Interface   : N/A
00006 *  Description : Declares the container controller for the Tactile Example
00007 *  Version     :
00008 *
00009 *  Copyright (c) 2008 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 __TACTILEEXAMPLEAPPVIEW_H__
00017 #define __TACTILEEXAMPLEAPPVIEW_H__
00018 
00019 // INCLUDES
00020 #include <coecntrl.h>
00021 #include "tactileexamplesquare.h"
00022 #include "tactileexamplecircle.h"
00023 
00024 // FORWARD DECLARATIONS
00025 class CAknButton;
00026 class MTouchFeedback;
00027 
00028 // CLASS DECLARATION
00029 /**
00030 * CTactileExampleAppView application view class.
00031 *
00032 */
00033 class CTactileExampleAppView : public CCoeControl, MCoeControlObserver
00034     {
00035 public: // New methods
00036 
00037     /**
00038      * NewL.
00039      * Two-phased constructor.
00040      * Create a CTactileExampleAppView object, which will draw itself to aRect.
00041      * @param aRect The rectangle this view will be drawn to.
00042      * @return a pointer to the created instance of CTactileExampleAppView.
00043      */
00044     static CTactileExampleAppView* NewL( const TRect& aRect );
00045 
00046     /**
00047      * NewLC.
00048      * Two-phased constructor.
00049      * Create a CTactileExampleAppView object, which will draw itself
00050      * to aRect.
00051      * @param aRect Rectangle this view will be drawn to.
00052      * @return A pointer to the created instance of CTactileExampleAppView.
00053      */
00054     static CTactileExampleAppView* NewLC( const TRect& aRect );
00055 
00056     /**
00057      * ~CTactileExampleAppView
00058      * Virtual Destructor.
00059      */
00060     virtual ~CTactileExampleAppView();
00061 
00062 
00063 
00064 // from base class CCoeControl
00065 
00066     /**
00067      * From CoeControl.
00068      * @return Nbr of controls inside this container.
00069      */
00070     TInt CountComponentControls() const;
00071 
00072     /**
00073      * From CCoeControl.
00074      * @param Index number of the control.
00075      * @return Pointer of controls inside this container.
00076      */
00077     CCoeControl* ComponentControl( TInt aIndex ) const;
00078 
00079     /**
00080      * From CCoeControl.
00081      * Draw this CTactileExampleAppView to the screen.
00082      * @param aRect the rectangle of this view that needs updating
00083      */
00084     void Draw( const TRect& aRect ) const;
00085 
00086     /**
00087      * From CoeControl.
00088      * Called by framework when the view size is changed.
00089      */
00090     void SizeChanged();
00091 
00092     /**
00093      * From CCoeControl.
00094      * @param aPointerEvent The pointer event.
00095      */
00096     void HandlePointerEventL( const TPointerEvent& aPointerEvent );
00097 
00098     /**
00099      * From CCoeControl.
00100      * @param aType The type of resources that have changed.
00101      */
00102     void HandleResourceChange( TInt aType );
00103 
00104 
00105 // from base class MCoeControlObserver
00106 
00107     /**
00108      * From MCoeControlObserver.
00109      * Handles an event of type aEventType
00110      * @param aControl Pointer to component control
00111      * @param aEventType Event code
00112      */
00113     void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
00114 
00115 
00116 
00117 private:
00118 
00119     /**
00120      * CTactileExampleAppView.
00121      * C++ default constructor.
00122      */
00123     CTactileExampleAppView();
00124 
00125     /**
00126      * ConstructL
00127 
00128      * 2nd phase constructor.
00129      * Perform the second phase construction of a
00130      * CTactileExampleAppView object.
00131      * @param aRect The rectangle this view will be drawn to.
00132      */
00133     void ConstructL( const TRect& aRect );
00134 
00135     /**
00136      * SetObjects
00137      * Sets the circle and square objects to default position
00138      */
00139     void SetObjects();
00140 
00141     /**
00142      * Move
00143      * Moves the control snapping to imaginary grid lines
00144      * @param aControl Control which is moved.
00145      * @param aPoint Point where control is moved to.
00146      */
00147     void Move( CCoeControl* aControl, TPoint aPoint );
00148 
00149     /**
00150      * ObjectDimension
00151      * Calculates object's side length related to screen size
00152      */
00153     void ObjectDimension();
00154 
00155 
00156 
00157 private: // data
00158 
00159     /**
00160      * Offset from the object's top left corner to the point of touch
00161      */
00162     TPoint  iDraggingOffset;
00163 
00164     /**
00165      * Area where dragging is possible
00166      */
00167     TRect  iDragArea;
00168 
00169     /**
00170      * Flag indicating circle is dragged
00171      */
00172     TBool  iDragCircle;
00173 
00174     /**
00175      * Flag indicating square is dragged
00176      */
00177     TBool  iDragSquare;
00178 
00179     /**
00180      * Size of objects related to screen size
00181      */
00182     TInt  iObjectDimension;
00183 
00184     /**
00185      * Circle object
00186      * Own.
00187      */
00188     CTactileExampleCircle* iCircle;
00189 
00190     /**
00191      * Square object
00192      * Own.
00193      */
00194     CTactileExampleSquare* iSquare;
00195 
00196     /**
00197      * Reset button
00198      * Own.
00199      */
00200     CAknButton*  iButton;
00201 
00202     /**
00203      * Pointer to touch feedback instance
00204      * Not own.
00205      */
00206     MTouchFeedback* iFeedback;
00207     };
00208 
00209 #endif // __TACTILEEXAMPLEAPPVIEW_H__
00210 
00211 // End of File

© Nokia 2009

Back to top