src/hbwidgets/sliders/hbprogressbar.cpp
changeset 21 4633027730f5
parent 7 923ff622b8b9
--- a/src/hbwidgets/sliders/hbprogressbar.cpp	Tue Jul 06 14:36:53 2010 +0300
+++ b/src/hbwidgets/sliders/hbprogressbar.cpp	Wed Aug 18 10:05:37 2010 +0300
@@ -141,12 +141,10 @@
 {
     Q_Q(HbProgressBar);
 
-    HbStyle *style = qobject_cast<HbStyle*>(q->style());
-    Q_ASSERT(style);
 
-    mFrame = style->createPrimitive(HbStyle::P_ProgressBar_frame,q);
-    mTrack = style->createPrimitive(HbStyle::P_ProgressBar_track,mFrame);
-    mWaitTrack = style->createPrimitive(HbStyle::P_ProgressBar_waittrack,mFrame);    
+    mFrame = HbStylePrivate::createPrimitive(HbStylePrivate::P_ProgressBar_frame,q);
+    mTrack = HbStylePrivate::createPrimitive(HbStylePrivate::P_ProgressBar_track,mFrame);
+    mWaitTrack = HbStylePrivate::createPrimitive(HbStylePrivate::P_ProgressBar_waittrack,mFrame);    
     mWaitTrack->setVisible(false);
 
     if(q->layoutDirection() == Qt::RightToLeft) {
@@ -167,8 +165,8 @@
 {
     Q_Q(HbProgressBar);
 
-    mMinTextItem = q->style()->createPrimitive(HbStyle::P_ProgressBar_mintext,q);
-    mMaxTextItem = q->style()->createPrimitive(HbStyle::P_ProgressBar_maxtext,q);
+    mMinTextItem = HbStylePrivate::createPrimitive(HbStylePrivate::P_ProgressBar_mintext,q);
+    mMaxTextItem = HbStylePrivate::createPrimitive(HbStylePrivate::P_ProgressBar_maxtext,q);
 }
 
 void HbProgressBarPrivate::setProgressValue(int value)
@@ -193,7 +191,7 @@
     HbStyleOptionProgressBar progressBarOption;
     q->initStyleOption(&progressBarOption);
     if(mTrack) {
-        q->style()->updatePrimitive(mTrack, HbStyle::P_ProgressBar_track, &progressBarOption);
+        HbStylePrivate::updatePrimitive(mTrack, HbStylePrivate::P_ProgressBar_track, &progressBarOption);
     }
 
     emit q->valueChanged(value);
@@ -243,12 +241,12 @@
         mWaitTrack->setVisible(true);
         mTrack->setVisible(false);
 
-        q->style()->updatePrimitive(mWaitTrack, HbStyle::P_ProgressBar_waittrack, &progressBarOption);
+        HbStylePrivate::updatePrimitive(mWaitTrack, HbStylePrivate::P_ProgressBar_waittrack, &progressBarOption);
     } else {
         mWaitTrack->setVisible(false);
         mTrack->setVisible(true);
 
-        q->style()->updatePrimitive(mTrack, HbStyle::P_ProgressBar_track, &progressBarOption);
+        HbStylePrivate::updatePrimitive(mTrack, HbStylePrivate::P_ProgressBar_track, &progressBarOption);
     }
     //q->updatePrimitives();
 } 
@@ -460,7 +458,7 @@
         d->mMinText = text;
         HbStyleOptionProgressBar progressBarOption;
         progressBarOption.minText = d->mMinText;
-        style()->updatePrimitive(d->mMinTextItem,HbStyle::P_ProgressBar_mintext,&progressBarOption);
+        HbStylePrivate::updatePrimitive(d->mMinTextItem,HbStylePrivate::P_ProgressBar_mintext,&progressBarOption);
      }
 }
 
@@ -491,7 +489,7 @@
         d->mMaxText = text;
         HbStyleOptionProgressBar progressBarOption;
         progressBarOption.maxText = d->mMaxText;
-        style()->updatePrimitive(d->mMaxTextItem,HbStyle::P_ProgressBar_maxtext,&progressBarOption);
+        HbStylePrivate::updatePrimitive(d->mMaxTextItem,HbStylePrivate::P_ProgressBar_maxtext,&progressBarOption);
     }
 }
 
@@ -529,8 +527,8 @@
     HbStyleOptionProgressBar progressBarOption;
     initStyleOption(&progressBarOption);
 
-    style()->updatePrimitive(d->mMinTextItem,HbStyle::P_ProgressBar_mintext,&progressBarOption);    
-    style()->updatePrimitive(d->mMaxTextItem,HbStyle::P_ProgressBar_maxtext,&progressBarOption); 
+    HbStylePrivate::updatePrimitive(d->mMinTextItem,HbStylePrivate::P_ProgressBar_mintext,&progressBarOption);    
+    HbStylePrivate::updatePrimitive(d->mMaxTextItem,HbStylePrivate::P_ProgressBar_maxtext,&progressBarOption); 
 
             d->mMinTextItem->show();
             d->mMaxTextItem->show();
@@ -635,15 +633,15 @@
     Q_D(const HbProgressBar);
 
     switch (primitive) {
-        case HbStyle::P_ProgressBar_frame:
+        case HbStylePrivate::P_ProgressBar_frame:
             return d->mFrame;
-        case HbStyle::P_ProgressBar_track:
+        case HbStylePrivate::P_ProgressBar_track:
             return d->mTrack;  
-        case HbStyle::P_ProgressBar_waittrack:
+        case HbStylePrivate::P_ProgressBar_waittrack:
             return d->mWaitTrack;
-        case HbStyle::P_ProgressBar_mintext:
+        case HbStylePrivate::P_ProgressBar_mintext:
             return d->mMinTextItem;
-        case HbStyle::P_ProgressBar_maxtext:
+        case HbStylePrivate::P_ProgressBar_maxtext:
             return d->mMaxTextItem;
         default:
             return 0;
@@ -661,23 +659,23 @@
         HbStyleOptionProgressBar progressBarOption;
         initStyleOption(&progressBarOption);
         if (d->mFrame) {
-            style()->updatePrimitive(d->mFrame, HbStyle::P_ProgressBar_frame, &progressBarOption);          
+            HbStylePrivate::updatePrimitive(d->mFrame, HbStylePrivate::P_ProgressBar_frame, &progressBarOption);          
         }
      
         if (d->mTrack) {
-                style()->updatePrimitive(d->mTrack, HbStyle::P_ProgressBar_track, &progressBarOption);
+                HbStylePrivate::updatePrimitive(d->mTrack, HbStylePrivate::P_ProgressBar_track, &progressBarOption);
         }
         
         if (d->mWaitTrack) {
-                style()->updatePrimitive(d->mWaitTrack, HbStyle::P_ProgressBar_waittrack, &progressBarOption);
+                HbStylePrivate::updatePrimitive(d->mWaitTrack, HbStylePrivate::P_ProgressBar_waittrack, &progressBarOption);
         }
         
         if(d->mMinTextItem && d->mMinMaxTextVisible) {
-            style()->updatePrimitive(d->mMinTextItem,HbStyle::P_ProgressBar_mintext,&progressBarOption);    
+            HbStylePrivate::updatePrimitive(d->mMinTextItem,HbStylePrivate::P_ProgressBar_mintext,&progressBarOption);    
         }
 
         if(d->mMaxTextItem && d->mMinMaxTextVisible) {
-            style()->updatePrimitive(d->mMaxTextItem,HbStyle::P_ProgressBar_maxtext,&progressBarOption);    
+            HbStylePrivate::updatePrimitive(d->mMaxTextItem,HbStylePrivate::P_ProgressBar_maxtext,&progressBarOption);    
         }
     }
     HbWidget::updatePrimitives();
@@ -715,7 +713,7 @@
     initStyleOption(&progressBarOption);
     progressBarOption.stopWaitAnimation = true;
     if (d->mWaitTrack) {
-        style()->updatePrimitive(d->mWaitTrack, HbStyle::P_ProgressBar_waittrack, &progressBarOption);
+        HbStylePrivate::updatePrimitive(d->mWaitTrack, HbStylePrivate::P_ProgressBar_waittrack, &progressBarOption);
     }
     event->accept();
 }