mpxplugins/viewplugins/views/albumarteditordialog/inc/mpxalbumarteditordialogcustomcontrol.h
changeset 0 ff3acec5bc43
equal deleted inserted replaced
-1:000000000000 0:ff3acec5bc43
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Music Player album art editor dialog declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MPXALBUMARTEDITORDIALOGCUSTOMCONTROL_H
       
    20 #define MPXALBUMARTEDITORDIALOGCUSTOMCONTROL_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <coecntrl.h>
       
    24 #include "mpxalbumartutilobserver.h"
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CEikImage;
       
    28 class CEikLabel;
       
    29 class CMPXAlbumArtEditorDialog;
       
    30 class MMPXAlbumArtEventObserver;
       
    31 class CAknsBasicBackgroundControlContext;
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36  * The custom control for Album Art Dialog.
       
    37  */
       
    38 NONSHARABLE_CLASS( CMPXAlbumArtEditorDialogCustomControl ) : public CCoeControl,
       
    39                                                              public MMPXAlbumArtUtilObserver
       
    40     {
       
    41 public:           
       
    42     // States for category rename operations
       
    43     enum TMPXAlbumArtEditorDialogMode
       
    44         {
       
    45         EMPXAlbumArtEditorDialogBlank = 0,
       
    46         EMPXAlbumArtEditorDialogAlbumArt,
       
    47         EMPXAlbumArtEditorDialogNoAlbumArt
       
    48         };
       
    49 
       
    50 public:  // Constructors and destructor
       
    51 
       
    52     /**
       
    53      * Two-phased constructor. Leaves on failure. Places the instance on the
       
    54      * cleanup stack.
       
    55      * @param aParent Parent control.
       
    56      * @param aRect The control's extent.
       
    57      * @param aObserver observer for album art events
       
    58      * @return The constructed item.
       
    59      */
       
    60     static CMPXAlbumArtEditorDialogCustomControl* NewLC( const CCoeControl& aParent, 
       
    61                                                        const TRect& aRect,
       
    62                                                        MMPXAlbumArtEventObserver* aObserver );
       
    63 
       
    64     /**
       
    65      * Two-phased constructor. Leaves on failure.
       
    66      * @param aParent Parent control.
       
    67      * @param aRect The control's extent.
       
    68      * @param aObserver observer for album art events
       
    69      * @return The constructed item.
       
    70      */
       
    71     static CMPXAlbumArtEditorDialogCustomControl* NewL( const CCoeControl& aParent, 
       
    72                                                       const TRect& aRect,
       
    73                                                       MMPXAlbumArtEventObserver* aObserver );
       
    74     
       
    75     /**
       
    76      * Destructor.
       
    77      */
       
    78     virtual ~CMPXAlbumArtEditorDialogCustomControl();       
       
    79     
       
    80 private:
       
    81 
       
    82     /**
       
    83      * C++ default constructor.
       
    84      */
       
    85     CMPXAlbumArtEditorDialogCustomControl();
       
    86 
       
    87     /**
       
    88      * By default Symbian 2nd phase constructor is private.
       
    89      * @param aParent Parent control.
       
    90      * @param aRect The control's extent.
       
    91      * @param aObserver observer for album art events
       
    92      */
       
    93     void ConstructL( const CCoeControl& aParent, 
       
    94                      const TRect &aRect,
       
    95                      MMPXAlbumArtEventObserver* aObserver );
       
    96 
       
    97 public: // New functions
       
    98     
       
    99     /**
       
   100      * Updates and displays the new album art.
       
   101      * @param aMode album art mode.
       
   102      * @param aNewAlbumArt The new bitmap album art.
       
   103      */
       
   104     void UpdateAlbumArt( TMPXAlbumArtEditorDialogMode aMode, 
       
   105                          CFbsBitmap* aNewAlbumArt = NULL );
       
   106 
       
   107     /**
       
   108      * Displays image in a specific mode, 
       
   109      * either Album Art/No Album Art or Various
       
   110      * @param aMode album art mode.
       
   111      */      
       
   112     void SetModeL( TMPXAlbumArtEditorDialogMode aMode );
       
   113     
       
   114     /**
       
   115      * updates skin color
       
   116      */
       
   117     void HandleSkinChangedL();
       
   118 
       
   119 private: // from base class MMPXAlbumArtUtilObserver
       
   120 
       
   121     /**
       
   122      * From MMPXAlbumArtUtilObserver.
       
   123      * Notify that extraction of album art started.
       
   124      */
       
   125     void ExtractAlbumArtStarted();
       
   126 
       
   127     /**
       
   128      * From MMPXAlbumArtUtilObserver.
       
   129      * Album art is extracted from file and ready to use.
       
   130      *
       
   131      * @param aBitmap a converted image. Ownership is transferred.
       
   132      * @param aErr error code
       
   133      */
       
   134     void ExtractAlbumArtCompleted(
       
   135         CFbsBitmap* aBitmap, 
       
   136         TInt aErr );    
       
   137     
       
   138 private: // Functions from base classes
       
   139     	   
       
   140     /**
       
   141      * Draws to screen.
       
   142      * @param aRect The control's extent
       
   143      */
       
   144     void Draw( const TRect& aRect ) const;
       
   145 
       
   146     /**
       
   147      * Determines the number of components.
       
   148      */
       
   149     TInt CountComponentControls() const;
       
   150 
       
   151     /**
       
   152      * Passes control of indexed component.
       
   153      * @param aIndex The desired control index.
       
   154      * @return The components control.
       
   155      */
       
   156     CCoeControl* ComponentControl( TInt aIndex ) const;
       
   157 
       
   158     /**
       
   159      * Resizes controls.
       
   160      */
       
   161     void SizeChanged();
       
   162     
       
   163  private:    // Data
       
   164    
       
   165     CEikImage*                   iImage; // image to display Album Art
       
   166     CEikLabel*                   iLabel; // Labe to display either "(various)" or "(no album art)"       
       
   167     TMPXAlbumArtEditorDialogMode iMode;  // mode of either Album Art, Various or No Album Art
       
   168     MMPXAlbumArtEventObserver*   iObserver;
       
   169     CAknsBasicBackgroundControlContext* iBackground;
       
   170     TRect                        iBorder;
       
   171     };
       
   172 
       
   173 #endif      // MPXALBUMARTEDITORDIALOGCUSTOMCONTROL_H 
       
   174             
       
   175 // End of File