src/hbwidgets/itemviews/hbindexfeedback_p.cpp
changeset 30 80e4d18b72f5
parent 28 b7da29130b0e
--- a/src/hbwidgets/itemviews/hbindexfeedback_p.cpp	Fri Sep 17 08:32:10 2010 +0300
+++ b/src/hbwidgets/itemviews/hbindexfeedback_p.cpp	Mon Oct 04 00:38:12 2010 +0300
@@ -26,17 +26,19 @@
 #include "hbindexfeedback_p.h"
 #include "hbindexfeedback.h"
 
+#include <hbapplication.h>
 #include <hbscrollbar.h>
 #include <hbabstractitemview.h>
 #include <hbabstractviewitem.h>
 #include <hbstyle.h>
 #include <hbabstractitemcontainer_p.h>
-#include <hbapplication.h>
+#include <hbtextitem.h>
+#include <hbframeitem.h>
+#include <hbframedrawer.h>
 
 #include <hbeffect.h>
 #include <hbeffectinternal_p.h>
 
-#include <hbstyleoptionindexfeedback_p.h>
 #include <hbabstractitemview_p.h>
 
 #include <QTimer>
@@ -144,6 +146,7 @@
 */
 void HbIndexFeedbackPrivate::showIndexFeedback()
 {
+    Q_Q( HbIndexFeedback );
     if (!mItemView 
         || mIndexFeedbackPolicy == HbIndexFeedback::IndexFeedbackNone) {
         return;
@@ -169,7 +172,7 @@
             QString testString = displayText(data);
             if (testString != mPopupContent) {
                 mPopupContent = testString;
-                updatePrimitives();
+                q->updatePrimitives();
             }
 
            if (mTextItem) {
@@ -338,23 +341,6 @@
 }
 
 /*
-    Update the primitives for the index feedback.
-*/
-void HbIndexFeedbackPrivate::updatePrimitives()
-{
-    Q_Q( HbIndexFeedback );
-
-    HbStyleOptionIndexFeedback option;
-    q->initStyleOption(&option);
-    if (mTextItem) {
-        HbStylePrivate::updatePrimitive(mTextItem, HbStylePrivate::P_IndexFeedback_popup_text, &option);
-    }
-    if (mPopupItem) {
-        HbStylePrivate::updatePrimitive(mPopupItem, HbStylePrivate::P_IndexFeedback_popup_background, &option);
-    }
-}
-
-/*
     Create the primitives for the index feedback.
 */
 void HbIndexFeedbackPrivate::createPrimitives()
@@ -364,13 +350,33 @@
     mPopupItemList.clear();
 
     if (!mTextItem) {
-        mTextItem = HbStylePrivate::createPrimitive(HbStylePrivate::P_IndexFeedback_popup_text, q);
+        mTextItem = q->style()->createPrimitive(HbStyle::PT_TextItem, QLatin1String("index-text"), q);
+        mTextItem->setZValue(4);
+
+        HbTextItem *textItem = qobject_cast<HbTextItem*>(mTextItem);
+        if (textItem) {
+            textItem->setAlignment(Qt::AlignCenter);
+            textItem->setTextWrapping(Hb::TextNoWrap);
+        }
+
         mTextItem->hide();
         mPopupItemList.append(mTextItem);
     }
 
     if (!mPopupItem) {
-        mPopupItem = HbStylePrivate::createPrimitive(HbStylePrivate::P_IndexFeedback_popup_background, q);
+        mPopupItem = q->style()->createPrimitive(HbStyle::PT_FrameItem, QLatin1String("index-background"), q);
+        mPopupItem->setZValue(3);
+        HbFrameItem *frameItem = qobject_cast<HbFrameItem*>(mPopupItem);
+        if (frameItem) {
+            HbFrameDrawer &frameDrawer(frameItem->frameDrawer());
+            frameDrawer.setFrameGraphicsName(QLatin1String("qtg_fr_popup_preview"));
+            frameDrawer.setFrameType(HbFrameDrawer::NinePieces);
+
+            qreal cornerPieceSize = 0;
+            q->style()->parameter(QLatin1String("hb-param-background-popup-preview"),cornerPieceSize);
+            frameDrawer.setBorderWidths(cornerPieceSize, cornerPieceSize, cornerPieceSize, cornerPieceSize);
+        }
+
         mPopupItem->hide();
         mPopupItemList.append(mPopupItem);
     }