messagingappbase/mce/src/MceMainViewEmptyListContainer.cpp
branchRCL_3
changeset 17 caea42e26caa
parent 0 72b543305e3a
equal deleted inserted replaced
9:1d7827e39b52 17:caea42e26caa
    17 */
    17 */
    18 
    18 
    19 
    19 
    20 
    20 
    21 // INCLUDE FILES
    21 // INCLUDE FILES
    22 #include    <eikenv.h>
    22 #include <eikenv.h>
    23 #include <aknenv.h>
    23 #include <aknenv.h>
       
    24 #include <AknsDrawUtils.h>
       
    25 #include <AknsBasicBackgroundControlContext.h>
    24 #include    "MceMainViewEmptyListContainer.h"
    26 #include    "MceMainViewEmptyListContainer.h"
    25 
    27 
    26 
    28 
    27 // ================= MEMBER FUNCTIONS =======================
    29 // ================= MEMBER FUNCTIONS =======================
    28 
    30 
    34     }
    36     }
    35 
    37 
    36 // Symbian OS default constructor can leave.
    38 // Symbian OS default constructor can leave.
    37 void CMceMainViewEmptyListContainer::ConstructL( const TRect& aRect )
    39 void CMceMainViewEmptyListContainer::ConstructL( const TRect& aRect )
    38     {
    40     {
       
    41     iBgContext = CAknsBasicBackgroundControlContext::NewL(
       
    42                 KAknsIIDQsnBgAreaMainMessage, aRect, ETrue);
    39     CreateWindowL();
    43     CreateWindowL();
    40     SetRect( aRect );
    44     SetRect( aRect );
    41     ActivateL();
    45     ActivateL();
    42     MakeVisible( ETrue );
    46     MakeVisible( ETrue );
    43     }
    47     }
    54 
    58 
    55 
    59 
    56 // Destructor
    60 // Destructor
    57 CMceMainViewEmptyListContainer::~CMceMainViewEmptyListContainer()
    61 CMceMainViewEmptyListContainer::~CMceMainViewEmptyListContainer()
    58     {
    62     {
       
    63     delete iBgContext;
    59     }
    64     }
    60 
    65 
    61 
    66 
    62 // ---------------------------------------------------------
    67 // ---------------------------------------------------------
    63 // CMceMainViewEmptyListContainer::OfferKeyEventL
    68 // CMceMainViewEmptyListContainer::OfferKeyEventL
    66 TKeyResponse CMceMainViewEmptyListContainer::OfferKeyEventL(
    71 TKeyResponse CMceMainViewEmptyListContainer::OfferKeyEventL(
    67     const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/)
    72     const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/)
    68     {
    73     {
    69     return EKeyWasConsumed;
    74     return EKeyWasConsumed;
    70     }
    75     }
    71 
    76 // ---------------------------------------------------------
       
    77 // CMceMainViewEmptyListContainer::MopSupplyObject
       
    78 // ---------------------------------------------------------
       
    79 //
       
    80 TTypeUid::Ptr CMceMainViewEmptyListContainer::MopSupplyObject(TTypeUid aId)
       
    81     {
       
    82     if (aId.iUid == MAknsControlContext::ETypeId)
       
    83         {
       
    84         return MAknsControlContext::SupplyMopObject( aId, iBgContext );
       
    85         }
       
    86     return CCoeControl::MopSupplyObject(aId);
       
    87     }
       
    88 // ---------------------------------------------------------
       
    89 // CMceMainViewEmptyListContainer::SizeChanged
       
    90 // ---------------------------------------------------------
       
    91 //
       
    92 void CMceMainViewEmptyListContainer::SizeChanged()
       
    93     {
       
    94     if ( iBgContext )
       
    95         {
       
    96         iBgContext->SetRect( Rect() );
       
    97         iBgContext->SetParentPos( PositionRelativeToScreen() );
       
    98        }
       
    99     }
    72 // ---------------------------------------------------------
   100 // ---------------------------------------------------------
    73 // CMceMainViewEmptyListContainer::Draw
   101 // CMceMainViewEmptyListContainer::Draw
    74 // ---------------------------------------------------------
   102 // ---------------------------------------------------------
    75 //
   103 //
    76 void CMceMainViewEmptyListContainer::Draw(const TRect& /*aRect*/ ) const
   104 void CMceMainViewEmptyListContainer::Draw(const TRect& /*aRect*/ ) const
    77     {
   105     {
    78     CWindowGc& gc = SystemGc();
   106     CWindowGc& gc = SystemGc();
    79     gc.SetPenColor( AKN_LAF_COLOR ( 0 ) ); // background
   107     TRect aRect = Rect();
    80     gc.SetPenStyle( CGraphicsContext::ESolidPen );
   108     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
    81     gc.SetPenSize( TSize(0,0) ); // no border needed here
   109     MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
    82     gc.DrawRect( Rect() );
   110 
       
   111     if( !AknsDrawUtils::Background( skin, cc, this, gc, aRect ) )
       
   112         {
       
   113         // Same as CCoeControl draw for blank controls
       
   114         CGraphicsContext& gcBlank = SystemGc();
       
   115         gcBlank.SetPenStyle( CGraphicsContext::ENullPen );
       
   116         gcBlank.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   117         gcBlank.DrawRect( aRect );
       
   118       }
       
   119 
    83     }
   120     }
    84 
   121 
    85 //  End of File
   122 //  End of File