idlehomescreen/inc/xneditmode.h
changeset 0 f72a12da539e
child 4 4d54b72983ae
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Edit mode for widget drag and drop.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef XNEDITMODE_H
       
    19 #define XNEDITMODE_H
       
    20 
       
    21 // System includes
       
    22 #include <coecntrl.h>
       
    23 
       
    24 // Forward declarations
       
    25 class CXnUiEngine;
       
    26 class CXnViewManager;
       
    27 class CXnNode;
       
    28 class CFbsBitGc;
       
    29 class CFbsBitmap;
       
    30 class CFbsBitmapDevice;
       
    31 class CWindowToBitmapMappingGc;
       
    32 
       
    33 // Class declaration
       
    34 
       
    35 /**
       
    36  * Edit mode. Enables widget drag and drop.
       
    37  *
       
    38  * @ingroup group_xnlayoutengine
       
    39  * @lib xnlayoutengine.lib
       
    40  * @since Series 60 5.1
       
    41  */
       
    42 NONSHARABLE_CLASS( CXnEditMode ) : public CCoeControl  
       
    43     {
       
    44 public:
       
    45     // Data types
       
    46     enum TEditState
       
    47         {
       
    48         ENone = 0x00,
       
    49         EWaitDrag = 0x01,        
       
    50         EShootContent = 0x02,
       
    51         EDragging = 0x04,
       
    52         EDragAndDrop = 0x08,
       
    53         EKeyMove = 0x10
       
    54         };
       
    55 
       
    56 public:
       
    57     /**
       
    58      * Two-phased constructor.
       
    59      */
       
    60     static CXnEditMode* NewL( CXnUiEngine& aUiEngine );
       
    61 
       
    62     /**
       
    63      * Destructor.
       
    64      */
       
    65     ~CXnEditMode();
       
    66 
       
    67 private:
       
    68     // from CCoeControl
       
    69 
       
    70     /**
       
    71      * @see CCoeControl
       
    72      */
       
    73     void Draw( const TRect& aRect ) const;
       
    74 
       
    75     /**
       
    76      * @see CCoeControl
       
    77      */    
       
    78     void MakeVisible( TBool aVisible );
       
    79 
       
    80     /**
       
    81      * @see CCoeControl
       
    82      */        
       
    83     void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
    84 
       
    85     /**
       
    86      * @see CCoeControl
       
    87      */        
       
    88     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
       
    89             TEventCode aType );
       
    90 
       
    91     /**
       
    92      * @see CCoeControl
       
    93      */            
       
    94     void SizeChanged();
       
    95             
       
    96 public:
       
    97     // New functions
       
    98 
       
    99     /**
       
   100      * Changes the state of edit mode.
       
   101      *
       
   102      * @since Series 60 5.0
       
   103      * @param aSet The state of edit mode.     
       
   104      */
       
   105     void SetEditModeL( CXnEditMode::TEditState aSet );
       
   106 
       
   107     /**
       
   108      * Gets the status of the edit mode.
       
   109      *
       
   110      * @since Series 60 5.0
       
   111      * @return Edit mode state.
       
   112      */
       
   113     CXnEditMode::TEditState EditState() const;
       
   114     
       
   115     /**
       
   116      * This is for to re-initializing the double buffer when the orientations
       
   117      * is changed
       
   118      *
       
   119      * @since Series 60 5.0
       
   120      */
       
   121     void HandleScreenDeviceChangedL();
       
   122         
       
   123 private:
       
   124     // new functions
       
   125 
       
   126     /**
       
   127      * Organizing starts using drag and drop.
       
   128      *
       
   129      * @since Series 60 5.0
       
   130      * @param aNode Node to drag.
       
   131      */
       
   132     void StartDragL( CXnNode& aNode );
       
   133     
       
   134     /**
       
   135      * Reset the dragging state and deletes screenshot bitmaps.
       
   136      *
       
   137      * @since Series 60 5.0
       
   138      */
       
   139     void StopDragL();
       
   140     
       
   141     /**
       
   142      * Updates invalid parts of the screen. Calls internally DrawNow
       
   143      *
       
   144      * @since Series 60 5.0     
       
   145      */
       
   146     void UpdateScreen();
       
   147 
       
   148     /**
       
   149      * Sets the title for status pane
       
   150      *
       
   151      * @since Series 60 5.0
       
   152      */
       
   153     void SetStatusPaneTitleL();
       
   154     
       
   155 private:    
       
   156     // Constructors
       
   157     
       
   158     /**
       
   159      * C++ default constructor.
       
   160      */
       
   161     CXnEditMode( CXnUiEngine& aEngine );
       
   162 
       
   163     /**
       
   164      * 2nd phase constructor.
       
   165      */    
       
   166     void ConstructL();
       
   167     
       
   168 private:
       
   169     // Data
       
   170 
       
   171     /**
       
   172      * UI engine
       
   173      * Not own.
       
   174      */
       
   175     CXnUiEngine& iUiEngine;
       
   176 
       
   177     /**
       
   178      * View manager
       
   179      * Not own.
       
   180      */
       
   181     CXnViewManager& iViewManager;
       
   182     
       
   183     /**
       
   184      * Screenshot of part of mainpane
       
   185      * Owned
       
   186      */    
       
   187     CFbsBitmap* iMainpane;
       
   188 
       
   189     /**
       
   190      * Screenshot of widget
       
   191      * Owned
       
   192      */
       
   193     CFbsBitmap* iWidget;
       
   194     
       
   195     /**
       
   196      * Mapping Gc
       
   197      * Owned
       
   198      */
       
   199     CWindowToBitmapMappingGc* iMapGc;
       
   200     
       
   201     /**
       
   202      * Bmp device
       
   203      * Owned
       
   204      */
       
   205     CFbsBitmapDevice* iBmpDevice;
       
   206     
       
   207     /**
       
   208      * Bmp Gc
       
   209      * Owned
       
   210      */
       
   211     CFbsBitGc* iBmpGc;          
       
   212     
       
   213     /**
       
   214      * A pointer to the node that is being dragged.
       
   215      * Not own.
       
   216      */
       
   217     CXnNode* iDraggingNode;
       
   218 
       
   219     /**
       
   220      * A pointer to the node that is underneath of the dragging node.
       
   221      * Not own.
       
   222      */
       
   223     CXnNode* iTargetNode;
       
   224     
       
   225     /**
       
   226      * State of edit mode
       
   227      */
       
   228     CXnEditMode::TEditState iState;
       
   229         
       
   230     /**
       
   231      * A point where dragging started from.
       
   232      */
       
   233     TPoint iStylusDownPos;
       
   234 
       
   235     /**
       
   236      * A point where drawing was done last time.
       
   237      */
       
   238     TPoint iPreviousPos;
       
   239                
       
   240     /**
       
   241      * Screenshot draw position
       
   242      */
       
   243     TPoint iDrawPos;
       
   244     
       
   245     /**
       
   246      * Last redraw rect
       
   247      */
       
   248     TRect iLastDrawRect;
       
   249     
       
   250     /**
       
   251      * Flag determine whether drag is occured
       
   252      */
       
   253     TBool iDragged;
       
   254     };
       
   255 
       
   256 #endif