16 * |
16 * |
17 */ |
17 */ |
18 |
18 |
19 // INCLUDE FILES |
19 // INCLUDE FILES |
20 #include <coemain.h> |
20 #include <coemain.h> |
21 #include <StringLoader.h> |
|
22 #include <aknstyluspopupmenu.h> |
|
23 #include <AknsDrawUtils.h> |
21 #include <AknsDrawUtils.h> |
24 #include <AknsFrameBackgroundControlContext.h> |
22 #include <AknsFrameBackgroundControlContext.h> |
25 #include <AknsListBoxBackgroundControlContext.h> |
23 #include <AknsListBoxBackgroundControlContext.h> |
26 #include <aknlayout.cdl.h> |
24 #include <aknlayout.cdl.h> |
27 #include <layoutmetadata.cdl.h> |
25 #include <layoutmetadata.cdl.h> |
28 #include <aknlayoutscalable_avkon.cdl.h> |
26 #include <aknlayoutscalable_avkon.cdl.h> |
29 #include <aknlayoutscalable_apps.cdl.h> |
27 #include <aknlayoutscalable_apps.cdl.h> |
30 #include <AknLayout.lag> |
28 #include <AknLayout.lag> |
|
29 #include <AknIconArray.h> |
|
30 #include <gulicon.h> |
31 #include <widgetmanagerview.rsg> |
31 #include <widgetmanagerview.rsg> |
32 #include <widgetmanager.mbg> |
32 #include <widgetmanager.mbg> |
33 #include "wmcommon.h" |
33 #include "wmcommon.h" |
34 #include "wmplugin.h" |
34 #include "wmplugin.h" |
35 #include "wmresourceloader.h" |
35 #include "wmresourceloader.h" |
121 iAddWidgetBtnHighlightMask, |
121 iAddWidgetBtnHighlightMask, |
122 iWmPlugin.ResourceLoader().IconFilePath(), |
122 iWmPlugin.ResourceLoader().IconFilePath(), |
123 EMbmWidgetmanagerAdd_widget_button, |
123 EMbmWidgetmanagerAdd_widget_button, |
124 EMbmWidgetmanagerAdd_widget_button_mask, |
124 EMbmWidgetmanagerAdd_widget_button_mask, |
125 KRgbWhite ); |
125 KRgbWhite ); |
|
126 |
|
127 // This is temporary fix for ou1cimx1#228810 |
|
128 // Can be removed when avkon provides real fix for this error. |
|
129 // Currently forever loop in CFormattedCellListBoxData::DrawFormattedSimple |
|
130 // never exits if there is no iconarray and name contains tab+digit which |
|
131 // confuses listbox e.g. considering name as icon index |
|
132 CArrayPtr<CGulIcon>* dummyArray = new( ELeave ) CAknIconArray(2); |
|
133 CleanupStack::PushL(dummyArray); |
|
134 CGulIcon* dummyIcon = CGulIcon::NewLC(); |
|
135 CGulIcon* dummyIcon2 = CGulIcon::NewLC(); |
|
136 dummyArray->AppendL(dummyIcon); |
|
137 dummyArray->AppendL(dummyIcon2); |
|
138 ColumnData()->SetIconArray(dummyArray); |
|
139 CleanupStack::Pop(3); |
126 } |
140 } |
127 |
141 |
128 // --------------------------------------------------------- |
142 // --------------------------------------------------------- |
129 // CWmListItemDrawer::~CWmListItemDrawer |
143 // CWmListItemDrawer::~CWmListItemDrawer |
130 // --------------------------------------------------------- |
144 // --------------------------------------------------------- |
254 gc.SetPenSize( TSize(2,2) ); |
268 gc.SetPenSize( TSize(2,2) ); |
255 |
269 |
256 TAknTextLineLayout titleTextLayout = |
270 TAknTextLineLayout titleTextLayout = |
257 AknLayoutScalable_Apps::listrow_wgtman_pane_t1().LayoutLine(); |
271 AknLayoutScalable_Apps::listrow_wgtman_pane_t1().LayoutLine(); |
258 |
272 |
259 TAknLayoutText textLayout; |
273 TAknLayoutText textLayoutTitle; |
260 textLayout.LayoutText( itemRect, titleTextLayout ); |
274 textLayoutTitle.LayoutText( itemRect, titleTextLayout ); |
261 textLayout.DrawText( gc, wData.Name(), ETrue, textColor ); |
275 textLayoutTitle.DrawText( gc, wData.Name(), ETrue, textColor ); |
262 |
276 |
263 if ( !wData.IsUninstalling() && |
277 if ( !wData.IsUninstalling() && |
264 wData.HsContentInfo().CanBeAdded() ) |
278 wData.HsContentInfo().CanBeAdded() ) |
265 { |
279 { |
266 // DRAW ADD BUTTON |
280 // DRAW ADD BUTTON |
283 { |
297 { |
284 TAknTextLineLayout descTextLayout = |
298 TAknTextLineLayout descTextLayout = |
285 AknLayoutScalable_Apps::listrow_wgtman_pane_t2().LayoutLine(); |
299 AknLayoutScalable_Apps::listrow_wgtman_pane_t2().LayoutLine(); |
286 gc.SetPenSize(TSize(1,1)); |
300 gc.SetPenSize(TSize(1,1)); |
287 // DRAW DESCRIPTION TEXT |
301 // DRAW DESCRIPTION TEXT |
288 textLayout.LayoutText( itemRect, descTextLayout ); |
302 TAknLayoutText textLayoutDes; |
289 textLayout.DrawText( gc, wData.Description(), ETrue, textColor ); |
303 textLayoutDes.LayoutText( itemRect, descTextLayout ); |
|
304 textLayoutDes.DrawText( gc, wData.Description(), ETrue, textColor ); |
290 } |
305 } |
291 else |
306 else |
292 { |
307 { |
293 // draw animation |
308 // draw animation |
294 TAknLayoutRect animationLayout; |
309 TAknLayoutRect animationLayout; |
521 // CWmListBox::RedrawItem |
536 // CWmListBox::RedrawItem |
522 // --------------------------------------------------------- |
537 // --------------------------------------------------------- |
523 // |
538 // |
524 void CWmListBox::RedrawItem( TInt aItemIndex ) |
539 void CWmListBox::RedrawItem( TInt aItemIndex ) |
525 { |
540 { |
526 View()->DrawItem( aItemIndex ); |
541 if ( aItemIndex >= 0 && |
|
542 aItemIndex < Model()->NumberOfItems() ) |
|
543 { |
|
544 View()->DrawItem( aItemIndex ); |
|
545 } |
527 } |
546 } |
528 |
547 |
529 // --------------------------------------------------------- |
548 // --------------------------------------------------------- |
530 // CWmListBox::SetSortOrderL |
549 // CWmListBox::SetSortOrderL |
531 // --------------------------------------------------------- |
550 // --------------------------------------------------------- |
550 Model(), |
569 Model(), |
551 iEikonEnv->DenseFont(), |
570 iEikonEnv->DenseFont(), |
552 cellData, |
571 cellData, |
553 this ); |
572 this ); |
554 CleanupStack::Pop(); // cellData |
573 CleanupStack::Pop(); // cellData |
555 |
|
556 // enable extended drawing |
|
557 EnableExtendedDrawingL(); |
|
558 } |
574 } |
559 |
575 |
560 // --------------------------------------------------------- |
576 // --------------------------------------------------------- |
561 // CWmListBox::HandleLayoutChanged |
577 // CWmListBox::HandleLayoutChanged |
562 // --------------------------------------------------------- |
578 // --------------------------------------------------------- |
688 // CWmListBox::HandlePointerEventL |
704 // CWmListBox::HandlePointerEventL |
689 // --------------------------------------------------------- |
705 // --------------------------------------------------------- |
690 // |
706 // |
691 void CWmListBox::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
707 void CWmListBox::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
692 { |
708 { |
693 // Check if pointer is down ( needed for drawing correct hightlight frame ) |
709 CAknDouble2LargeStyleListBox::HandlePointerEventL( aPointerEvent ); |
|
710 |
|
711 // Check if pointer is down ( needed for drawing correct hightlight frame ) |
694 if ( Rect().Contains( aPointerEvent.iPosition ) ) |
712 if ( Rect().Contains( aPointerEvent.iPosition ) ) |
695 { |
713 { |
696 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
714 TInt itemIndex = CurrentListBoxItemIndex(); |
697 { |
715 TBool itemPointed = View()->XYPosToItemIndex( |
698 iPressedDown = ETrue; |
716 aPointerEvent.iPosition, |
699 RedrawItem( CurrentListBoxItemIndex() ); |
717 itemIndex ); |
700 } |
718 if ( itemIndex >= 0 && itemPointed ) |
701 else if( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
719 { |
702 { |
720 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
703 iPressedDown = EFalse; |
721 { |
704 RedrawItem( CurrentListBoxItemIndex() ); |
722 iPressedDown = ETrue; |
705 } |
723 // redraw item |
|
724 RedrawItem( itemIndex ); |
|
725 } |
|
726 else if( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
727 { |
|
728 iPressedDown = EFalse; |
|
729 // redraw item |
|
730 RedrawItem( itemIndex ); |
|
731 } |
|
732 } |
706 } |
733 } |
707 |
|
708 CAknDouble2LargeStyleListBox::HandlePointerEventL( aPointerEvent ); |
|
709 } |
734 } |
710 |
735 |
711 // --------------------------------------------------------- |
736 // --------------------------------------------------------- |
712 // CWmListBox::LogoSize |
737 // CWmListBox::LogoSize |
713 // --------------------------------------------------------- |
738 // --------------------------------------------------------- |