tsrc/CenrepEditor/Src/cenrepeditorview3container.cpp
changeset 22 496ad160a278
parent 0 f0cf47e981f9
equal deleted inserted replaced
15:ccd8e69b5392 22:496ad160a278
       
     1 /*
       
     2 * Copyright (c) 2005 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "cenrepeditorview3container.h"
       
    21 #include "cenrepeditordocument.h"
       
    22 #include "cenrepeditorappui.h"
       
    23 #include  "cenrepeditormodel.h"
       
    24 
       
    25 
       
    26 
       
    27 #include <eiklabel.h>  // for example label control
       
    28 
       
    29 
       
    30 // ================= MEMBER FUNCTIONS =======================
       
    31 
       
    32 // ---------------------------------------------------------
       
    33 // CCenrepEditorView3Container::ConstructL(const TRect& aRect)
       
    34 // EPOC two phased constructor
       
    35 // ---------------------------------------------------------
       
    36 //
       
    37 void CCenrepEditorView3Container::ConstructL(const TRect& aRect,TInt aResourceId, CMusApplication*  aMusApplication)
       
    38     {      
       
    39     CreateWindowL(); 
       
    40     iMusApplicationListbox = new(ELeave)CMusApplicationListbox;
       
    41     // and put the data in the list
       
    42     iMusApplicationListbox->SetData(aMusApplication);
       
    43     // setting list is constructed from resources
       
    44     iMusApplicationListbox->ConstructFromResourceL(aResourceId);     
       
    45     SetRect(aRect);
       
    46     iMusApplicationListbox->MakeVisible(ETrue);
       
    47     iMusApplicationListbox->SetRect(aRect);    
       
    48 	iMusApplicationListbox->LoadSettingsL();    
       
    49     iMusApplicationListbox->ActivateL();                
       
    50     ActivateL();
       
    51     }
       
    52 
       
    53 // Destructor
       
    54 CCenrepEditorView3Container::~CCenrepEditorView3Container()
       
    55     {
       
    56     iMusApplicationListbox->StoreSettingsL();
       
    57     delete iMusApplicationListbox;
       
    58 	iMusApplicationListbox = NULL;
       
    59     }
       
    60 
       
    61 // ---------------------------------------------------------
       
    62 // CCenrepEditorView3Container::StoreSettingsL()
       
    63 // Store the Settings to Variable
       
    64 // ---------------------------------------------------------
       
    65 //
       
    66 void CCenrepEditorView3Container::StoreSettingsL()
       
    67     {    
       
    68     iMusApplicationListbox->StoreSettingsL();
       
    69     }
       
    70 
       
    71 // ---------------------------------------------------------
       
    72 // CCenrepEditorView3Container::SizeChanged()
       
    73 // Called by framework when the view size is changed
       
    74 // ---------------------------------------------------------
       
    75 //
       
    76 void CCenrepEditorView3Container::SizeChanged()
       
    77     {
       
    78     // TODO: Add here control resize code etc.
       
    79     iMusApplicationListbox->SetRect(Rect());  
       
    80     }
       
    81 
       
    82 // ---------------------------------------------------------
       
    83 // CCenrepEditorView3Container::CountComponentControls() const
       
    84 // ---------------------------------------------------------
       
    85 //
       
    86 TInt CCenrepEditorView3Container::CountComponentControls() const
       
    87     {
       
    88     TInt count = 0;    
       
    89     if(iMusApplicationListbox)
       
    90         count++; 
       
    91     return count;
       
    92     }
       
    93 
       
    94 // ---------------------------------------------------------
       
    95 // CCenrepEditorView3Container::ComponentControl(TInt aIndex) const
       
    96 // ---------------------------------------------------------
       
    97 //
       
    98 CCoeControl* CCenrepEditorView3Container::ComponentControl(TInt /*aIndex*/) const
       
    99     {
       
   100     return iMusApplicationListbox;     
       
   101     }
       
   102 
       
   103 // ---------------------------------------------------------
       
   104 // CCenrepEditorView3Container::Draw(const TRect& aRect) const
       
   105 // ---------------------------------------------------------
       
   106 //
       
   107 void CCenrepEditorView3Container::Draw(const TRect& aRect) const
       
   108     {
       
   109     CWindowGc& gc = SystemGc();    
       
   110     gc.SetPenStyle( CGraphicsContext::ENullPen );
       
   111     gc.SetBrushColor( KRgbGray );
       
   112     gc.SetBrushStyle( CGraphicsContext::ESolidBrush );    
       
   113     gc.DrawRect( aRect );   
       
   114     }
       
   115 
       
   116 
       
   117 TKeyResponse CCenrepEditorView3Container::OfferKeyEventL(
       
   118     const TKeyEvent& aKeyEvent,
       
   119     TEventCode aType )
       
   120     {
       
   121     if(aType != EEventKey) // Is not key event?
       
   122         {
       
   123         return EKeyWasNotConsumed;
       
   124         }       
       
   125     switch (aKeyEvent.iCode)
       
   126         {
       
   127             case EKeyLeftArrow:
       
   128             case EKeyRightArrow:
       
   129                  return EKeyWasNotConsumed;
       
   130             default:
       
   131                  if(iMusApplicationListbox)
       
   132                     {
       
   133                     return iMusApplicationListbox->OfferKeyEventL( aKeyEvent, aType );   
       
   134                     }
       
   135                  else
       
   136                     {
       
   137                     return EKeyWasNotConsumed;
       
   138                     }
       
   139                  
       
   140         }    
       
   141     }    
       
   142 
       
   143 
       
   144 
       
   145 
       
   146 // End of File