calendarui/views/src/calendaylistbox.cpp
branchRCL_3
changeset 66 bd7edf625bdd
child 67 1539a383d7b6
child 86 ed599363c2d7
equal deleted inserted replaced
65:12af337248b1 66:bd7edf625bdd
       
     1 /*
       
     2 * Copyright (c) 2002 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 ListBox class's virtual functions.
       
    15  *                MakeViewClassInstanceL() are overridden by the
       
    16  *                Day View's ListBox.
       
    17  *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 //debug
       
    23 #include "calendarui_debug.h"
       
    24 
       
    25 // INCLUDE FILES
       
    26 #include "calendaylistbox.h"
       
    27 
       
    28 #include "calendaycontainer.h"
       
    29 #include "calendaylistboxdata.h"
       
    30 #include "calendaylistboxitemdrawer.h"
       
    31 #include "calendaylistboxview.h"
       
    32 #include "calendrawutils.h"
       
    33 #include "CalendarVariant.hrh"
       
    34 
       
    35 #include <Calendar.rsg>
       
    36 #include <calenservices.h>
       
    37 #include <AknsControlContext.h>
       
    38 #include <aknlists.h>
       
    39 #include <AknsUtils.h>
       
    40 #include <gulicon.h>
       
    41 #include <StringLoader.h>
       
    42 
       
    43 #include <aknlayoutscalable_apps.cdl.h>
       
    44 
       
    45 
       
    46 // ================= MEMBER FUNCTIONS =======================
       
    47 
       
    48 
       
    49 CCalenDayListBox::CCalenDayListBox( MCalenServices& aServices )
       
    50     : iServices( aServices )
       
    51     {
       
    52     TRACE_ENTRY_POINT;
       
    53     TRACE_EXIT_POINT;
       
    54     }
       
    55 
       
    56 // ----------------------------------------------------
       
    57 //
       
    58 // ----------------------------------------------------
       
    59 //
       
    60 CCalenDayListBox* CCalenDayListBox::NewL( const CCalenDayContainer* aDayContainer,
       
    61                                                              MCalenServices& aServices )
       
    62     {
       
    63     TRACE_ENTRY_POINT;
       
    64     
       
    65     CCalenDayListBox* self = new (ELeave) CCalenDayListBox( aServices );
       
    66     CleanupStack::PushL(self);
       
    67     self->ConstructL(aDayContainer);
       
    68     CleanupStack::Pop(self);
       
    69     
       
    70     TRACE_EXIT_POINT;
       
    71     return self;
       
    72     }
       
    73 
       
    74 // ----------------------------------------------------
       
    75 // 
       
    76 // ----------------------------------------------------
       
    77 //
       
    78 void CCalenDayListBox::ConstructL(const CCalenDayContainer* aDayContainer)
       
    79     {
       
    80     TRACE_ENTRY_POINT;
       
    81     
       
    82     iDayContainer = aDayContainer;
       
    83     SetContainerWindowL(*aDayContainer); 
       
    84     TInt flags = 0; // no flags
       
    85     CEikFormattedCellListBox::ConstructL(aDayContainer, flags);
       
    86     //UpdateIconsL();
       
    87 
       
    88     // Conversion is made in CalenDayListboxModel, so turn it off
       
    89     UseLogicalToVisualConversion(EFalse);
       
    90 
       
    91     // FIXME: is this necessary ?
       
    92     SetBorder(TGulBorder::ENone); 
       
    93     //set NULL string so that "no entries" is not shown 
       
    94     //until the list is populated
       
    95     View()->SetListEmptyTextL(KNullDesC); 
       
    96    
       
    97        // Create scroll bar
       
    98     CreateScrollBarFrameL(ETrue);
       
    99     ScrollBarFrame()->SetScrollBarVisibilityL(
       
   100         CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
       
   101         
       
   102     TRACE_EXIT_POINT;
       
   103     }
       
   104 
       
   105 // ---------------------------------------------------------
       
   106 // CCalenDayListBox::CreateItemDrawerL
       
   107 // Create CCalenDayLBData and CCalenDayListBoxItemDrawer.
       
   108 // (other items were commented in a header).
       
   109 // ---------------------------------------------------------
       
   110 //
       
   111 void CCalenDayListBox::CreateItemDrawerL()
       
   112     {
       
   113     TRACE_ENTRY_POINT;
       
   114     
       
   115     CCalenDayListboxData* listboxData = CCalenDayListboxData::NewL();
       
   116     CleanupStack::PushL( listboxData );
       
   117     iItemDrawer = new(ELeave) CCalenDayListBoxItemDrawer(
       
   118                                                             Model(), 
       
   119                                                             iEikonEnv->NormalFont(),
       
   120                                                             listboxData,
       
   121                                                             this );
       
   122     CleanupStack::Pop( listboxData );
       
   123     
       
   124     TRACE_EXIT_POINT;
       
   125     }
       
   126 
       
   127 
       
   128 // ---------------------------------------------------------
       
   129 // CCalenDayListBox::HandleResourceChange
       
   130 // Handles global resource changes, such as skin events
       
   131 // (other items were commented in a header).
       
   132 // ---------------------------------------------------------
       
   133 void CCalenDayListBox::HandleResourceChange(TInt aType)
       
   134     {
       
   135     TRACE_ENTRY_POINT;
       
   136     
       
   137 /* // Temp: to be removed. Icon updates is now handled in CalenDayContainer   
       
   138     if( aType == KAknsMessageSkinChange ||
       
   139         aType == KEikDynamicLayoutVariantSwitch )
       
   140         {
       
   141         PIM_TRAPD_HANDLE( UpdateIconsL() );
       
   142         // After this, icon sizes should be also set in SizeChanged, 
       
   143         // i.e SizeChanged should be called
       
   144         }
       
   145 */
       
   146     // Performance improvement: in layout changes, 
       
   147     // we get to DoStepL ultimately. No need to invoke 
       
   148     // HandleLayoutChangeL of Listbox at this early stage
       
   149     if(aType != KEikDynamicLayoutVariantSwitch)
       
   150         {       
       
   151         CEikFormattedCellListBox::HandleResourceChange(aType);        
       
   152         }
       
   153     
       
   154     TRACE_EXIT_POINT;
       
   155     }
       
   156 
       
   157 // ---------------------------------------------------------
       
   158 // CCalenDayListBox::SizeChangedL
       
   159 // Handles size change event
       
   160 // (other items were commented in a header).
       
   161 // ---------------------------------------------------------
       
   162 //
       
   163 void CCalenDayListBox::HandleSizeChangedL()
       
   164     {
       
   165     TRACE_ENTRY_POINT;
       
   166 
       
   167     CEikFormattedCellListBox &aListBox = *this;
       
   168     CFormattedCellListBoxItemDrawer *itemDrawer = aListBox.ItemDrawer();
       
   169 
       
   170 
       
   171     AknListBoxLayouts::SetupStandardListBox( aListBox );
       
   172     AknListBoxLayouts::SetupStandardFormListbox( itemDrawer );
       
   173 
       
   174     AknListBoxLayouts::SetupListboxPos( aListBox, AknLayoutScalable_Apps::list_cale_time_pane( 0 ).LayoutLine() );
       
   175 
       
   176     TAknWindowLineLayout gfxA;
       
   177     TAknTextLineLayout textA;
       
   178     TAknTextLineLayout textB;
       
   179     TAknTextLineLayout textC;
       
   180     TAknWindowLineLayout iconA;
       
   181     TAknWindowLineLayout iconB;
       
   182 
       
   183 #ifdef RD_CALEN_MIDNIGHT_VISUALIZATION 
       
   184     TBool midnight = iDayContainer->IsMidnightVisualization();
       
   185 #endif // RD_CALEN_MIDNIGHT_VISUALIZATION
       
   186     TLocale locale;
       
   187     CCalenDayListBox::ReadLayout(
       
   188         locale,
       
   189         gfxA, textA, textB, textC, iconA, iconB
       
   190 #ifdef RD_CALEN_MIDNIGHT_VISUALIZATION    
       
   191         , midnight 
       
   192 #endif // RD_CALEN_MIDNIGHT_VISUALIZATION        
       
   193         );
       
   194 
       
   195 
       
   196     /* Day view list content 
       
   197      * 
       
   198      * Memos & Anniversaries
       
   199      *
       
   200      * gfxA | textB        | textC   | iconA 
       
   201      * 0    | 2            | 3       | 4
       
   202      * icon | always empty | subject | alarm icon
       
   203      * 
       
   204      *
       
   205      * Meetings 
       
   206      *
       
   207      * textA | textB         | textC            | iconA  | iconB 
       
   208      * 1     | 2             | 3                | 4      | 5
       
   209      * time  | space or dash | subject,location | repeat | alarm 
       
   210      *
       
   211      *
       
   212      * To-Dos
       
   213      *
       
   214      * gfxA  | textB         | textC   | iconA    | iconB 
       
   215      * 0     | 2             | 3       | 4        | 5
       
   216      * icon  | always empty  | subject | priority | alarm 
       
   217      * 
       
   218      * 
       
   219      * 0 t 1 t 2 t 3 t 4 t 5
       
   220      * Meeting
       
   221      * \t14:00\t-\tXXXXX,XXXXXX\trepeat icon index\talarm icon index
       
   222      * Memo & anniversary 
       
   223      * icon index\t \t\tXXXXXXXXXXXXXX\talarm icon\t\t
       
   224      * To-Do
       
   225      * icon index\t \t\tXXXXXXXXXXXXXX\tpriority icon\talarm icon\t
       
   226      */
       
   227 
       
   228     TPoint area[2];
       
   229     TSize itemSize( View()->ItemSize() );
       
   230 
       
   231     // subcell 0, gfxA, memo or anniversary icon
       
   232     TInt subCell = 0;
       
   233 
       
   234     CalenDrawUtils::GfxPos( area, gfxA, itemSize );
       
   235     
       
   236     AknListBoxLayouts::SetupFormGfxCell( aListBox, itemDrawer, subCell, gfxA, area[0], area[1] );
       
   237     itemDrawer->FormattedCellData()->SetNotAlwaysDrawnSubCellL( subCell, ETrue );
       
   238     ++subCell;
       
   239 
       
   240     // subcell 1, textA, meeting time 
       
   241     CalenDrawUtils::TextPos( area, textA, itemSize );
       
   242     
       
   243     AknListBoxLayouts::SetupFormAntiFlickerTextCell( aListBox, itemDrawer, subCell, textA, area[0], area[1] );
       
   244     itemDrawer->FormattedCellData()->SetNotAlwaysDrawnSubCellL( subCell, ETrue );
       
   245     ++subCell;
       
   246 
       
   247     // subcell 2, textB, space or dash
       
   248     CalenDrawUtils::TextPos( area, textB, itemSize );
       
   249     
       
   250     AknListBoxLayouts::SetupFormAntiFlickerTextCell( aListBox, itemDrawer, subCell, textB, area[0], area[1] );
       
   251     ++subCell;
       
   252 
       
   253     // subcell 3, textC, subject,location
       
   254     CalenDrawUtils::TextPos( area, textC, itemSize );
       
   255     
       
   256     AknListBoxLayouts::SetupFormAntiFlickerTextCell( aListBox, itemDrawer, subCell, textC, area[0], area[1] );
       
   257     ++subCell;
       
   258 
       
   259     // subcell 4, iconA
       
   260     CalenDrawUtils::GfxPos( area, iconA, itemSize );
       
   261     AknListBoxLayouts::SetupFormGfxCell( aListBox, itemDrawer, subCell, iconA, area[0], area[1] );
       
   262     itemDrawer->FormattedCellData()->SetNotAlwaysDrawnSubCellL( subCell, ETrue );
       
   263     ++subCell;
       
   264 
       
   265     // subcell 5, iconB
       
   266     CalenDrawUtils::GfxPos( area, iconB, itemSize );
       
   267     AknListBoxLayouts::SetupFormGfxCell( aListBox, itemDrawer, subCell, iconB, area[0], area[1] );
       
   268     itemDrawer->FormattedCellData()->SetNotAlwaysDrawnSubCellL( subCell, ETrue );
       
   269     // Set skinend text and highlight colors
       
   270 
       
   271     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   272     // highlight color
       
   273     TRgb textColor(KRgbBlack);
       
   274     TInt error = AknsUtils::GetCachedColor( skin, textColor, 
       
   275                                             KAknsIIDQsnTextColors,
       
   276                                             EAknsCIQsnTextColorsCG22);
       
   277     if (!error)
       
   278         {
       
   279         itemDrawer->SetTextColor(textColor);
       
   280         }
       
   281 
       
   282     // highlight color
       
   283     TRgb highlightColor(KRgbBlack);
       
   284     error = AknsUtils::GetCachedColor( skin, highlightColor, 
       
   285                                              KAknsIIDQsnTextColors,
       
   286                                              EAknsCIQsnTextColorsCG10);
       
   287     if (!error)
       
   288         {
       
   289         itemDrawer->SetHighlightedTextColor(highlightColor);
       
   290         }
       
   291 
       
   292     TSize main_pane_Size;
       
   293     AknLayoutUtils::LayoutMetricsSize( AknLayoutUtils::EMainPane, main_pane_Size );
       
   294     TRect main_pane( main_pane_Size );
       
   295 
       
   296     TAknLayoutRect main_cale_day_pane;
       
   297     main_cale_day_pane.LayoutRect( main_pane, AknLayoutScalable_Apps::main_cale_day_pane().LayoutLine() );
       
   298 
       
   299     TAknLayoutRect listscroll_cale_day_pane;
       
   300     TInt layoutVariant = iDayContainer->LayoutVariantIndex( CCalenDayContainer::EListScrollCaleDayPane );
       
   301     listscroll_cale_day_pane.LayoutRect( main_cale_day_pane.Rect(), AknLayoutScalable_Apps::listscroll_cale_day_pane( layoutVariant ).LayoutLine() );
       
   302 
       
   303     TAknLayoutRect list_cale_pane;
       
   304     list_cale_pane.LayoutRect( listscroll_cale_day_pane.Rect(), AknLayoutScalable_Apps::list_cale_pane( layoutVariant ).LayoutLine() );
       
   305 
       
   306     TAknLayoutRect list_cale_time_pane;
       
   307     list_cale_time_pane.LayoutRect( list_cale_pane.Rect(), AknLayoutScalable_Apps::list_cale_time_pane( 0 ).LayoutLine() );
       
   308 
       
   309     // Set sizes to icons. Needed for SVG icons
       
   310     CArrayPtr<CGulIcon>* iconArray = ItemDrawer()->FormattedCellData()->IconArray();
       
   311     if(iconArray)
       
   312         {
       
   313         TAknLayoutRect sizeLayout;
       
   314         sizeLayout.LayoutRect( list_cale_time_pane.Rect(), gfxA );
       
   315         TSize size( sizeLayout.Rect().Size() );
       
   316 
       
   317         AknIconUtils::SetSize( iconArray->At( iDayContainer->IconIndex( MCalenServices::ECalenBirthdayIcon ))->Bitmap(), size );
       
   318         AknIconUtils::SetSize( iconArray->At( iDayContainer->IconIndex( MCalenServices::ECalenMeetingIcon ))->Bitmap(), size );
       
   319         AknIconUtils::SetSize( iconArray->At( iDayContainer->IconIndex( MCalenServices::ECalenDaynoteIcon ))->Bitmap(), size );
       
   320         AknIconUtils::SetSize( iconArray->At( iDayContainer->IconIndex( MCalenServices::ECalenToDoIcon ))->Bitmap(), size );
       
   321 
       
   322         // IconA and IconB size are same. Both icons can be in IconA column, when
       
   323         // just one icon is present. 
       
   324         sizeLayout.LayoutRect( list_cale_time_pane.Rect(), iconA );
       
   325         size = sizeLayout.Rect().Size();
       
   326         AknIconUtils::SetSize( iconArray->At( iDayContainer->IconIndex( MCalenServices::ECalenAlarmIcon ))->Bitmap(), size );
       
   327         AknIconUtils::SetSize( iconArray->At( iDayContainer->IconIndex( MCalenServices::ECalenRepeatIcon))->Bitmap(), size );
       
   328         AknIconUtils::SetSize( iconArray->At( iDayContainer->IconIndex( MCalenServices::ECalenRepeatExceptionIcon ))->Bitmap(), size );
       
   329         AknIconUtils::SetSize( iconArray->At( iDayContainer->IconIndex( MCalenServices::ECalenMapIcon ))->Bitmap(), size );
       
   330         }
       
   331     
       
   332     TRACE_EXIT_POINT;
       
   333     }
       
   334 
       
   335 // ---------------------------------------------------------
       
   336 // CCalenDayListBox::SizeChanged
       
   337 // Handles size change event
       
   338 // (other items were commented in a header).
       
   339 // ---------------------------------------------------------
       
   340 //
       
   341 void CCalenDayListBox::SizeChanged()
       
   342     {
       
   343     TRACE_ENTRY_POINT;
       
   344     
       
   345     PIM_TRAPD_HANDLE( HandleSizeChangedL() );
       
   346     CEikFormattedCellListBox::SizeChanged();
       
   347     
       
   348     TRACE_EXIT_POINT;
       
   349     }
       
   350 
       
   351 // ---------------------------------------------------------
       
   352 // CCalenDayListBox::MinimumSize
       
   353 // Returns minimum size of this control
       
   354 // (other items were commented in a header).
       
   355 // ---------------------------------------------------------
       
   356 //
       
   357 TSize CCalenDayListBox::MinimumSize()
       
   358     {
       
   359     TRACE_ENTRY_POINT;
       
   360     
       
   361     TRACE_EXIT_POINT;
       
   362     return Size(); // for AknListBoxLayouts::SetupColumnTextCell()
       
   363     }
       
   364 
       
   365 // ---------------------------------------------------------
       
   366 // CCalenDayListBox::Draw
       
   367 // Draws itself
       
   368 // (other items were commented in a header).
       
   369 // ---------------------------------------------------------
       
   370 //
       
   371 void CCalenDayListBox::Draw(const TRect& aRect) const
       
   372     {
       
   373     TRACE_ENTRY_POINT;
       
   374     
       
   375     if (Model()->NumberOfItems() == 0)
       
   376         {
       
   377         iView->DrawEmptyList(Rect());
       
   378         }
       
   379     else
       
   380         {
       
   381         iView->Draw(&aRect);
       
   382         }
       
   383     
       
   384     TRACE_EXIT_POINT;
       
   385     }
       
   386 
       
   387 
       
   388 
       
   389 
       
   390 TKeyResponse CCalenDayListBox::HandleDownwardLoopingL(const TKeyEvent& aKeyEvent)
       
   391     {
       
   392     TRACE_ENTRY_POINT;
       
   393 
       
   394     // iView->CurrentItemIndex holds first line of focused 
       
   395     // item of day view, not last line of listbox itself. 
       
   396     // For this reason Eikon listbox code (CEikListBox::DoOfferKeyEventL)
       
   397     // can't handle looping from end to beginning. 
       
   398     // Here checking is done ourselves. If-clause is modified copy-paste from 
       
   399     // CEikListBox class. 
       
   400     CCalenDayListBoxView* view = static_cast<CCalenDayListBoxView*>(iView);
       
   401 
       
   402     TInt oldCurrentItemIndex = view->LastLineOfCell(iView->CurrentItemIndex());
       
   403     if (aKeyEvent.iCode == EKeyDownArrow
       
   404         &&
       
   405         !(iListBoxFlags & EPopout) 
       
   406         && 
       
   407         (oldCurrentItemIndex==Model()->NumberOfItems()-1 || oldCurrentItemIndex==-1))
       
   408         {
       
   409         if (iListBoxFlags & ELoopScrolling)
       
   410             {
       
   411             iView->MoveCursorL(CListBoxView::ECursorFirstItem, CListBoxView::ENoSelection);
       
   412             UpdateScrollBarThumbs();
       
   413             }
       
   414         return EKeyWasConsumed;
       
   415         }
       
   416     else
       
   417         {
       
   418         return EKeyWasNotConsumed;
       
   419         }
       
   420     
       
   421     TRACE_EXIT_POINT;
       
   422     }
       
   423 
       
   424 TKeyResponse CCalenDayListBox::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
       
   425     {
       
   426     TRACE_ENTRY_POINT;
       
   427 
       
   428     TKeyEvent keyEvent=aKeyEvent;
       
   429     // FIXME: CEikListBox uses LafListBox for device customization
       
   430     // we should do same here. See uiklaf/src/laflbx.h. Needs dependency to uiklaf. 
       
   431     // keyEvent.iCode=LafListBox::MapKeyCode(aKeyEvent,aType);
       
   432     TKeyResponse keyRes = EKeyWasNotConsumed;
       
   433     if(keyEvent.iCode == EKeyDownArrow)
       
   434         {
       
   435         keyRes = HandleDownwardLoopingL(keyEvent);
       
   436         }
       
   437 
       
   438     if (keyRes != EKeyWasConsumed)
       
   439         {
       
   440         keyRes = CEikListBox::OfferKeyEventL(aKeyEvent,aType);
       
   441         }
       
   442     
       
   443     TRACE_EXIT_POINT;
       
   444     return keyRes;
       
   445     }
       
   446 
       
   447 // ---------------------------------------------------------
       
   448 // CCalenDayListBox::MakeViewClassInstanceL
       
   449 // Creates a derived class of CListBoxView class
       
   450 // (other items were commented in a header).
       
   451 // ---------------------------------------------------------
       
   452 //
       
   453 CListBoxView* CCalenDayListBox::MakeViewClassInstanceL()
       
   454     {
       
   455     TRACE_ENTRY_POINT;
       
   456     
       
   457     TRACE_EXIT_POINT;
       
   458     return new(ELeave) CCalenDayListBoxView(this);
       
   459     }
       
   460 
       
   461 //
       
   462 // Static method to read day view LAF values. This is needed both in 
       
   463 // CCalenDayListbox and CalenDayListboxModel.
       
   464 void CCalenDayListBox::ReadLayout(
       
   465     TInt aLayoutVariant, 
       
   466     TLocale& aLocale,
       
   467     TAknLayoutRect& aGfxA,
       
   468     TAknLayoutText& aTextA,
       
   469     TAknLayoutText& aTextB,
       
   470     TAknLayoutText& aTextC,
       
   471     TAknLayoutRect& aIconA,
       
   472     TAknLayoutRect& aIconB,
       
   473     TBool aMidnightVisualization)
       
   474     {
       
   475     TRACE_ENTRY_POINT;
       
   476     
       
   477     TAknWindowLineLayout GfxA;
       
   478     TAknTextLineLayout   TextA;
       
   479     TAknTextLineLayout   TextB;
       
   480     TAknTextLineLayout   TextC;
       
   481     TAknWindowLineLayout IconA;
       
   482     TAknWindowLineLayout IconB;
       
   483 
       
   484     CCalenDayListBox::ReadLayout( aLocale, GfxA, TextA, TextB, 
       
   485     TextC, IconA, IconB, aMidnightVisualization);
       
   486 
       
   487     TSize main_pane_Size;
       
   488     AknLayoutUtils::LayoutMetricsSize( AknLayoutUtils::EMainPane, main_pane_Size );
       
   489     TRect main_pane( main_pane_Size );
       
   490 
       
   491     TAknLayoutRect list_cale_pane;
       
   492     TAknLayoutRect list_cale_time_pane;
       
   493 
       
   494     TAknLayoutRect main_cale_day_pane;
       
   495     TAknLayoutRect listscroll_cale_day_pane;
       
   496     main_cale_day_pane.LayoutRect( main_pane, AknLayoutScalable_Apps::main_cale_day_pane().LayoutLine() );
       
   497     listscroll_cale_day_pane.LayoutRect( main_cale_day_pane.Rect(), AknLayoutScalable_Apps::listscroll_cale_day_pane( aLayoutVariant ).LayoutLine() );
       
   498 
       
   499     list_cale_pane.LayoutRect( listscroll_cale_day_pane.Rect(), AknLayoutScalable_Apps::list_cale_pane( aLayoutVariant ).LayoutLine() );  
       
   500 
       
   501     list_cale_time_pane.LayoutRect( list_cale_pane.Rect(), AknLayoutScalable_Apps::list_cale_time_pane( 0 ).LayoutLine() );
       
   502 
       
   503     aGfxA.LayoutRect(  list_cale_time_pane.Rect(), GfxA   );
       
   504     aIconA.LayoutRect( list_cale_time_pane.Rect(), IconA  );
       
   505     aIconB.LayoutRect( list_cale_time_pane.Rect(), IconB  );
       
   506     aTextA.LayoutText( list_cale_time_pane.Rect(), TextA );
       
   507     aTextB.LayoutText( list_cale_time_pane.Rect(), TextB );
       
   508     aTextC.LayoutText( list_cale_time_pane.Rect(), TextC );
       
   509     
       
   510     TRACE_EXIT_POINT;
       
   511     } 
       
   512 
       
   513 //
       
   514 // Static method to read day view LAF values. This is needed both in 
       
   515 // CCalenDayListbox and CalenDayListboxModel.
       
   516 
       
   517 void CCalenDayListBox::ReadLayout(TLocale& aLocale,
       
   518                                            TAknWindowLineLayout& aGfxA,
       
   519                                            TAknTextLineLayout& aTextA,
       
   520                                            TAknTextLineLayout& aTextB,
       
   521                                            TAknTextLineLayout& aTextC,
       
   522                                            TAknWindowLineLayout& aIconA,
       
   523                                            TAknWindowLineLayout& aIconB,
       
   524                                            TBool aMidnightVisualization)
       
   525     {
       
   526     TRACE_ENTRY_POINT;
       
   527     
       
   528     aGfxA = AknLayoutScalable_Apps::list_cale_time_pane_g1( 0 ).LayoutLine();
       
   529     aIconA = AknLayoutScalable_Apps::list_cale_time_pane_g4( 0 ).LayoutLine();
       
   530     aIconB = AknLayoutScalable_Apps::list_cale_time_pane_g3( 1 ).LayoutLine();
       
   531 
       
   532 
       
   533 
       
   534     if(aMidnightVisualization)
       
   535         {
       
   536 #ifdef RD_CALEN_MIDNIGHT_VISUALIZATION // with arrow        
       
   537         ReadTextLayoutForMidnight(aLocale, aTextA, aTextB, aTextC);
       
   538 #else
       
   539         ASSERT(KErrArgument);        
       
   540 #endif // RD_CALEN_MIDNIGHT_VISUALIZATION                      
       
   541         }
       
   542     else
       
   543         {
       
   544         ReadTextLayoutNoMidnight(aLocale, aTextA, aTextB, aTextC);
       
   545         }        
       
   546     
       
   547     TRACE_EXIT_POINT;
       
   548     } 
       
   549 
       
   550 void CCalenDayListBox::ReadTextLayoutNoMidnight
       
   551     (TLocale& aLocale,    
       
   552      TAknTextLineLayout& aTextA,
       
   553      TAknTextLineLayout& aTextB,
       
   554      TAknTextLineLayout& aTextC)
       
   555     {
       
   556     TRACE_ENTRY_POINT;
       
   557 
       
   558     TInt countryCode( User::Language() );
       
   559     TTimeFormat timeFormat( aLocale.TimeFormat() );
       
   560     
       
   561     TInt variety_t1(-1);
       
   562     TInt variety_t2(-1);
       
   563     TInt variety_t4(-1);
       
   564 
       
   565     // no arrow
       
   566     if( timeFormat == ETime24 )
       
   567         {
       
   568         // Option 1: 24 hour, no Arrow       
       
   569         variety_t1 = 0;
       
   570         variety_t2 = 0;
       
   571         variety_t4 = 0;
       
   572         }
       
   573     // 12 hour        
       
   574     else if( countryCode == ELangCzech ) 
       
   575         {
       
   576         // Option 3: Czech, 12 hour no Arrow
       
   577         variety_t1 = 2;
       
   578         variety_t2 = 2;
       
   579         variety_t4 = 2;
       
   580         }
       
   581     // 12 hour        
       
   582     else    
       
   583         {
       
   584         // Option 2: 12 hour, no Arrow
       
   585         variety_t1 = 1;
       
   586         variety_t2 = 1;
       
   587         variety_t4 = 1;
       
   588         }
       
   589 
       
   590     aTextA = AknLayoutScalable_Apps::list_cale_time_pane_t2( variety_t2 ).LayoutLine();
       
   591     aTextB = AknLayoutScalable_Apps::list_cale_time_pane_t4( variety_t4 ).LayoutLine();
       
   592     aTextC = AknLayoutScalable_Apps::list_cale_time_pane_t1( variety_t1 ).LayoutLine();        
       
   593 
       
   594     TRACE_EXIT_POINT;
       
   595     } 
       
   596 
       
   597 
       
   598 #ifdef RD_CALEN_MIDNIGHT_VISUALIZATION // with arrow
       
   599 
       
   600 void CCalenDayListBox::ReadTextLayoutForMidnight
       
   601     (TLocale& aLocale,
       
   602      TAknTextLineLayout& aTextA,
       
   603      TAknTextLineLayout& aTextB,
       
   604      TAknTextLineLayout& aTextC)
       
   605     {
       
   606     TRACE_ENTRY_POINT;
       
   607 
       
   608     TInt countryCode( User::Language() );
       
   609     TTimeFormat timeFormat( aLocale.TimeFormat() );
       
   610 
       
   611     TInt variety_t1(-1);
       
   612     TInt variety_t2(-1);
       
   613     TInt variety_t4(-1);
       
   614 
       
   615     // with arrow
       
   616     if( timeFormat == ETime24 )
       
   617         {
       
   618         // Option 1: 24 hour        
       
   619         variety_t1 = 0;
       
   620         variety_t2 = 0;
       
   621         variety_t4 = 0;
       
   622         }
       
   623     // 12 hour        
       
   624     else if( countryCode == ELangCzech ) 
       
   625         {
       
   626         // Option 16: Czech, 12 hour with Arrow
       
   627         variety_t1 = 8;
       
   628         variety_t2 = 7;
       
   629         variety_t4 = 7;
       
   630         }
       
   631     // 12 hour        
       
   632     else    
       
   633         {
       
   634         // Option 15: 12 hour, with Arrow
       
   635         variety_t1 = 7;
       
   636         variety_t2 = 6;
       
   637         variety_t4 = 6;
       
   638         }
       
   639 
       
   640     aTextA = AknLayoutScalable_Apps::list_cale_time_pane_t2( variety_t2 ).LayoutLine();
       
   641     aTextB = AknLayoutScalable_Apps::list_cale_time_pane_t4( variety_t4 ).LayoutLine();
       
   642     aTextC = AknLayoutScalable_Apps::list_cale_time_pane_t1( variety_t1 ).LayoutLine();
       
   643 
       
   644     TRACE_EXIT_POINT;        
       
   645     }
       
   646 #endif // RD_CALEN_MIDNIGHT_VISUALIZATION
       
   647     
       
   648 // ----------------------------------------------------
       
   649 // 
       
   650 // ----------------------------------------------------
       
   651 //
       
   652 TTypeUid::Ptr CCalenDayListBox::MopSupplyObject(TTypeUid aId)
       
   653     {
       
   654     TRACE_ENTRY_POINT;
       
   655     
       
   656     if(aId.iUid == MAknsControlContext::ETypeId )
       
   657         {
       
   658         MAknsControlContext* cc = AknsDrawUtils::ControlContextOfParent( this );
       
   659         if ( cc )
       
   660             {
       
   661             TRACE_EXIT_POINT;
       
   662             return MAknsControlContext::SupplyMopObject( aId, cc );
       
   663             }
       
   664         }
       
   665     
       
   666     TRACE_EXIT_POINT;
       
   667     return CCoeControl::MopSupplyObject( aId );
       
   668     }
       
   669 
       
   670 
       
   671 // ---------------------------------------------------------
       
   672 // CCalenDayListBox::HandlePointerEventL
       
   673 // Pointer event handler (events from touch ui)
       
   674 // (other items were commented in a header).
       
   675 // ---------------------------------------------------------
       
   676 //
       
   677 void CCalenDayListBox::HandlePointerEventL(const TPointerEvent& aPointerEvent)
       
   678     {
       
   679     TRACE_ENTRY_POINT;
       
   680     CEikFormattedCellListBox::HandlePointerEventL( aPointerEvent);
       
   681     TRACE_EXIT_POINT;
       
   682     }
       
   683 
       
   684 
       
   685 // End of File