camerauis/cameraapp/generic/inc/CamBurstThumbnailGrid.h
branchRCL_3
changeset 54 bac7acad7cb3
parent 0 1ddebce53859
equal deleted inserted replaced
53:61bc0f252b2b 54:bac7acad7cb3
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Class for displaying the images captured by a Burst session.*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 #ifndef CAMBURSTTHUMBNAILGRID_H
       
    20 #define CAMBURSTTHUMBNAILGRID_H
       
    21 
       
    22 // ===========================================================================
       
    23 //  INCLUDES
       
    24 
       
    25 #include    <e32base.h>
       
    26 #include    <e32std.h>
       
    27 #include    <coecntrl.h>
       
    28 #include    <eiksbobs.h>    // For Scroll component
       
    29 #include    <eikscrlb.h>    // For ScrollModel
       
    30 #include    <AknUtils.h>    // For TAknLayoutRect
       
    31 
       
    32 #include    "CamBurstThumbnailGridModel.h"
       
    33 
       
    34 
       
    35 // ===========================================================================
       
    36 // CONSTANTS
       
    37 const TInt KGridWidth = 3;   // Number of cells left to right
       
    38 
       
    39 const TInt KGridHeight= 3;   // Number of cells top to bottom
       
    40 
       
    41 const TInt KGridSize = KGridWidth*KGridHeight;
       
    42 
       
    43 
       
    44 const TInt KBurstGridDefaultThumbnails = 6;
       
    45 const TInt KBurstGridMaxVisibleThumbnails = 9;
       
    46 
       
    47 enum BurstGridLayoutTypes
       
    48     {
       
    49     EDefaultOrLessThumbnails = 0,
       
    50     EMaxVisibleThumbnails,
       
    51     EScrollbarNeeded
       
    52     };
       
    53     
       
    54 const TInt KNumberOfBurstGridLayoutTypes = 3;
       
    55 
       
    56 // MACROS
       
    57 
       
    58 // ===========================================================================
       
    59 // DATA TYPES
       
    60 
       
    61 // ===========================================================================
       
    62 // FUNCTION PROTOTYPES
       
    63 
       
    64 // ===========================================================================
       
    65 // FORWARD DECLARATIONS
       
    66 class CFbsBitmap;
       
    67 class CCamBurstThumbnailGridModel;
       
    68 class CBitmapScaler;
       
    69 class CEikScrollBar;
       
    70 
       
    71 
       
    72 // ===========================================================================
       
    73 // CLASS DECLARATION
       
    74 
       
    75 /**
       
    76 * Utility class used to group together related layout information into one
       
    77 * object, and construct itself using a supplied resource reader.
       
    78 *
       
    79 *  @since 2.8
       
    80 */
       
    81 class TCamBurstGridCellLayout
       
    82     {
       
    83 public:  
       
    84     /**
       
    85     * Constructs the layout information for the object
       
    86     * @since 2.8
       
    87     * @param aReader The resource reader to use for construction 
       
    88     * @param aRect The parent rect for the layout entries
       
    89     */
       
    90     void ConstructFromResource( TResourceReader& aReader, TRect& aRect );
       
    91     
       
    92 public:
       
    93     TAknLayoutRect iCellRect;   // Rectangle of the cell
       
    94     TAknLayoutRect iHighRect;   // Rectangle of the Highlight 
       
    95     TAknLayoutRect iMarkRect;   // Rectangle of the "mark"
       
    96     TAknLayoutRect iThmbRect;   // Rectangle of the thumbnail
       
    97     };
       
    98 
       
    99 
       
   100 /**
       
   101 *  Handles the drawing of the Burst Post-Capture control
       
   102 *
       
   103 *  @since 2.8
       
   104 */
       
   105 class CCamBurstThumbnailGrid : public CCoeControl, 
       
   106                                public MThumbModelObserver,
       
   107                                public MEikScrollBarObserver
       
   108     {
       
   109     public:  // Constructors and destructor
       
   110         
       
   111         /**
       
   112         * Two-phased constructor.
       
   113         */
       
   114         static CCamBurstThumbnailGrid* NewL( const CCoeControl* aParent, CCamBurstThumbnailGridModel& aModel );
       
   115         
       
   116         /**
       
   117         * Destructor.
       
   118         */
       
   119         virtual ~CCamBurstThumbnailGrid();
       
   120 
       
   121     public: // New functions
       
   122 
       
   123         /**
       
   124         * Constructs the layout information for the grid
       
   125         * @since 2.8
       
   126         */
       
   127         void ReadLayout();
       
   128         
       
   129         /**
       
   130         * Returns the ID of the resource to use for the grid structure
       
   131         * @since 2.8
       
   132         * @returns The resource ID to use
       
   133         */
       
   134         TInt ResourceId();    
       
   135         
       
   136         /**
       
   137          * Tests if the given coordinates match to any item on burst grid
       
   138          * @param aPosition Coordinates to be tested
       
   139          * @return TInt Grid item index that macthes the coordinates. Negative value returned
       
   140          * if position does not match any grid item
       
   141          */
       
   142         TInt HitTestGridItems( TPoint aPosition );
       
   143 
       
   144     public: // Functions from base classes
       
   145 
       
   146         /**
       
   147         * From CCoeControl
       
   148         * @since 2.8
       
   149         * @param aRect Area to be redrawn        
       
   150         */
       
   151         void Draw( const TRect& aRect ) const;
       
   152 
       
   153         /**
       
   154         * From CCoeControl
       
   155         * @since 2.8
       
   156         * @return The number of controls owned by this control
       
   157         */
       
   158         TInt CountComponentControls() const;
       
   159 
       
   160         /**
       
   161         * From CCoeControl
       
   162         * @since 2.8
       
   163         * @param aIndex The index of the required control
       
   164         * @return Returns the requested control
       
   165         */
       
   166         CCoeControl* ComponentControl( TInt aIndex ) const;
       
   167 
       
   168         /**
       
   169         * From CCoeControl
       
   170         * @since 2.8        
       
   171         */
       
   172         void SizeChanged();
       
   173 
       
   174         /**
       
   175         * From CCoeControl
       
   176         * @since 2.8
       
   177         * @param aKeyEvent Details of the key event
       
   178         * @param aType The keypress type
       
   179         * @return TKeyResponse whether the key event was handled or ignored
       
   180         */     
       
   181         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) ;
       
   182         
       
   183         /**
       
   184         * From MThumbModelObserver.
       
   185         * Called when the highlight has changed
       
   186         * @since 2.8                
       
   187         */
       
   188         void HighlightChanged();
       
   189         
       
   190         /**
       
   191         * From MThumbModelObserver
       
   192         * Called when an image has been deleted.
       
   193         * @since 2.8        
       
   194         */        
       
   195         void ImagesDeleted();
       
   196 
       
   197         /**
       
   198         * From MThumbModelObserver
       
   199         * Called when a new thumbnail has been generated       
       
   200         * @since 2.8        
       
   201         */        
       
   202         void ThumbnailGenerated();
       
   203 
       
   204         /**
       
   205         * From MEikScrollBarObserver
       
   206         * Called when a new thumbnail has been generated       
       
   207         * @since 2.8        
       
   208         * @param aScrollBar
       
   209         * @param aEventType
       
   210         */        
       
   211         void HandleScrollEventL( CEikScrollBar* aScrollBar, TEikScrollEvent aEventType );
       
   212 
       
   213         /**
       
   214         * Creates the scrollbar control.  SetMopParent must be called before this.
       
   215         * @since 3.0
       
   216         */        
       
   217         void CreateScrollBarL();
       
   218 
       
   219         /**
       
   220         * Creates the scrollbar control.  
       
   221         * @since 3.0
       
   222         */        
       
   223         void DeleteScrollBar();
       
   224 
       
   225         /**
       
   226         * Sets up the scroll bar, used on start up and when items are deleted
       
   227         * to update the state
       
   228         * @since 3.0
       
   229         */
       
   230         void SetupScrollbarL();
       
   231         
       
   232         /**
       
   233         * Returns the height of the grid control.
       
   234         * @since 3.0
       
   235         * @return Height of the grid control in cells
       
   236         */
       
   237         TInt GridSize() const; 
       
   238         
       
   239     protected:  // New functions
       
   240     
       
   241         /**
       
   242          * Updates layouts. Used to reload layouts when images are deleted.  
       
   243          */
       
   244         void UpdateLayout();
       
   245         
       
   246     protected:  // Functions from base classes        
       
   247 
       
   248     private:
       
   249 
       
   250         /**
       
   251         * C++ default constructor.
       
   252         */
       
   253         CCamBurstThumbnailGrid( CCamBurstThumbnailGridModel& aModel );
       
   254 
       
   255         /**
       
   256         * By default Symbian 2nd phase constructor is private.
       
   257         */
       
   258         void ConstructL( const CCoeControl* aParent );
       
   259 
       
   260 
       
   261 
       
   262     public:     // Data
       
   263     
       
   264     protected:  // Data
       
   265 
       
   266     private:    // Data        
       
   267         // Passed in by (and owned by) View
       
   268         CCamBurstThumbnailGridModel& iModel;                
       
   269 
       
   270         // Array of layout objects read from the resource file.  
       
   271         // Each object represents a "cell" on the grid
       
   272         TCamBurstGridCellLayout iGridCellLayout[KGridSize];
       
   273 
       
   274         // Bitmap and mask for the "mark" check box for an image
       
   275         CFbsBitmap* iBitmapMark;        
       
   276         CFbsBitmap* iBitmapMarkMask;  
       
   277         
       
   278         CEikScrollBarFrame* iScrollFrame;
       
   279         TAknDoubleSpanScrollBarModel ivModel; // model for double span (side) scrollbar
       
   280         TAknLayoutRect iScrollLayout;
       
   281         
       
   282         // As the grid size is potentially variable depending on whether
       
   283         // limited or unlimited capture is used, need to keep track of the
       
   284         // grid size used.
       
   285         TInt iGridSize;
       
   286         
       
   287     };
       
   288 
       
   289 
       
   290 
       
   291 #endif      // CAMBURSTTHUMBNAILGRID_H
       
   292 
       
   293 // ===========================================================================
       
   294 // End of File
       
   295 
       
   296