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> |
|
52 // LAF |
49 // LAF |
53 #include <aknlayoutscalable_avkon.cdl.h> |
50 #include <aknlayoutscalable_avkon.cdl.h> |
54 |
51 |
55 #include <AknDef.h> // For layout change event definitions |
52 #include <AknDef.h> // For layout change event definitions |
56 |
53 |
99 } |
96 } |
100 |
97 |
101 void CMIDGaugeItem::CGaugeTimer::RunL() |
98 void CMIDGaugeItem::CGaugeTimer::RunL() |
102 { |
99 { |
103 if (!iGauge.iGaugeFrameData) |
100 if (!iGauge.iGaugeFrameData) |
104 { |
101 {//if the bitmaps haven't been created it means we are inside an alert, |
105 //if the bitmaps haven't been created it means we are inside an alert, |
|
106 //which is using its own bitmaps for the gauge animation. |
102 //which is using its own bitmaps for the gauge animation. |
107 //Return without restarting the timer |
103 //Return without restarting the timer |
108 return; |
104 return; |
109 } |
105 } |
110 |
106 |
1081 } |
1077 } |
1082 |
1078 |
1083 TSize CMIDNonInteractiveGauge::MinimumSize() |
1079 TSize CMIDNonInteractiveGauge::MinimumSize() |
1084 { |
1080 { |
1085 if (!iLabelControl || (iLabelControl->Text()->Length() == 0)) |
1081 if (!iLabelControl || (iLabelControl->Text()->Length() == 0)) |
1086 { |
1082 { // item doesn't have label |
1087 // item doesn't have label |
|
1088 return TSize(FormClientAreaWidth(), iItemheightWithoutLabel); |
1083 return TSize(FormClientAreaWidth(), iItemheightWithoutLabel); |
1089 } |
1084 } |
1090 else // item has label |
1085 else // item has label |
1091 { |
1086 { |
1092 return TSize(FormClientAreaWidth(), |
1087 return TSize(FormClientAreaWidth(), |
1642 { |
1637 { |
1643 return iBitmapAnimation && iBitmapAnimation->BitmapAnimData() && |
1638 return iBitmapAnimation && iBitmapAnimation->BitmapAnimData() && |
1644 iBitmapAnimation->BitmapAnimData()->FrameArray().Count() > 0; |
1639 iBitmapAnimation->BitmapAnimData()->FrameArray().Count() > 0; |
1645 } |
1640 } |
1646 |
1641 |
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 |
|
1680 // --------------------------------------------------------------------------- |
1642 // --------------------------------------------------------------------------- |
1681 // |
1643 // |
1682 // --------------------------------------------------------------------------- |
1644 // --------------------------------------------------------------------------- |
1683 // |
1645 // |
1684 |
1646 |
1781 } |
1743 } |
1782 |
1744 |
1783 TSize CMIDInteractiveGauge::MinimumSize() |
1745 TSize CMIDInteractiveGauge::MinimumSize() |
1784 { |
1746 { |
1785 if (!iLabelControl || (iLabelControl->Text()->Length() == 0)) |
1747 if (!iLabelControl || (iLabelControl->Text()->Length() == 0)) |
1786 { |
1748 { // item doesn't have label |
1787 // item doesn't have label |
|
1788 return TSize(FormClientAreaWidth(), iItemheightWithoutLabel); |
1749 return TSize(FormClientAreaWidth(), iItemheightWithoutLabel); |
1789 } |
1750 } |
1790 else // item has label |
1751 else // item has label |
1791 { |
1752 { |
1792 return TSize(FormClientAreaWidth(), iItemheightWithoutLabel + OneLineLabelHeight()); |
1753 return TSize(FormClientAreaWidth(), iItemheightWithoutLabel + OneLineLabelHeight()); |