messagingappbase/msgeditor/appuisrc/MsgAttachmentItemDrawer.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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:  MsgAttachmentItemDrawer implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // ========== INCLUDE FILES ================================
       
    21 #include <msvapi.h>
       
    22 #include <eikspane.h>
       
    23 #include <eikmenup.h>
       
    24 #include <AknDef.h>
       
    25 #include <aknappui.h>
       
    26 #include <akntitle.h>
       
    27 #include <aknnavi.h>
       
    28 #include <aknlists.h>
       
    29 #include <gulicon.h>
       
    30 #include <coeutils.h>               // for ConeUtils::FileExists
       
    31 #include <bautils.h>
       
    32 #include <aknnotewrappers.h>
       
    33 #include <AknWaitDialog.h>          // CAknWaitDialog
       
    34 #include <DocumentHandler.h>
       
    35 #include <StringLoader.h>           // StringLoader
       
    36 #include <AiwCommon.h>
       
    37 #include <NpdApi.h>
       
    38 
       
    39 #include <mmsvattachmentmanager.h>
       
    40 
       
    41 #include <avkon.hrh>
       
    42 
       
    43 #include <aknlayout.cdl.h>
       
    44 #include <aknlayoutscalable_avkon.cdl.h>
       
    45 
       
    46 #include <AknUtils.h>
       
    47 #include <AknsUtils.h>          // skinned icons
       
    48 #include <AknsConstants.h>      // skinned icon ids
       
    49 
       
    50 #include "MsgEditorCommon.h"        // for KMsgEditorMbm
       
    51 #include "MsgEditorDocument.h"
       
    52 #include "MsgAttachmentInfo.h"
       
    53 #include "MsgAttachmentModel.h"
       
    54 #include "MsgViewAttachmentsDialog.h"
       
    55 #include "MsgAttachmentUtils.h"
       
    56 #include "MsgAttaListItemArray.h"
       
    57 
       
    58 #include <msgeditor.mbg>
       
    59 #include "MsgEditorAppUi.hrh"
       
    60 #include <MsgEditorAppUi.rsg>       // resouce identifiers
       
    61 
       
    62 #include <aknlistloadertfx.h>
       
    63 #include <aknlistboxtfxinternal.h>
       
    64 
       
    65 // ========== EXTERNAL DATA STRUCTURES =====================
       
    66 
       
    67 // ========== EXTERNAL FUNCTION PROTOTYPES =================
       
    68 
       
    69 // ========== CONSTANTS ====================================
       
    70 
       
    71 // ========== MACROS =======================================
       
    72 
       
    73 // ========== LOCAL CONSTANTS AND MACROS ===================
       
    74 
       
    75 // ========== MODULE DATA STRUCTURES =======================
       
    76 
       
    77 // ========== LOCAL FUNCTION PROTOTYPES ====================
       
    78 
       
    79 // ========== LOCAL FUNCTIONS ==============================
       
    80 
       
    81 // ========== MEMBER FUNCTIONS =============================
       
    82 
       
    83 // ---------------------------------------------------------
       
    84 // CMsgAttachmentItemDrawer::CMsgAttachmentItemDrawer
       
    85 //
       
    86 //
       
    87 // ---------------------------------------------------------
       
    88 //
       
    89 CMsgAttachmentItemDrawer::CMsgAttachmentItemDrawer(
       
    90     MTextListBoxModel* aTextListBoxModel,
       
    91     const CFont* aFont,
       
    92     CFormattedCellListBoxData* aFormattedCellData,
       
    93     CMsgAttachmentModel& aAttachmentModel,
       
    94     CMsgAttachmentsListBox* aAttaListBox )
       
    95     : CDoubleLargeStyleItemDrawer( aTextListBoxModel, aFont, aFormattedCellData, aAttaListBox ),
       
    96       iAttachmentModel( aAttachmentModel )
       
    97     {
       
    98     }
       
    99 
       
   100 // ---------------------------------------------------------
       
   101 // CMsgAttachmentItemDrawer::DrawItem
       
   102 //
       
   103 //
       
   104 // ---------------------------------------------------------
       
   105 //
       
   106 void CMsgAttachmentItemDrawer::DrawItem(
       
   107     TInt aItemIndex,
       
   108     TPoint aItemRectPos,
       
   109     TBool aItemIsSelected,
       
   110     TBool aItemIsCurrent,
       
   111     TBool aViewIsEmphasized,
       
   112     TBool aViewIsDimmed ) const
       
   113     {   
       
   114     CDoubleLargeStyleItemDrawer::DrawItem(
       
   115         aItemIndex,
       
   116         aItemRectPos,
       
   117         aItemIsSelected,
       
   118         aItemIsCurrent,
       
   119         aViewIsEmphasized,
       
   120         aViewIsDimmed );
       
   121 
       
   122     CMsgAttachmentInfo& currAttInfo =
       
   123             iAttachmentModel.AttachmentInfoAt( aItemIndex );
       
   124 
       
   125     if ( currAttInfo.IsSeparator() )
       
   126         {
       
   127         // draw separator line before item.
       
   128         
       
   129         // Resolve separator layout
       
   130         TRect mainPane;
       
   131         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPane );
       
   132         TAknLayoutRect listPaneLayout;
       
   133         listPaneLayout.LayoutRect(
       
   134             mainPane,
       
   135             AknLayoutScalable_Avkon::list_gen_pane( 0 ).LayoutLine() );
       
   136         TAknLayoutRect doubleGraphicLayout;
       
   137         doubleGraphicLayout.LayoutRect(
       
   138             listPaneLayout.Rect(),
       
   139             AknLayoutScalable_Avkon::list_double_large_graphic_pane( 0 ).LayoutLine() );
       
   140         TAknLayoutRect separator;
       
   141         separator.LayoutRect(             
       
   142             doubleGraphicLayout.Rect(),
       
   143             AknLayoutScalable_Avkon::list_double_large_graphic_pane_g5( 1 ).LayoutLine() );
       
   144 
       
   145         MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iGc );
       
   146         if ( transApi )
       
   147             {
       
   148             TRect lineRect( TPoint( separator.Rect().iTl.iX, aItemRectPos.iY ),
       
   149                             TPoint( separator.Rect().iBr.iX, aItemRectPos.iY + separator.Rect().Height() ) );
       
   150             transApi->BeginRedraw( MAknListBoxTfxInternal::EListItem, lineRect, aItemIndex );
       
   151             transApi->StartDrawing( MAknListBoxTfxInternal::EListItem );
       
   152             }
       
   153         
       
   154         iGc->SetPenColor( separator.Color() );
       
   155         iGc->DrawLine( TPoint( separator.Rect().iTl.iX, aItemRectPos.iY ),
       
   156                        TPoint( separator.Rect().iBr.iX, aItemRectPos.iY ) );
       
   157                        
       
   158         // Reset gc because empty area is drawn after this.
       
   159         // Otherwise lines in empty area is drawn with line color!
       
   160         iGc->Reset();
       
   161         
       
   162         if ( transApi )
       
   163             {
       
   164             transApi->StopDrawing();
       
   165             transApi->EndRedraw( MAknListBoxTfxInternal::EListItem, aItemIndex );
       
   166             }
       
   167         }
       
   168     }
       
   169 
       
   170 // End of File