44 #include <gulcolor.h> |
44 #include <gulcolor.h> |
45 |
45 |
46 // using AknsDrawUtils for drawing background |
46 // using AknsDrawUtils for drawing background |
47 #include <AknsDrawUtils.h> |
47 #include <AknsDrawUtils.h> |
48 #include <applayout.cdl.h> |
48 #include <applayout.cdl.h> |
|
49 |
|
50 // for MAknsControlContext::SupplyMopObject method |
|
51 #include <AknsFrameBackgroundControlContext.h> |
49 // LAF |
52 // LAF |
50 #include <aknlayoutscalable_avkon.cdl.h> |
53 #include <aknlayoutscalable_avkon.cdl.h> |
51 |
54 |
52 #include <AknDef.h> // For layout change event definitions |
55 #include <AknDef.h> // For layout change event definitions |
53 |
56 |
96 } |
99 } |
97 |
100 |
98 void CMIDGaugeItem::CGaugeTimer::RunL() |
101 void CMIDGaugeItem::CGaugeTimer::RunL() |
99 { |
102 { |
100 if (!iGauge.iGaugeFrameData) |
103 if (!iGauge.iGaugeFrameData) |
101 {//if the bitmaps haven't been created it means we are inside an alert, |
104 { |
|
105 //if the bitmaps haven't been created it means we are inside an alert, |
102 //which is using its own bitmaps for the gauge animation. |
106 //which is using its own bitmaps for the gauge animation. |
103 //Return without restarting the timer |
107 //Return without restarting the timer |
104 return; |
108 return; |
105 } |
109 } |
106 |
110 |
1077 } |
1081 } |
1078 |
1082 |
1079 TSize CMIDNonInteractiveGauge::MinimumSize() |
1083 TSize CMIDNonInteractiveGauge::MinimumSize() |
1080 { |
1084 { |
1081 if (!iLabelControl || (iLabelControl->Text()->Length() == 0)) |
1085 if (!iLabelControl || (iLabelControl->Text()->Length() == 0)) |
1082 { // item doesn't have label |
1086 { |
|
1087 // item doesn't have label |
1083 return TSize(FormClientAreaWidth(), iItemheightWithoutLabel); |
1088 return TSize(FormClientAreaWidth(), iItemheightWithoutLabel); |
1084 } |
1089 } |
1085 else // item has label |
1090 else // item has label |
1086 { |
1091 { |
1087 return TSize(FormClientAreaWidth(), |
1092 return TSize(FormClientAreaWidth(), |
1637 { |
1642 { |
1638 return iBitmapAnimation && iBitmapAnimation->BitmapAnimData() && |
1643 return iBitmapAnimation && iBitmapAnimation->BitmapAnimData() && |
1639 iBitmapAnimation->BitmapAnimData()->FrameArray().Count() > 0; |
1644 iBitmapAnimation->BitmapAnimData()->FrameArray().Count() > 0; |
1640 } |
1645 } |
1641 |
1646 |
|
1647 TTypeUid::Ptr CMIDNonInteractiveGauge::MopSupplyObject(TTypeUid aId) |
|
1648 { |
|
1649 TTypeUid::Ptr ptr = TTypeUid::Null(); |
|
1650 |
|
1651 // When control context is requested we return new correct one. |
|
1652 // Default implementation otherwise. |
|
1653 if (aId.iUid == MAknsControlContext::ETypeId && iForm && IsFocused()) |
|
1654 { |
|
1655 ptr = MAknsControlContext::SupplyMopObject(aId, BackgroundControlContext()); |
|
1656 } |
|
1657 else |
|
1658 { |
|
1659 ptr = CMIDControlItem::MopSupplyObject(aId); |
|
1660 } |
|
1661 return ptr; |
|
1662 } |
|
1663 |
|
1664 CAknsFrameBackgroundControlContext* CMIDNonInteractiveGauge::BackgroundControlContext() |
|
1665 { |
|
1666 // It tries create new instance of CAknsFrameBackgroundControlContext. |
|
1667 // When construction fails, the error is logged. |
|
1668 CAknsFrameBackgroundControlContext* context = NULL; |
|
1669 TRAPD(err, context = CAknsFrameBackgroundControlContext::NewL( |
|
1670 KAknsIIDQsnFrInput, Rect(), Rect(), EFalse)); |
|
1671 if (err != KErrNone) |
|
1672 { |
|
1673 DEBUG_INT("CMIDNonInteractiveGauge::BackgroundControlContext -\ |
|
1674 CAknsFrameBackgroundControlContext::NewL failed with error number %d", err); |
|
1675 context = NULL; |
|
1676 } |
|
1677 return context; |
|
1678 } |
|
1679 |
1642 // --------------------------------------------------------------------------- |
1680 // --------------------------------------------------------------------------- |
1643 // |
1681 // |
1644 // --------------------------------------------------------------------------- |
1682 // --------------------------------------------------------------------------- |
1645 // |
1683 // |
1646 |
1684 |
1743 } |
1781 } |
1744 |
1782 |
1745 TSize CMIDInteractiveGauge::MinimumSize() |
1783 TSize CMIDInteractiveGauge::MinimumSize() |
1746 { |
1784 { |
1747 if (!iLabelControl || (iLabelControl->Text()->Length() == 0)) |
1785 if (!iLabelControl || (iLabelControl->Text()->Length() == 0)) |
1748 { // item doesn't have label |
1786 { |
|
1787 // item doesn't have label |
1749 return TSize(FormClientAreaWidth(), iItemheightWithoutLabel); |
1788 return TSize(FormClientAreaWidth(), iItemheightWithoutLabel); |
1750 } |
1789 } |
1751 else // item has label |
1790 else // item has label |
1752 { |
1791 { |
1753 return TSize(FormClientAreaWidth(), iItemheightWithoutLabel + OneLineLabelHeight()); |
1792 return TSize(FormClientAreaWidth(), iItemheightWithoutLabel + OneLineLabelHeight()); |