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