diff -r 000000000000 -r f979ecb2b13e calendarui/views/src/calenweeklistboxitemdrawer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/calendarui/views/src/calenweeklistboxitemdrawer.cpp Tue Feb 02 10:12:19 2010 +0200 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Customized drawing of CCalenWeekLBData. + * DrawItemText() passes extended parameters to CCalenWeekLBData. + * +*/ + + + +//debug +#include "calendarui_debug.h" + +// INCLUDE FILES +#include "calenweeklistboxitemdrawer.h" + +#include "calenweeklistboxdata.h" +#include "calenweekdata.h" + +#include "calendar.hrh" + +#include +#include +#include + +#include + + +// ================= MEMBER FUNCTIONS ======================= + +// C++ constructor can NOT contain any code, that +// might leave. +// +CCalenWeekListBoxItemDrawer::CCalenWeekListBoxItemDrawer( + MTextListBoxModel* aTextListBoxModel, + const CFont* aFont, + CFormattedCellListBoxData* aFormattedCellData) + : CFormattedCellListBoxItemDrawer(aTextListBoxModel, aFont, aFormattedCellData) + { + TRACE_ENTRY_POINT; + TRACE_EXIT_POINT; + } + +// Destructor +CCalenWeekListBoxItemDrawer::~CCalenWeekListBoxItemDrawer() + { + TRACE_ENTRY_POINT; + TRACE_EXIT_POINT; + } + +// --------------------------------------------------------- +// CCalenWeekListBoxItemDrawer::DrawItemText +// Draws grid lines of one list row of Calendar week view. +// Calls CCalenWeekLBData to draw contents of cells +// (other items were commented in a header). +// --------------------------------------------------------- +// + +void CCalenWeekListBoxItemDrawer::DrawItemText(TInt aItemIndex, // Item index + const TRect& aItemTextRect, // Item rect + TBool aItemIsCurrent, // Current Item flag + TBool /*aViewIsEmphasized*/, // ignored. + TBool /*aItemIsSelected*/) const // Item hilighted flag + { + TRACE_ENTRY_POINT; + + // We use custom DrawItemText, because Avkon's + // CFormattedCellListBoxItemDrawer does a whole lotta things, + // e.g. background drawing, separator lines etc. + // Though it seems that it uses Enabled/Disabled functions for most + // of them, and setting properties properly could make this override + // unnecessary. + // It seems safer to have override, so that Avkon changes don't break + // Calendar. Avkon implementation of new features probably don't do + // it for Calendar week view in any case. + + iGc->SetPenColor(iTextColor); + iGc->SetBrushColor(iBackColor); + + SetupGc(aItemIndex); + + TBufC<256> target(iModel->ItemText(aItemIndex)); + + CFormattedCellListBoxData::TColors colors; + colors.iText = iTextColor; + colors.iBack = iBackColor; + colors.iHighlightedText = iHighlightedTextColor; + colors.iHighlightedBack = iHighlightedBackColor; + + CCalenWeekLBData* data = + static_cast( FormattedCellData() ); + data->Draw(Properties(aItemIndex), *iGc, + &target, aItemTextRect, aItemIsCurrent, colors); + + TRACE_EXIT_POINT; + } + +// End of File