calendarui/views/src/calendummyviewcontainer.cpp
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2009 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:  Container for missed alarm view's controls.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 // System Includes
       
    20 #include <AknsBasicBackgroundControlContext.h>
       
    21 #include <AknsDrawUtils.h>
       
    22 #include <AknUtils.h>
       
    23 #include <aknlayoutscalable_apps.cdl.h>
       
    24 #include <aknlists.h>
       
    25 #include <AknIconArray.h>
       
    26 
       
    27 // User Includes
       
    28 #include "calendarui_debug.h"
       
    29 #include "calendummyviewcontainer.h"
       
    30 #include "AknsControlContext.h"
       
    31 
       
    32 // -----------------------------------------------------------------------------
       
    33 // CCalenDummyViewContainer::CCalenDummyViewContainer
       
    34 // Performs the first phase of two phase construction.
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 CCalenDummyViewContainer::CCalenDummyViewContainer(CCalenNativeView* aView,
       
    38                          MCalenServices& aServices) :
       
    39     CCalenContainer(aView, aServices)
       
    40     {
       
    41     TRACE_ENTRY_POINT;
       
    42     TRACE_EXIT_POINT;
       
    43     }
       
    44 
       
    45 // -----------------------------------------------------------------------------
       
    46 // CCalenDummyViewContainer::~CCalenDummyViewContainer
       
    47 // Destructor
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 CCalenDummyViewContainer::~CCalenDummyViewContainer()
       
    51     {
       
    52     TRACE_ENTRY_POINT;
       
    53     delete iBgContext;
       
    54     if(iListBoxItemArray)
       
    55         {
       
    56         delete iListBoxItemArray;
       
    57         }
       
    58     if (iListBox)
       
    59         {
       
    60         delete iListBox;
       
    61         iListBox = NULL;
       
    62         }
       
    63 
       
    64     TRACE_EXIT_POINT;
       
    65     }
       
    66 
       
    67 // ----------------------------------------------------------------------------
       
    68 // CCalenDummyViewContainer::ConstructImplL
       
    69 // Third phase constructor.
       
    70 // This function was called CCalenNativeView::ConstructL().
       
    71 // (other items were commented in a header).
       
    72 // ----------------------------------------------------------------------------
       
    73 //
       
    74 void CCalenDummyViewContainer::ConstructImplL()
       
    75     {
       
    76     TRACE_ENTRY_POINT;
       
    77     
       
    78     TRect main_pane(  );
       
    79     SetRect( Rect() );
       
    80     
       
    81     iListBoxItemArray = new(ELeave) CDesCArrayFlat(1);
       
    82     
       
    83     iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain,
       
    84                                                            Rect(),
       
    85                                                            ETrue );
       
    86     iListBox = new( ELeave ) CAknDoubleGraphicStyleListBox;
       
    87     iListBox->ConstructL( this, 0);
       
    88     iListBox->SetContainerWindowL( *this);
       
    89     
       
    90     // set the model array
       
    91     iListBox->Model()->SetItemTextArray(iListBoxItemArray);
       
    92 
       
    93     // set icon array
       
    94     CAknIconArray* iconArray = CreateIconsL( iIconIndices );
       
    95     CleanupStack::PushL(iconArray);
       
    96     iListBox->ItemDrawer()->FormattedCellData()->SetIconArray(iconArray);
       
    97     CleanupStack::Pop();
       
    98 
       
    99     iListBox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray);
       
   100     iListBox->View()->SetListEmptyTextL( KNullDesC );
       
   101 
       
   102     
       
   103     AddToStackAndMakeVisibleL();
       
   104     
       
   105     TRACE_EXIT_POINT;
       
   106     }
       
   107 
       
   108 // ----------------------------------------------------------------------------
       
   109 // CCalenDummyViewContainer::UpdateSize
       
   110 // Do layout changes after calendar settings are
       
   111 // changed.  No necessary actions for this view.
       
   112 // ----------------------------------------------------------------------------
       
   113 //
       
   114 void CCalenDummyViewContainer::UpdateSize()
       
   115     {
       
   116     TRACE_ENTRY_POINT;
       
   117     TRACE_EXIT_POINT;
       
   118     }
       
   119 
       
   120 // ----------------------------------------------------------------------------
       
   121 // CCalenDummyViewContainer::CreateIconIndicesL
       
   122 // (other items were commented in a header).
       
   123 // ----------------------------------------------------------------------------
       
   124 //
       
   125 void CCalenDummyViewContainer::CreateIconIndicesL(
       
   126                                RArray<MCalenServices::TCalenIcons>&  aIndexArray)
       
   127     {
       
   128     TRACE_ENTRY_POINT;
       
   129     aIndexArray.Reset();
       
   130     aIndexArray.AppendL( MCalenServices::ECalenBirthdayIcon );
       
   131     TRACE_EXIT_POINT;
       
   132     }
       
   133 
       
   134 // ----------------------------------------------------------------------------
       
   135 // CCalenDummyViewContainer::GetHelpContext
       
   136 // Get help context.
       
   137 // (other items were commented in a header).
       
   138 // ----------------------------------------------------------------------------
       
   139 //
       
   140 void CCalenDummyViewContainer::GetHelpContext(TCoeHelpContext& /*aContext*/) const
       
   141     {
       
   142     TRACE_ENTRY_POINT;
       
   143 
       
   144     TRACE_EXIT_POINT;
       
   145     }
       
   146 
       
   147 // -----------------------------------------------------------------------------
       
   148 // CCalenDummyViewContainer::MopSupplyObject
       
   149 // Pass the skin information
       
   150 // (other items were commented in a header).
       
   151 // -----------------------------------------------------------------------------
       
   152 //
       
   153 TTypeUid::Ptr CCalenDummyViewContainer::MopSupplyObject(TTypeUid aId)
       
   154     {
       
   155     TRACE_ENTRY_POINT;
       
   156     TRACE_EXIT_POINT;
       
   157 
       
   158     return MAknsControlContext::SupplyMopObject(aId, iBgContext);
       
   159     }
       
   160 
       
   161 // -----------------------------------------------------------------------------
       
   162 // CCalenDummyViewContainer::SizeChanged
       
   163 // Called by the framework when the view size is changed.
       
   164 // -----------------------------------------------------------------------------
       
   165 //
       
   166 void CCalenDummyViewContainer::SizeChanged()
       
   167     {
       
   168     TRACE_ENTRY_POINT;
       
   169     TRect main_pane( Rect() );
       
   170     CCalenContainer::SizeChanged( main_pane );
       
   171     iServices.IssueNotificationL(ECalenNotifyCheckPluginUnloading);
       
   172     if(iListBox)
       
   173         {
       
   174         iListBox->SetRect( main_pane );
       
   175         }
       
   176     TRACE_EXIT_POINT;
       
   177     }
       
   178 
       
   179 // -----------------------------------------------------------------------------
       
   180 // CCalenDummyViewContainer::CountComponentControls
       
   181 // Gets the number of controls contained in a compound control.
       
   182 // -----------------------------------------------------------------------------
       
   183 //
       
   184 TInt CCalenDummyViewContainer::CountComponentControls() const
       
   185     {
       
   186     TRACE_ENTRY_POINT;
       
   187     TRACE_EXIT_POINT;
       
   188 
       
   189     return 1;
       
   190     }
       
   191 
       
   192 // -----------------------------------------------------------------------------
       
   193 // CCalenDummyViewContainer::ComponentControl
       
   194 // Gets the specified component of a compound control.
       
   195 // -----------------------------------------------------------------------------
       
   196 //
       
   197 CCoeControl* CCalenDummyViewContainer::ComponentControl(TInt /*aIndex*/) const
       
   198     {
       
   199     TRACE_ENTRY_POINT;
       
   200     TRACE_EXIT_POINT;
       
   201     if(iListBox)
       
   202         {
       
   203         return iListBox;
       
   204         }
       
   205     else
       
   206         {
       
   207         return NULL;
       
   208         }
       
   209     }
       
   210 
       
   211 // -----------------------------------------------------------------------------
       
   212 // CCalenDummyViewContainer::OfferKeyEventL
       
   213 // Called by the framework when a key event needs to be processed. 
       
   214 // -----------------------------------------------------------------------------
       
   215 //
       
   216 TKeyResponse CCalenDummyViewContainer::OfferKeyEventL(
       
   217         const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/)
       
   218     {
       
   219     TRACE_ENTRY_POINT;
       
   220 
       
   221     TKeyResponse ret(EKeyWasNotConsumed);
       
   222   
       
   223     TRACE_EXIT_POINT;
       
   224     return ret;
       
   225     }
       
   226 
       
   227 // -----------------------------------------------------------------------------
       
   228 // CCalenDummyViewContainer::HandleResourceChange
       
   229 // Handles a change to the application's resources which are shared across the environment. 
       
   230 // -----------------------------------------------------------------------------
       
   231 //
       
   232 void CCalenDummyViewContainer::HandleResourceChange(TInt aType)
       
   233     {
       
   234     TRACE_ENTRY_POINT;
       
   235     
       
   236     CCalenContainer::HandleResourceChange( aType );
       
   237 
       
   238     if ( aType == KAknsMessageSkinChange || aType == KEikDynamicLayoutVariantSwitch )
       
   239         {
       
   240         SizeChanged();
       
   241         }
       
   242     CCoeControl::HandleResourceChange( aType );
       
   243 
       
   244     TRACE_EXIT_POINT;
       
   245     }
       
   246 
       
   247 // -----------------------------------------------------------------------------
       
   248 // CCalenDummyViewContainer::Draw
       
   249 // Draws the control
       
   250 // -----------------------------------------------------------------------------
       
   251 //
       
   252 void CCalenDummyViewContainer::Draw(const TRect& /*aRect*/) const
       
   253     {
       
   254     TRACE_ENTRY_POINT;
       
   255     
       
   256     CWindowGc& gc = SystemGc();
       
   257 
       
   258     TRect mainPane;
       
   259     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPane );
       
   260     TRect bgContextRect( TPoint(0, 0), mainPane.Size() );
       
   261     iBgContext->SetRect( bgContextRect);
       
   262     iBgContext->SetParentPos(mainPane.iTl);
       
   263     AknsDrawUtils::Background( AknsUtils::SkinInstance(), iBgContext, this, gc, Rect());
       
   264     
       
   265     TRACE_EXIT_POINT;
       
   266     }
       
   267 
       
   268 // -----------------------------------------------------------------------------
       
   269 // CCalenDummyViewContainer::HandlePointerEventL
       
   270 // Handles the pointer events in touch resolutions
       
   271 // -----------------------------------------------------------------------------
       
   272 //
       
   273 void CCalenDummyViewContainer::HandlePointerEventL(
       
   274         const TPointerEvent& /*aPointerEvent*/)
       
   275     {
       
   276     TRACE_ENTRY_POINT;
       
   277  
       
   278     TRACE_EXIT_POINT;
       
   279     }
       
   280 
       
   281 // ----------------------------------------------------------------------------
       
   282 // CCalenDummyViewContainer::HandleNaviDecoratorEventL
       
   283 // ?implementation_description
       
   284 // (other items were commented in a header).
       
   285 // ----------------------------------------------------------------------------
       
   286 //
       
   287 void CCalenDummyViewContainer::HandleNaviDecoratorEventL( TInt /*aEventID*/ )
       
   288     {
       
   289     TRACE_ENTRY_POINT;
       
   290     
       
   291     TRACE_EXIT_POINT;   
       
   292     }
       
   293 
       
   294 // ----------------------------------------------------------------------------
       
   295 // CCalenDummyViewContainer::HandleLongTapEventL
       
   296 // processing of a long tap event
       
   297 // (other items were commented in a header).
       
   298 // ----------------------------------------------------------------------------
       
   299 //
       
   300 void CCalenDummyViewContainer::HandleLongTapEventL( const TPoint& /*aPenEventLocation*/,
       
   301                                               const TPoint& /*aPenEventScreenLocation*/ )
       
   302     {
       
   303     TRACE_ENTRY_POINT;
       
   304 
       
   305     TRACE_EXIT_POINT;
       
   306     }
       
   307 
       
   308 // End of File