mmsharing/mmshui/src/musuisendviewcontainer.cpp
branchRCL_3
changeset 33 bc78a40cd63c
child 41 755f0370535b
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
       
     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:  The MUS application's UI class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "musuiclipsharingviewcontainer.h"
       
    20 #include "musuisendview.h"
       
    21 #include "musuilevelindicator.h"
       
    22 #include "musuidialogutil.h"
       
    23 #include "musuidefinitions.h"
       
    24 #include "musuisendcontroller.h"
       
    25 #include "muslogger.h" // debug logging
       
    26 #include <musui.rsg>
       
    27 
       
    28 #include <AknWaitDialog.h>
       
    29 #include <AknsBasicBackgroundControlContext.h>
       
    30 #include <AknsUtils.h>
       
    31 #include <AknsDrawUtils.h>
       
    32 
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 CMusUiSendViewContainer::CMusUiSendViewContainer()
       
    38     {
       
    39     // NOP
       
    40     }
       
    41     
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 void CMusUiSendViewContainer::ConstructL( CMusUiGeneralView* aView,
       
    48                                           const TRect& aRect,
       
    49                                           TAknOrientation aIndicatorLayout,
       
    50                                           TBool aContainerVisible,
       
    51                                           TBool aIndicatorVisible )
       
    52     {
       
    53     MUS_LOG2( "mus: [MUSUI ]  -> CMusUiSendViewContainer::ConstructL, visibilty:%d,%d",
       
    54         aContainerVisible, aIndicatorVisible );
       
    55     
       
    56     CreateWindowL();
       
    57     iView = aView;
       
    58     iBackGround = CAknsBasicBackgroundControlContext::NewL(
       
    59                             KAknsIIDQsnBgAreaMain,
       
    60                             aRect,
       
    61                             EFalse );
       
    62 
       
    63     iIndicator = CMusUiLevelIndicator::NewL( aIndicatorLayout,
       
    64                                              0, 
       
    65                                              100, 
       
    66                                              this,
       
    67                                              aRect,
       
    68                                              this );
       
    69     iIndicator->SetContainerWindowL( *this );
       
    70     
       
    71     iVideoRect = aRect;
       
    72     
       
    73     SetRect( aRect );
       
    74     
       
    75     iIndicator->SetRect( Rect() );
       
    76     
       
    77     if ( aContainerVisible && !aIndicatorVisible )
       
    78         {
       
    79         iIndicator->MakeVisible( aIndicatorVisible );
       
    80         }
       
    81 
       
    82     MakeVisible( aContainerVisible );
       
    83     ActivateL();
       
    84     
       
    85     MUS_LOG( "mus: [MUSUI ]  <- CMusUiSendViewContainer::ConstructL" );
       
    86     }
       
    87 
       
    88 
       
    89 // -----------------------------------------------------------------------------
       
    90 //
       
    91 // -----------------------------------------------------------------------------
       
    92 //
       
    93 CMusUiSendViewContainer::~CMusUiSendViewContainer()
       
    94     {
       
    95     MUS_LOG( "mus: [MUSUI ]  -> CMusUiSendViewContainer::~CMusUiSendViewContainer" );
       
    96 
       
    97     delete iIndicator;
       
    98     delete iBackGround;
       
    99 
       
   100     MUS_LOG( "mus: [MUSUI ]  <- CMusUiSendViewContainer::~CMusUiSendViewContainer" );
       
   101     }
       
   102 
       
   103 
       
   104 // -----------------------------------------------------------------------------
       
   105 // Fetches a pointer to the view that owns this container.
       
   106 // -----------------------------------------------------------------------------
       
   107 //
       
   108 CMusUiGeneralView* CMusUiSendViewContainer::MusUiView() const
       
   109     {
       
   110     MUS_LOG( "mus: [MUSUI ]  -> CMusUiSendViewContainer::MusUiView" );
       
   111     MUS_LOG( "mus: [MUSUI ]  <- CMusUiSendViewContainer::MusUiView" );
       
   112     return iView;
       
   113     }
       
   114 
       
   115 
       
   116 // -----------------------------------------------------------------------------
       
   117 //
       
   118 // -----------------------------------------------------------------------------
       
   119 //
       
   120 void CMusUiSendViewContainer::SetController( CMusUiSendController* aController )
       
   121     {
       
   122     iSendController = aController;
       
   123     }
       
   124 
       
   125 
       
   126 // -----------------------------------------------------------------------------
       
   127 // Called by framework to redraw the screen area.
       
   128 // -----------------------------------------------------------------------------
       
   129 //
       
   130 void CMusUiSendViewContainer::Draw( const TRect& aRect ) const
       
   131     {
       
   132     MUS_LOG( "mus: [MUSUI ]  -> CMusUiSendViewContainer::Draw" );
       
   133     CWindowGc& gc = SystemGc();
       
   134   
       
   135     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   136     MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
       
   137     if(!AknsDrawUtils::Background( skin, 
       
   138                                    cc,
       
   139                                    this,
       
   140                                    gc,
       
   141                                    iVideoRect,
       
   142                                    KAknsDrawParamDefault ))
       
   143         {
       
   144         MUS_LOG( "mus: [MUSUI ]     Skin not valid or not found" );
       
   145         gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) );
       
   146         gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   147         gc.Clear( aRect );
       
   148         }
       
   149        
       
   150     MUS_LOG( "mus: [MUSUI ]  <- CMusUiSendViewContainer::Draw" );
       
   151     }
       
   152     
       
   153 
       
   154 // -----------------------------------------------------------------------------
       
   155 // Called by framework when the view size is changed
       
   156 // -----------------------------------------------------------------------------
       
   157 //
       
   158 void CMusUiSendViewContainer::SizeChanged()
       
   159     {
       
   160     if (iBackGround)
       
   161         {
       
   162         static_cast<CAknsBasicBackgroundControlContext*>
       
   163                                 ( iBackGround )->SetRect( Rect() );
       
   164         }
       
   165     iIndicator->SetRect( Rect() );    
       
   166     }
       
   167     
       
   168 
       
   169 // -----------------------------------------------------------------------------
       
   170 // Supply the Mob Object for background skin drawing
       
   171 // -----------------------------------------------------------------------------
       
   172 //
       
   173 TTypeUid::Ptr CMusUiSendViewContainer::MopSupplyObject( TTypeUid aId )
       
   174     {
       
   175     if (aId.iUid == MAknsControlContext::ETypeId && iBackGround )
       
   176         {
       
   177         return MAknsControlContext::SupplyMopObject( aId, iBackGround );
       
   178         }
       
   179     return CCoeControl::MopSupplyObject( aId );
       
   180     }
       
   181 
       
   182 
       
   183 // -----------------------------------------------------------------------------
       
   184 //
       
   185 // -----------------------------------------------------------------------------
       
   186 //
       
   187 void CMusUiSendViewContainer::SetLevelIndicatorVisibility( TBool aVisible)
       
   188     {
       
   189     MUS_LOG1( "mus: [MUSUI ]  -> CMusUiSendViewContainer::SetLevelIndicatorVisibility( %d )",
       
   190               aVisible )
       
   191               
       
   192     MakeVisible( aVisible );
       
   193     
       
   194     MUS_LOG( "mus: [MUSUI ]  <- CMusUiSendViewContainer::SetLevelIndicatorVisibility" )
       
   195     }
       
   196 
       
   197 
       
   198 // -----------------------------------------------------------------------------
       
   199 //
       
   200 // -----------------------------------------------------------------------------
       
   201 //
       
   202 void CMusUiSendViewContainer::IndicatorLevelChanged( TInt aNewLevel )
       
   203     {
       
   204     if ( iSendController )
       
   205         {
       
   206         TRAPD( error, iSendController->HandleSliderValueChangeL( aNewLevel ) )
       
   207 
       
   208         if ( error != KErrNone )
       
   209             {
       
   210             MUS_LOG1( "mus: [MUSUI ]     Error during handling of slider value change( %d )",
       
   211                       error )
       
   212               
       
   213             iSendController->HandleError( error );
       
   214             }
       
   215         }
       
   216     }
       
   217     
       
   218 
       
   219 
       
   220 // end of file