javauis/lcdui_akn/lcdui/src/CMIDGaugeItem.cpp
branchRCL_3
changeset 60 6c158198356e
parent 24 0fd27995241b
--- a/javauis/lcdui_akn/lcdui/src/CMIDGaugeItem.cpp	Thu Jul 15 18:31:06 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/src/CMIDGaugeItem.cpp	Thu Aug 19 09:48:13 2010 +0300
@@ -46,6 +46,9 @@
 // using AknsDrawUtils for drawing background
 #include <AknsDrawUtils.h>
 #include <applayout.cdl.h>
+
+// for MAknsControlContext::SupplyMopObject method
+#include <AknsFrameBackgroundControlContext.h>
 // LAF
 #include <aknlayoutscalable_avkon.cdl.h>
 
@@ -98,7 +101,8 @@
 void CMIDGaugeItem::CGaugeTimer::RunL()
 {
     if (!iGauge.iGaugeFrameData)
-    {//if the bitmaps haven't been created it means we are inside an alert,
+    {
+        //if the bitmaps haven't been created it means we are inside an alert,
         //which is using its own bitmaps for the gauge animation.
         //Return without restarting the timer
         return;
@@ -1079,7 +1083,8 @@
 TSize CMIDNonInteractiveGauge::MinimumSize()
 {
     if (!iLabelControl || (iLabelControl->Text()->Length() == 0))
-    { // item doesn't have label
+    {
+        // item doesn't have label
         return TSize(FormClientAreaWidth(), iItemheightWithoutLabel);
     }
     else // item has label
@@ -1639,6 +1644,39 @@
            iBitmapAnimation->BitmapAnimData()->FrameArray().Count() > 0;
 }
 
+TTypeUid::Ptr CMIDNonInteractiveGauge::MopSupplyObject(TTypeUid aId)
+{
+    TTypeUid::Ptr ptr = TTypeUid::Null();
+
+    // When control context is requested we return new correct one.
+    // Default implementation otherwise.
+    if (aId.iUid == MAknsControlContext::ETypeId && iForm && IsFocused())
+    {
+        ptr =  MAknsControlContext::SupplyMopObject(aId, BackgroundControlContext());
+    }
+    else
+    {
+        ptr = CMIDControlItem::MopSupplyObject(aId);
+    }
+    return ptr;
+}
+
+CAknsFrameBackgroundControlContext* CMIDNonInteractiveGauge::BackgroundControlContext()
+{
+    // It tries create new instance of CAknsFrameBackgroundControlContext.
+    // When construction fails, the error is logged.
+    CAknsFrameBackgroundControlContext* context = NULL;
+    TRAPD(err, context = CAknsFrameBackgroundControlContext::NewL(
+                             KAknsIIDQsnFrInput,  Rect(),  Rect(), EFalse));
+    if (err != KErrNone)
+    {
+        DEBUG_INT("CMIDNonInteractiveGauge::BackgroundControlContext -\
+ CAknsFrameBackgroundControlContext::NewL failed with error number %d", err);
+        context = NULL;
+    }
+    return context;
+}
+
 // ---------------------------------------------------------------------------
 //
 // ---------------------------------------------------------------------------
@@ -1745,7 +1783,8 @@
 TSize CMIDInteractiveGauge::MinimumSize()
 {
     if (!iLabelControl || (iLabelControl->Text()->Length() == 0))
-    { // item doesn't have label
+    {
+        // item doesn't have label
         return TSize(FormClientAreaWidth(), iItemheightWithoutLabel);
     }
     else // item has label