src/hbcore/style/hbstyle.cpp
changeset 34 ed14f46c0e55
parent 7 923ff622b8b9
equal deleted inserted replaced
31:7516d6d86cf5 34:ed14f46c0e55
    28 #include "hbstyleoptionsliderelement_p.h"
    28 #include "hbstyleoptionsliderelement_p.h"
    29 #include "hbstyleoptionpushbutton_p.h"
    29 #include "hbstyleoptionpushbutton_p.h"
    30 #include "hbstyleoptiontoolbutton_p.h"
    30 #include "hbstyleoptiontoolbutton_p.h"
    31 #include "hbstyleoptiontooltip_p.h"
    31 #include "hbstyleoptiontooltip_p.h"
    32 #include "hbstyleoptionprogressbar_p.h"
    32 #include "hbstyleoptionprogressbar_p.h"
    33 #include "hbstyleoptionabstractviewitem_p.h"
       
    34 #include "hbstyleoptionlistviewitem_p.h"
       
    35 #include "hbstyleoptionmenuitem_p.h"
       
    36 #include "hbstyleoptionlabel_p.h"
    33 #include "hbstyleoptionlabel_p.h"
    37 #include "hbstyleoptionscrollbar_p.h"
       
    38 #include "hbstyleoptiongridviewitem_p.h"
       
    39 #include "hbstyleoptioncheckbox_p.h"
    34 #include "hbstyleoptioncheckbox_p.h"
    40 #include "hbiconloader_p.h"
    35 #include "hbiconloader_p.h"
    41 #include "hbstyleoptiontitlepane_p.h"
    36 #include "hbstyleoptiontitlepane_p.h"
    42 #include "hbstyleoptionstatusbar_p.h"
    37 #include "hbstyleoptionstatusbar_p.h"
    43 #include "hbstyleoptionindicatorgroup_p.h"
    38 #include "hbstyleoptionindicatorgroup_p.h"
    44 #include "hbstyleoptionprogressdialog_p.h"
    39 #include "hbstyleoptionprogressdialog_p.h"
    45 #include "hbstyleoptionnotificationdialog_p.h"
    40 #include "hbstyleoptionnotificationdialog_p.h"
    46 #include "hbstyleoptiontreeviewitem_p.h"
       
    47 #include "hbstyleoptioncolorgridviewitem_p.h"
       
    48 #include "hbstyleoptionmessagebox_p.h"
    41 #include "hbstyleoptionmessagebox_p.h"
    49 #include "hbstyleoptionnavigationbutton_p.h"
    42 #include "hbstyleoptionnavigationbutton_p.h"
    50 #include "hbstyleoptionindicatorbutton_p.h"
    43 #include "hbstyleoptionindicatorbutton_p.h"
    51 #include "hbstyleoptionsignalindicator_p.h"
    44 #include "hbstyleoptionsignalindicator_p.h"
    52 #include "hbstyleoptionbatteryindicator_p.h"
    45 #include "hbstyleoptionbatteryindicator_p.h"
    57 #include "hbstyleoptiondataformviewitem_p.h"
    50 #include "hbstyleoptiondataformviewitem_p.h"
    58 #include "hbstyleoptiondatagroup_p.h"
    51 #include "hbstyleoptiondatagroup_p.h"
    59 #include "hbstyleoptiondatagroupheadingwidget_p.h"
    52 #include "hbstyleoptiondatagroupheadingwidget_p.h"
    60 #include "hbstyleoptiondataform_p.h"
    53 #include "hbstyleoptiondataform_p.h"
    61 #include "hbstyleoptiongroupbox_p.h"
    54 #include "hbstyleoptiongroupbox_p.h"
    62 #include "hbstyleoptionindexfeedback_p.h"
       
    63 #include "hbstyleoptioncombobox_p.h"
    55 #include "hbstyleoptioncombobox_p.h"
    64 #include "hbstyleoptioninputdialog_p.h"
    56 #include "hbstyleoptioninputdialog_p.h"
    65 #include "hbstyleoptionprogresssliderhandle_p.h"
    57 #include "hbstyleoptionprogresssliderhandle_p.h"
    66 #include "hbstyleoptionprogressslider_p.h"
    58 #include "hbstyleoptionprogressslider_p.h"
       
    59 
       
    60 
       
    61 #include <hbstyleprimitivedata.h>
       
    62 #include <hbstyletextprimitivedata.h>
       
    63 #include <hbstylerichtextprimitivedata.h>
       
    64 #include <hbstyleiconprimitivedata.h>
       
    65 #include <hbstyleframeprimitivedata.h>
       
    66 #include <hbstylemarqueeprimitivedata.h>
       
    67 #include <hbstyletouchareaprimitivedata.h>
    67 
    68 
    68 #include <hbicon.h>
    69 #include <hbicon.h>
    69 #include <hbstyle.h>
    70 #include <hbstyle.h>
    70 #include <hbframedrawer.h>
    71 #include <hbframedrawer.h>
    71 #include <hbiconitem.h>
    72 #include <hbiconitem.h>
    72 #include <hbiconitem_p.h>
    73 #include <hbiconitem_p.h>
    73 #include <hbframeitem.h>
    74 #include <hbframeitem.h>
    74 #include <hbframedrawer.h>
    75 #include <hbframedrawer.h>
    75 #include <hbframedrawer_p.h>
    76 #include <hbframedrawer_p.h>
    76 #include <hbframebackground.h>
    77 #include <hbframebackground.h>
    77 #include <hbprogresstrackitem_p.h>
       
    78 #include <hbslidertrackitem_p.h>
    78 #include <hbslidertrackitem_p.h>
    79 #include <hbinstance.h>
    79 #include <hbinstance.h>
    80 #include <hbtextitem.h>
    80 #include <hbtextitem.h>
    81 #include <hbtextitem_p.h>
    81 #include <hbtextitem_p.h>
    82 #include <hbmarqueeitem.h>
    82 #include <hbmarqueeitem.h>
    91 
    91 
    92 #include "hbstyleselector_p.h"
    92 #include "hbstyleselector_p.h"
    93 #include "hblayeredstyleloader_p.h"
    93 #include "hblayeredstyleloader_p.h"
    94 #include "hbwidgetstyleloader_p.h"
    94 #include "hbwidgetstyleloader_p.h"
    95 #include "hbcssparser_p.h"
    95 #include "hbcssparser_p.h"
    96 #include "hbrepeaticonitem_p.h"
       
    97 #include "hbnamespace_p.h"
    96 #include "hbnamespace_p.h"
    98 
       
    99 
    97 
   100 #include "hbanchorlayout.h"
    98 #include "hbanchorlayout.h"
   101 #include <hbanchor.h>
    99 #include <hbanchor.h>
   102 
   100 
   103 #include <QGraphicsWidget>
   101 #include <QGraphicsWidget>
   104 #include <hbwidget.h>
       
   105 #include <hbwidgetbase.h>
   102 #include <hbwidgetbase.h>
   106 #include "hbdeviceprofile.h"
   103 #include "hbdeviceprofile.h"
   107 #include "hbrepeatitem_p.h"
   104 
   108 
   105 
   109 #include <QDebug>
   106 #include <QDebug>
   110 #include <QMetaClassInfo>
   107 #include <QMetaClassInfo>
       
   108 
       
   109 #ifdef HB_TEXT_MEASUREMENT_UTILITY
       
   110 #include "hbinstance_p.h"
       
   111 #include "hbtextmeasurementutility_r.h"
       
   112 #endif
       
   113 
   111 
   114 
   112 Q_DECLARE_METATYPE(QGraphicsLayout*)
   115 Q_DECLARE_METATYPE(QGraphicsLayout*)
   113 
   116 
   114 //Uncomment next define(s) in order to get more debug prints.
   117 //Uncomment next define(s) in order to get more debug prints.
   115 //Similar define exists also in the engine side.
   118 //Similar define exists also in the engine side.
   132     Whenever the widget's state changes in a way that needs changes in drawing the primitive
   135     Whenever the widget's state changes in a way that needs changes in drawing the primitive
   133     (such as button pressed down -> change the button background image) then the widget needs to
   136     (such as button pressed down -> change the button background image) then the widget needs to
   134     call the updatePrimitive method.
   137     call the updatePrimitive method.
   135 
   138 
   136     Generally primitives should be updated only when a state change occurs. When a widget uses primitives to construct
   139     Generally primitives should be updated only when a state change occurs. When a widget uses primitives to construct
   137     itself it does not need a paint() method at all since primitives (widget's children) are doing the drawing. 
   140     itself it does not need a paint() method at all since primitives (widget's children) are doing the drawing.
   138     Painting for the primitives occurs from the graphics scene.
   141     Painting for the primitives occurs from the graphics scene.
   139 
   142 
   140     HbStyle has some caching functionality and thus it should not be instantiated explicitly, but 
   143     HbStyle has some caching functionality and thus it should not be instantiated explicitly, but
   141     accessed only through HbWidget::style() or HbInstance::style() APIs.
   144     accessed only through HbWidget::style() or HbInstance::style() APIs.
   142 
   145 
   143 */
   146 */
   144 
   147 
   145 /*!
       
   146 
       
   147 	    \deprecated P_PushButton_icon
       
   148         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   149 
       
   150 
       
   151         \deprecated P_PushButton_text
       
   152         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   153 
       
   154 
       
   155         \deprecated P_PushButton_additionaltext
       
   156         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   157 
       
   158 
       
   159         \deprecated P_PushButton_background
       
   160         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   161 
       
   162 
       
   163         \deprecated P_PushButton_toucharea
       
   164         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   165 
       
   166 
       
   167         \deprecated P_PushButton_focus
       
   168         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   169 
       
   170 
       
   171         \deprecated P_DataGrou\deprecated P_background
       
   172         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   173 
       
   174 
       
   175         \deprecated P_DataGroupComboBackground
       
   176         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   177 
       
   178 
       
   179         \deprecated P_DataGrou\deprecated P_heading
       
   180         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   181 
       
   182 
       
   183         \deprecated P_DataGrou\deprecated P_description
       
   184         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   185 
       
   186 
       
   187         \deprecated P_DataForm_heading
       
   188         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   189 
       
   190 
       
   191         \deprecated P_DataForm_heading_background
       
   192         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   193 
       
   194 
       
   195         \deprecated P_DataForm_description
       
   196         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   197 
       
   198 
       
   199         \deprecated P_DataGrou\deprecated P_icon
       
   200         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   201 
       
   202 
       
   203         \deprecated P_ToolButton_frame
       
   204         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   205 
       
   206 
       
   207         \deprecated P_ToolButton_text
       
   208         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   209 
       
   210 
       
   211         \deprecated P_ToolButton_icon
       
   212         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   213 
       
   214 
       
   215         \deprecated P_Slider_thumb
       
   216         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   217 
       
   218 
       
   219         \deprecated P_SliderElement_text
       
   220         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   221 
       
   222 
       
   223         \deprecated P_SliderElement_icon
       
   224         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   225 
       
   226 
       
   227         \deprecated P_SliderElement_increase
       
   228         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   229 
       
   230 
       
   231         \deprecated P_SliderElement_decrease
       
   232         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   233 
       
   234 
       
   235         \deprecated P_Slider_groove
       
   236         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   237 
       
   238 
       
   239         \deprecated P_Slider_progressgroove
       
   240         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   241 
       
   242 
       
   243         \deprecated P_ItemViewItem_checkbox
       
   244         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   245 
       
   246 
       
   247         \deprecated P_ItemViewItem_radiobutton
       
   248         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   249 
       
   250 
       
   251         \deprecated P_ItemViewItem_selection
       
   252         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   253 
       
   254 
       
   255         \deprecated P_LineEdit_frame_normal
       
   256         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   257 
       
   258 
       
   259         \deprecated P_LineEdit_frame_highlight
       
   260         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   261 
       
   262 
       
   263         \deprecated P_TextEdit_frame_normal
       
   264         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   265 
       
   266 
       
   267         \deprecated P_TextEdit_frame_highlight
       
   268         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   269 
       
   270 
       
   271         \deprecated P_Edit_text
       
   272         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   273 
       
   274 
       
   275         \deprecated P_Label_text
       
   276         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   277 
       
   278 
       
   279         \deprecated P_Label_icon
       
   280         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   281 
       
   282 
       
   283         \deprecated P_MenuItem_frame
       
   284         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   285 
       
   286 
       
   287         \deprecated P_MenuItem_focus
       
   288         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   289 
       
   290 
       
   291         \deprecated P_MenuItem_text
       
   292         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   293 
       
   294 
       
   295         \deprecated P_MenuItem_submenuindicator
       
   296         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   297 
       
   298 
       
   299         \deprecated P_MenuItem_checkindicator
       
   300         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   301 
       
   302 
       
   303         \deprecated P_MenuItem_separator
       
   304         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   305 
       
   306 
       
   307         \deprecated P_ScrollBar_groove
       
   308         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   309 
       
   310 
       
   311         \deprecated P_ScrollBar_handle
       
   312         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   313 
       
   314 
       
   315         \deprecated P_ScrollBar_toucharea
       
   316         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   317 
       
   318 
       
   319         \deprecated P_Popu\deprecated P_background
       
   320         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   321 
       
   322 
       
   323         \deprecated P_Popu\deprecated P_background_weak
       
   324         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   325 
       
   326 
       
   327         \deprecated P_Popu\deprecated P_heading_frame
       
   328         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   329 
       
   330 
       
   331         \deprecated P_ToolTi\deprecated P_background
       
   332         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   333 
       
   334 
       
   335         \deprecated P_MessageBox_icon
       
   336         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   337 
       
   338 
       
   339         \deprecated P_ItemViewItem_background
       
   340         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   341 
       
   342 
       
   343         \deprecated P_ListViewItem_text
       
   344         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   345 
       
   346 
       
   347         \deprecated P_ListViewItem_richtext
       
   348         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   349 
       
   350 
       
   351         \deprecated P_ListViewItem_icon
       
   352         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   353 
       
   354 
       
   355         \deprecated P_ItemHighlight_background
       
   356         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   357 
       
   358 
       
   359         \deprecated P_ToolBarExtension_background
       
   360         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   361 
       
   362 
       
   363         \deprecated P_GridViewItem_text
       
   364         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   365 
       
   366 
       
   367         \deprecated P_GridViewItem_icon
       
   368         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   369 
       
   370 
       
   371         \deprecated P_CheckBox_text
       
   372         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   373 
       
   374 
       
   375         \deprecated P_CheckBox_icon
       
   376         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   377 
       
   378 
       
   379         \deprecated P_CheckBox_toucharea
       
   380         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   381 
       
   382 
       
   383         \deprecated P_Fade_background
       
   384         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   385 
       
   386 
       
   387         \deprecated P_TitlePane_background
       
   388         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   389 
       
   390 
       
   391         \deprecated P_TitlePane_text
       
   392         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   393 
       
   394 
       
   395         \deprecated P_TitlePane_icon
       
   396         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   397 
       
   398 
       
   399         \deprecated P_TitleBar_toucharea
       
   400         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   401 
       
   402 
       
   403         \deprecated P_IndicatorGrou\deprecated P_background
       
   404         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   405 
       
   406 
       
   407         \deprecated P_IndicatorGrou\deprecated P_signalicon
       
   408         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   409 
       
   410 
       
   411         \deprecated P_IndicatorGrou\deprecated P_batteryicon
       
   412         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   413 
       
   414 
       
   415         \deprecated P_SignalIndicator_icon
       
   416         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   417 
       
   418 
       
   419         \deprecated P_SignalLevel_background
       
   420         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   421 
       
   422 
       
   423         \deprecated P_SignalLevel_icon
       
   424         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   425 
       
   426 
       
   427         \deprecated P_BatteryIndicator_icon
       
   428         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   429 
       
   430 
       
   431         \deprecated P_BatteryLevel_background
       
   432         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   433 
       
   434 
       
   435         \deprecated P_BatteryLevel_icon
       
   436         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   437 
       
   438 
       
   439         \deprecated P_IndicatorGrou\deprecated P_icon1
       
   440         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   441 
       
   442 
       
   443         \deprecated P_IndicatorGrou\deprecated P_icon2
       
   444         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   445 
       
   446 
       
   447         \deprecated P_IndicatorGrou\deprecated P_icon3
       
   448         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   449 
       
   450 
       
   451         \deprecated P_IndicatorGrou\deprecated P_icon4
       
   452         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   453 
       
   454 
       
   455         \deprecated P_ProgressBar_frame
       
   456         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   457 
       
   458 
       
   459         \deprecated P_ProgressBar_track
       
   460         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   461 
       
   462 
       
   463         \deprecated P_ProgressBar_waittrack
       
   464         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   465 
       
   466 
       
   467         \deprecated P_ProgressBar_mintext
       
   468         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   469 
       
   470 
       
   471         \deprecated P_ProgressBar_maxtext
       
   472         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   473 
       
   474 
       
   475         \deprecated P_Softkey_background
       
   476         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   477 
       
   478 
       
   479         \deprecated P_NavigationButton_background
       
   480         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   481 
       
   482 
       
   483         \deprecated P_IndicatorButton_background
       
   484         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   485 
       
   486 
       
   487         \deprecated P_IndicatorButton_handleindication
       
   488         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   489 
       
   490 
       
   491         \deprecated P_ItemViewItem_frame
       
   492         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   493 
       
   494 
       
   495         \deprecated P_SelectionControl_selectionstart
       
   496         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   497 
       
   498 
       
   499         \deprecated P_SelectionControl_selectionend
       
   500         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   501 
       
   502 
       
   503         \deprecated P_TreeViewItem_expandicon
       
   504         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   505 
       
   506 
       
   507         \deprecated P_Label_richtext
       
   508         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   509 
       
   510 
       
   511         \deprecated P_RatingSlider_track
       
   512         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   513 
       
   514 
       
   515         \deprecated P_RatingSlider_frame
       
   516         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   517 
       
   518 
       
   519         \deprecated P_RatingSlider_toucharea
       
   520         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   521 
       
   522 
       
   523 				\deprecated P_ProgressSlider_frame
       
   524         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   525 
       
   526 
       
   527 				\deprecated P_ProgressSlider_track
       
   528         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   529 
       
   530 
       
   531         \deprecated P_ProgressSlider_slidertrack
       
   532         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   533 
       
   534 
       
   535         \deprecated P_ProgressSlider_toucharea
       
   536         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   537 
       
   538 
       
   539         \deprecated P_ProgressSliderHandle_background
       
   540         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   541 
       
   542 
       
   543         \deprecated P_ProgressSliderHandle_icon
       
   544         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   545 
       
   546 
       
   547         \deprecated P_ProgressSliderHandle_toucharea
       
   548         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   549 
       
   550 
       
   551         \deprecated P_RatingSlider_layout
       
   552         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   553 
       
   554 
       
   555         \deprecated P_ScrollArea_continuationbottom
       
   556         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   557 
       
   558 
       
   559         \deprecated P_ScrollArea_continuationtop
       
   560         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   561 
       
   562 
       
   563         \deprecated P_ScrollArea_continuationleft
       
   564         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   565 
       
   566 
       
   567         \deprecated P_ScrollArea_continuationright
       
   568         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   569 
       
   570 
       
   571         \deprecated P_ItemViewItem_focus
       
   572         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   573 
       
   574 
       
   575         \deprecated P_NotificationDialog_icon
       
   576         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   577 
       
   578 
       
   579         \deprecated P_NotificationDialog_text
       
   580         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   581 
       
   582 
       
   583         \deprecated P_NotificationDialog_title
       
   584         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   585 
       
   586 
       
   587         \deprecated P_NotificationDialog_frame
       
   588         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   589 
       
   590 
       
   591         \deprecated P_ComboBox_background
       
   592         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   593 
       
   594 
       
   595         \deprecated P_ComboBoxPopu\deprecated P_background
       
   596         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   597 
       
   598 
       
   599         \deprecated P_ComboBoxButton_toucharea
       
   600         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   601 
       
   602 
       
   603         \deprecated P_ComboBox_text
       
   604         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   605 
       
   606 
       
   607         \deprecated P_DataItem_background
       
   608         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   609 
       
   610 
       
   611         \deprecated P_DataItem_separator
       
   612         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   613 
       
   614 
       
   615         \deprecated P_ColorGridViewItem_colorIcon
       
   616         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   617 
       
   618 
       
   619         \deprecated P_ColorGridViewItem_borderIcon
       
   620         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   621 
       
   622 
       
   623         \deprecated P_ColorGridViewItem_checkIcon
       
   624         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   625 
       
   626 
       
   627         \deprecated P_ComboBox_button
       
   628         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   629 
       
   630 
       
   631         \deprecated P_ProgressDialog_icon
       
   632         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   633 
       
   634 
       
   635         \deprecated P_ProgressDialog_text
       
   636         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   637 
       
   638 
       
   639         \deprecated P_DataItem_label
       
   640         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   641 
       
   642 
       
   643         \deprecated P_DataItem_description
       
   644         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   645 
       
   646 
       
   647         \deprecated P_SliderElement_touchincrease
       
   648         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   649 
       
   650 
       
   651         \deprecated P_SliderElement_touchdecrease
       
   652         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   653 
       
   654 
       
   655         \deprecated P_SliderElement_touchhandle
       
   656         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   657 
       
   658 
       
   659         \deprecated P_SliderElement_touchgroove
       
   660         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   661 
       
   662 
       
   663         \deprecated P_SliderTickMark_majoricon
       
   664         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   665 
       
   666 
       
   667         \deprecated P_SliderTickMark_minoricon
       
   668         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   669 
       
   670 
       
   671         \deprecated P_SliderTickMark_majorlabel
       
   672         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   673 
       
   674 
       
   675         \deprecated P_SliderTickMark_minorlabel
       
   676         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   677 
       
   678 
       
   679         \deprecated P_QueryInputMode_image
       
   680         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   681 
       
   682 
       
   683         \deprecated P_GroupBoxHeading_icon
       
   684         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   685 
       
   686 
       
   687         \deprecated P_GroupBoxHeading_text
       
   688         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   689 
       
   690 
       
   691         \deprecated P_GroupBoxMarquee_text
       
   692         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   693 
       
   694 
       
   695         \deprecated P_GroupBoxHeading_background
       
   696         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   697 
       
   698 
       
   699         \deprecated P_GroupBoxContent_background
       
   700         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   701 
       
   702 
       
   703         \deprecated P_DataItem_icon
       
   704         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   705 
       
   706 
       
   707         \deprecated P_ItemViewItem_touchmultiselection
       
   708         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   709 
       
   710 
       
   711         \deprecated P_TumbleView_background
       
   712         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   713 
       
   714 
       
   715         \deprecated P_TumbleView_frame
       
   716         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   717 
       
   718 
       
   719         \deprecated P_TumbleView_highlight
       
   720         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   721 
       
   722 
       
   723         \deprecated P_DateTimePicker_background
       
   724         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   725 
       
   726 
       
   727         \deprecated P_DateTimePicker_frame
       
   728         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   729 
       
   730 
       
   731         \deprecated P_DateTimePicker_separator
       
   732         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   733 
       
   734 
       
   735         \deprecated P_IndexFeedback_popu\deprecated P_text
       
   736         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   737 
       
   738 
       
   739         \deprecated P_IndexFeedback_popu\deprecated P_background
       
   740         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   741 
       
   742 
       
   743         \deprecated P_SliderPopu\deprecated P_background
       
   744         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   745 
       
   746 
       
   747         \deprecated P_StatusBar_background
       
   748         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   749 
       
   750 
       
   751         \deprecated P_StatusBar_timetext
       
   752         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   753 
       
   754 
       
   755         \deprecated P_InputDialog_text
       
   756         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   757 
       
   758 
       
   759         \deprecated P_InputDialog_additionaltext
       
   760         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   761 
       
   762 
       
   763         \deprecated P_ProgressSlider_toucharea
       
   764         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   765 
       
   766 
       
   767         \deprecated P_ProgressSlider_track
       
   768         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   769 
       
   770 
       
   771         \deprecated P_ProgressSliderHandle_icon
       
   772         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   773 
       
   774 
       
   775         \deprecated P_InputDialog_additionaltext
       
   776         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   777 
       
   778 
       
   779         \deprecated P_MessageBox_text
       
   780         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   781 
       
   782 
       
   783         \deprecated P_ProgressSlider_handle
       
   784         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   785 
       
   786 
       
   787         \deprecated P_ProgressBar_text
       
   788         is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString).
       
   789 */
       
   790 
       
   791 // TODO: margins should be defined in layout data once layout specification exists.
   148 // TODO: margins should be defined in layout data once layout specification exists.
   792 static const int ItemName = 0xfffe;
       
   793 static const QString STYLE_LOCATION = QLatin1String(":/themes/style/hbdefault/rules/widgets/%w/%w");
   149 static const QString STYLE_LOCATION = QLatin1String(":/themes/style/hbdefault/rules/widgets/%w/%w");
   794 static const QString COLOR_STYLE_LOCATION = QLatin1String(":/themes/style/hbdefault/rules/widgets/%w/%w_color");
   150 static const QString COLOR_STYLE_LOCATION = QLatin1String(":/themes/style/hbdefault/rules/widgets/%w/%w_color.css");
   795 static const int TOUCHAREA_ZVALUE = 1000;
   151 static const int TOUCHAREA_ZVALUE = 1000;
   796 
   152 
   797 static const QString GLOBAL_PARAMETERS_LOCATION = QLatin1String(":/themes/style/hbdefault/variables/layout/zoom/0/hbglobalparameters.css");
   153 static const QString GLOBAL_PARAMETERS_LOCATION = QLatin1String(":/themes/style/hbdefault/variables/layout/zoom/0/hbglobalparameters.css");
   798 
   154 
   799 static const char* LAYOUT_PTR_PROPERTY = "HbStyle_layout_ptr";
   155 static const char* LAYOUT_PTR_PROPERTY = "HbStyle_layout_ptr";
   820         }
   176         }
   821     }
   177     }
   822 }
   178 }
   823 
   179 
   824 /*!
   180 /*!
   825 Constructor
   181   Must not be called explicitly. Use HbWidget::style() or HbInstance::style() instead.
   826 
   182 
   827 Should not be called explicitly. Use HbWidget::style() or HbInstance::style() instead.
   183   \deprecated HbStyle::HbStyle()
       
   184         is deprecated. Use HbWidget::style() or HbInstance::style() instead.
   828 */
   185 */
   829 HbStyle::HbStyle() :
   186 HbStyle::HbStyle() :
   830     d_ptr(new HbStylePrivate)
   187     d_ptr(new HbStylePrivate)
   831 {
   188 {
   832     Q_D( HbStyle );
   189     Q_D( HbStyle );
   838 */
   195 */
   839 HbStyle::~HbStyle()
   196 HbStyle::~HbStyle()
   840 {
   197 {
   841     delete d_ptr;
   198     delete d_ptr;
   842 }
   199 }
   843 
       
   844 
       
   845 /*!
   200 /*!
   846 
   201    Instantiates widget building blocks. The building blocks are called "primitives" and their main function is to perform the painting (e.g. drawing text).
   847   \deprecated HbStyle::createPrimitive(HbStyle::Primitive, QGraphicsItem*)
   202    A set of base primitives are defined in HbStyle::BasePrimitive enumeration. A widget calling this method should not cast the returned QGraphicsObject
   848   is deprecated. This method will be replaced with an altered version which will use new base primitive enumerations.
   203    to the actual primitive object. By following this rule the styling mechanism can be used to change the actual primitive instance to something else than the original one 
   849 
   204    instantiated by the createPrimitive() method. This enables customizing the painting of the UI without touching the widget code.
   850   Creates instances of primitive graphics items. This method should be used by all widgets that support styling.
   205       
   851   When changing the style the returned primitives can be replaced with an altered version of the primitives, or with a completely
   206    Updating of a primitive's state is done by using HbStyle::updatePrimitive() method which uses the style primitive data classes (comparable to
   852   different primitive, to create a custom appearance. This shouldn't cause changes to the widget if the functional design
   207    Qt styleoptions) to get the state information needed for the primitive updating.
   853   remains the same.
   208 
   854 
   209     \param primitiveType enumeration of the base primitive
   855   This method returns HbWidgetBase objects. A widget can store the returned items as HbWidgetBase. If a widget
   210     \param itemName string which identifies a primitive in the widget (e.g. "background", or "text"). The item name matches with primitive names in widget's CSS file.
   856   does not require any functionality from HbWidgetBase then it should store the primitives as QGraphicsItems.
   211     \param parent parent for the primitive, although the default is 0 usually the widget is given as a parent for the primitive
   857 
   212     \return QGraphicsObject, the returned primitive should be stored as a QGraphicsObject on the widget side
   858   \note This method is used to replace the conventional Qt-style paint indirection via drawPrimitive.
   213     \sa HbStyle::updatePrimitive()
   859   \sa HbStyle::updatePrimitive method which is to be used in conjunction with this method
   214     \sa HbStylePrimitiveData
   860   \sa HbWidgetBase
   215     \sa HbStyleTextPrimitiveData
   861   \param primitive, to identify the primitive to create
   216     \sa HbStyleFramePrimitiveData
   862   \param parent of the item
   217     \sa HbStyleIconPrimitiveData
   863   \return HbWidgetBase is returned.
   218     \sa HbStyleRichTextPrimitiveData
       
   219     \sa HbStyleMarqueePrimitiveData
       
   220     \sa HbStyleTouchAreaPrimitiveData
   864 
   221 
   865  */
   222  */
   866 QGraphicsItem *HbStyle::createPrimitive( HbStyle::Primitive primitive, QGraphicsItem *parent ) const
   223 QGraphicsObject *HbStyle::createPrimitive(HbStyle::PrimitiveType primitiveType, const QString &itemName, QGraphicsObject *parent) const
   867 {
   224 {
   868 
   225     QGraphicsObject *bp;
       
   226 
       
   227     switch (primitiveType) {
       
   228     case PT_TextItem:
       
   229         bp = new HbTextItem(parent);
       
   230         break;
       
   231     case PT_RichTextItem:
       
   232         bp = new HbRichTextItem(parent);
       
   233         break;
       
   234     case PT_FrameItem:
       
   235         bp = new HbFrameItem(parent);
       
   236         break;
       
   237     case PT_IconItem:
       
   238         bp = new HbIconItem(parent);
       
   239         break;
       
   240     case PT_MarqueeItem:
       
   241         bp = new HbMarqueeItem(parent);
       
   242         break;
       
   243     case PT_TouchArea:
       
   244         bp = new HbTouchArea(parent);
       
   245         break;
       
   246     default:
       
   247         bp = 0;
       
   248     }
       
   249 
       
   250     if (bp != 0) {
       
   251         setItemName(bp, itemName);
       
   252     }
       
   253 
       
   254     return bp;
       
   255 }
       
   256 
       
   257 /*!
       
   258     This method is called by Hb widgets whenever there's a widget state change that results to a change in primitive's state.
       
   259     For example if a button's text changes the button widget needs to update the button's text primitive by calling this method.
       
   260     
       
   261     Widgets need to use the HbStylePrimitiveData-derived classes to carry the primitive state information from the widget to the style.
       
   262     These data classes enable the widget to set the primitives' state information without directly using the primitive APIs. 
       
   263 
       
   264     Note that the updating of the primitive attributes is optimized so that if just one value from the primitive data set is updated only that one
       
   265     value will be updated to the primitive on the style side. The values on primitive data classes are stored by using HbStyleValue templated class
       
   266     which keeps track of whether a primitive data value was assigned or not. On the style side before calling the primitive API the HbStyleValue's
       
   267     isSet()-method is called first to check if the widget did assign the primitive data value.
       
   268 
       
   269 
       
   270     \param primitive the primitive to be updated
       
   271     \param data primitive data needed for updating the primitive
       
   272     \param parent optionally the parent can be given
       
   273     \return bool, true if correct primitive type was found from the style, false if not.
       
   274     \sa HbStyle::createPrimitive()
       
   275     \sa HbStylePrimitiveData
       
   276     \sa HbStyleTextPrimitiveData
       
   277     \sa HbStyleFramePrimitiveData
       
   278     \sa HbStyleIconPrimitiveData
       
   279     \sa HbStyleRichTextPrimitiveData
       
   280     \sa HbStyleMarqueePrimitiveData
       
   281     \sa HbStyleTouchAreaPrimitiveData
       
   282  */
       
   283 bool HbStyle::updatePrimitive(QGraphicsObject *primitive, const HbStylePrimitiveData *data, QGraphicsObject *parent) const
       
   284 {
       
   285     Q_UNUSED(parent);
       
   286     bool ret = false;
       
   287 
       
   288     if (HbTextItem *textItem = qgraphicsitem_cast<HbTextItem*>(primitive)) {
       
   289         const HbStyleTextPrimitiveData *td = hbstyleprimitivedata_cast<const HbStyleTextPrimitiveData*>(data);
       
   290         if (td->text.isSet())
       
   291             textItem->setText(td->text);
       
   292         if (td->textColor.isSet())
       
   293             textItem->setTextColor(td->textColor);
       
   294         if (td->alignment.isSet())
       
   295             textItem->setAlignment(td->alignment);
       
   296         if (td->elideMode.isSet())
       
   297             textItem->setElideMode(td->elideMode);
       
   298         if (td->textWrapping.isSet())
       
   299             textItem->setTextWrapping(td->textWrapping);
       
   300         if (td->isTextVisible.isSet())
       
   301             textItem->setTextVisible(td->isTextVisible);
       
   302         if (td->isTextClip.isSet())
       
   303             textItem->setTextClip(td->isTextClip);
       
   304         if (td->geometry.isSet())
       
   305             textItem->setGeometry(td->geometry);
       
   306         if (td->fadeLengths.isSet())
       
   307             textItem->setFadeLengths(td->fadeLengths);
       
   308         if (td->minimumLines.isSet())
       
   309             textItem->setMinimumLines(td->minimumLines);
       
   310         if (td->maximumLines.isSet())
       
   311             textItem->setMaximumLines(td->maximumLines);
       
   312         if (td->fontSpec.isSet())
       
   313             textItem->setFontSpec(td->fontSpec);
       
   314         ret = true;
       
   315 
       
   316     } else if (HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(primitive)) {
       
   317         const HbStyleIconPrimitiveData *id = hbstyleprimitivedata_cast<const HbStyleIconPrimitiveData*>(data);
       
   318         if (id->icon.isSet())
       
   319             iconItem->setIcon(id->icon);
       
   320         if (id->size.isSet())
       
   321             iconItem->setSize(id->size);
       
   322         if (id->aspectRatioMode.isSet())
       
   323             iconItem->setAspectRatioMode(id->aspectRatioMode);
       
   324         if (id->alignment.isSet())
       
   325             iconItem->setAlignment(id->alignment);
       
   326         if (id->iconMode.isSet())
       
   327             iconItem->setMode(id->iconMode);
       
   328         if (id->iconState.isSet())
       
   329             iconItem->setState(id->iconState);
       
   330         if (id->iconName.isSet())
       
   331             iconItem->setIconName(id->iconName);
       
   332         if (id->iconFlags.isSet())
       
   333             iconItem->setFlags(id->iconFlags);
       
   334         if (id->mirroringMode.isSet())
       
   335             iconItem->setMirroringMode(id->mirroringMode);
       
   336         if (id->brush.isSet())
       
   337             iconItem->setBrush(id->brush);
       
   338         if (id->color.isSet())
       
   339             iconItem->setColor(id->color);
       
   340         ret = true;
       
   341 
       
   342     } else if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(primitive)) {
       
   343         const HbStyleFramePrimitiveData *fd =  hbstyleprimitivedata_cast<const HbStyleFramePrimitiveData*>(data);
       
   344         HbFrameDrawer *drawer = &(frameItem->frameDrawer()); 
       
   345         if (fd->frameGraphicsName.isSet())
       
   346             drawer->setFrameGraphicsName(fd->frameGraphicsName);
       
   347         if (fd->frameType.isSet())
       
   348             drawer->setFrameType(fd->frameType);
       
   349         if (fd->borderWidthLeft.isSet() || fd->borderWidthRight.isSet() || fd->borderWidthBottom.isSet() || fd->borderWidthTop.isSet())
       
   350             drawer->setBorderWidths(fd->borderWidthLeft, fd->borderWidthTop, fd->borderWidthRight, fd->borderWidthBottom);  
       
   351         if (fd->fillWholeRect.isSet())
       
   352             drawer->setFillWholeRect(fd->fillWholeRect);       
       
   353         if (fd->mirroringMode.isSet())
       
   354             drawer->setMirroringMode(fd->mirroringMode);
       
   355         if (fd->fileNameSuffixList.isSet())
       
   356             drawer->setFileNameSuffixList(fd->fileNameSuffixList);
       
   357         if (fd->pixmapMask.isSet())
       
   358             drawer->setMask(fd->pixmapMask);
       
   359         if (fd->bitmapMask.isSet())
       
   360             drawer->setMask(fd->bitmapMask); 
       
   361         frameItem->setFrameDrawer(drawer);
       
   362         ret = true;
       
   363 
       
   364     } else if (HbMarqueeItem *marqueeItem = qgraphicsitem_cast<HbMarqueeItem*>(primitive)) {
       
   365          const HbStyleMarqueePrimitiveData *md =  hbstyleprimitivedata_cast<const HbStyleMarqueePrimitiveData*>(data);
       
   366          if (md->text.isSet())
       
   367              marqueeItem->setText(md->text);
       
   368          if (md->textColor.isSet())
       
   369              marqueeItem->setTextColor(md->textColor);
       
   370          if (md->animation.isSet()) {
       
   371              if (md->animation)
       
   372                  marqueeItem->startAnimation();
       
   373              else 
       
   374                  marqueeItem->stopAnimation();
       
   375          }
       
   376          if (md->loopCount.isSet())
       
   377              marqueeItem->setLoopCount(md->loopCount);
       
   378         ret = true;
       
   379 
       
   380     } else if (HbTouchArea *touchArea = qgraphicsitem_cast<HbTouchArea*>(primitive)) {
       
   381         const HbStyleTouchAreaPrimitiveData *td =  hbstyleprimitivedata_cast<const HbStyleTouchAreaPrimitiveData*>(data);
       
   382         if (td->size.isSet())
       
   383             touchArea->setSize(td->size);
       
   384         if (td->geometry.isSet())
       
   385             touchArea->setGeometry(td->geometry);
       
   386         ret = true;
       
   387 
       
   388     } else if (HbRichTextItem *richTextItem = qgraphicsitem_cast<HbRichTextItem*>(primitive)) {
       
   389         const HbStyleRichTextPrimitiveData *rd =  hbstyleprimitivedata_cast<const HbStyleRichTextPrimitiveData*>(data);
       
   390         if (rd->text.isSet())
       
   391             richTextItem->setText(rd->text);
       
   392         if (rd->defaultColor.isSet())
       
   393             richTextItem->setTextDefaultColor(rd->defaultColor);
       
   394         if (rd->alignment.isSet())
       
   395             richTextItem->setAlignment(rd->alignment);
       
   396         if (rd->textWrappingMode.isSet())
       
   397             richTextItem->setTextWrapping(rd->textWrappingMode);
       
   398         if (rd->isTextVisible.isSet())
       
   399             richTextItem->setTextVisible(rd->isTextVisible);
       
   400         if (rd->clipping.isSet())
       
   401             richTextItem->setTextClip(rd->clipping);
       
   402         if (rd->geometry.isSet())
       
   403             richTextItem->setGeometry(rd->geometry);
       
   404         ret = true;
       
   405     }
       
   406 
       
   407     if (ret) {
       
   408         if (data->geometry.isSet() 
       
   409             && primitive->isWidget()) {
       
   410             static_cast<QGraphicsWidget*>(primitive)->setGeometry(data->geometry);
       
   411         }
       
   412     }
       
   413 
       
   414     return ret;
       
   415 }
       
   416 
       
   417 
       
   418 QGraphicsItem *HbStylePrivate::createPrimitive( HbStylePrivate::Primitive primitive, QGraphicsItem *parent )
       
   419 {
       
   420         
   869         switch (primitive){
   421         switch (primitive){
   870             case P_MenuItem_submenuindicator:
       
   871                 {
       
   872                 HbIconItem *item = new HbIconItem(parent);
       
   873                 setItemName(item, QLatin1String("submenu-indicator"));
       
   874                 return item;
       
   875                 }
       
   876 
       
   877             case P_MenuItem_checkindicator:
       
   878                 {
       
   879                 HbIconItem *item = new HbIconItem(parent);
       
   880                 setItemName(item, QLatin1String("check-indicator"));
       
   881                 return item;
       
   882                 }
       
   883 
       
   884             case P_MenuItem_separator:
       
   885                 {
       
   886                 HbIconItem *item = new HbIconItem(parent);
       
   887                 setItemName(item, QLatin1String("separator"));
       
   888                 return item;
       
   889                 }
       
   890             case P_ToolButton_icon:
   422             case P_ToolButton_icon:
   891             case P_PushButton_icon:
   423             case P_PushButton_icon:
   892             case P_ProgressDialog_icon: {
   424             case P_ProgressDialog_icon: {
   893                 HbIconItem *iconItem = new HbIconItem(HbIcon(),parent);
   425                 HbIconItem *iconItem = new HbIconItem(HbIcon(),parent);
   894                 setItemName(iconItem, QLatin1String("icon"));
   426                 HbStyle::setItemName(iconItem, QLatin1String("icon"));
   895                 return iconItem;
   427                 return iconItem;
   896                 }
   428                 }
   897 
   429 
   898             case P_CheckBox_icon:
   430             case P_CheckBox_icon:
   899             case P_GroupBoxHeading_icon:
   431             case P_GroupBoxHeading_icon:
   900             case P_Label_icon:
   432             case P_Label_icon: {
       
   433                 HbIconItem *item = q_check_ptr(new HbIconItem(HbIcon(),parent));
       
   434                 HbStyle::setItemName(item, QLatin1String("icon"));
       
   435                 return item;
       
   436                 }
   901             case P_GridViewItem_icon: {
   437             case P_GridViewItem_icon: {
   902                 HbIconItem *item = q_check_ptr(new HbIconItem(HbIcon(),parent));
   438                 Q_ASSERT_X(false, "HbStyle" , "P_GridViewItem_icon no more supported. Use refactored styling");
   903                 setItemName(item, QLatin1String("icon"));
   439                 return 0;
   904                 return item;
   440             }
   905                 }
       
   906             case P_DataGroup_icon:
   441             case P_DataGroup_icon:
   907                 {
   442                 {
   908                 HbIconItem *item = new HbIconItem(HbIcon(), parent);
   443                 HbIconItem *item = new HbIconItem(HbIcon(), parent);
   909                 setItemName(item, QLatin1String("dataGroup_Icon"));
   444                 HbStyle::setItemName(item, QLatin1String("dataGroup_Icon"));
   910                 return item;
   445                 return item;
   911                 }
   446                 }
   912             case P_DataItem_icon:
   447             case P_DataItem_icon:
   913                 {
   448                 {
   914                 HbIconItem *item = new HbIconItem(HbIcon(), parent);
   449                 HbIconItem *item = new HbIconItem(HbIcon(), parent);
   915                 setItemName(item, QLatin1String("dataItem_Icon"));
   450                 HbStyle::setItemName(item, QLatin1String("dataItem_Icon"));
   916                 return item;
   451                 return item;
   917                 }
   452                 }
   918             case P_ComboBox_text:
   453             case P_ComboBox_text:
   919                 {
   454                 {
   920                     HbTextItem *textItem = new HbTextItem(parent);
   455                     HbTextItem *textItem = new HbTextItem(parent);
   921                     setItemName(textItem, QLatin1String("combobox_labelfield"));
   456                     HbStyle::setItemName(textItem, QLatin1String("combobox_labelfield"));
   922                     return  textItem;
   457                     return  textItem;
   923                 }
   458                 }
   924             case P_ToolButton_text:
   459             case P_ToolButton_text:
   925             case P_CheckBox_text:
   460             case P_CheckBox_text:
   926             case P_ProgressDialog_text:
   461             case P_ProgressDialog_text:
   927                 {
   462                 {
   928                     HbTextItem *textItem = new HbTextItem(parent);
   463                     HbTextItem *textItem = new HbTextItem(parent);
   929                     setItemName(textItem, QLatin1String("text"));
   464                     HbStyle::setItemName(textItem, QLatin1String("text"));
       
   465                     textItem->setTextWrapping(Hb::TextWordWrap);
   930                     return  textItem;
   466                     return  textItem;
   931                 }
   467                 }
   932             case P_PushButton_text:
   468             case P_PushButton_text:
   933                 {
   469                 {
   934                 HbTextItem *ti = new HbTextItem(parent);
   470                 HbTextItem *ti = new HbTextItem(parent);
   935                 setItemName(ti, QLatin1String("text"));
   471                 HbStyle::setItemName(ti, QLatin1String("text"));
   936                 return  ti;
   472                 return  ti;
   937                 }
   473                 }
   938             case P_DataGroup_heading:
   474             case P_DataGroup_heading:
   939                 {
   475                 {
   940                 HbTextItem *ti = new HbTextItem(parent);
   476                 HbTextItem *ti = new HbTextItem(parent);
   941                 setItemName(ti, QLatin1String("dataGroup_HeadingLabel"));
   477                 HbStyle::setItemName(ti, QLatin1String("dataGroup_HeadingLabel"));
   942                 return  ti;
   478                 return  ti;
   943                 }
   479                 }
   944             case P_DataGroup_description:
   480             case P_DataGroup_description:
   945                 {
   481                 {
   946                 HbTextItem *ti = new HbTextItem(parent);
   482                 HbTextItem *ti = new HbTextItem(parent);
   947                 setItemName(ti, QLatin1String("dataGroup_Description"));
   483                 HbStyle::setItemName(ti, QLatin1String("dataGroup_Description"));
   948                 return  ti;
   484                 return  ti;
   949                 }
   485                 }
   950             case P_DataForm_heading:
   486             case P_DataForm_heading:
   951                 {
   487                 {
   952                 HbTextItem *ti = new HbTextItem(parent);
   488                 HbTextItem *ti = new HbTextItem(parent);
   953                 setItemName(ti, QLatin1String("dataForm_Heading"));
   489                 HbStyle::setItemName(ti, QLatin1String("dataForm_Heading"));
   954                 //ti->setZValue(2);
   490                 //ti->setZValue(2);
   955                 return  ti;
   491                 return  ti;
   956                 }
   492                 }
   957             case P_DataForm_description:
   493             case P_DataForm_description:
   958                 {
   494                 {
   959                 HbTextItem *ti = new HbTextItem(parent);
   495                 HbTextItem *ti = new HbTextItem(parent);
   960                 setItemName(ti, QLatin1String("dataForm_Desc"));
   496                 HbStyle::setItemName(ti, QLatin1String("dataForm_Desc"));
   961                 return  ti;
   497                 return  ti;
   962                 }
   498                 }
   963             case P_PushButton_additionaltext:
   499             case P_PushButton_additionaltext:
   964                 {
   500                 {
   965                 HbTextItem *ti = new HbTextItem(parent);
   501                 HbTextItem *ti = new HbTextItem(parent);
   966                 setItemName(ti, QLatin1String("additional-text"));
   502                 HbStyle::setItemName(ti, QLatin1String("additional-text"));
   967                 return  ti;
   503                 return  ti;
   968                 }
   504                 }
       
   505 
   969             case P_ProgressSlider_toucharea:
   506             case P_ProgressSlider_toucharea:
   970                 {
   507                 return 0;
   971                 HbTouchArea *ta = new HbTouchArea(parent);
       
   972                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
       
   973                 setItemName(ta, QLatin1String("toucharea"));
       
   974                 ta->setZValue(TOUCHAREA_ZVALUE);
       
   975                 return ta;
       
   976                 }
       
   977             case P_ProgressSliderHandle_toucharea:
   508             case P_ProgressSliderHandle_toucharea:
   978                 {
   509                 return 0;
   979                 HbTouchArea *ta = new HbTouchArea(parent);
       
   980                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
       
   981                 setItemName(ta, QLatin1String("toucharea"));
       
   982                 ta->setZValue(TOUCHAREA_ZVALUE);
       
   983                 if(parent){
       
   984                     parent->setFiltersChildEvents(true);
       
   985                 }
       
   986                 return ta;
       
   987                 }
       
   988 
   510 
   989             case P_ProgressSliderHandle_icon:
   511             case P_ProgressSliderHandle_icon:
   990                 {
   512                 {
   991                 HbIconItem *item = new HbIconItem(QLatin1String("qtg_graf_progslider_handle_normal"), parent);
   513                 HbIconItem *item = new HbIconItem(QLatin1String("qtg_graf_progslider_handle_normal"), parent);
   992                 item->setAspectRatioMode(Qt::IgnoreAspectRatio);
   514                 item->setAspectRatioMode(Qt::IgnoreAspectRatio);
   997             case P_RatingSlider_toucharea:
   519             case P_RatingSlider_toucharea:
   998             case P_SliderElement_touchhandle:
   520             case P_SliderElement_touchhandle:
   999                 {
   521                 {
  1000                 HbTouchArea *ta = new HbTouchArea(parent);
   522                 HbTouchArea *ta = new HbTouchArea(parent);
  1001                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
   523                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
  1002                 setItemName(ta, QLatin1String("toucharea"));
   524                 HbStyle::setItemName(ta, QLatin1String("toucharea"));
  1003                 if(parent){
   525                 if(parent){
  1004                     parent->setFiltersChildEvents(true);
   526                     parent->setFiltersChildEvents(true);
  1005                 }
   527                 }
  1006                 return ta;
       
  1007                 }
       
  1008             case P_ScrollBar_toucharea:
       
  1009                 {
       
  1010                 HbTouchArea *ta = new HbTouchArea(parent);
       
  1011                 ta->setFlags(QGraphicsItem::ItemIsFocusable);
       
  1012                 setItemName(ta, QLatin1String("toucharea"));
       
  1013                 // NOTE:: This is a temporary fix
       
  1014                 //if(parent){
       
  1015                 //    parent->setHandlesChildEvents(true);
       
  1016                 //}
       
  1017                 return ta;
   528                 return ta;
  1018                 }
   529                 }
  1019             case P_ComboBoxButton_toucharea:
   530             case P_ComboBoxButton_toucharea:
  1020                 {
   531                 {
  1021                 HbTouchArea *ta = new HbTouchArea(parent);
   532                 HbTouchArea *ta = new HbTouchArea(parent);
  1022                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
   533                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
  1023                 setItemName(ta, QLatin1String("combobox_button_toucharea"));
   534                 HbStyle::setItemName(ta, QLatin1String("combobox_button_toucharea"));
  1024                 if(parent){
   535                 if(parent){
  1025                     parent->setFiltersChildEvents(true);
   536                     parent->setFiltersChildEvents(true);
  1026                 }
   537                 }
  1027                 return ta;
   538                 return ta;
  1028                 }
   539                 }
  1029              case P_TitleBar_toucharea: 
   540              case P_TitleBar_toucharea:
  1030                 {
   541                 {
  1031                 HbTouchArea *ta = new HbTouchArea(parent);
   542                 HbTouchArea *ta = new HbTouchArea(parent);
  1032                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
   543                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
  1033                 setItemName(ta, QLatin1String("toucharea"));
   544                 ta->grabGesture(Qt::SwipeGesture);
       
   545                 HbStyle::setItemName(ta, QLatin1String("toucharea"));
  1034                 return ta;
   546                 return ta;
  1035                 }
   547                 }
  1036              case P_IndicatorButton_toucharea:
   548              case P_IndicatorButton_toucharea:
  1037              case P_TitlePane_toucharea:
       
  1038              case P_NavigationButton_toucharea:
   549              case P_NavigationButton_toucharea:
  1039                 {
   550                 {
  1040                 HbTouchArea *ta = new HbTouchArea(parent);
   551                 HbTouchArea *ta = new HbTouchArea(parent);
  1041                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
   552                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
  1042                 setItemName(ta, QLatin1String("toucharea"));
   553                 ta->grabGesture(Qt::TapGesture);
       
   554                 HbStyle::setItemName(ta, QLatin1String("toucharea"));
       
   555                 if (parent){
       
   556                     parent->setHandlesChildEvents(true);
       
   557                 }
       
   558                 return ta;
       
   559                 }
       
   560              case P_TitlePane_toucharea:
       
   561                 {
       
   562                 HbTouchArea *ta = new HbTouchArea(parent);
       
   563                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
       
   564                 ta->grabGesture(Qt::TapGesture);
       
   565                 ta->grabGesture(Qt::SwipeGesture);
       
   566                 ta->grabGesture(Qt::PanGesture);
       
   567                 HbStyle::setItemName(ta, QLatin1String("toucharea"));
  1043                 if (parent){
   568                 if (parent){
  1044                     parent->setHandlesChildEvents(true);
   569                     parent->setHandlesChildEvents(true);
  1045                 }
   570                 }
  1046                 return ta;
   571                 return ta;
  1047                 }
   572                 }
  1054                 if(parent){
   579                 if(parent){
  1055                     parent->setFiltersChildEvents(true);
   580                     parent->setFiltersChildEvents(true);
  1056                 }
   581                 }
  1057                 return ta;
   582                 return ta;
  1058                 }
   583                 }
       
   584 
  1059             case P_SliderElement_text:
   585             case P_SliderElement_text:
       
   586                 {
       
   587                     HbTextItem *ti = new HbTextItem(parent);
       
   588                     return  ti;
       
   589                 }
       
   590 
  1060             case P_ProgressBar_text:
   591             case P_ProgressBar_text:
       
   592                 return 0;
       
   593 
       
   594             case P_DataItem_label:
  1061             {
   595             {
  1062                 HbTextItem *ti = new HbTextItem(parent);
   596                 HbTextItem *ti = new HbTextItem(parent);
       
   597                 HbStyle::setItemName(ti, QLatin1String("dataItem_Label"));
  1063                 return  ti;
   598                 return  ti;
  1064             }
   599             }
  1065             case P_DataItem_label:
   600             case P_DataItem_description:
  1066             {
   601             {
  1067                 HbTextItem *ti = new HbTextItem(parent);
   602                 HbTextItem *ti = new HbTextItem(parent);
  1068                 setItemName(ti, QLatin1String("dataItem_Label"));
   603                 HbStyle::setItemName(ti, QLatin1String("dataItem_Description"));
  1069                 return  ti;
   604                 return  ti;
  1070             }
   605             }
  1071             case P_DataItem_description:
       
  1072             {
       
  1073                 HbTextItem *ti = new HbTextItem(parent);
       
  1074                 setItemName(ti, QLatin1String("dataItem_Description"));
       
  1075                 return  ti;
       
  1076             }
       
  1077             case P_ProgressBar_mintext:
   606             case P_ProgressBar_mintext:
  1078             {
   607                 return 0;
  1079                 HbTextItem *ti = new HbTextItem(parent);
       
  1080                 setItemName(ti, QLatin1String("min-text"));
       
  1081                 return  ti;
       
  1082             }
       
  1083             case P_ProgressBar_maxtext:
   608             case P_ProgressBar_maxtext:
  1084             {
   609                 return 0;
  1085                 HbTextItem *ti = new HbTextItem(parent);
   610 
  1086                 setItemName(ti, QLatin1String("max-text"));
       
  1087                 return  ti;
       
  1088             }
       
  1089             case P_Label_text: {
   611             case P_Label_text: {
  1090                 HbTextItem *ti = new HbTextItem(parent);
   612                 HbTextItem *ti = new HbTextItem(parent);
  1091                 setItemName(ti, QLatin1String("text"));
   613                 HbStyle::setItemName(ti, QLatin1String("text"));
  1092                 ti->setAlignment(Qt::AlignCenter);
   614                 ti->setAlignment(Qt::AlignCenter);
  1093                 return ti;
   615                 return ti;
  1094             }
   616             }
  1095 
   617 
  1096             case P_Label_richtext:
   618             case P_Label_richtext:
  1097             {
   619             {
  1098                 HbRichTextItem *rti = new HbRichTextItem(parent);
   620                 HbRichTextItem *rti = new HbRichTextItem(parent);
  1099                 setItemName(rti, QLatin1String("text"));
   621                 HbStyle::setItemName(rti, QLatin1String("text"));
  1100                 return rti;
   622                 return rti;
  1101             }
   623             }
  1102 
       
  1103             case P_MenuItem_text:
       
  1104                 {
       
  1105                 HbTextItem *item = new HbTextItem(parent);
       
  1106                 setItemName(item, QLatin1String("text"));
       
  1107 
       
  1108                 return item;
       
  1109                 }
       
  1110 
   624 
  1111             case P_Slider_thumb:
   625             case P_Slider_thumb:
  1112                 return new HbIconItem(parent);
   626                 return new HbIconItem(parent);
  1113 
   627 
  1114             case P_MenuItem_frame:
   628             case P_Slider_groove:            
  1115             case P_MenuItem_focus:
       
  1116             case P_ScrollBar_groove:
       
  1117             case P_ScrollBar_handle:
       
  1118             case P_Slider_groove:
       
  1119             case P_Popup_background:
       
  1120             case P_Popup_background_weak:
       
  1121             case P_Popup_heading_frame:
   629             case P_Popup_heading_frame:
  1122             case P_NotificationDialog_frame:
   630             case P_NotificationDialog_frame:
  1123             case P_ToolTip_background:
       
  1124             case P_PushButton_focus:
   631             case P_PushButton_focus:
  1125             case P_ComboBox_background:
   632             case P_ComboBox_background:
  1126             case P_ToolBarExtension_background:
       
  1127             case P_SliderPopup_background:
   633             case P_SliderPopup_background:
  1128             {
   634             {
  1129                 HbFrameItem *n = new HbFrameItem(parent);
   635                 HbFrameItem *n = new HbFrameItem(parent);
  1130                 n->setZValue(-1);
   636                 n->setZValue(-1);
  1131                 return n;
   637                 return n;
  1132             }
   638             }
  1133 
   639 
  1134             case P_ProgressBar_frame:
   640             case P_ProgressBar_frame:
       
   641                 return 0;
       
   642 
       
   643             case P_ComboBoxPopup_background:
  1135             {
   644             {
  1136                 HbFrameItem *n = new HbFrameItem(parent);
   645                 HbFrameItem *n = new HbFrameItem(parent);
  1137                 n->setZValue(-1);
   646                 n->setZValue(-1);
  1138                 n->frameDrawer().setFillWholeRect(true);
   647                 HbStyle::setItemName(n , "dropdown_background");
  1139                 setItemName(n, "frame");
       
  1140                 return n;
       
  1141             }
       
  1142 
       
  1143             case P_ComboBoxPopup_background:
       
  1144             {
       
  1145                 HbFrameItem *n = new HbFrameItem(parent);
       
  1146                 n->setZValue(-1);
       
  1147                 setItemName(n , "dropdown_background");
       
  1148                 return n;
   648                 return n;
  1149             }
   649             }
  1150 
   650 
  1151             case P_TumbleView_background:
   651             case P_TumbleView_background:
  1152             case P_TumbleView_frame:
   652             case P_TumbleView_frame:
  1168             }
   668             }
  1169             case P_DataGroup_background :
   669             case P_DataGroup_background :
  1170             {
   670             {
  1171                 HbFrameItem *n = new HbFrameItem(parent);
   671                 HbFrameItem *n = new HbFrameItem(parent);
  1172                 n->setZValue(-1);
   672                 n->setZValue(-1);
  1173                 setItemName(n, QLatin1String("dataGroup_Background"));
   673                 HbStyle::setItemName(n, QLatin1String("dataGroup_Background"));
  1174                 return n;
   674                 return n;
  1175             }
   675             }
  1176             case P_DataGroupComboBackground:
   676             case P_DataGroupComboBackground:
  1177             {
   677             {
  1178                 HbFrameItem *n = new HbFrameItem(parent);
   678                 HbFrameItem *n = new HbFrameItem(parent);
  1179                 n->setZValue(-1);
   679                 n->setZValue(-1);
  1180                 setItemName(n, QLatin1String("dataGroup_ComboBackground"));
   680                 HbStyle::setItemName(n, QLatin1String("dataGroup_ComboBackground"));
  1181                 return n;
   681                 return n;
  1182             }
   682             }
  1183             case P_DataForm_heading_background :
   683             case P_DataForm_heading_background :
  1184             {
   684             {
  1185                 HbFrameItem *n = new HbFrameItem(parent);
   685                 HbFrameItem *n = new HbFrameItem(parent);
  1186                 n->setZValue(-1);
   686                 n->setZValue(-1);
  1187                 setItemName(n, QLatin1String("dataFormHeading_Background"));
   687                 HbStyle::setItemName(n, QLatin1String("dataFormHeading_Background"));
  1188                 return n;
   688                 return n;
  1189             }
   689             }
  1190             case P_DataItem_background:
   690             case P_DataItem_background:
  1191             {
   691             {
  1192                 HbFrameItem *n = new HbFrameItem(parent);
   692                 HbFrameItem *n = new HbFrameItem(parent);
  1193                 n->setZValue(-2);
   693                 n->setZValue(-2);
  1194                 setItemName(n, QLatin1String("dataItem_Background"));
   694                 HbStyle::setItemName(n, QLatin1String("dataItem_Background"));
  1195                 return n;
   695                 return n;
  1196             }
   696             }
  1197             case P_GroupBoxContent_background:
   697             case P_GroupBoxContent_background:
  1198             case P_GroupBoxHeading_background:
   698             case P_GroupBoxHeading_background:
  1199             case P_PushButton_background:
   699             case P_PushButton_background:
  1200             {
   700             {
  1201                 HbFrameItem *n = new HbFrameItem(parent);
   701                 HbFrameItem *n = new HbFrameItem(parent);
  1202                 n->setZValue(-1);
   702                 n->setZValue(-1);
  1203                 setItemName(n, QLatin1String("background"));
   703                 HbStyle::setItemName(n, QLatin1String("background"));
  1204                 return n;
   704                 return n;
  1205             }
   705             }
       
   706 
  1206             case P_ProgressBar_track:
   707             case P_ProgressBar_track:
  1207             {
   708                 return 0;
  1208                 HbProgressTrackItem *n = new HbProgressTrackItem(parent);
       
  1209                 n->frameDrawer().setFillWholeRect(true);
       
  1210                 n->setZValue(-2);
       
  1211                 return n;
       
  1212             }
       
  1213             case P_ProgressSlider_slidertrack:
   709             case P_ProgressSlider_slidertrack:
  1214             {
   710                 return 0;
  1215                 HbProgressTrackItem *n = new HbProgressTrackItem(parent);
   711 
  1216                 n->setZValue(-1);
       
  1217                 return n;
       
  1218             }
       
  1219             case P_Slider_progressgroove:
   712             case P_Slider_progressgroove:
  1220             {
   713             {
  1221                 HbSliderTrackItem *n=new HbSliderTrackItem(parent);
   714                 HbSliderTrackItem *n=new HbSliderTrackItem(parent);
  1222                 n->setZValue(0);
   715                 n->setZValue(0);
  1223                 return n;
   716                 return n;
  1224             }
   717             }
  1225             case P_ToolButton_frame:
   718             case P_ToolButton_frame:
  1226             {
   719             {
  1227                 HbFrameItem *n = new HbFrameItem(parent);
   720                 HbFrameItem *n = new HbFrameItem(parent);
  1228                 n->setZValue(-1);
   721                 n->setZValue(-1);
  1229                 setItemName(n, QLatin1String("background"));
   722                 HbStyle::setItemName(n, QLatin1String("background"));
  1230                 return n;
   723                 return n;
  1231             }
   724             }
  1232             case P_NavigationButton_background:
   725             case P_NavigationButton_background:
  1233             case P_IndicatorButton_background:
   726             case P_IndicatorButton_background:
  1234             {
   727             {
  1235                 HbIconItem *n = new HbIconItem(HbIcon(), parent);
   728                 HbIconItem *n = new HbIconItem(HbIcon(), parent);
  1236                 n->setZValue(-1);
   729                 n->setZValue(-1);
  1237                 setItemName(n, QLatin1String("background"));
   730                 HbStyle::setItemName(n, QLatin1String("background"));
  1238                 return n;
   731                 return n;
  1239             }
   732             }
  1240             case P_IndicatorButton_handleindication:
   733             case P_IndicatorButton_handleindication:
  1241             {
   734             {
  1242                 HbIconItem *n = new HbIconItem(parent);
   735                 HbIconItem *n = new HbIconItem(parent);
  1243                 setItemName(n, QLatin1String("handleindication"));
   736                 HbStyle::setItemName(n, QLatin1String("handleindication"));
  1244                 return n;
   737                 return n;
  1245             }
   738             }
  1246             case P_IndicatorButton_eventindication:
   739             case P_IndicatorButton_eventindication:
  1247             {
   740             {
  1248                 HbIconItem *n = new HbIconItem(parent);
   741                 HbIconItem *n = new HbIconItem(parent);
  1249                 n->setFlags(HbIcon::Colorized);
   742                 n->setFlags(HbIcon::Colorized);
  1250                 setItemName(n, QLatin1String("eventindication"));
   743                 HbStyle::setItemName(n, QLatin1String("eventindication"));
  1251                 return n;
   744                 return n;
  1252             }
   745             }
  1253             case P_IndicatorGroup_icon1:
   746             case P_IndicatorGroup_icon1:
  1254             {
   747             {
  1255                 HbIconItem *n = new HbIconItem(parent);
   748                 HbIconItem *n = new HbIconItem(parent);
  1256                 n->setFlags(HbIcon::Colorized);
   749                 n->setFlags(HbIcon::Colorized);
  1257                 setItemName(n, QLatin1String("icon1"));
   750                 HbStyle::setItemName(n, QLatin1String("icon1"));
  1258                 return n;
   751                 return n;
  1259             }
   752             }
  1260             case P_IndicatorGroup_icon2:
   753             case P_IndicatorGroup_icon2:
  1261             {
   754             {
  1262                 HbIconItem *n = new HbIconItem(parent);
   755                 HbIconItem *n = new HbIconItem(parent);
  1263                 n->setFlags(HbIcon::Colorized);
   756                 n->setFlags(HbIcon::Colorized);
  1264                 setItemName(n, QLatin1String("icon2"));
   757                 HbStyle::setItemName(n, QLatin1String("icon2"));
  1265                 return n;
   758                 return n;
  1266             }
   759             }
  1267             case P_IndicatorGroup_icon3:
   760             case P_IndicatorGroup_icon3:
  1268             {
   761             {
  1269                 HbIconItem *n = new HbIconItem(parent);
   762                 HbIconItem *n = new HbIconItem(parent);
  1270                 n->setFlags(HbIcon::Colorized);
   763                 n->setFlags(HbIcon::Colorized);
  1271                 setItemName(n, QLatin1String("icon3"));
   764                 HbStyle::setItemName(n, QLatin1String("icon3"));
  1272                 return n;
   765                 return n;
  1273             }
   766             }
  1274             case P_IndicatorGroup_icon4:
   767             case P_IndicatorGroup_icon4:
  1275             {
   768             {
  1276                 HbIconItem *n = new HbIconItem(parent);
   769                 HbIconItem *n = new HbIconItem(parent);
  1277                 n->setFlags(HbIcon::Colorized);
   770                 n->setFlags(HbIcon::Colorized);
  1278                 setItemName(n, QLatin1String("icon4"));
   771                 HbStyle::setItemName(n, QLatin1String("icon4"));
  1279                 return n;
   772                 return n;
  1280             }
   773             }
  1281             case P_SignalIndicator_icon:
   774             case P_SignalIndicator_icon:
  1282             {
   775             {
  1283                 HbIconItem *n = new HbIconItem(parent);
   776                 HbIconItem *n = new HbIconItem(parent);
  1284                 n->setFlags(HbIcon::Colorized);
   777                 n->setFlags(HbIcon::Colorized);
  1285                 setItemName(n, QLatin1String("icon"));
   778                 HbStyle::setItemName(n, QLatin1String("icon"));
  1286                 return n;
   779                 return n;
  1287             }
   780             }
  1288             case P_SignalLevel_background:
   781             case P_SignalLevel_background:
  1289             {
   782             {
  1290                 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent);
   783                 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent);
  1291                 n->setZValue(-1);
   784                 n->setZValue(-1);
  1292                 setItemName(n, QLatin1String("background"));
   785                 HbStyle::setItemName(n, QLatin1String("background"));
  1293                 return n;
   786                 return n;
  1294             }
   787             }
  1295             case P_SignalLevel_icon:
   788             case P_SignalLevel_icon:
  1296             {
   789             {
  1297                 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent);
   790                 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent);
  1298                 setItemName(n, QLatin1String("levelicon"));
   791                 HbStyle::setItemName(n, QLatin1String("levelicon"));
  1299                 return n;
   792                 return n;
  1300             }
   793             }
  1301             case P_BatteryIndicator_icon:
   794             case P_BatteryIndicator_icon:
  1302             {
   795             {
  1303                 HbIconItem *n = new HbIconItem(parent);
   796                 HbIconItem *n = new HbIconItem(parent);
  1304                 n->setFlags(HbIcon::Colorized);
   797                 n->setFlags(HbIcon::Colorized);
  1305                 setItemName(n, QLatin1String("icon"));
   798                 HbStyle::setItemName(n, QLatin1String("icon"));
  1306                 return n;
   799                 return n;
  1307             }
   800             }
  1308             case P_BatteryLevel_background:
   801             case P_BatteryLevel_background:
  1309             {
   802             {
  1310                 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent);
   803                 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent);
  1311                 n->setZValue(-1);
   804                 n->setZValue(-1);
  1312                 setItemName(n, QLatin1String("background"));
   805                 HbStyle::setItemName(n, QLatin1String("background"));
  1313                 return n;
   806                 return n;
  1314             }
   807             }
  1315             case P_BatteryLevel_icon:
   808             case P_BatteryLevel_icon:
  1316             {
   809             {
  1317                 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent);
   810                 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent);
  1318                 setItemName(n, QLatin1String("levelicon"));
   811                 HbStyle::setItemName(n, QLatin1String("levelicon"));
  1319                 return n;
   812                 return n;
  1320             }
   813             }
  1321             case P_TitlePane_background:
   814             case P_TitlePane_background:
  1322                 {
   815                 {
  1323                     HbFrameItem *n = new HbFrameItem(parent);
   816                     HbFrameItem *n = new HbFrameItem(parent);
  1324                     n->setZValue(-1);
   817                     n->setZValue(-1);
  1325                     setItemName(n, QLatin1String("background"));
   818                     HbStyle::setItemName(n, QLatin1String("background"));
  1326                     return n;
   819                     return n;
  1327                 }
   820                 }
  1328             case P_LineEdit_frame_normal:
   821             case P_LineEdit_frame_normal:
  1329             case P_LineEdit_frame_highlight:
   822             case P_LineEdit_frame_highlight:
  1330             case P_TextEdit_frame_normal:
   823             case P_TextEdit_frame_normal:
  1336             }
   829             }
  1337             case P_GroupBoxMarquee_text:
   830             case P_GroupBoxMarquee_text:
  1338             case P_TitlePane_text:
   831             case P_TitlePane_text:
  1339             {
   832             {
  1340                 HbMarqueeItem *n = new HbMarqueeItem(parent);
   833                 HbMarqueeItem *n = new HbMarqueeItem(parent);
  1341                 setItemName(n, QLatin1String("text"));
   834                 HbStyle::setItemName(n, QLatin1String("text"));
  1342                 return n;
   835                 return n;
  1343             }
   836             }
  1344             case P_TitlePane_icon:
   837             case P_TitlePane_icon:
  1345             {
   838             {
  1346                 HbIconItem *n = new HbIconItem(parent);
   839                 HbIconItem *n = new HbIconItem(parent);
  1347                 n->setFlags(HbIcon::Colorized);
   840                 n->setFlags(HbIcon::Colorized);
  1348                 setItemName(n, QLatin1String("icon"));
   841                 HbStyle::setItemName(n, QLatin1String("icon"));
  1349                 return n;
   842                 return n;
  1350             }
   843             }
  1351             case P_StatusBar_background:
   844             case P_StatusBar_background:
  1352             {
   845             {
  1353                 HbFrameItem *n = new HbFrameItem(parent);
   846                 HbFrameItem *n = new HbFrameItem(parent);
  1354                 n->setZValue(-1);
   847                 n->setZValue(-1);
  1355                 setItemName(n, QLatin1String("background"));
   848                 HbStyle::setItemName(n, QLatin1String("background"));
  1356                 return n;
   849                 return n;
  1357             }
   850             }
  1358             case P_StatusBar_timetext:
   851             case P_StatusBar_timetext:
  1359             {
   852             {
  1360                 HbTextItem *textItem = new HbTextItem(parent);
   853                 HbTextItem *textItem = new HbTextItem(parent);
  1361                 setItemName(textItem, QLatin1String("timetext"));
   854                 HbStyle::setItemName(textItem, QLatin1String("timetext"));
  1362                 textItem->setAlignment(Qt::AlignCenter);
   855                 textItem->setAlignment(Qt::AlignCenter);
  1363                 return textItem;
   856                 return textItem;
  1364             }
   857             }
  1365             case P_Fade_background:
   858             case P_Fade_background:
  1366                 return new HbIconItem(QString(), parent);
   859                 return new HbIconItem(QString(), parent);
  1369             case P_SliderElement_decrease:
   862             case P_SliderElement_decrease:
  1370                 return new HbIconItem(QString(), parent);
   863                 return new HbIconItem(QString(), parent);
  1371 
   864 
  1372             case P_SliderTickMark_majoricon: {
   865             case P_SliderTickMark_majoricon: {
  1373                 HbIconItem *iconItem = new HbIconItem(parent);
   866                 HbIconItem *iconItem = new HbIconItem(parent);
  1374                 setItemName(iconItem,QLatin1String("tickmark-majoricon"));
   867                 HbStyle::setItemName(iconItem,QLatin1String("tickmark-majoricon"));
  1375                 return iconItem;
   868                 return iconItem;
  1376             }
   869             }
  1377             case P_SliderTickMark_minoricon: {
   870             case P_SliderTickMark_minoricon: {
  1378                 HbIconItem *iconItem = new HbIconItem(parent);
   871                 HbIconItem *iconItem = new HbIconItem(parent);
  1379                 setItemName(iconItem,QLatin1String("tickmark-minoricon"));
   872                 HbStyle::setItemName(iconItem,QLatin1String("tickmark-minoricon"));
  1380                 return iconItem;
   873                 return iconItem;
  1381             }
   874             }
  1382             case P_SliderTickMark_majorlabel: {
   875             case P_SliderTickMark_majorlabel: {
  1383                 HbTextItem *textItem = new HbTextItem(parent);
   876                 HbTextItem *textItem = new HbTextItem(parent);
  1384                 setItemName(textItem,QLatin1String("tickmark-majorlabel"));
   877                 HbStyle::setItemName(textItem,QLatin1String("tickmark-majorlabel"));
  1385                 return textItem;
   878                 return textItem;
  1386             }
   879             }
  1387             case P_SliderTickMark_minorlabel: {
   880             case P_SliderTickMark_minorlabel: {
  1388                 HbTextItem *textItem = new HbTextItem(parent);
   881                 HbTextItem *textItem = new HbTextItem(parent);
  1389                 setItemName(textItem,QLatin1String("tickmark-minorlabel"));
   882                 HbStyle::setItemName(textItem,QLatin1String("tickmark-minorlabel"));
  1390                 return textItem;
   883                 return textItem;
  1391             }
   884             }
  1392 
   885 
  1393             case P_ProgressBar_waittrack:
   886             case P_ProgressBar_waittrack:
  1394                 return new HbRepeatIconItem(QLatin1String("qtg_graf_progbar_h_wait"), parent);
   887                 return 0;
  1395 
       
  1396             case P_RatingSlider_frame:
   888             case P_RatingSlider_frame:
  1397                 return  new HbRepeatItem(parent);
   889                 return 0;
  1398 
       
  1399             case P_RatingSlider_track:
   890             case P_RatingSlider_track:
  1400                 return new HbRepeatMaskItem(parent);
   891                 return 0;
  1401 
   892             case P_RatingSlider_layout:
  1402             case P_RatingSlider_layout: {
   893                 return 0;
  1403                 HbWidgetBase *layout = new HbWidgetBase(parent);
       
  1404                 setItemName(layout, "frame");
       
  1405                 return layout;
       
  1406             }
       
  1407 
   894 
  1408             case P_ItemViewItem_checkbox: {
   895             case P_ItemViewItem_checkbox: {
  1409                 qDebug() << "Primitive P_ItemViewItem_checkbox is deprecated and will cease to exist in the near future.";
   896                 qDebug() << "Primitive P_ItemViewItem_checkbox is deprecated and will cease to exist in the near future.";
  1410                 HbIconItem *iconItem = new HbIconItem(parent);
   897                 HbIconItem *iconItem = new HbIconItem(parent);
  1411                 setItemName(iconItem, QLatin1String("checkbox-icon"));
   898                 HbStyle::setItemName(iconItem, QLatin1String("checkbox-icon"));
  1412                 return iconItem;
   899                 return iconItem;
  1413             }
   900             }
  1414 
   901 
  1415             case P_ItemViewItem_radiobutton:
   902             case P_ItemViewItem_radiobutton:
  1416             case P_ItemViewItem_selection: {
   903             case P_ItemViewItem_selection: {
  1417                 HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent));
   904                 Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_selection no more supported. Use refactored styling");
  1418                 setItemName(iconItem, QLatin1String("selection-icon"));
   905                 return 0;
  1419                 return iconItem;
       
  1420             }
   906             }
  1421 
   907 
  1422             case P_Edit_text:{
   908             case P_Edit_text:{
  1423                 return 0;
   909                 return 0;
  1424             }
   910             }
  1425             case P_GroupBoxHeading_text:
   911             case P_GroupBoxHeading_text:
  1426             case P_NotificationDialog_text:{
   912             case P_NotificationDialog_text:{
  1427                 HbTextItem *n = new HbTextItem(parent);
   913                 HbTextItem *n = new HbTextItem(parent);
  1428                 setItemName(n, QLatin1String("text"));
   914                 HbStyle::setItemName(n, QLatin1String("text"));
  1429                 n->setMinimumLines(1);
   915                 n->setMinimumLines(1);
  1430                 n->setMaximumLines(1);
   916                 n->setMaximumLines(1);
  1431                 n->setTextWrapping(Hb::TextNoWrap);
   917                 n->setTextWrapping(Hb::TextNoWrap);
  1432                 return n;
   918                 return n;
  1433             }
   919             }
  1434             case P_NotificationDialog_title:{
   920             case P_NotificationDialog_title:{
  1435                 HbTextItem *n = new HbTextItem(parent);
   921                 HbTextItem *n = new HbTextItem(parent);
  1436                 setItemName(n, QLatin1String("title"));
   922                 HbStyle::setItemName(n, QLatin1String("title"));
  1437                 return n;
   923                 return n;
  1438             }
   924             }
  1439             case P_NotificationDialog_icon:{
   925             case P_NotificationDialog_icon:{
  1440                 HbIconItem *n = new HbIconItem(QString(), parent);
   926                 HbIconItem *n = new HbIconItem(QString(), parent);
  1441                 setItemName(n, QLatin1String("icon"));
   927                 HbStyle::setItemName(n, QLatin1String("icon"));
  1442                 return n;
   928                 return n;
  1443             }
   929             }
  1444             case P_MessageBox_text:{    //deprecated
   930             case P_MessageBox_text:{    
  1445                 HbTextItem *rti = new HbTextItem(parent);
   931                 HbTextItem *rti = new HbTextItem(parent);
  1446                 return rti;
   932                 return rti;
  1447             }
   933             }
  1448             case P_MessageBox_icon:{
   934             case P_MessageBox_icon:{
  1449                 HbIconItem *n = new HbIconItem(QString(), parent);
   935                 HbIconItem *n = new HbIconItem(QString(), parent);
  1450                 return n;
   936                 return n;
  1451             }
   937             }
  1452 
   938 
  1453             case P_ItemViewItem_background: {
   939             case P_ItemViewItem_background: {
  1454                 HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent));
   940                 Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_background no more supported. Use refactored styling");
  1455                 iconItem->setZValue(-3.0);
   941                 return 0;
  1456                 setItemName(iconItem, QLatin1String("background"));
       
  1457                 return iconItem;
       
  1458             }
   942             }
  1459 
   943 
  1460             case P_ListViewItem_text: {
   944             case P_ListViewItem_text: {
  1461                 HbTextItem *textItem = q_check_ptr(new HbTextItem(parent));
   945                 Q_ASSERT_X(false, "HbStyle" , "P_ListViewItem_text no more supported. Use refactored styling");
  1462 
   946                 return 0;
  1463                 return textItem;
       
  1464             }
   947             }
  1465 
   948 
  1466             case P_ListViewItem_richtext: {
   949             case P_ListViewItem_richtext: {
  1467                 HbRichTextItem *textItem = q_check_ptr(new HbRichTextItem(parent));
   950                 Q_ASSERT_X(false, "HbStyle" , "P_ListViewItem_richtext no more supported. Use refactored styling");
  1468                 return textItem;
   951                 return 0;
  1469             }
   952             }
  1470 
   953 
  1471             case P_GridViewItem_text: {
   954             case P_GridViewItem_text: {
  1472                 HbTextItem *textItem = q_check_ptr(new HbTextItem(parent));
   955                 Q_ASSERT_X(false, "HbStyle" , "P_GridViewItem_text no more supported. Use refactored styling");
  1473                 // caching do not work properly - text is not refreshed immediatelly
   956                 return 0;
  1474                 //textItem->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
       
  1475                 setItemName(textItem, QLatin1String("text"));
       
  1476                 return textItem;
       
  1477             }
   957             }
  1478 
   958 
  1479             case P_ListViewItem_icon:
   959             case P_ListViewItem_icon:
  1480                 return q_check_ptr(new HbIconItem(parent));
   960                 Q_ASSERT_X(false, "HbStyle" , "P_ListViewItem_icon no more supported. Use refactored styling");
  1481 
   961                 return 0;
  1482             case P_ColorGridViewItem_colorIcon:
       
  1483                 return new HbIconItem("qtg_graf_colorpicker_mask", parent);
       
  1484             case P_ColorGridViewItem_borderIcon:
       
  1485                 return new HbIconItem("qtg_graf_colorpicker_filled", parent);
       
  1486             case P_ColorGridViewItem_checkIcon:
       
  1487                 return new HbIconItem("qtg_small_tick", parent);
       
  1488 
   962 
  1489             case P_TreeViewItem_expandicon: {
   963             case P_TreeViewItem_expandicon: {
  1490                 HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent));
   964                 Q_ASSERT_X(false, "HbStyle" , "P_TreeViewItem_expandicon no more supported. Use refactored styling");
  1491                 setItemName(iconItem, QLatin1String("subitem-indicator"));
   965                 return 0;
  1492                 return iconItem;
   966             }
  1493             }
   967 
  1494 
       
  1495             case P_SelectionControl_selectionstart://fallthrough
       
  1496             case P_SelectionControl_selectionend://fallthrough
       
  1497             {
       
  1498                 HbIconItem *iconItem = new HbIconItem(parent);
       
  1499                 switch (primitive) {
       
  1500                     case P_SelectionControl_selectionstart:
       
  1501                         iconItem->setIconName(QLatin1String("qtg_graf_editor_handle_begin"));
       
  1502                         break;
       
  1503                     case P_SelectionControl_selectionend:
       
  1504                         iconItem->setIconName(QLatin1String("qtg_graf_editor_handle_end"));
       
  1505                         break;
       
  1506                     default:
       
  1507                         qWarning("Unknown HbSelectionControl primitive %i", primitive);
       
  1508                         break;
       
  1509                 }
       
  1510                 setItemName(iconItem, QLatin1String("handle-icon"));
       
  1511                 return iconItem;
       
  1512             }
       
  1513             case P_ComboBox_button: {
   968             case P_ComboBox_button: {
  1514                 HbIconItem *n = new HbIconItem(QString(), parent);
   969                 HbIconItem *n = new HbIconItem(QString(), parent);
  1515                 return n;
   970                 return n;
  1516             }
   971             }
  1517             case P_ItemViewItem_focus: {
   972             case P_ItemViewItem_focus: {
  1518                 HbFrameItem *frameItem = q_check_ptr(new HbFrameItem(parent));
   973                 Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_focus no more supported. Use refactored styling");
  1519                 frameItem->setZValue(-1.0);
   974                 return 0;
  1520                 return frameItem;
       
  1521             }
   975             }
  1522             case P_ItemHighlight_background:
   976             case P_ItemHighlight_background:
  1523                 return new HbFrameItem(parent);
   977                 return new HbFrameItem(parent);
  1524 
   978 
  1525             case P_ItemViewItem_frame: {
   979             case P_ItemViewItem_frame: {
  1526                 HbFrameItem *item = q_check_ptr(new HbFrameItem(parent));
   980                 Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_frame no more supported. Use refactored styling");
  1527                 item->setZValue(-4.0);
   981                 return 0;
  1528                 setItemName(item,"frame");
   982             }
  1529                 return item;
   983             case P_ItemViewItem_touchmultiselection:
  1530             }
   984             {
  1531             case P_ScrollArea_continuationbottom:
   985                 Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_touchmultiselection no more supported. Use refactored styling");
  1532             {
   986                 return 0;
  1533                 HbFrameItem *n = new HbFrameItem(parent);
   987             }
  1534                 setItemName(n, QLatin1String("continuation-indicator-bottom"));
   988             case P_IndexFeedback_popup_text:
  1535                 n->setZValue(-1);
   989             {
       
   990                 Q_ASSERT_X(false, "HbStyle" , "P_IndexFeedback_popup_text no more supported. Use refactored styling");
       
   991                 return 0;
       
   992             }
       
   993             case P_IndexFeedback_popup_background:
       
   994             {
       
   995                 Q_ASSERT_X(false, "HbStyle" , "P_IndexFeedback_popup_background no more supported. Use refactored styling");
       
   996                 return 0;
       
   997             }
       
   998             case P_InputDialog_text:
       
   999             {
       
  1000                 HbTextItem *n = new HbTextItem(parent);
       
  1001                 n->setTextWrapping(Hb::TextWordWrap);
       
  1002                 HbStyle::setItemName(n, QLatin1String("label-1"));
  1536                 return n;
  1003                 return n;
  1537             }
  1004             }
  1538             case P_ScrollArea_continuationtop:
  1005             case P_InputDialog_additionaltext:
  1539             {
       
  1540                 HbFrameItem *n = new HbFrameItem(parent);
       
  1541                 setItemName(n, QLatin1String("continuation-indicator-top"));
       
  1542                 n->setZValue(-1);
       
  1543                 return n;
       
  1544             }
       
  1545             case P_ScrollArea_continuationleft:
       
  1546             {
       
  1547                 HbFrameItem *n = new HbFrameItem(parent);
       
  1548                 setItemName(n, QLatin1String("continuation-indicator-left"));
       
  1549                 n->setZValue(-1);
       
  1550                 return n;
       
  1551             }
       
  1552             case P_ScrollArea_continuationright:
       
  1553                 {
       
  1554                 HbFrameItem *n = new HbFrameItem(parent);
       
  1555                 setItemName(n, QLatin1String("continuation-indicator-right"));
       
  1556                 n->setZValue(-1);
       
  1557                 return n;
       
  1558             }
       
  1559             case P_ItemViewItem_touchmultiselection:
       
  1560             {
       
  1561                 HbTouchArea *area = q_check_ptr(new HbTouchArea(parent));
       
  1562                 setItemName(area, "multiselection-toucharea");
       
  1563                 return area;
       
  1564             }
       
  1565             case P_IndexFeedback_popup_text:
       
  1566             {
       
  1567                 HbTextItem *textItem = new HbTextItem(parent);
       
  1568                 textItem->setAlignment(Qt::AlignCenter);
       
  1569                 textItem->setTextWrapping(Hb::TextNoWrap);
       
  1570                 setItemName(textItem, QLatin1String("index-text"));
       
  1571 
       
  1572                 //TODO:: make this a sane value
       
  1573                 textItem->setZValue(4);
       
  1574                 return textItem;
       
  1575             }
       
  1576             case P_IndexFeedback_popup_background:
       
  1577             {
       
  1578                 HbFrameItem *n = new HbFrameItem(parent);
       
  1579                 n->frameDrawer().setFrameGraphicsName("qtg_fr_popup_preview");
       
  1580                 n->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
       
  1581                 qreal cornerPieceSize = 0;
       
  1582                 parameter(QLatin1String("hb-param-background-popup-preview"),cornerPieceSize);
       
  1583                 n->frameDrawer().setBorderWidths(cornerPieceSize, cornerPieceSize);
       
  1584                 setItemName(n, QLatin1String("index-background"));
       
  1585                 n->setZValue(3);
       
  1586                 return n;
       
  1587             }
       
  1588             case P_InputDialog_text:
       
  1589             {
  1006             {
  1590                 HbTextItem *n = new HbTextItem(parent);
  1007                 HbTextItem *n = new HbTextItem(parent);
  1591                 setItemName(n, QLatin1String("label-1"));
  1008                 n->setTextWrapping(Hb::TextWordWrap);
  1592                 return n;
  1009                 HbStyle::setItemName(n, QLatin1String("label-2"));
  1593             }
       
  1594             case P_InputDialog_additionaltext:
       
  1595             {
       
  1596                 HbTextItem *n = new HbTextItem(parent);
       
  1597                 setItemName(n, QLatin1String("label-2"));
       
  1598                 return n;
  1010                 return n;
  1599             }
  1011             }
  1600             default:
  1012             default:
  1601                 return 0;
  1013                 return 0;
  1602         }
  1014         }
  1603 }
  1015 }
  1604 
  1016 
  1605 /*!
  1017 void HbStylePrivate::updatePrimitive( QGraphicsItem *item, HbStylePrivate::Primitive primitive, const QStyleOption *option )
  1606 
       
  1607   \deprecated HbStyle::updatePrimitive(QGraphicsItem*, HbStyle::Primitive, const QStyleOption*)
       
  1608   is deprecated. This method will be made private and finally removed since primitive updating will be done in the widgets.
       
  1609 
       
  1610   Updates the state and content of widget's child primitives. Update for a styled primitive should happen always when
       
  1611   a state change that affects drawing occurs. Such a situation can be for example pressing of a button (change background image), or
       
  1612   changing a text for a widget having text content. The updatePrimitive() implementation for each primitive element can be considered
       
  1613   as a part of widget's implementation. Note that it's up to the widget to decide what the styleoption contains and what the updatePrimitive() method
       
  1614   uses the styleoption data for.
       
  1615 
       
  1616   \sa HbStyle::createPrimitive
       
  1617   \param item Primitive graphicsitem.
       
  1618   \param primitive To identify the primitive to create.
       
  1619   \param option Style option, contains all the information needed to update the primitive, this
       
  1620   information is widget specific and each widget usually has a styleoption. Styleoption may include
       
  1621   information about the widget's state, content etc.
       
  1622  */
       
  1623 void HbStyle::updatePrimitive( QGraphicsItem *item, HbStyle::Primitive primitive, const QStyleOption *option ) const
       
  1624 {
  1018 {
  1625     Q_D( const HbStyle );
  1019     
  1626 
       
  1627     switch(primitive){
  1020     switch(primitive){
  1628             case P_PushButton_icon:
  1021             case P_PushButton_icon:
  1629                 {
  1022                 {
  1630                     if (const HbStyleOptionPushButton *opt =
  1023                     if (const HbStyleOptionPushButton *opt =
  1631                         qstyleoption_cast<const HbStyleOptionPushButton*>(option)) {
  1024                         qstyleoption_cast<const HbStyleOptionPushButton*>(option)) {
  1632                         HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1025                         HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1633                         //iconItem->setIconName(opt->icon.iconName());
  1026                         //iconItem->setIconName(opt->icon.iconName());
  1634                         iconItem->setIcon(opt->icon); // with this call iconitem refresh issue is there
  1027                         iconItem->setIcon(opt->icon); // with this call iconitem refresh issue is there
  1635                         iconItem->setMode(d->iconMode(opt->state));
  1028                         iconItem->setMode(iconMode(opt->state));
  1636                         iconItem->setState(d->iconState(opt->state));
  1029                         iconItem->setState(iconState(opt->state));
  1637                         iconItem->setAlignment(Qt::AlignCenter);
  1030                         iconItem->setAlignment(Qt::AlignCenter);
  1638                     }
  1031                     }
  1639                 break;
  1032                 break;
  1640                 }
  1033                 }
  1641             case P_GroupBoxHeading_icon:
  1034             case P_GroupBoxHeading_icon:
  1674             case P_Label_icon:
  1067             case P_Label_icon:
  1675                 if (const HbStyleOptionLabel *opt = qstyleoption_cast<const HbStyleOptionLabel*>(option)) {
  1068                 if (const HbStyleOptionLabel *opt = qstyleoption_cast<const HbStyleOptionLabel*>(option)) {
  1676                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1069                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1677                     iconItem->setIcon(opt->icon);
  1070                     iconItem->setIcon(opt->icon);
  1678                     if (!opt->icon.isNull()) {
  1071                     if (!opt->icon.isNull()) {
  1679                         iconItem->setMode(d->iconMode(opt->state));
  1072                         iconItem->setMode(iconMode(opt->state));
  1680                         iconItem->setState(d->iconState(opt->state));
  1073                         iconItem->setState(iconState(opt->state));
  1681                         iconItem->setAspectRatioMode(opt->aspectRatioMode);
  1074                         iconItem->setAspectRatioMode(opt->aspectRatioMode);
  1682                         iconItem->setAlignment(opt->alignment);
  1075                         iconItem->setAlignment(opt->alignment);
  1683                     }
  1076                     }
  1684                 }
  1077                 }
  1685                 break;
  1078                 break;
  1686             case P_ToolButton_icon:
  1079             case P_ToolButton_icon:
  1687                 if (const HbStyleOptionToolButton *opt = qstyleoption_cast<const HbStyleOptionToolButton*>(option)) {
  1080                 if (const HbStyleOptionToolButton *opt = qstyleoption_cast<const HbStyleOptionToolButton*>(option)) {
  1688                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1081                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1689                     iconItem->setIcon(opt->icon);
  1082                     iconItem->setIcon(opt->icon);
  1690                     iconItem->setMode(d->iconMode(opt->state));
  1083                     iconItem->setMode(iconMode(opt->state));
  1691                     iconItem->setState(d->iconState(opt->state));
  1084                     iconItem->setState(iconState(opt->state));
  1692                 }
  1085                 }
  1693                 break;
  1086                 break;
  1694             case P_ComboBox_text:
  1087             case P_ComboBox_text:
  1695                 if (const HbStyleOptionComboBox *opt = qstyleoption_cast<const HbStyleOptionComboBox*>(option)) {
  1088                 if (const HbStyleOptionComboBox *opt = qstyleoption_cast<const HbStyleOptionComboBox*>(option)) {
  1696                     HbTextItem *comboTextItem = static_cast<HbTextItem*>(item);
  1089                     HbTextItem *comboTextItem = static_cast<HbTextItem*>(item);
  1746             case P_NavigationButton_toucharea:
  1139             case P_NavigationButton_toucharea:
  1747             case P_SliderElement_touchdecrease:
  1140             case P_SliderElement_touchdecrease:
  1748             case P_SliderElement_touchincrease:
  1141             case P_SliderElement_touchincrease:
  1749             case P_SliderElement_touchgroove:
  1142             case P_SliderElement_touchgroove:
  1750             case P_SliderElement_touchhandle:
  1143             case P_SliderElement_touchhandle:
  1751             case P_ScrollBar_toucharea:
       
  1752                 {
  1144                 {
  1753                     HbTouchArea *touchArea = static_cast<HbTouchArea*>(item);
  1145                     HbTouchArea *touchArea = static_cast<HbTouchArea*>(item);
  1754                     touchArea->setZValue(TOUCHAREA_ZVALUE);
  1146                     touchArea->setZValue(TOUCHAREA_ZVALUE);
  1755                 }
  1147                 }
  1756                 break;
  1148                 break;
  1810                 if (const HbStyleOptionToolButton *opt = qstyleoption_cast<const HbStyleOptionToolButton*>(option)) {
  1202                 if (const HbStyleOptionToolButton *opt = qstyleoption_cast<const HbStyleOptionToolButton*>(option)) {
  1811                     HbTextItem *textItem = static_cast<HbTextItem*>(item);
  1203                     HbTextItem *textItem = static_cast<HbTextItem*>(item);
  1812                     textItem->setText(opt->text);
  1204                     textItem->setText(opt->text);
  1813                 }
  1205                 }
  1814                 break;
  1206                 break;
  1815             case P_ProgressBar_text: {
  1207             case P_ProgressBar_text: 
  1816                   if (const HbStyleOptionProgressBar *opt = qstyleoption_cast<const HbStyleOptionProgressBar*>(option)) {
  1208                 break;
  1817                       HbTextItem *textItem = static_cast<HbTextItem*>(item);
  1209             
  1818                       textItem->setAlignment(Qt::AlignCenter);
       
  1819                       textItem->setZValue(100);
       
  1820                       textItem->setText(opt->text);
       
  1821                   }
       
  1822                   break;
       
  1823               }
       
  1824             case P_DataGroup_background: {
  1210             case P_DataGroup_background: {
  1825                 if (const HbStyleOptionDataGroupHeadingWidget *opt =
  1211                 if (const HbStyleOptionDataGroupHeadingWidget *opt =
  1826                     qstyleoption_cast<const HbStyleOptionDataGroupHeadingWidget *>(option)) {
  1212                     qstyleoption_cast<const HbStyleOptionDataGroupHeadingWidget *>(option)) {
  1827                     HbFrameItem *frameItem = static_cast<HbFrameItem*>( item );
  1213                     HbFrameItem *frameItem = static_cast<HbFrameItem*>( item );
  1828                     if(!frameItem){
  1214                     if(!frameItem){
  1833                     if (opt->state & QStyle::State_Enabled) {
  1219                     if (opt->state & QStyle::State_Enabled) {
  1834                         mode = QIcon::Normal;
  1220                         mode = QIcon::Normal;
  1835                     }
  1221                     }
  1836                     if (opt->state & QStyle::State_Active) {
  1222                     if (opt->state & QStyle::State_Active) {
  1837                         mode = QIcon::Active;
  1223                         mode = QIcon::Active;
  1838                     } 
  1224                     }
  1839                     if (opt->state & QStyle::State_Selected) {
  1225                     if (opt->state & QStyle::State_Selected) {
  1840                         mode = QIcon::Selected;
  1226                         mode = QIcon::Selected;
  1841                     }
  1227                     }
  1842                     frameItem->setZValue(-1.0);
  1228                     frameItem->setZValue(-1.0);
  1843                     if(mode == QIcon::Disabled) {
  1229                     if(mode == QIcon::Disabled) {
  1844                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_disabled"));
  1230                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_disabled"));
  1845                     }                   
  1231                     }
  1846                     else if(opt->pressed ) {
  1232                     else if(opt->pressed ) {
  1847                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_pressed"));
  1233                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_pressed"));
  1848                     } else {
  1234                     } else {
  1849                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_parent_normal"));
  1235                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_parent_normal"));
  1850                     }
  1236                     }
  1851                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  1237                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  1852                     frameItem->setGeometry(opt->rect);
       
  1853                 }
  1238                 }
  1854                 break;
  1239                 break;
  1855             }
  1240             }
  1856             case P_DataGroupComboBackground: {
  1241             case P_DataGroupComboBackground: {
  1857                 if (const HbStyleOptionDataGroup *opt = qstyleoption_cast<const HbStyleOptionDataGroup *>(option)) {
  1242                 if (const HbStyleOptionDataGroup *opt = qstyleoption_cast<const HbStyleOptionDataGroup *>(option)) {
  1932                 if (const HbStyleOptionDataFormViewItem *opt = qstyleoption_cast<const HbStyleOptionDataFormViewItem *>(option)) {
  1317                 if (const HbStyleOptionDataFormViewItem *opt = qstyleoption_cast<const HbStyleOptionDataFormViewItem *>(option)) {
  1933                     QString frameGraphicsName;
  1318                     QString frameGraphicsName;
  1934                     HbFrameItem *frameItem = static_cast<HbFrameItem*>( item );
  1319                     HbFrameItem *frameItem = static_cast<HbFrameItem*>( item );
  1935                     if(!frameItem){
  1320                     if(!frameItem){
  1936                         return;
  1321                         return;
  1937                     } 
  1322                     }
  1938                     QIcon::Mode mode = QIcon::Disabled;
  1323                     QIcon::Mode mode = QIcon::Disabled;
  1939                     if (opt->state & QStyle::State_Enabled) {
  1324                     if (opt->state & QStyle::State_Enabled) {
  1940                         mode = QIcon::Normal;
  1325                         mode = QIcon::Normal;
  1941                     }
  1326                     }
  1942                     if (opt->state & QStyle::State_Active) {
  1327                     if (opt->state & QStyle::State_Active) {
  1946                         mode = QIcon::Selected;
  1331                         mode = QIcon::Selected;
  1947                     }
  1332                     }
  1948                     if (mode == QIcon::Disabled ) {
  1333                     if (mode == QIcon::Disabled ) {
  1949                             frameGraphicsName = QLatin1String("qtg_fr_list_disabled");
  1334                             frameGraphicsName = QLatin1String("qtg_fr_list_disabled");
  1950                         } else  {
  1335                         } else  {
  1951                             frameGraphicsName = QLatin1String("qtg_fr_list_parent_normal");
  1336                             frameGraphicsName = QLatin1String("qtg_fr_list_normal");
  1952                     }
  1337                     }
  1953                     frameItem->frameDrawer().setFrameGraphicsName(frameGraphicsName);
  1338                     frameItem->frameDrawer().setFrameGraphicsName(frameGraphicsName);
  1954                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  1339                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  1955                 }
  1340                 }
  1956                 break;
  1341                 break;
  2051             case P_StatusBar_background: {
  1436             case P_StatusBar_background: {
  2052                 const HbStyleOptionStatusBar *opt = qstyleoption_cast<const HbStyleOptionStatusBar *>(option);
  1437                 const HbStyleOptionStatusBar *opt = qstyleoption_cast<const HbStyleOptionStatusBar *>(option);
  2053                 if (opt) {
  1438                 if (opt) {
  2054                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
  1439                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
  2055                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
  1440                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
       
  1441                     frameItem->frameDrawer().setFillWholeRect(true);
  2056                     if (opt->transparent) {
  1442                     if (opt->transparent) {
  2057                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_statusbar_trans"));
  1443                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_statusbar_trans"));
  2058                     } else {
  1444                     } else {
  2059                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_statusbar"));
  1445                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_statusbar"));
  2060                     }
  1446                     }
  2090                     iconItem->setIconName("qtg_graf_titlebar_minimize");
  1476                     iconItem->setIconName("qtg_graf_titlebar_minimize");
  2091                 }
  1477                 }
  2092                 break;
  1478                 break;
  2093             }
  1479             }
  2094 
  1480 
  2095             case P_IndicatorButton_eventindication: {  
  1481             case P_IndicatorButton_eventindication: {
  2096                 const HbStyleOptionIndicatorButton *opt = qstyleoption_cast<const HbStyleOptionIndicatorButton *>(option);
  1482                 const HbStyleOptionIndicatorButton *opt = qstyleoption_cast<const HbStyleOptionIndicatorButton *>(option);
  2097                 if (opt) {
  1483                 if (opt) {
  2098                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1484                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2099                     if (opt->twoIcons) {
  1485                     if (opt->twoIcons) {
  2100                         iconItem->setIconName("qtg_mono_new_event");
  1486                         iconItem->setIconName("qtg_mono_new_event");
  2261                             iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_l"));
  1647                             iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_l"));
  2262                         } else {
  1648                         } else {
  2263                             iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_l"));
  1649                             iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_l"));
  2264                         }
  1650                         }
  2265                     }
  1651                     }
       
  1652                     iconItem->update();
  2266                 }
  1653                 }
  2267                 break;
  1654                 break;
  2268             }
  1655             }
  2269 
  1656 
  2270             case P_TitlePane_text: {
  1657             case P_TitlePane_text: {
  2271                 const HbStyleOptionTitlePane *opt = qstyleoption_cast<const HbStyleOptionTitlePane *>(option);
  1658                 const HbStyleOptionTitlePane *opt = qstyleoption_cast<const HbStyleOptionTitlePane *>(option);
  2272 
  1659 
  2273                 if (opt) {
  1660                 if (opt) {
  2274                     HbMarqueeItem *marqueeItem = static_cast<HbMarqueeItem*>( item );
  1661                     HbMarqueeItem *marqueeItem = static_cast<HbMarqueeItem*>(item);
  2275                     if (marqueeItem) {
  1662                     if (marqueeItem) {
  2276                         marqueeItem->setText(opt->caption);
  1663                         marqueeItem->setText(opt->caption);
       
  1664                         if (opt->margueeAnimation) {
       
  1665                             marqueeItem->startAnimation();
       
  1666                         }
  2277                     }
  1667                     }
  2278                 }
  1668                 }
  2279                 break;
  1669                 break;
  2280             }
  1670             }
  2281 
  1671 
  2317             case P_PushButton_focus: {
  1707             case P_PushButton_focus: {
  2318                 if (const HbStyleOptionPushButton *opt =
  1708                 if (const HbStyleOptionPushButton *opt =
  2319                         qstyleoption_cast<const HbStyleOptionPushButton *>(option)) {
  1709                         qstyleoption_cast<const HbStyleOptionPushButton *>(option)) {
  2320                      HbFrameItem *iconItem  = static_cast<HbFrameItem*>(item);
  1710                      HbFrameItem *iconItem  = static_cast<HbFrameItem*>(item);
  2321                      iconItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_btn_highlight"));
  1711                      iconItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_btn_highlight"));
  2322                      int margin = 4;
  1712                      //int margin = 4;
  2323                      QRectF focusRect  = opt->rect.adjusted(-margin , -margin , margin , margin);
  1713                      //QRectF focusRect  = opt->rect.adjusted(-margin , -margin , margin , margin);
  2324                      iconItem->setGeometry(focusRect);
  1714                      iconItem->setGeometry(opt->boundingRect);
  2325                      iconItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  1715                      iconItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  2326                  }
  1716                  }
  2327                 break;
  1717                 break;
  2328             }
  1718             }
  2329             case P_ToolButton_frame:{
  1719             case P_ToolButton_frame:{
  2336                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
  1726                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
  2337                 }
  1727                 }
  2338 
  1728 
  2339                 QStringList list;
  1729                 QStringList list;
  2340                 QString frameGraphicsFooter;
  1730                 QString frameGraphicsFooter;
  2341                 QIcon::Mode mode = d->iconMode(opt->state);
  1731                 QIcon::Mode mode = iconMode(opt->state);
  2342                 QIcon::State state = d->iconState(opt->state);
  1732                 QIcon::State state = iconState(opt->state);
  2343 
  1733 
  2344                 if (!opt->customBackground.isNull()) {
  1734                 if (!opt->customBackground.isNull()) {
  2345                     QString customName = opt->customBackground.iconName(mode, state);
  1735                     QString customName = opt->customBackground.iconName(mode, state);
  2346                     frameItem->frameDrawer().setFrameGraphicsName(customName);
  1736                     frameItem->frameDrawer().setFrameGraphicsName(customName);
  2347                     break;
  1737                     break;
  2454 
  1844 
  2455             case P_SliderTickMark_majoricon: {
  1845             case P_SliderTickMark_majoricon: {
  2456                  if (const HbStyleOptionSlider *opt =
  1846                  if (const HbStyleOptionSlider *opt =
  2457                         qstyleoption_cast<const HbStyleOptionSlider*>(option)) {
  1847                         qstyleoption_cast<const HbStyleOptionSlider*>(option)) {
  2458                         HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(item);
  1848                         HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(item);
  2459                         iconItem->setMode(d->iconMode(opt->state));
  1849                         iconItem->setMode(iconMode(opt->state));
  2460                         if ( opt->orientation ==Qt::Horizontal ){
  1850                         if ( opt->orientation ==Qt::Horizontal ){
  2461                             iconItem->setIconName( "qtg_graf_slider_h_tick_major" );
  1851                             iconItem->setIconName( "qtg_graf_slider_h_tick_major" );
  2462                         } else {
  1852                         } else {
  2463                             iconItem->setIconName ( "qtg_graf_slider_v_tick_major" );
  1853                             iconItem->setIconName ( "qtg_graf_slider_v_tick_major" );
  2464                         }
  1854                         }
  2465                         iconItem->setState(d->iconState(opt->state));
  1855                         iconItem->setState(iconState(opt->state));
  2466                     }
  1856                     }
  2467                  break;
  1857                  break;
  2468 
  1858 
  2469              }
  1859              }
  2470 
  1860 
  2471             case P_SliderTickMark_minoricon: {
  1861             case P_SliderTickMark_minoricon: {
  2472                  if (const HbStyleOptionSlider *opt =
  1862                  if (const HbStyleOptionSlider *opt =
  2473                         qstyleoption_cast<const HbStyleOptionSlider*>(option)) {
  1863                         qstyleoption_cast<const HbStyleOptionSlider*>(option)) {
  2474                         HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(item);
  1864                         HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(item);
  2475                         iconItem->setMode(d->iconMode(opt->state));
  1865                         iconItem->setMode(iconMode(opt->state));
  2476                         if ( opt->orientation ==Qt::Horizontal ){
  1866                         if ( opt->orientation ==Qt::Horizontal ){
  2477                             iconItem->setIconName( "qtg_graf_slider_h_tick_minor" );
  1867                             iconItem->setIconName( "qtg_graf_slider_h_tick_minor" );
  2478                         } else {
  1868                         } else {
  2479                             iconItem->setIconName ( "qtg_graf_slider_v_tick_minor" );
  1869                             iconItem->setIconName ( "qtg_graf_slider_v_tick_minor" );
  2480                         }
  1870                         }
  2481                         iconItem->setState(d->iconState(opt->state));
  1871                         iconItem->setState(iconState(opt->state));
  2482                     }
  1872                     }
  2483                  break;
  1873                  break;
  2484 
  1874 
  2485              }
  1875              }
  2486 
  1876 
  2527                     frameItem->setMaximum(opt->maximum);
  1917                     frameItem->setMaximum(opt->maximum);
  2528                     frameItem->setMinimum(opt->minimum);
  1918                     frameItem->setMinimum(opt->minimum);
  2529                     frameItem->setValue(opt->sliderValue);
  1919                     frameItem->setValue(opt->sliderValue);
  2530                     frameItem->setOrientation(opt->orientation);
  1920                     frameItem->setOrientation(opt->orientation);
  2531                     frameItem->setSpan( opt->span );
  1921                     frameItem->setSpan( opt->span );
       
  1922                     frameItem->setHandleRect(opt->handleRect);
  2532                     frameItem->update();
  1923                     frameItem->update();
  2533                 }
  1924                 }
  2534                 break;
  1925                 break;
  2535             }
  1926             }
  2536             case P_Slider_groove:{
  1927             case P_Slider_groove:{
  2560                             else {
  1951                             else {
  2561                                 name = QLatin1String("qtg_fr_slider_v_frame_pressed");
  1952                                 name = QLatin1String("qtg_fr_slider_v_frame_pressed");
  2562                             }
  1953                             }
  2563                         } else {
  1954                         } else {
  2564                                 name = QLatin1String("qtg_fr_slider_v_frame_disabled");
  1955                                 name = QLatin1String("qtg_fr_slider_v_frame_disabled");
  2565                         
  1956 
  2566                         }
  1957                         }
  2567                         type = HbFrameDrawer::ThreePiecesVertical;
  1958                         type = HbFrameDrawer::ThreePiecesVertical;
  2568                     }
  1959                     }
  2569 
  1960 
  2570                     frameItem->frameDrawer().setFrameGraphicsName(name);
  1961                     frameItem->frameDrawer().setFrameGraphicsName(name);
  2571                     frameItem->frameDrawer().setFrameType(type);
  1962                     frameItem->frameDrawer().setFrameType(type);
  2572                     frameItem->frameDrawer().setFillWholeRect(true);
  1963                     frameItem->frameDrawer().setFillWholeRect(true);                    
  2573                     break;
  1964                 }
  2574                 }
  1965                 break;
  2575             }
  1966             }
  2576 
  1967 
  2577             case P_Slider_thumb: {
  1968             case P_Slider_thumb: {
  2578                  if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider *>(option)){
  1969                  if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider *>(option)){
  2579                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1970                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2580                     // Set pixmap name and bounding rect
  1971                     // Set pixmap name and bounding rect
  2581                     QString thumbPath;
  1972                     QString thumbPath;
  2582                     if(opt->thumbPath.isNull())
  1973                     if(opt->thumbPath.isNull())
  2583                     {
  1974                     {
  2584                         thumbPath=d->logicalName(HbStyle::P_Slider_thumb, option);
  1975                         thumbPath=logicalName(HbStylePrivate::P_Slider_thumb, option);
  2585                     }
  1976                     }
  2586                     else
  1977                     else
  2587                     {
  1978                     {
  2588                         thumbPath=opt->thumbPath;
  1979                         thumbPath=opt->thumbPath;
  2589                         iconItem->setAlignment(Qt::AlignCenter);
  1980                     }
  2590                     }
  1981                     iconItem->setAlignment(Qt::AlignCenter);
  2591                     iconItem->setIconName(thumbPath);
  1982                     iconItem->setIconName(thumbPath);
  2592                     iconItem->setAspectRatioMode(Qt::KeepAspectRatio);
  1983                     iconItem->setAspectRatioMode(Qt::KeepAspectRatio);
  2593                  }
  1984                  }
  2594                 break;
  1985                 break;
  2595             }
  1986             }
  2596             case HbStyle::P_SliderElement_increase:
  1987             case HbStylePrivate::P_SliderElement_increase:
  2597                 {
  1988                 {
  2598                     if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider*>(option)) {
  1989                     if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider*>(option)) {
  2599                         HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1990                         HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2600                         iconItem->setZValue(1.0);
  1991                         iconItem->setZValue(1.0);
  2601                         iconItem->setMode(d->iconMode(opt->state));
  1992                         iconItem->setMode(iconMode(opt->state));
  2602                         iconItem->setState(d->iconState(opt->state));
  1993                         iconItem->setState(iconState(opt->state));
  2603                         if ( !opt->sliderElementIcon.isNull() ){
  1994                         if ( !opt->sliderElementIcon.isNull() ){
  2604                             iconItem->setIcon(opt->sliderElementIcon);
  1995                             iconItem->setIcon(opt->sliderElementIcon);
  2605                         } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) {
  1996                         } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) {
  2606                             iconItem->setIconName(QLatin1String("qtg_mono_vol_up"));
  1997                             iconItem->setIconName(QLatin1String("qtg_mono_vol_up"));
  2607                         } else if (opt->sliderType == HbStyleOptionSlider::ZoomType) {
  1998                         } else if (opt->sliderType == HbStyleOptionSlider::ZoomType) {
  2608                             iconItem->setIconName(QLatin1String("qtg_mono_zoom_in"));
  1999                             iconItem->setIconName(QLatin1String("qtg_mono_zoom_in"));
  2609                         }
  2000                         }
  2610                     }
  2001                     }
  2611                 break;
  2002                 break;
  2612                 }
  2003                 }
  2613             case HbStyle::P_SliderElement_decrease:
  2004             case HbStylePrivate::P_SliderElement_decrease:
  2614                 {
  2005                 {
  2615                     if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider*>(option)) {
  2006                     if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider*>(option)) {
  2616                         HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2007                         HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2617                         iconItem->setZValue(1.0);
  2008                         iconItem->setZValue(1.0);
  2618                         iconItem->setMode(d->iconMode(opt->state));
  2009                         iconItem->setMode(iconMode(opt->state));
  2619                         iconItem->setState(d->iconState(opt->state));
  2010                         iconItem->setState(iconState(opt->state));
  2620                         if ( !opt->sliderElementIcon.isNull() ){
  2011                         if ( !opt->sliderElementIcon.isNull() ){
  2621                             iconItem->setIcon(opt->sliderElementIcon);
  2012                             iconItem->setIcon(opt->sliderElementIcon);
  2622                         } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) {
  2013                         } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) {
  2623                             iconItem->setIconName(QLatin1String("qtg_mono_vol_down"));
  2014                             iconItem->setIconName(QLatin1String("qtg_mono_vol_down"));
  2624                         } else if (opt->sliderType == HbStyleOptionSlider::ZoomType) {
  2015                         } else if (opt->sliderType == HbStyleOptionSlider::ZoomType) {
  2625                             iconItem->setIconName(QLatin1String("qtg_mono_zoom_out"));
  2016                             iconItem->setIconName(QLatin1String("qtg_mono_zoom_out"));
  2626                         }
  2017                         }
  2627                     }
  2018                     }
  2628                 break;
  2019                 break;
  2629                 }
  2020                 }
  2630             case HbStyle::P_SliderElement_icon:
  2021             case HbStylePrivate::P_SliderElement_icon:
  2631                 {
  2022                 {
  2632                     if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider*>(option)) {
  2023                     if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider*>(option)) {
  2633                         HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2024                         HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2634                         iconItem->setZValue(1.0);
  2025                         iconItem->setZValue(1.0);
  2635                         iconItem->setMode(d->iconMode(opt->state));
  2026                         iconItem->setMode(iconMode(opt->state));
  2636                         iconItem->setState(d->iconState(opt->state));
  2027                         iconItem->setState(iconState(opt->state));
  2637                         if ( !opt->sliderElementIcon.isNull() ){
  2028                         if ( !opt->sliderElementIcon.isNull() ){
  2638                             iconItem->setIcon(opt->sliderElementIcon);
  2029                             iconItem->setIcon(opt->sliderElementIcon);
  2639                         } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) {
  2030                         } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) {
  2640                             if( opt->state & QStyle::State_Sunken) {
  2031                             if( opt->state & QStyle::State_Sunken) {
  2641                                 iconItem->setIconName(QLatin1String("qtg_mono_speaker_off"));
  2032                                 iconItem->setIconName(QLatin1String("qtg_mono_speaker_off"));
  2695                 break;
  2086                 break;
  2696             }
  2087             }
  2697             case P_ItemViewItem_radiobutton:
  2088             case P_ItemViewItem_radiobutton:
  2698             case P_ItemViewItem_checkbox:
  2089             case P_ItemViewItem_checkbox:
  2699             case P_ItemViewItem_selection:{
  2090             case P_ItemViewItem_selection:{
  2700                 if (const HbStyleOptionAbstractViewItem *opt = qstyleoption_cast<const HbStyleOptionAbstractViewItem *>(option)){
  2091                 Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_selection no more supported. Use refactored styling");
  2701                     HbIconItem *iconItem = static_cast<HbIconItem *>(item);
       
  2702                     iconItem->setAlignment(Qt::AlignCenter);
       
  2703 
       
  2704                     if (opt->viewItemType == Hb::ItemType_RadioButtonListViewItem) {
       
  2705                         if (opt->checkState == Qt::Checked) {
       
  2706                             iconItem->setState(QIcon::On);
       
  2707                             iconItem->setIconName(QLatin1String("qtg_small_radio_selected"));
       
  2708                         } else {
       
  2709                             iconItem->setState(QIcon::Off);
       
  2710                             iconItem->setIconName(QLatin1String("qtg_small_radio_unselected"));
       
  2711                         }
       
  2712                     } else {
       
  2713                         if (opt->checkState == Qt::Checked) {
       
  2714                             iconItem->setState(QIcon::On);
       
  2715                             if (opt->singleSelectionMode) {
       
  2716                                 iconItem->setIconName(QLatin1String("qtg_small_tick"));
       
  2717                             }
       
  2718                             else {
       
  2719                                 iconItem->setIconName(QLatin1String("qtg_small_selected"));
       
  2720                             }
       
  2721                         } else if (opt->checkState == Qt::PartiallyChecked) {
       
  2722                             iconItem->setState(QIcon::On);
       
  2723                             iconItem->setIconName(QLatin1String("qtg_small_selected_partial"));
       
  2724                         } else {
       
  2725                             iconItem->setState(QIcon::Off);
       
  2726                             if (opt->singleSelectionMode) {
       
  2727                                 iconItem->setIconName(QLatin1String(""));
       
  2728                             }
       
  2729                             else {
       
  2730                                 iconItem->setIconName(QLatin1String("qtg_small_unselected"));
       
  2731                             }
       
  2732                         }
       
  2733                     }
       
  2734                 }
       
  2735                 break;
  2092                 break;
  2736             }
  2093             }
  2737 
  2094 
  2738             case P_LineEdit_frame_normal:{
  2095             case P_LineEdit_frame_normal:{
  2739                 if (HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>( item ) ) {
  2096                 if (HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>( item ) ) {
  2740                     frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_lineedit_normal"));
  2097                     if(frameItem->isEnabled()) {
       
  2098                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_lineedit_normal"));
       
  2099                     } else {
       
  2100                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_lineedit_disabled"));
       
  2101                     }
  2741                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  2102                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  2742                 }
  2103                 }
  2743             break;
  2104             break;
  2744             }
  2105             }
  2745 
  2106 
  2754             break;
  2115             break;
  2755             }
  2116             }
  2756 
  2117 
  2757             case P_TextEdit_frame_normal:{
  2118             case P_TextEdit_frame_normal:{
  2758                 if (HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>( item ) ) {
  2119                 if (HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>( item ) ) {
  2759                     frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_textedit_normal"));
  2120                     if(frameItem->isEnabled()) {
       
  2121                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_textedit_normal"));
       
  2122                     } else {
       
  2123                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_textedit_disabled"));
       
  2124                     }
  2760                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  2125                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  2761                 }
  2126                 }
  2762             break;
  2127             break;
  2763             }
  2128             }
  2764 
  2129 
  2816 
  2181 
  2817             case P_Edit_text:{
  2182             case P_Edit_text:{
  2818                 break;
  2183                 break;
  2819             }
  2184             }
  2820 
  2185 
  2821             case P_MenuItem_frame:{
       
  2822                         HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
       
  2823                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
       
  2824                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_list_normal"));
       
  2825                     break;
       
  2826                 }
       
  2827             case P_MenuItem_focus:{
       
  2828                         HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
       
  2829                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
       
  2830                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_list_pressed"));
       
  2831                     break;
       
  2832                 }
       
  2833 
       
  2834             case P_Label_text:
  2186             case P_Label_text:
  2835                  if (const HbStyleOptionLabel *opt = qstyleoption_cast<const HbStyleOptionLabel*>(option)) {
  2187                  if (const HbStyleOptionLabel *opt = qstyleoption_cast<const HbStyleOptionLabel*>(option)) {
  2836                     HbTextItem *textItem = static_cast<HbTextItem*>(item);
  2188                     HbTextItem *textItem = static_cast<HbTextItem*>(item);
  2837                     textItem->setAlignment(opt->alignment);
  2189                     textItem->setAlignment(opt->alignment);
  2838                     textItem->setElideMode(opt->elideMode);
  2190                     textItem->setElideMode(opt->elideMode);
  2842                     }
  2194                     }
  2843                     if (opt->color.isValid()) {
  2195                     if (opt->color.isValid()) {
  2844                         textItem->setTextColor(opt->color);
  2196                         textItem->setTextColor(opt->color);
  2845                     }
  2197                     }
  2846                     textItem->setText(opt->text);
  2198                     textItem->setText(opt->text);
       
  2199                     textItem->setMaximumLines(opt->maximumLines);
  2847                  }
  2200                  }
  2848                  break;
  2201                  break;
  2849             case P_Label_richtext:
  2202             case P_Label_richtext:
  2850                 if (const HbStyleOptionLabel *opt = qstyleoption_cast<const HbStyleOptionLabel*>(option)) {
  2203                 if (const HbStyleOptionLabel *opt = qstyleoption_cast<const HbStyleOptionLabel*>(option)) {
  2851                     HbRichTextItem *textItem = static_cast<HbRichTextItem*>(item);
  2204                     HbRichTextItem *textItem = static_cast<HbRichTextItem*>(item);
  2858                         textItem->setTextDefaultColor(opt->color);
  2211                         textItem->setTextDefaultColor(opt->color);
  2859                     }
  2212                     }
  2860                     textItem->setText(opt->text);
  2213                     textItem->setText(opt->text);
  2861                 }
  2214                 }
  2862                 break;
  2215                 break;
  2863 
  2216             case P_Popup_heading_frame: {
  2864             case P_MenuItem_submenuindicator:
       
  2865                 if (const HbStyleOptionMenuItem *opt = qstyleoption_cast<const HbStyleOptionMenuItem *>(option)) {
       
  2866                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
       
  2867                     Q_UNUSED(opt)
       
  2868                     iconItem->setIconName(QLatin1String("qtg_mono_options_menu"));
       
  2869                 }
       
  2870                 break;
       
  2871 
       
  2872             case P_MenuItem_checkindicator:
       
  2873                 if (const HbStyleOptionMenuItem *opt = qstyleoption_cast<const HbStyleOptionMenuItem *>(option)) {
       
  2874                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
       
  2875                     if (opt->checked) {
       
  2876                         iconItem->setIconName(QLatin1String("qtg_small_tick"));
       
  2877                     } else {
       
  2878                         iconItem->setIcon(HbIcon());
       
  2879                     }
       
  2880                 }
       
  2881                 break;
       
  2882 
       
  2883             case P_MenuItem_separator:
       
  2884                 if (const HbStyleOptionMenuItem *opt = qstyleoption_cast<const HbStyleOptionMenuItem *>(option)) {
       
  2885                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
       
  2886                     Q_UNUSED(opt)
       
  2887                     iconItem->setAspectRatioMode(Qt::IgnoreAspectRatio);
       
  2888                     iconItem->setAlignment(Qt::AlignCenter);
       
  2889                     iconItem->setIconName(QLatin1String("qtg_graf_popup_separator"));
       
  2890                 }
       
  2891                 break;
       
  2892 
       
  2893             case P_ScrollBar_groove:
       
  2894                 if (const HbStyleOptionScrollBar *opt = qstyleoption_cast<const HbStyleOptionScrollBar *>(option)) {
       
  2895                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
       
  2896                     if (opt->interactive) {
       
  2897                         if (opt->groovePressed) {
       
  2898                             if (opt->orientation == Qt::Vertical) {
       
  2899                                 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
       
  2900                                 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_v_active_frame_pressed"));
       
  2901                             } else {
       
  2902                                 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
       
  2903                                 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_h_active_frame_pressed"));
       
  2904                             }
       
  2905                         } else {
       
  2906                             if (opt->orientation == Qt::Vertical) {
       
  2907                                 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
       
  2908                                 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_v_active_frame_normal"));
       
  2909                             } else {
       
  2910                                 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
       
  2911                                 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_h_active_frame_normal"));
       
  2912                             }
       
  2913                         }
       
  2914                     } else {
       
  2915                         if (opt->orientation == Qt::Vertical) {
       
  2916                             frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
       
  2917                             frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_v_frame"));
       
  2918                         } else {
       
  2919                             frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
       
  2920                             frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_h_frame"));
       
  2921                         }
       
  2922                     }
       
  2923 
       
  2924                     frameItem->frameDrawer().setFillWholeRect(true);
       
  2925                 }
       
  2926                 break;
       
  2927 
       
  2928             case P_ScrollBar_handle:
       
  2929                 if (const HbStyleOptionScrollBar *opt = qstyleoption_cast<const HbStyleOptionScrollBar *>(option)) {
       
  2930                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
       
  2931                     if (opt->interactive) {
       
  2932                         if (opt->thumbPressed) {
       
  2933                             if (opt->orientation == Qt::Vertical) {
       
  2934                                 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
       
  2935                                 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_v_active_handle_pressed"));
       
  2936                             } else {
       
  2937                                 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
       
  2938                                 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_h_active_handle_pressed"));
       
  2939                             }
       
  2940                         } else {
       
  2941                             if (opt->orientation == Qt::Vertical) {
       
  2942                                 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
       
  2943                                 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_v_active_handle_normal"));
       
  2944                             } else {
       
  2945                                 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
       
  2946                                 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_h_active_handle_normal"));
       
  2947                             }
       
  2948                         }
       
  2949                     } else {
       
  2950                         if (opt->orientation == Qt::Vertical) {
       
  2951                             frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
       
  2952                             frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_v_handle"));
       
  2953                         } else {
       
  2954                             frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
       
  2955                             frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_h_handle"));
       
  2956                         }
       
  2957                     }
       
  2958                     frameItem->frameDrawer().setFillWholeRect(true);
       
  2959                 }
       
  2960                 break;
       
  2961 
       
  2962             case P_Popup_background:
       
  2963                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) {
       
  2964                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
       
  2965                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
       
  2966                     frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup"));
       
  2967                     frameItem->setGeometry(opt->boundingRect);
       
  2968                 }
       
  2969                 break;
       
  2970             case P_Popup_background_weak:
       
  2971                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) {
       
  2972                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
       
  2973                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
       
  2974                     frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_secondary"));
       
  2975                     frameItem->setGeometry(opt->boundingRect);
       
  2976                 }
       
  2977                 break;
       
  2978 
       
  2979             case P_Popup_heading_frame:
       
  2980                 if (const HbStyleOptionPopup *opt = qstyleoption_cast<const HbStyleOptionPopup *>(option)) {
  2217                 if (const HbStyleOptionPopup *opt = qstyleoption_cast<const HbStyleOptionPopup *>(option)) {
  2981                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
  2218                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
  2982                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
  2219                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
  2983                     frameItem->setGeometry(opt->boundingRect);
  2220                     frameItem->setGeometry(opt->boundingRect);
  2984                     if (opt->headingMode == QIcon::Active) {
  2221                     if (opt->headingMode == QIcon::Active) {
  2988                     } else {
  2225                     } else {
  2989                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_heading_normal"));
  2226                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_heading_normal"));
  2990                     }
  2227                     }
  2991                 }
  2228                 }
  2992                 break;
  2229                 break;
  2993 
  2230             }
  2994             case P_ComboBoxPopup_background:
  2231 
  2995                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) {
  2232             case P_ComboBoxPopup_background: {         
  2996                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
  2233                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
  2997                         if(!frameItem){
  2234                     if(!frameItem){
  2998                            return;
  2235                            return;
  2999                         }
  2236                     }
  3000                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  2237                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  3001                     frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_secondary"));
  2238                     frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_secondary"));
  3002                     frameItem->setGeometry(opt->boundingRect);
       
  3003                 }
       
  3004                 break;
       
  3005 
       
  3006             case P_ToolTip_background:
       
  3007                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) {
       
  3008                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
       
  3009                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
       
  3010                     frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_preview"));
       
  3011                     frameItem->setGeometry(opt->boundingRect);
       
  3012                 }
  2239                 }
  3013                 break;
  2240                 break;
  3014 
  2241 
  3015             case P_NotificationDialog_frame:
  2242             case P_NotificationDialog_frame:
  3016                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) {
  2243                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) {
  3073                 break;
  2300                 break;
  3074 
  2301 
  3075             case P_MessageBox_text:    //deprecated
  2302             case P_MessageBox_text:    //deprecated
  3076                 if (const HbStyleOptionMessageBox *opt = static_cast<const HbStyleOptionMessageBox *>(option)) {
  2303                 if (const HbStyleOptionMessageBox *opt = static_cast<const HbStyleOptionMessageBox *>(option)) {
  3077                     HbTextItem *textItem = static_cast<HbTextItem*>(item);
  2304                     HbTextItem *textItem = static_cast<HbTextItem*>(item);
  3078                     textItem->setAlignment(opt->textAlignment);
  2305                     textItem->setTextWrapping(Hb::TextWordWrap);
  3079 
       
  3080                     if (opt->textWrapping) {
       
  3081                         textItem->setTextWrapping(Hb::TextWrapAnywhere);
       
  3082                     } else {
       
  3083                         textItem->setTextWrapping(Hb::TextNoWrap);
       
  3084                     }
       
  3085                     textItem->setText(opt->text);
  2306                     textItem->setText(opt->text);
  3086                 }
  2307                 }
  3087                 break;
  2308                 break;
  3088             case P_MessageBox_icon:
  2309             case P_MessageBox_icon:
  3089                 if (const HbStyleOptionMessageBox *opt = static_cast<const HbStyleOptionMessageBox *>(option)) {
  2310                 if (const HbStyleOptionMessageBox *opt = static_cast<const HbStyleOptionMessageBox *>(option)) {
  3107                         icon->setIcon(opt->icon);
  2328                         icon->setIcon(opt->icon);
  3108                     }
  2329                     }
  3109                 }
  2330                 }
  3110                 break;
  2331                 break;
  3111             case P_ListViewItem_text:
  2332             case P_ListViewItem_text:
  3112                 if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) {
  2333                 Q_ASSERT_X(false, "HbStyle" , "P_ListViewItem_text no more supported. Use refactored styling");
  3113                     HbTextItem *textItem = static_cast<HbTextItem*>(item);
       
  3114 
       
  3115                     if (opt->index == 1) {
       
  3116                         if (opt->multilineSecondaryTextSupported) {
       
  3117                             if (opt->minimumLines != -1) {
       
  3118                                 // min & max secondary text row counts set by app
       
  3119                                 Hb::TextWrapping wrapping = Hb::TextNoWrap;
       
  3120                                 if (    opt->minimumLines != 1
       
  3121                                     ||  opt->maximumLines != 1) {
       
  3122                                     wrapping = Hb::TextWordWrap;
       
  3123                                 }
       
  3124                                 textItem->setTextWrapping(wrapping);
       
  3125                                 textItem->setMinimumLines(opt->minimumLines);
       
  3126                                 textItem->setMaximumLines(opt->maximumLines);
       
  3127                             } else {
       
  3128                                 // min & max secondary text row counts not set by app. Allow setting those from .css
       
  3129                                 // Needed when multilineSecondaryTextSupported changed from FALSE to TRUE and
       
  3130                                 // min & max secondary text row counts has not bee set by app
       
  3131                                 HbWidgetBasePrivate *widgetBasePrivate = d->widgetBasePrivate(textItem);
       
  3132                                 widgetBasePrivate->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode, false);
       
  3133                                 widgetBasePrivate->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMin, false);
       
  3134                                 widgetBasePrivate->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMax, false);
       
  3135                             }
       
  3136                         } else {
       
  3137                             // min & max secondary text row counts must always be 1. They cannot be overridden by .css
       
  3138                             textItem->setTextWrapping(Hb::TextNoWrap);
       
  3139                             textItem->setMinimumLines(1);
       
  3140                             textItem->setMaximumLines(1);
       
  3141                         }
       
  3142                     } // else - default values from .css still in use
       
  3143                     setItemName(textItem, QLatin1String("text-") + QString::number(opt->index + 1));
       
  3144                     textItem->setText(opt->content.value<QString>());
       
  3145                 }
       
  3146                 break;
  2334                 break;
  3147             case P_ListViewItem_richtext:
  2335             case P_ListViewItem_richtext:
  3148                 if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) {
  2336                 Q_ASSERT_X(false, "HbStyle" , "P_ListViewItem_richtext no more supported. Use refactored styling");
  3149                     HbRichTextItem *label = static_cast<HbRichTextItem*>(item);
       
  3150                     label->setText(opt->content.value<QString>());
       
  3151 
       
  3152                     setItemName(label, QLatin1String("text-") + QString::number(opt->index + 1));
       
  3153                 }
       
  3154                 break;
  2337                 break;
  3155             case P_ListViewItem_icon:
  2338             case P_ListViewItem_icon:
  3156                 if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) {
  2339                 Q_ASSERT_X(false, "HbStyle" , "P_ListViewItem_icon no more supported. Use refactored styling");
  3157                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
       
  3158 
       
  3159                     setItemName(iconItem, QLatin1String("icon-") + QString::number(opt->index + 1));
       
  3160                     if (iconItem->zValue() != opt->index + 1) {
       
  3161                         iconItem->setZValue(opt->index + 1);
       
  3162                     }
       
  3163 
       
  3164                     if (opt->content.canConvert<HbIcon>()){
       
  3165                         iconItem->setIcon(opt->content.value<HbIcon>());
       
  3166                     } if (opt->content.canConvert<QIcon>()){
       
  3167                         iconItem->setIcon(opt->content.value<QIcon>());
       
  3168                     }
       
  3169                 }
       
  3170                 break;
  2340                 break;
  3171             case P_GridViewItem_icon:
  2341             case P_GridViewItem_icon:
  3172                 if (const  HbStyleOptionGridViewItem*opt = qstyleoption_cast<const HbStyleOptionGridViewItem*>(option)) {
  2342                 Q_ASSERT_X(false, "HbStyle" , "P_GridViewItem_icon no more supported. Use refactored styling");
  3173                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2343                 break;
  3174                     iconItem->setIcon(opt->icon);
       
  3175                     iconItem->setAlignment(Qt::AlignCenter);
       
  3176                     iconItem->setAspectRatioMode(Qt::KeepAspectRatio);
       
  3177                 }
       
  3178                 break;
       
  3179 
       
  3180             case P_ColorGridViewItem_colorIcon:
       
  3181                 if (const  HbStyleOptionColorGridViewItem* opt = qstyleoption_cast<const HbStyleOptionColorGridViewItem*>(option)) {
       
  3182                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
       
  3183                     if(!iconItem)
       
  3184                         return;
       
  3185                     iconItem->setColor(opt->color);
       
  3186                     iconItem->setZValue(iconItem->parentItem()->zValue()+2);
       
  3187                 }
       
  3188                 break;
       
  3189             case P_ColorGridViewItem_borderIcon:
       
  3190                 if (const  HbStyleOptionColorGridViewItem* opt = qstyleoption_cast<const HbStyleOptionColorGridViewItem*>(option)) {
       
  3191                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
       
  3192                     if(!iconItem)
       
  3193                         return;
       
  3194                     iconItem->setIconName(opt->borderIcon);
       
  3195                     iconItem->setColor(opt->borderColor);
       
  3196                     iconItem->setZValue(iconItem->parentItem()->zValue()+1);
       
  3197                 }
       
  3198                 break;
       
  3199             case P_ColorGridViewItem_checkIcon:
       
  3200                 if (const  HbStyleOptionColorGridViewItem* opt = qstyleoption_cast<const HbStyleOptionColorGridViewItem*>(option)) {
       
  3201                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
       
  3202                     if(!iconItem)
       
  3203                         return;
       
  3204                     Q_UNUSED(opt);
       
  3205                     iconItem->setZValue(iconItem->parentItem()->zValue()+3);
       
  3206                 }
       
  3207                 break;
       
  3208 
       
  3209 
  2344 
  3210             case P_GridViewItem_text:
  2345             case P_GridViewItem_text:
  3211                 if (const  HbStyleOptionGridViewItem*opt = qstyleoption_cast<const HbStyleOptionGridViewItem*>(option)) {
  2346                 Q_ASSERT_X(false, "HbStyle" , "P_GridViewItem_text no more supported. Use refactored styling");
  3212                     HbTextItem *textItem = static_cast<HbTextItem*>(item);
       
  3213                     textItem->setAlignment(Qt::AlignCenter);
       
  3214                     textItem->setText(opt->text);
       
  3215                 }
       
  3216                 break;
  2347                 break;
  3217 
  2348 
  3218             case P_ItemHighlight_background:
  2349             case P_ItemHighlight_background:
  3219                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) {
  2350                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) {
  3220                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
  2351                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
  3222                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  2353                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  3223                     frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_highlight"));
  2354                     frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_highlight"));
  3224                     frameItem->setGeometry(opt->boundingRect);
  2355                     frameItem->setGeometry(opt->boundingRect);
  3225                 }
  2356                 }
  3226                 break;
  2357                 break;
  3227             case P_ToolBarExtension_background:
       
  3228                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) {
       
  3229                     Q_UNUSED(opt);
       
  3230                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
       
  3231                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
       
  3232                     frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_trans"));
       
  3233                 }
       
  3234                 break;
       
  3235             case P_SliderPopup_background:
  2358             case P_SliderPopup_background:
  3236                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) {
  2359                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) {
  3237                     Q_UNUSED(opt)
  2360                     Q_UNUSED(opt)
  3238                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
  2361                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
  3239                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  2362                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  3240                     frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_trans"));
  2363                     frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_trans"));
  3241                 }
  2364                 }
  3242                 break;
  2365                 break;
       
  2366 
  3243             case P_ProgressBar_frame:
  2367             case P_ProgressBar_frame:
  3244                 if (const HbStyleOptionProgressBar *opt = qstyleoption_cast<const HbStyleOptionProgressBar *>(option)) {
       
  3245                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
       
  3246                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
       
  3247                         if(opt->orientation == Qt::Horizontal){
       
  3248                        
       
  3249                                 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_h_frame"));
       
  3250                          }
       
  3251                       
       
  3252                         else{
       
  3253                             frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
       
  3254                             frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_v_frame"));
       
  3255                         }
       
  3256                   //  frameItem->frameDrawer().setFillWholeRect(true);
       
  3257                 }
       
  3258                 break;
  2368                 break;
  3259             case P_ProgressBar_track:
  2369             case P_ProgressBar_track:
  3260 
       
  3261                 if (const HbStyleOptionProgressBar *opt = qstyleoption_cast<const HbStyleOptionProgressBar *>(option)) {
       
  3262                     HbProgressTrackItem* frameItem = static_cast<HbProgressTrackItem*>(item);
       
  3263                     if(!frameItem->isVisible()) {
       
  3264                         break;
       
  3265                     }
       
  3266                     
       
  3267                     if(opt->orientation == Qt::Horizontal){
       
  3268                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
       
  3269                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_h_filled"));
       
  3270                      }
       
  3271                      else{
       
  3272                                frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
       
  3273                                frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_v_filled"));
       
  3274                      }
       
  3275                     
       
  3276                     frameItem->setMaximum(opt->maximum);
       
  3277                     frameItem->setMinimum(opt->minimum);
       
  3278                     frameItem->setValue(opt->progressValue);
       
  3279                     frameItem->setInverted(opt->inverted);
       
  3280                     //frameItem->setGeometry(opt->rect);
       
  3281                     frameItem->setOrientation(opt->orientation);
       
  3282                     frameItem->update();
       
  3283                 }
       
  3284                 break;
  2370                 break;
  3285             case P_ProgressBar_waittrack:
  2371             case P_ProgressBar_waittrack:
  3286                 if (const HbStyleOptionProgressBar *opt = qstyleoption_cast<const HbStyleOptionProgressBar *>(option)) {
  2372                 break;
  3287                     HbRepeatIconItem *iconItem = static_cast<HbRepeatIconItem*>(item);
       
  3288                     iconItem->setOrientation(opt->orientation);
       
  3289                     if( !iconItem->isVisible() ) {
       
  3290                         break;
       
  3291                     }
       
  3292                     if(opt->orientation == Qt::Horizontal){
       
  3293                         iconItem->setName(QLatin1String("qtg_graf_progbar_h_wait"));
       
  3294                     }
       
  3295                     else{
       
  3296                         iconItem->setName(QLatin1String("qtg_graf_progbar_v_wait"));
       
  3297                     }
       
  3298                     if(opt->stopWaitAnimation){
       
  3299                         iconItem->stopAnimation();
       
  3300                     }
       
  3301                     }
       
  3302                     break;
       
  3303 
       
  3304             case P_ProgressSlider_frame:
  2373             case P_ProgressSlider_frame:
  3305                 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) {
  2374                 break;
  3306                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
  2375             case P_ProgressSlider_track: 
  3307                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
  2376                 break;
  3308                    	if (opt->disableState ) {
  2377             case P_ProgressSlider_slidertrack: 
  3309                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_disabled"));
  2378                 break;
  3310 					}
  2379             case P_ProgressBar_mintext:
  3311 					else {
  2380                 break;
  3312 					     if(opt->pressedState) {
  2381             case P_ProgressBar_maxtext: 
  3313                                frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_pressed"));
  2382                 break;
  3314                          }
  2383             case P_RatingSlider_frame:
  3315                          else {
  2384                 break;
  3316                                frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_normal"));
  2385             case P_RatingSlider_track:
  3317                          }
  2386                 break;
  3318 					}
  2387             case P_ProgressSliderHandle_icon:
  3319                     frameItem->frameDrawer().setFillWholeRect(true);
  2388                 break;
  3320                     //frameItem->update();
  2389 
  3321                     }
       
  3322                     break;
       
  3323             case P_ProgressSlider_track: // The ProgressValue Mask
       
  3324                 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) {
       
  3325                     HbProgressTrackItem* frameItem = static_cast<HbProgressTrackItem*>(item);
       
  3326                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
       
  3327 
       
  3328 					if (opt->disableState ) {
       
  3329                          frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_loaded_disabled"));
       
  3330 					}
       
  3331 					else {
       
  3332                          frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_loaded"));
       
  3333 					}
       
  3334                     frameItem->frameDrawer().setFillWholeRect(true);
       
  3335                     frameItem->setMaximum(opt->maximum);
       
  3336                     frameItem->setMinimum(opt->minimum);
       
  3337                     frameItem->setValue(opt->progressValue);
       
  3338                     frameItem->setInverted(opt->inverted);
       
  3339                     frameItem->setOrientation(opt->orientation);
       
  3340                     frameItem->update();
       
  3341                     }
       
  3342                     break;
       
  3343 
       
  3344             case P_ProgressSlider_slidertrack: // The Slider Position Mask
       
  3345                 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) {
       
  3346                     HbProgressTrackItem* frameItem = static_cast<HbProgressTrackItem*>(item);
       
  3347                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
       
  3348 					if (opt->disableState ) {
       
  3349                          frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_played_disabled"));
       
  3350 					}
       
  3351 					else {
       
  3352                          frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_played"));
       
  3353 					}
       
  3354                     frameItem->frameDrawer().setFillWholeRect(true);
       
  3355                     frameItem->setMaximum(opt->maximum);
       
  3356                     frameItem->setMinimum(opt->minimum);
       
  3357                     frameItem->setValue(opt->progressSliderValue);
       
  3358                     frameItem->setInverted(opt->inverted);
       
  3359                     frameItem->setOrientation(opt->orientation);
       
  3360                     frameItem->update();
       
  3361                     }
       
  3362                     break;
       
  3363             case P_ProgressBar_mintext: {
       
  3364                  if (const HbStyleOptionProgressBar *opt =
       
  3365                         qstyleoption_cast<const HbStyleOptionProgressBar*>(option)) {
       
  3366                         HbTextItem *textItem = static_cast<HbTextItem*>(item);
       
  3367                         if(!item) {
       
  3368                             return;
       
  3369                         }
       
  3370                         textItem->setTextWrapping(Hb::TextWrapAnywhere);
       
  3371                         textItem->setText(opt->minText);
       
  3372                     }
       
  3373                  break;
       
  3374             }
       
  3375 
       
  3376             case P_ProgressBar_maxtext: {
       
  3377                 if (const HbStyleOptionProgressBar *opt =
       
  3378                         qstyleoption_cast<const HbStyleOptionProgressBar*>(option)) {
       
  3379                         HbTextItem *textItem = static_cast<HbTextItem*>(item);
       
  3380                         if(!item) {
       
  3381                             return;
       
  3382                         }
       
  3383                         textItem->setTextWrapping(Hb::TextWrapAnywhere);
       
  3384                         textItem->setText(opt->maxText);
       
  3385                     }
       
  3386                 break;
       
  3387             }
       
  3388 
       
  3389             case P_RatingSlider_frame:{
       
  3390                 if (const HbStyleOptionRatingSlider *opt = qstyleoption_cast<const HbStyleOptionRatingSlider *>(option)) {
       
  3391                     HbRepeatItem *repeatItem = static_cast<HbRepeatItem*>(item);
       
  3392                     repeatItem->setRepeatingNumber(opt->noOfStars);
       
  3393                     if (!opt->unRatedGraphicsName.isEmpty()) {
       
  3394                         repeatItem->setName(opt->unRatedGraphicsName);
       
  3395                     }
       
  3396                     else {
       
  3397                         if(opt->disableState) {
       
  3398                              repeatItem->setName(QLatin1String("qtg_graf_ratingslider_unrated_disabled"));
       
  3399 
       
  3400                         }
       
  3401                         else {
       
  3402 							if(opt->pressedState) {
       
  3403 
       
  3404 								repeatItem->setName(QLatin1String("qtg_graf_ratingslider_unrated_pressed"));
       
  3405 							}
       
  3406 							else {
       
  3407                             
       
  3408 								repeatItem->setName(QLatin1String("qtg_graf_ratingslider_unrated"));
       
  3409 							}
       
  3410                         }
       
  3411                     }
       
  3412                     repeatItem->setGeometry(opt->boundingRect);
       
  3413                     repeatItem->update();
       
  3414                 }
       
  3415                 break;
       
  3416             }
       
  3417 
       
  3418             case P_RatingSlider_track:{
       
  3419                 if (const HbStyleOptionRatingSlider *opt = qstyleoption_cast<const HbStyleOptionRatingSlider *>(option)) {
       
  3420                     HbRepeatMaskItem *repeatItem = static_cast<HbRepeatMaskItem*>(item);
       
  3421                     repeatItem->setMaskValue(opt->progressValue);
       
  3422                     repeatItem->setMaximum(opt->noOfIntervals);
       
  3423                     repeatItem->setInverted(opt->inverted);
       
  3424                     repeatItem->setRepeatingNumber(opt->noOfStars);
       
  3425                     if (!opt->ratedGraphicsName.isEmpty()) {
       
  3426                         repeatItem->setName(opt->ratedGraphicsName);
       
  3427                     }
       
  3428                     else {
       
  3429                         if(opt->disableState) {
       
  3430                             repeatItem->setName(QLatin1String("qtg_graf_ratingslider_rated_disabled"));
       
  3431 
       
  3432 
       
  3433                         }
       
  3434                         else {
       
  3435 
       
  3436 							if(opt->pressedState) {
       
  3437 
       
  3438 								repeatItem->setName(QLatin1String("qtg_graf_ratingslider_rated_pressed"));
       
  3439 							}
       
  3440 							else {
       
  3441 								repeatItem->setName(QLatin1String("qtg_graf_ratingslider_rated"));
       
  3442 							}
       
  3443                         }
       
  3444                     }
       
  3445                     repeatItem->setGeometry(opt->boundingRect);
       
  3446                     repeatItem->update();
       
  3447                 }
       
  3448                 break;
       
  3449             }
       
  3450         case P_ProgressSliderHandle_icon:
       
  3451                     if (const HbStyleOptionProgressSliderHandle *opt = qstyleoption_cast<const HbStyleOptionProgressSliderHandle *>(option)) {
       
  3452                         HbIconItem *iconItem = static_cast<HbIconItem*>(item);
       
  3453 
       
  3454                         if(!opt->handleIcon.isNull()) {
       
  3455                             iconItem->setIconName(opt->handleIcon.iconName());
       
  3456                         }
       
  3457                         else {
       
  3458                             if(opt->pressedState) {
       
  3459                                 iconItem->setIconName(QLatin1String("qtg_graf_progslider_handle_pressed"));
       
  3460                             }
       
  3461                             else {
       
  3462                                 iconItem->setIconName(QLatin1String("qtg_graf_progslider_handle_normal"));
       
  3463                             }
       
  3464                         }
       
  3465                     }
       
  3466                     break;
       
  3467             case P_QueryInputMode_image:
  2390             case P_QueryInputMode_image:
  3468 
  2391 
  3469              /*   if (const HbStyleOptionInputPopup *opt = qstyleoption_cast<const HbStyleOptionInputPopup *>(option)){
  2392              /*   if (const HbStyleOptionInputPopup *opt = qstyleoption_cast<const HbStyleOptionInputPopup *>(option)){
  3470                     if (HbIconItem *iconItem = static_cast<HbIconItem*>(item)) {
  2393                     if (HbIconItem *iconItem = static_cast<HbIconItem*>(item)) {
  3471                        iconItem->setIcon(*opt->modeIcon);
  2394                        iconItem->setIcon(*opt->modeIcon);
  3472                        iconItem->setPos(opt->editRect.width() - opt->modeIcon->width() - 6,opt->editRect.top()-3);
  2395                        iconItem->setPos(opt->editRect.width() - opt->modeIcon->width() - 6,opt->editRect.top()-3);
  3473                     }
  2396                     }
  3474                 }*/
  2397                 }*/
  3475                 break;
  2398                 break;
  3476             case P_ItemViewItem_background:
  2399             case P_ItemViewItem_background:
  3477                 if (const HbStyleOptionAbstractViewItem *opt = qstyleoption_cast<const HbStyleOptionAbstractViewItem *>(option)) {
  2400                 Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_background no more supported. Use refactored styling");
  3478                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
       
  3479                     iconItem->setGeometry(opt->boundingRect);
       
  3480                     if (opt->background.canConvert<HbIcon>()){
       
  3481                         iconItem->setIcon(opt->background.value<HbIcon>());
       
  3482                     } else if (opt->background.canConvert<QBrush>()){
       
  3483                         iconItem->setBrush(opt->background.value<QBrush>());
       
  3484                     }
       
  3485                 }
       
  3486 
       
  3487                 break;
  2401                 break;
  3488             case P_ItemViewItem_frame:
  2402             case P_ItemViewItem_frame:
  3489                 if (const HbStyleOptionAbstractViewItem *opt = qstyleoption_cast<const HbStyleOptionAbstractViewItem *>(option)) {
  2403                 Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_frame no more supported. Use refactored styling");
  3490                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
       
  3491                     frameItem->setGeometry(opt->boundingRect);
       
  3492 
       
  3493                     if (opt->background.canConvert<HbFrameBackground>()) {
       
  3494                         HbFrameBackground frame = opt->background.value<HbFrameBackground>();
       
  3495                         frameItem->frameDrawer().setFrameType(frame.frameType());
       
  3496                         frameItem->frameDrawer().setFrameGraphicsName(frame.frameGraphicsName());
       
  3497                     } else if (opt->viewItemType == Hb::ItemType_TreeViewItem) {
       
  3498                         if (opt->modelItemType == Hb::ParentItem) {
       
  3499                             frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
       
  3500                             frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ?
       
  3501                                 QLatin1String("qtg_fr_popup_list_parent_normal") : QLatin1String("qtg_fr_list_parent_normal"));
       
  3502                         } else if (opt->modelItemType == Hb::SeparatorItem) {
       
  3503                             frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
       
  3504                             frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_separator"));
       
  3505                         } else {
       
  3506                             frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
       
  3507                             frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ?
       
  3508                                 QLatin1String("qtg_fr_popup_list_normal") : QLatin1String("qtg_fr_list_normal"));
       
  3509                         }
       
  3510                     } else if ( opt->viewItemType == Hb::ItemType_ListViewItem
       
  3511                                 || opt->viewItemType == Hb::ItemType_RadioButtonListViewItem) {
       
  3512                         if (opt->modelItemType == Hb::SeparatorItem) {
       
  3513                             frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
       
  3514                             frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_separator"));
       
  3515                         } else {
       
  3516                             frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
       
  3517                             frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ?
       
  3518                                 QLatin1String("qtg_fr_popup_list_normal") : QLatin1String("qtg_fr_list_normal"));
       
  3519                         }
       
  3520                     } else if (opt->viewItemType == Hb::ItemType_GridViewItem
       
  3521                                 || opt->viewItemType == HbPrivate::ItemType_ColorGridViewItem) {
       
  3522                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
       
  3523                         frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ?
       
  3524                             QLatin1String("qtg_fr_popup_grid_normal") : QLatin1String("qtg_fr_grid_normal"));
       
  3525                     }
       
  3526                     else{
       
  3527                         frameItem->frameDrawer().setFrameGraphicsName(QString());
       
  3528                     }
       
  3529                 }
       
  3530                 break;
  2404                 break;
  3531             case P_ItemViewItem_focus:
  2405             case P_ItemViewItem_focus:
  3532                 if (const HbStyleOptionAbstractViewItem *opt = qstyleoption_cast<const HbStyleOptionAbstractViewItem *>(option)) {
  2406                 Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_focus no more supported. Use refactored styling");
  3533                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
  2407                 break;
  3534                     frameItem->setGeometry(opt->boundingRect);
       
  3535 
       
  3536                     if (opt->viewItemType == Hb::ItemType_TreeViewItem
       
  3537                         || opt->viewItemType == Hb::ItemType_ListViewItem
       
  3538                         || opt->viewItemType == Hb::ItemType_RadioButtonListViewItem) {
       
  3539                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
       
  3540                         frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ?
       
  3541                             QLatin1String("qtg_fr_popup_list_pressed") : QLatin1String("qtg_fr_list_pressed"));
       
  3542                     } else if (     opt->viewItemType == Hb::ItemType_GridViewItem
       
  3543                                 ||  opt->viewItemType == HbPrivate::ItemType_ColorGridViewItem) {
       
  3544                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
       
  3545                         frameItem->frameDrawer().setFrameGraphicsName(opt->insidePopup ?
       
  3546                             QLatin1String("qtg_fr_popup_grid_pressed") : QLatin1String("qtg_fr_grid_pressed"));
       
  3547                     } else {
       
  3548                         setItemName(frameItem,QString());
       
  3549                         frameItem->frameDrawer().setFrameGraphicsName(QString());
       
  3550                     }
       
  3551                 }
       
  3552                 break;
       
  3553             case P_SelectionControl_selectionstart://fallthrough
       
  3554             case P_SelectionControl_selectionend://fallthrough
       
  3555             {
       
  3556                 if (HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(item)) {
       
  3557                     iconItem->setSize(iconItem->preferredSize());
       
  3558                 }
       
  3559                 break;
       
  3560             }
       
  3561             case P_TreeViewItem_expandicon:
  2408             case P_TreeViewItem_expandicon:
  3562                 if (const HbStyleOptionTreeViewItem *opt = qstyleoption_cast<const HbStyleOptionTreeViewItem *>(option)) {
  2409                 Q_ASSERT_X(false, "HbStyle" , "P_TreeViewItem_expandicon no more supported. Use refactored styling");
  3563                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2410                 break;
  3564                     if (opt->expanded) {
       
  3565                         iconItem->setIconName(opt->insidePopup ? QLatin1String("qtg_mono_collapse") : QLatin1String("qtg_small_collapse"));
       
  3566                     } else {
       
  3567                         iconItem->setIconName(opt->insidePopup ? QLatin1String("qtg_mono_expand") : QLatin1String("qtg_small_expand"));
       
  3568                     }
       
  3569                 }
       
  3570                 break;
       
  3571             case P_ScrollArea_continuationbottom:
       
  3572                 if (HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>( item ) ) {
       
  3573                     frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_graf_list_mask_b"));
       
  3574                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::OnePiece);
       
  3575                     frameItem->setZValue(1);
       
  3576                 }
       
  3577                 break;
       
  3578             case P_ScrollArea_continuationtop:
       
  3579                 if (HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>( item ) ) {
       
  3580                     frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_graf_list_mask_t"));
       
  3581                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::OnePiece);
       
  3582                     frameItem->setZValue(1);
       
  3583                 }
       
  3584                 break;
       
  3585             case P_ScrollArea_continuationright:
       
  3586                 if (HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>( item ) ) {
       
  3587                     frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_graf_list_mask_r"));
       
  3588                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::OnePiece);
       
  3589                     frameItem->setZValue(1);
       
  3590                 }
       
  3591                 break;
       
  3592             case P_ScrollArea_continuationleft:
       
  3593                 if (HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>( item ) ) {
       
  3594                     frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_graf_list_mask_l"));
       
  3595                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::OnePiece);
       
  3596                     frameItem->setZValue(1);
       
  3597                 }
       
  3598                 break;
       
  3599 
       
  3600             case P_TumbleView_background:
  2411             case P_TumbleView_background:
  3601                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
  2412                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
  3602                     if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) {
  2413                     if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) {
  3603 
  2414 
  3604                         //Temporary source to avoid introducing new style primitive for selection dialog mark widget background item.
  2415                         //Temporary source to avoid introducing new style primitive for selection dialog mark widget background item.
  3608                         QString className;
  2419                         QString className;
  3609                         if(obj){
  2420                         if(obj){
  3610                             className = obj->className();
  2421                             className = obj->className();
  3611                         }
  2422                         }
  3612                         ///////////////////////////////////////////////////////////
  2423                         ///////////////////////////////////////////////////////////
  3613                         
  2424 
  3614                         if( !className.compare("HbTumbleView") ){
  2425                         if( !className.compare("HbTumbleView") ){
  3615                             frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_bg");
  2426                             frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_bg");
  3616                         }
  2427                         }
  3617                         else if( !className.compare("HbSelectionDialogMarkWidget") )
  2428                         else if( !className.compare("HbSelectionDialogMarkWidget") )
  3618                         {
  2429                         {
  3638                     }
  2449                     }
  3639                 }
  2450                 }
  3640                 break;
  2451                 break;
  3641 
  2452 
  3642             case P_TumbleView_highlight:
  2453             case P_TumbleView_highlight:
  3643                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
  2454                /* if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
  3644                     if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) {
  2455                     if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) {
  3645                         frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_highlight_pri");
  2456                         frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_highlight_pri");
  3646                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
  2457                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
  3647                         frameItem->setZValue(3);
  2458                         frameItem->setZValue(-1);
  3648                         //TODO:temp fix, issue with css rule picking in derived class
  2459                         //TODO:temp fix, issue with css rule picking in derived class
  3649 
  2460 
  3650                         //frameItem->setGeometry(0,(opt->boundingRect.height()-frameItem->boundingRect().height())/2,opt->boundingRect.width(),opt->boundingRect.height());
  2461                         //frameItem->setGeometry(0,(opt->boundingRect.height()-frameItem->boundingRect().height())/2,opt->boundingRect.width(),opt->boundingRect.height());
  3651                         Q_UNUSED(opt);
  2462                         Q_UNUSED(opt);
  3652                     }
  2463                     }
  3653 
  2464 
  3654                 }
  2465                 }*/
  3655                 break;
  2466                 break;
  3656 
  2467 
  3657             case P_IndexFeedback_popup_text:
  2468             case P_IndexFeedback_popup_text:
  3658                 if (const HbStyleOptionIndexFeedback *opt = qstyleoption_cast<const HbStyleOptionIndexFeedback *>(option)) {
  2469                 Q_ASSERT_X(false, "HbStyle" , "P_IndexFeedback_popup_text no more supported. Use refactored styling");
  3659                     HbTextItem *textItem = static_cast<HbTextItem*>(item);
       
  3660                     textItem->setFontSpec(opt->fontSpec);
       
  3661                     textItem->setGeometry(opt->textRect);
       
  3662                     textItem->setText(opt->text);
       
  3663                 }
       
  3664                 break;
  2470                 break;
  3665             case P_IndexFeedback_popup_background:
  2471             case P_IndexFeedback_popup_background:
  3666                 if (const HbStyleOptionIndexFeedback *opt = qstyleoption_cast<const HbStyleOptionIndexFeedback *>(option)) {
  2472                 Q_ASSERT_X(false, "HbStyle" , "P_IndexFeedback_popup_background no more supported. Use refactored styling");
  3667                     if (HbFrameItem* frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) {
       
  3668                         frameItem->setGeometry(opt->popupRect);
       
  3669                     }
       
  3670                 }
       
  3671                 break;
  2473                 break;
  3672             case P_DateTimePicker_background:
  2474             case P_DateTimePicker_background:
  3673                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
  2475                /* if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
  3674                     if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) {
  2476                     if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) {
  3675                         frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_bg");
  2477                         frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_bg");
  3676                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  2478                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  3677                         frameItem->setZValue(-5);
  2479                         frameItem->setZValue(-5);
  3678                         //TODO:temp fix, issue with css rule picking in derived class
  2480                         //TODO:temp fix, issue with css rule picking in derived class
  3679                         //frameItem->setGeometry(opt->boundingRect);
  2481                         //frameItem->setGeometry(opt->boundingRect);
  3680                         Q_UNUSED(opt);
  2482                         Q_UNUSED(opt);
  3681                     }
  2483                     }
  3682                 }
  2484                 }*/
  3683                 break;
  2485                 break;
  3684             case P_DateTimePicker_frame:
  2486             case P_DateTimePicker_frame:
  3685                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
  2487                /* if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
  3686                     if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) {
  2488                     if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) {
  3687                         frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_overlay");
  2489                         frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_overlay");
  3688                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  2490                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  3689                         frameItem->setZValue(1);
  2491                         frameItem->setZValue(1);
  3690                         //TODO:temp fix, issue with css rule picking in derived class
  2492                         //TODO:temp fix, issue with css rule picking in derived class
  3691                         //frameItem->setGeometry(opt->boundingRect);
  2493                         //frameItem->setGeometry(opt->boundingRect);
  3692                         Q_UNUSED(opt);
  2494                         Q_UNUSED(opt);
  3693                     }
  2495                     }
  3694                 }
  2496                 }*/
  3695                 break;
  2497                 break;
  3696             case P_DateTimePicker_separator:
  2498             case P_DateTimePicker_separator:
  3697                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
  2499                /* if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
  3698                     if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) {
  2500                     if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) {
  3699                         frameItem->frameDrawer().setFrameGraphicsName("qtg_graf_tumbler_divider");
  2501                         frameItem->frameDrawer().setFrameGraphicsName("qtg_graf_tumbler_divider");
  3700                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::OnePiece);
  2502                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::OnePiece);
  3701                         frameItem->setZValue(2);
  2503                         frameItem->setZValue(2);
  3702                         //TODO:temp fix, issue with css rule picking in derived class
  2504                         //TODO:temp fix, issue with css rule picking in derived class
  3703 
  2505 
  3704                         //frameItem->setGeometry(0,(opt->boundingRect.height()-frameItem->boundingRect().height())/2,opt->boundingRect.width(),opt->boundingRect.height());
  2506                         //frameItem->setGeometry(0,(opt->boundingRect.height()-frameItem->boundingRect().height())/2,opt->boundingRect.width(),opt->boundingRect.height());
  3705                         Q_UNUSED(opt);
  2507                         Q_UNUSED(opt);
  3706                     }
  2508                     }
  3707 
  2509 
  3708                 }
  2510                 }*/
  3709                 break;
  2511                 break;
  3710             case P_InputDialog_text:
  2512             case P_InputDialog_text:
  3711                 if (const HbStyleOptionInputDialog *opt =
  2513                 if (const HbStyleOptionInputDialog *opt =
  3712                     qstyleoption_cast<const HbStyleOptionInputDialog*>(option)) {
  2514                     qstyleoption_cast<const HbStyleOptionInputDialog*>(option)) {
  3713                     HbTextItem *textItem = static_cast<HbTextItem*>(item);
  2515                     HbTextItem *textItem = static_cast<HbTextItem*>(item);
  3714                     if(!item) {
  2516                     if(!item) {
  3715                         return;
  2517                         return;
  3716                     }
  2518                     }
  3717                     textItem->setTextWrapping(Hb::TextWrapAnywhere);
       
  3718                     textItem->setText(opt->text);
  2519                     textItem->setText(opt->text);
  3719                 }
  2520                 }
  3720                 break;
  2521                 break;
  3721              case P_InputDialog_additionaltext:
  2522              case P_InputDialog_additionaltext:
  3722                 if (const HbStyleOptionInputDialog *opt =
  2523                 if (const HbStyleOptionInputDialog *opt =
  3723                     qstyleoption_cast<const HbStyleOptionInputDialog*>(option)) {
  2524                     qstyleoption_cast<const HbStyleOptionInputDialog*>(option)) {
  3724                     HbTextItem *textItem = static_cast<HbTextItem*>(item);
  2525                     HbTextItem *textItem = static_cast<HbTextItem*>(item);
  3725                     if(!item) {
  2526                     if(!item) {
  3726                         return;
  2527                         return;
  3727                     }
  2528                     }
  3728                     textItem->setTextWrapping(Hb::TextWrapAnywhere);
       
  3729                     textItem->setText(opt->additionalText);
  2529                     textItem->setText(opt->additionalText);
  3730                 }
  2530                 }
  3731                 break;
  2531                 break;
  3732 
  2532 
  3733              default:
  2533              default:
  3813 
  2613 
  3814     const HbVector<HbCss::Declaration> decl = declarations(styleRules, name, widget, profile);
  2614     const HbVector<HbCss::Declaration> decl = declarations(styleRules, name, widget, profile);
  3815 #ifdef HBSTYLE_DEBUG
  2615 #ifdef HBSTYLE_DEBUG
  3816     qDebug() << "HbStyle::polishItem : -- Number of matching CSS declarations: " << decl.count();
  2616     qDebug() << "HbStyle::polishItem : -- Number of matching CSS declarations: " << decl.count();
  3817 #endif
  2617 #endif
  3818     HbCss::ValueExtractor extractor(decl, layoutParameters, profile);
  2618     HbCss::ValueExtractor extractor(decl, profile);
       
  2619     extractor.setLayoutParameters(layoutParameters);
  3819     HbCss::KnownProperties prop;
  2620     HbCss::KnownProperties prop;
  3820 
  2621 
  3821     if ( !extractor.extractKnownProperties(prop) ) {
  2622     if ( !extractor.extractKnownProperties(prop) ) {
  3822 #ifdef HBSTYLE_DEBUG
  2623 #ifdef HBSTYLE_DEBUG
  3823         qDebug() << "HbStyle::polishItem : -- No polish overrides found";
  2624         qDebug() << "HbStyle::polishItem : -- No polish overrides found";
  3927                 qDebug() << "HbStyle::polishItem : -- Setting wrap mode : " << prop.mTextWrapMode;
  2728                 qDebug() << "HbStyle::polishItem : -- Setting wrap mode : " << prop.mTextWrapMode;
  3928 #endif
  2729 #endif
  3929                 text->setTextWrapping( prop.mTextWrapMode );
  2730                 text->setTextWrapping( prop.mTextWrapMode );
  3930                 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode, false);
  2731                 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode, false);
  3931             }
  2732             }
       
  2733             if ( prop.mFlags & HbCss::ExtractedElideMode
       
  2734                 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextElideMode)) {
       
  2735 #ifdef HBSTYLE_DEBUG
       
  2736                 qDebug() << "HbStyle::polishItem : -- Setting elide mode : " << prop.mTextElideMode;
       
  2737 #endif
       
  2738                 text->setElideMode( prop.mTextElideMode );
       
  2739                 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextElideMode, false);
       
  2740             }
  3932         }
  2741         }
  3933 
  2742 
  3934         HbRichTextItem* richtext = qobject_cast<HbRichTextItem*>(hbWidget);
  2743         HbRichTextItem* richtext = qobject_cast<HbRichTextItem*>(hbWidget);
  3935         if (richtext) {
  2744         if (richtext) {
  3936             if ( prop.mFlags & HbCss::ExtractedAlignment
  2745             if ( prop.mFlags & HbCss::ExtractedAlignment
  4101 
  2910 
  4102     const HbVector<HbCss::Declaration> decl = declarations(styleRules, anchor->anchorId(), widget, profile);
  2911     const HbVector<HbCss::Declaration> decl = declarations(styleRules, anchor->anchorId(), widget, profile);
  4103 #ifdef HBSTYLE_DEBUG
  2912 #ifdef HBSTYLE_DEBUG
  4104     qDebug() << "HbStyle::polishAnchor : -- Number of matching CSS declarations: " << decl.count();
  2913     qDebug() << "HbStyle::polishAnchor : -- Number of matching CSS declarations: " << decl.count();
  4105 #endif
  2914 #endif
  4106     HbCss::ValueExtractor extractor(decl, layoutParameters, profile);
  2915     HbCss::ValueExtractor extractor(decl, profile);
       
  2916     extractor.setLayoutParameters(layoutParameters);
  4107     HbCss::KnownProperties prop;
  2917     HbCss::KnownProperties prop;
  4108 
  2918 
  4109     if ( !extractor.extractKnownProperties(prop) ) {
  2919     if ( !extractor.extractKnownProperties(prop) ) {
  4110 #ifdef HBSTYLE_DEBUG
  2920 #ifdef HBSTYLE_DEBUG
  4111         qDebug() << "HbStyle::polishAnchor : -- No polish overrides found";
  2921         qDebug() << "HbStyle::polishAnchor : -- No polish overrides found";
  4149 #endif
  2959 #endif
  4150         anchor->setDirection( prop.mAnchorDir );
  2960         anchor->setDirection( prop.mAnchorDir );
  4151     }
  2961     }
  4152 }
  2962 }
  4153 
  2963 
  4154 
       
  4155 
       
  4156 #define NODEPTR_N(x) HbCss::StyleSelector::NodePtr n = {n.ptr = (void *)x};
       
  4157 /*!
  2964 /*!
  4158     Polishes the appearance of the given \a widget.
  2965     Polishes the appearance of the given \a widget.
  4159 
  2966 
  4160     This method should be called only by HbWidget (base class). The inherited
  2967     This method should be called only by HbWidget (base class). The inherited
  4161     classes should not call this method directly, but use the HbWidget's
  2968     classes should not call this method directly, but use the HbWidget's
  4162     polish loop instead.
  2969     polish loop instead.
  4163 
  2970 
  4164     This method reads the CSS and WidgetML definition for a given widget and positions
  2971     This method reads the CSS and WidgetML definition for a given widget and positions
  4165     the sub-elements inside it. Note you need to set the names for the sub-elements
  2972     the sub-elements inside it. Note you need to set the names for the sub-elements
  4166     with HbStyle::setItemName method before this method is called.
  2973     with HbStyle::HbStyle::setItemName method before this method is called.
  4167 
  2974 
  4168     Note that this method is heavy on the system resources and should be called
  2975     Note that this method is heavy on the system resources and should be called
  4169     absolutely when necessary by the widget.
  2976     absolutely when necessary by the widget.
  4170 
  2977 
  4171     \param widget, HbWidget to be polished
  2978     \param widget HbWidget to be polished
  4172     \param params, style parameters to be returned to the caller
  2979     \param params style parameters to be returned to the caller
  4173 */
  2980 */
  4174 void HbStyle::polish(HbWidget *widget, HbStyleParameters &params)
  2981 void HbStyle::polish(HbWidget *widget, HbStyleParameters &params)
  4175 {
  2982 {
  4176     Q_D( HbStyle );
  2983     Q_D( HbStyle );
  4177 #ifdef HBSTYLE_DEBUG
  2984 #ifdef HBSTYLE_DEBUG
  4178     qDebug() << "HbStyle::polish : -- -- -- --";
  2985     qDebug() << "HbStyle::polish : -- -- -- -- ENTER";
  4179 #endif
  2986 #endif
  4180     if( !widget ) {
  2987     if( !widget ) {
       
  2988 #ifdef HBSTYLE_DEBUG
       
  2989         qDebug() << "HbStyle::polish : -- -- -- -- EXIT";
       
  2990 #endif
  4181         return;
  2991         return;
  4182     }
  2992     }
  4183 #ifdef HBSTYLE_DEBUG
  2993 #ifdef HBSTYLE_DEBUG
  4184     qDebug() << "HbStyle::polish : Polishing" << widget->metaObject()->className();
  2994     qDebug() << "HbStyle::polish : Polishing" << widget->metaObject()->className();
  4185 #endif
  2995 #endif
  4186 
  2996 
  4187     HbLayeredStyleLoader *styleLoader = HbLayeredStyleLoader::getStack(HbLayeredStyleLoader::Concern_Layouts);
  2997     HbLayeredStyleLoader *styleLoader = HbLayeredStyleLoader::getStack(HbLayeredStyleLoader::Concern_Layouts);
  4188     if(!styleLoader){
  2998     if(!styleLoader){
  4189 #ifdef HBSTYLE_DEBUG
  2999 #ifdef HBSTYLE_DEBUG
  4190         qDebug() << "HbStyle::polish : HbLayeredStyleLoader returned a null pointer.";
  3000         qDebug() << "HbStyle::polish : HbLayeredStyleLoader returned a null pointer.";
       
  3001         qDebug() << "HbStyle::polish : -- -- -- -- EXIT";
  4191 #endif
  3002 #endif
  4192         return;
  3003         return;
  4193     }
  3004     }
  4194     HbDeviceProfile profile(HbDeviceProfile::profile(widget));
  3005     HbDeviceProfile profile(HbDeviceProfile::profile(widget));
  4195     NODEPTR_N(widget);
  3006     HbCss::StyleSelector::NodePtr n(widget);
  4196 
  3007 
  4197     HbVector<HbCss::StyleRule> styleRules;
  3008     HbVector<HbCss::StyleRule> styleRules = styleLoader->styleRulesForNode(n, profile.orientation());
  4198     QVariant widgetStyleCache = widget->property( HbStyleRulesCacheId::hbStyleRulesForNodeCache );
       
  4199 
       
  4200     if(widgetStyleCache.isValid()) {
       
  4201         QString widgetStyleCacheId = widgetStyleCache.toString();
       
  4202         if (d->styleRulesCache.contains(widgetStyleCacheId)) {
       
  4203             styleRules = d->styleRulesCache.value(widgetStyleCacheId);
       
  4204         } else {
       
  4205             styleRules = styleLoader->styleRulesForNode(n, profile.orientation());
       
  4206             d->styleRulesCache[widgetStyleCacheId] = styleRules;
       
  4207         }
       
  4208     } else {
       
  4209         styleRules = styleLoader->styleRulesForNode(n, profile.orientation());
       
  4210     }
       
  4211 
  3009 
  4212 #ifdef HBSTYLE_DEBUG
  3010 #ifdef HBSTYLE_DEBUG
  4213     qDebug() << "HbStyle::polish : Number of style rules:" << styleRules.count();
  3011     qDebug() << "HbStyle::polish : Number of style rules:" << styleRules.count();
  4214 #endif
  3012 #endif
  4215     if (!styleRules.count()) {
  3013     if (!styleRules.count()) {
       
  3014 #ifdef HBSTYLE_DEBUG
       
  3015         qDebug() << "HbStyle::polish : -- -- -- -- EXIT";
       
  3016 #endif
  4216         return;
  3017         return;
  4217     }
  3018     }
  4218     const HbVector<HbCss::Declaration> decl = declarations(styleRules, "", widget, profile);
  3019     const HbVector<HbCss::Declaration> decl = declarations(styleRules, "", widget, profile);
  4219 #ifdef HBSTYLE_DEBUG
  3020 #ifdef HBSTYLE_DEBUG
  4220     qDebug() << "HbStyle::polish : Number of matching CSS declarations: " << decl.count();
  3021     qDebug() << "HbStyle::polish : Number of matching CSS declarations: " << decl.count();
  4221 #endif
  3022 #endif
  4222     d->ensureLayoutParameters(profile);
  3023     d->layoutParameters.init(profile);
  4223 
  3024 
  4224     HbCss::ValueExtractor extractor(decl, d->layoutParameters, profile);
  3025     HbCss::ValueExtractor extractor(decl, profile);
       
  3026     extractor.setLayoutParameters(d->layoutParameters);
  4225     QString layoutName;
  3027     QString layoutName;
  4226     QString sectionName;
  3028     QString sectionName;
  4227 
  3029 
  4228     if ( params.count() ) {
  3030     if ( params.count() ) {
  4229 #ifdef HBSTYLE_DEBUG
  3031 #ifdef HBSTYLE_DEBUG
  4265 #endif
  3067 #endif
  4266                 HbWidgetStyleLoader *loader = HbWidgetStyleLoader::instance();
  3068                 HbWidgetStyleLoader *loader = HbWidgetStyleLoader::instance();
  4267                 if ( !loader->loadWidgetML(widget, layoutName, sectionName)) {
  3069                 if ( !loader->loadWidgetML(widget, layoutName, sectionName)) {
  4268 #ifdef HBSTYLE_DEBUG
  3070 #ifdef HBSTYLE_DEBUG
  4269                     qDebug() << "HbStyle::polish : Failed to load WidgetML";
  3071                     qDebug() << "HbStyle::polish : Failed to load WidgetML";
       
  3072                     qDebug() << "HbStyle::polish : -- -- -- -- EXIT";
  4270 #endif
  3073 #endif
  4271                     return;
  3074                     return;
  4272                 }
  3075                 }
  4273                 const QVariant ptrVariant = QVariant::fromValue( widget->layout() );
  3076                 const QVariant ptrVariant = QVariant::fromValue( widget->layout() );
  4274                 widget->setProperty( LAYOUT_PTR_PROPERTY, ptrVariant );
  3077                 widget->setProperty( LAYOUT_PTR_PROPERTY, ptrVariant );
  4300             // twice for this item.
  3103             // twice for this item.
  4301             nodeIds.removeAll(name);
  3104             nodeIds.removeAll(name);
  4302         }
  3105         }
  4303         d->polishItem(styleRules, widget, item, name, profile, layoutDefined);
  3106         d->polishItem(styleRules, widget, item, name, profile, layoutDefined);
  4304     }
  3107     }
  4305     foreach (QString nodeId, nodeIds) {
  3108     foreach (const QString &nodeId, nodeIds) {
  4306         // These are the "missing" anchor items. Need to call polishItem
  3109         // These are the "missing" anchor items. Need to call polishItem
  4307         // for them, too, for getting the anchor spacings right.
  3110         // for them, too, for getting the anchor spacings right.
  4308         // if there are anchor node ids, layoutDefined is always true.
  3111         // if there are anchor node ids, layoutDefined is always true.
  4309         if ( !nodeId.isEmpty() ) {
  3112         if ( !nodeId.isEmpty() ) {
  4310             d->polishItem(styleRules, widget, 0, nodeId, profile, true);
  3113             d->polishItem(styleRules, widget, 0, nodeId, profile, true);
  4316             if ( !anchor->anchorId().isEmpty() ) {
  3119             if ( !anchor->anchorId().isEmpty() ) {
  4317                 d->polishAnchor(styleRules, widget, anchor, profile);
  3120                 d->polishAnchor(styleRules, widget, anchor, profile);
  4318             }
  3121             }
  4319         }
  3122         }
  4320     }
  3123     }
       
  3124 
       
  3125 #ifdef HB_TEXT_MEASUREMENT_UTILITY
       
  3126     if ( d->mLocTestMode == -1 ) {
       
  3127         d->mLocTestMode = HbTextMeasurementUtility::instance()->locTestMode();
       
  3128     }
       
  3129     if ( d->mLocTestMode == HbTextMeasurementUtility::Automatic ) {
       
  3130         HbInstancePrivate::d_ptr()->startLocalizationMeasurement();
       
  3131     }
       
  3132 #endif // HB_TEXT_MEASUREMENT_UTILITY
       
  3133 
       
  3134 #ifdef HBSTYLE_DEBUG
       
  3135     qDebug() << "HbStyle::polish : -- -- -- -- EXIT";
       
  3136 #endif
  4321 }
  3137 }
  4322 
  3138 
  4323 /*!
  3139 /*!
  4324     updateThemedItems updates themable children items of widget
  3140     updateThemedItems updates themable children items of widget
  4325 
  3141 
  4326     \param styleRules, style-rules of the widget
  3142     \param styleRules style-rules of the widget
  4327     \param variableRules, variable-rules of the widget
  3143     \param variableRules variable-rules of the widget
  4328     \param widget, widget whose themed parameters are supposed to be updated
  3144     \param widget widget whose themed parameters are supposed to be updated
  4329     \param item, graphics item whose themed parameters are supposed to be updated
  3145     \param item graphics item whose themed parameters are supposed to be updated
  4330 */
  3146 */
  4331 void HbStylePrivate::updateThemedItems(
  3147 void HbStylePrivate::updateThemedItems(
  4332     const HbVector<HbCss::StyleRule> &styleRules,
  3148     const HbVector<HbCss::StyleRule> &styleRules,
  4333     QGraphicsItem *item,
  3149     QGraphicsItem *item,
  4334     HbDeviceProfile &profile) const
  3150     HbDeviceProfile &profile) const
  4404 /*!
  3220 /*!
  4405     HbStyle::updateThemedParams()
  3221     HbStyle::updateThemedParams()
  4406 
  3222 
  4407     Updates the themable parameters of widget (specially those which are specified in css files)
  3223     Updates the themable parameters of widget (specially those which are specified in css files)
  4408 
  3224 
  4409     \param widget, widget whose themed parameters are supposed to be updated
  3225     \param widget widget whose themed parameters are supposed to be updated
  4410 */
  3226 */
  4411 void HbStyle::updateThemedParams(HbWidget *widget)
  3227 void HbStyle::updateThemedParams(HbWidget *widget)
  4412 {
  3228 {
  4413     Q_D( HbStyle );
  3229     Q_D( HbStyle );
  4414 #ifdef HBSTYLE_DEBUG
  3230 #ifdef HBSTYLE_DEBUG
  4415     qDebug() << "HbStyle::updateThemedParams : -- -- -- --";
  3231     qDebug() << "HbStyle::updateThemedParams : -- -- -- -- ENTER";
  4416 #endif
  3232 #endif
  4417     if( !widget ) {
  3233     if( !widget ) {
  4418         return;
  3234         return;
  4419     }
  3235     }
  4420     if(!widget->childItems().count()){
  3236     if(!widget->childItems().count()){
  4426 
  3242 
  4427     HbLayeredStyleLoader *styleLoader = HbLayeredStyleLoader::getStack(HbLayeredStyleLoader::Concern_Colors);
  3243     HbLayeredStyleLoader *styleLoader = HbLayeredStyleLoader::getStack(HbLayeredStyleLoader::Concern_Colors);
  4428     if(!styleLoader){
  3244     if(!styleLoader){
  4429 #ifdef HBSTYLE_DEBUG
  3245 #ifdef HBSTYLE_DEBUG
  4430         qDebug() << "HbStyle::updateThemedParams : HbLayeredStyleLoader returned a null pointer.";
  3246         qDebug() << "HbStyle::updateThemedParams : HbLayeredStyleLoader returned a null pointer.";
       
  3247         qDebug() << "HbStyle::updateThemedParams : -- -- -- -- EXIT";
  4431 #endif
  3248 #endif
  4432         return;
  3249         return;
  4433     }
  3250     }
  4434     NODEPTR_N(widget);
  3251     HbCss::StyleSelector::NodePtr n(widget);
  4435     HbDeviceProfile profile(HbDeviceProfile::profile(widget));
  3252     HbDeviceProfile profile(HbDeviceProfile::profile(widget));
  4436     HbVector<HbCss::StyleRule> styleRules = styleLoader->styleRulesForNode(n, profile.orientation());
  3253     HbVector<HbCss::StyleRule> styleRules = styleLoader->styleRulesForNode(n, profile.orientation());
  4437     if (!styleRules.count()) {
  3254     if (!styleRules.count()) {
  4438 #ifdef HBSTYLE_DEBUG
  3255 #ifdef HBSTYLE_DEBUG
  4439         qDebug() << "HbStyle::updateThemedParams : No style rules found.";
  3256         qDebug() << "HbStyle::updateThemedParams : No style rules found.";
       
  3257         qDebug() << "HbStyle::updateThemedParams : -- -- -- -- EXIT";
  4440 #endif
  3258 #endif
  4441         return;
  3259         return;
  4442     }
  3260     }
  4443 
  3261 
  4444     // update themed items
  3262     // update themed items
  4445     QList<QGraphicsItem*> list = widget->childItems();
  3263     QList<QGraphicsItem*> list = widget->childItems();
  4446     foreach (QGraphicsItem* item, list) {
  3264     foreach (QGraphicsItem* item, list) {
  4447         d->updateThemedItems(styleRules, item, profile);
  3265         d->updateThemedItems(styleRules, item, profile);
  4448     }
  3266     }
       
  3267 
       
  3268 #ifdef HBSTYLE_DEBUG
       
  3269     qDebug() << "HbStyle::updateThemedParams : -- -- -- -- EXIT";
       
  3270 #endif
  4449 }
  3271 }
  4450 
  3272 
  4451 /*!
  3273 /*!
  4452     Checkes whether given widget has orienation specific style
  3274     Checkes whether given widget has orienation specific style
  4453     rules. This can be used for optimizing orientation switch.
  3275     rules. This can be used for optimizing orientation switch.
  4454 */
  3276 */
  4455 bool HbStyle::hasOrientationSpecificStyleRules(HbWidget *widget)
  3277 bool HbStyle::hasOrientationSpecificStyleRules(HbWidget *widget)
  4456 {
  3278 {
  4457     HbLayeredStyleLoader *styleLoader =
  3279     HbLayeredStyleLoader *styleLoader =
  4458         HbLayeredStyleLoader::getStack(HbLayeredStyleLoader::Concern_Layouts);
  3280         HbLayeredStyleLoader::getStack(HbLayeredStyleLoader::Concern_Layouts);
  4459     NODEPTR_N(widget);
  3281     HbCss::StyleSelector::NodePtr n(widget);
  4460     return styleLoader->hasOrientationSpecificStyleRules(n);
  3282     return styleLoader->hasOrientationSpecificStyleRules(n);
  4461 }
  3283 }
  4462 
  3284 
  4463 /*!
  3285 /*!
  4464     For clearing caches.
  3286     For clearing caches.
  4478     Note that polish() method requires widget's children to be set with a correct item name.
  3300     Note that polish() method requires widget's children to be set with a correct item name.
  4479     \sa HbStyle::polish()
  3301     \sa HbStyle::polish()
  4480 
  3302 
  4481     This method uses QGraphicsItem::setData() with id 0xfffe.
  3303     This method uses QGraphicsItem::setData() with id 0xfffe.
  4482 
  3304 
  4483     \param item, graphics item
  3305     \param item graphics item
  4484     \param name, name to be set
  3306     \param name name to be set
  4485 */
  3307 */
  4486 void HbStyle::setItemName( QGraphicsItem *item, const QString &name )
  3308 void HbStyle::setItemName( QGraphicsItem *item, const QString &name )
  4487 {
  3309 {
  4488     QString originalName = itemName(item);
  3310     QString originalName = itemName(item);
  4489     if (item && originalName != name) {
  3311     if (item && originalName != name) {
  4498                 HbAnchorLayout* layout = static_cast<HbAnchorLayout*>(parentW->layout());
  3320                 HbAnchorLayout* layout = static_cast<HbAnchorLayout*>(parentW->layout());
  4499                 if ( layout->indexOf(lItem) != -1 ) {
  3321                 if ( layout->indexOf(lItem) != -1 ) {
  4500                     if( name.isEmpty() ) {
  3322                     if( name.isEmpty() ) {
  4501                         layout->removeMapping(originalName);
  3323                         layout->removeMapping(originalName);
  4502                     } else {
  3324                     } else {
  4503                         if ( !originalName.isEmpty() ) {
       
  4504                             layout->removeMapping(originalName);
       
  4505                         }
       
  4506                         layout->setMapping(lItem, name);
  3325                         layout->setMapping(lItem, name);
  4507                     }
  3326                     }
  4508                 }
  3327                 }
  4509             }
  3328             }
  4510         }
  3329         }
  4514 /*!
  3333 /*!
  4515 
  3334 
  4516     Returns the item name of a graphics item. Item name is not the same as object name.
  3335     Returns the item name of a graphics item. Item name is not the same as object name.
  4517     It's a textual identifier that uniquely identifies QGraphicsItem's child items.
  3336     It's a textual identifier that uniquely identifies QGraphicsItem's child items.
  4518 
  3337 
  4519     \param item, graphics item
  3338     \param item graphics item
  4520     \return item name or an empty string if name's not set
  3339     \return item name or an empty string if name's not set
  4521 */
  3340 */
  4522 QString HbStyle::itemName( const QGraphicsItem *item )
  3341 QString HbStyle::itemName( const QGraphicsItem *item )
  4523 {
  3342 {
  4524     return item
  3343     return item
  4543     HbDeviceProfile effectiveProfile = profile;
  3362     HbDeviceProfile effectiveProfile = profile;
  4544     if ( effectiveProfile.isNull() ) {
  3363     if ( effectiveProfile.isNull() ) {
  4545         effectiveProfile = HbDeviceProfile::current();
  3364         effectiveProfile = HbDeviceProfile::current();
  4546     }
  3365     }
  4547     Q_D( const HbStyle );
  3366     Q_D( const HbStyle );
  4548     d->ensureLayoutParameters(effectiveProfile);
  3367     d->layoutParameters.init(effectiveProfile);
  4549     HbCss::ValueExtractor valueExtractor(d->layoutParameters, true, effectiveProfile);
  3368     HbCss::ValueExtractor valueExtractor(effectiveProfile);
  4550     // todo: parsing variable/expression is done here so that there is no need to change API
  3369     valueExtractor.setLayoutParameters(d->layoutParameters);
  4551     // also parameters method not changed (this change is done for docml/widgetml parsing)
  3370 
  4552     if (param.startsWith(QLatin1String("var(")) && param.endsWith(QLatin1String(")"))) {
  3371     if ( param.endsWith(QLatin1String(")")) &&
  4553         return valueExtractor.extractVariableValue(param.mid(4,param.length()-5), value);
  3372         ( param.startsWith(QLatin1String("var(")) ||
  4554     } else if (param.startsWith(QLatin1String("-var(")) && param.endsWith(QLatin1String(")"))) {
  3373           param.startsWith(QLatin1String("-var(")) ||
  4555         bool retVal = valueExtractor.extractVariableValue(param.mid(5,param.length()-6), value);
  3374           param.startsWith(QLatin1String("expr(")) ||
  4556         value = -value;
  3375           param.startsWith(QLatin1String("-expr(")) ) ) {
  4557         return retVal;
  3376         // Expression parser can deal with "functions"
  4558     } else if (param.startsWith(QLatin1String("expr(")) && param.endsWith(QLatin1String(")"))) {
  3377         return valueExtractor.extractExpressionValue(param, value);
  4559         QString expressionString = param.mid(5,param.length()-6);
  3378     }
  4560         return valueExtractor.extractExpressionValue(expressionString, value);
       
  4561     } else if (param.startsWith(QLatin1String("-expr(")) && param.endsWith(QLatin1String(")"))) {
       
  4562         QString expressionString = param.mid(6,param.length()-7);
       
  4563         bool retVal = valueExtractor.extractExpressionValue(expressionString, value);
       
  4564         value = -value;
       
  4565         return retVal;
       
  4566     }
       
  4567 
       
  4568     return valueExtractor.extractVariableValue(param, value);
  3379     return valueExtractor.extractVariableValue(param, value);
  4569 }
  3380 }
       
  3381 
       
  3382 bool HbStylePrivate::valueFromTokens(const QList<int> &tokens, qreal &value, const HbDeviceProfile &profile) const
       
  3383 {
       
  3384     HbDeviceProfile effectiveProfile = profile;
       
  3385     if ( effectiveProfile.isNull() ) {
       
  3386         effectiveProfile = HbDeviceProfile::current();
       
  3387     }
       
  3388     layoutParameters.init(effectiveProfile);
       
  3389     HbCss::ValueExtractor valueExtractor(effectiveProfile);
       
  3390     valueExtractor.setLayoutParameters(layoutParameters);
       
  3391     return valueExtractor.extractExpressionValue(tokens, value);
       
  3392 }
       
  3393 
  4570 
  3394 
  4571 /*!
  3395 /*!
  4572     Returns copy of all global style parameters. Both names and values
  3396     Returns copy of all global style parameters. Both names and values
  4573     of the parameters are returned. The values are returned in pixels.
  3397     of the parameters are returned. The values are returned in pixels.
  4574 
  3398 
  4587     if ( effectiveProfile.isNull() ) {
  3411     if ( effectiveProfile.isNull() ) {
  4588         effectiveProfile = HbDeviceProfile::current();
  3412         effectiveProfile = HbDeviceProfile::current();
  4589     }
  3413     }
  4590 
  3414 
  4591     Q_D( const HbStyle );
  3415     Q_D( const HbStyle );
  4592     d->ensureLayoutParameters(effectiveProfile);
  3416     d->layoutParameters.init(effectiveProfile);
  4593     HbCss::ValueExtractor valueExtractor(d->layoutParameters, true, effectiveProfile);
  3417     HbCss::ValueExtractor valueExtractor(effectiveProfile);
       
  3418     valueExtractor.setLayoutParameters(d->layoutParameters);
  4594     qreal value = 0;
  3419     qreal value = 0;
  4595     QHash<QString, HbCss::Declaration>::const_iterator i = d->layoutParameters.constBegin();
  3420     HbLayoutParameters::const_iterator i = d->layoutParameters.constBegin();
  4596     while (i != d->layoutParameters.constEnd()) {
  3421     while (i != d->layoutParameters.constEnd()) {
  4597         if (valueExtractor.extractVariableValue(i.key(), value)) {
  3422         QString name(d->layoutParameters.name(i));
  4598             params.addParameter(i.key(), value);
  3423         if (valueExtractor.extractVariableValue(name, value)) {
       
  3424             params.addParameter(name, value);
  4599         }
  3425         }
  4600         ++i;
  3426         ++i;
  4601     }
  3427     }
  4602 }
  3428 }
  4603 
  3429 
  4607 
  3433 
  4608     This method should be used only if you need to access widget specific parameters out
  3434     This method should be used only if you need to access widget specific parameters out
  4609     of the polish loop. It is more efficient to use HbWidget::polish(HbStyleParameters &params)
  3435     of the polish loop. It is more efficient to use HbWidget::polish(HbStyleParameters &params)
  4610     if you don't need to access the parameters before the (first) polish event.
  3436     if you don't need to access the parameters before the (first) polish event.
  4611 
  3437 
  4612     \param parameters, style parameters to be returned to the caller
  3438     \param parameters style parameters to be returned to the caller
  4613     \param widget, HbWidget to be polished
  3439     \param widget HbWidget to be polished
  4614     \sa HbStyle::polish, HbStyle::parameters and HbWidget::polish
  3440     \sa HbStyle::polish, HbStyle::parameters and HbWidget::polish
  4615 */
  3441 */
  4616 void HbStyle::widgetParameters(HbStyleParameters &params, HbWidget* widget) const
  3442 void HbStyle::widgetParameters(HbStyleParameters &params, HbWidget* widget) const
  4617 {
  3443 {
  4618     Q_D( const HbStyle );
  3444     Q_D( const HbStyle );
  4629         qDebug() << "HbStyle::widgetParameters : HbLayeredStyleLoader returned a null pointer.";
  3455         qDebug() << "HbStyle::widgetParameters : HbLayeredStyleLoader returned a null pointer.";
  4630 #endif
  3456 #endif
  4631         return;
  3457         return;
  4632     }
  3458     }
  4633     HbDeviceProfile profile(HbDeviceProfile::profile(widget));
  3459     HbDeviceProfile profile(HbDeviceProfile::profile(widget));
  4634     NODEPTR_N(widget);
  3460     HbCss::StyleSelector::NodePtr n(widget);
  4635 
  3461 
  4636     HbVector<HbCss::StyleRule> styleRules = styleLoader->styleRulesForNode(n, profile.orientation());
  3462     HbVector<HbCss::StyleRule> styleRules = styleLoader->styleRulesForNode(n, profile.orientation());
  4637 
  3463 
  4638 #ifdef HBSTYLE_DEBUG
  3464 #ifdef HBSTYLE_DEBUG
  4639     qDebug() << "HbStyle::widgetParameters : Number of style rules:" << styleRules.count();
  3465     qDebug() << "HbStyle::widgetParameters : Number of style rules:" << styleRules.count();
  4643     }
  3469     }
  4644     const HbVector<HbCss::Declaration> decl = declarations(styleRules, "", widget, profile);
  3470     const HbVector<HbCss::Declaration> decl = declarations(styleRules, "", widget, profile);
  4645 #ifdef HBSTYLE_DEBUG
  3471 #ifdef HBSTYLE_DEBUG
  4646     qDebug() << "HbStyle::widgetParameters : Number of matching CSS declarations: " << decl.count();
  3472     qDebug() << "HbStyle::widgetParameters : Number of matching CSS declarations: " << decl.count();
  4647 #endif
  3473 #endif
  4648     d->ensureLayoutParameters(profile);
  3474     d->layoutParameters.init(profile);
  4649 
  3475 
  4650     HbCss::ValueExtractor extractor(decl, d->layoutParameters, profile);
  3476     HbCss::ValueExtractor extractor(decl, profile);
       
  3477     extractor.setLayoutParameters(d->layoutParameters);
  4651     extractor.extractCustomProperties( params.keys(), params.values() );
  3478     extractor.extractCustomProperties( params.keys(), params.values() );
  4652 }
  3479 }
  4653 
  3480 
  4654 
  3481 
  4655 /*!
  3482 /*!
  4656 \internal
  3483 \internal
  4657 */
  3484 */
  4658 HbStylePrivate::HbStylePrivate()
  3485 HbStylePrivate::HbStylePrivate() : mLocTestMode(-1)
  4659 {
  3486 {
  4660     HbWidgetStyleLoader *loader = HbWidgetStyleLoader::instance();
  3487     HbWidgetStyleLoader *loader = HbWidgetStyleLoader::instance();
  4661     if(loader){
  3488     if(loader){
  4662         loader->addFilePath(STYLE_LOCATION, HbLayeredStyleLoader::Concern_Layouts,
  3489         loader->addFilePath(STYLE_LOCATION, HbLayeredStyleLoader::Concern_Layouts,
  4663                 HbLayeredStyleLoader::Priority_Core);
  3490                 HbLayeredStyleLoader::Priority_Core);
  4669 /*!
  3496 /*!
  4670 \internal
  3497 \internal
  4671 */
  3498 */
  4672 HbStylePrivate::~HbStylePrivate()
  3499 HbStylePrivate::~HbStylePrivate()
  4673 {
  3500 {
  4674     layoutParameters.clear();
       
  4675 
       
  4676     HbWidgetStyleLoader *loader = HbWidgetStyleLoader::instance();
  3501     HbWidgetStyleLoader *loader = HbWidgetStyleLoader::instance();
  4677     if(loader){
  3502     if(loader){
  4678         loader->removeFilePath(STYLE_LOCATION, HbLayeredStyleLoader::Concern_Layouts,
  3503         loader->removeFilePath(STYLE_LOCATION, HbLayeredStyleLoader::Concern_Layouts,
  4679                 HbLayeredStyleLoader::Priority_Core);
  3504                 HbLayeredStyleLoader::Priority_Core);
  4680         loader->removeFilePath(COLOR_STYLE_LOCATION, HbLayeredStyleLoader::Concern_Colors,
  3505         loader->removeFilePath(COLOR_STYLE_LOCATION, HbLayeredStyleLoader::Concern_Colors,
  4683 }
  3508 }
  4684 
  3509 
  4685 /*!
  3510 /*!
  4686 \internal
  3511 \internal
  4687 */
  3512 */
  4688 QString HbStylePrivate::logicalName(HbStyle::Primitive primitive, const QStyleOption *option) const
  3513 QString HbStylePrivate::logicalName(HbStylePrivate::Primitive primitive, const QStyleOption *option)
  4689 {
  3514 {
  4690     switch (primitive) {
  3515     switch (primitive) {
  4691 
  3516 
  4692     case HbStyle::P_Slider_thumb: {
  3517     case HbStylePrivate::P_Slider_thumb: {
  4693         const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider *>(option);
  3518         const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider *>(option);
  4694         if (opt) {
  3519         if (opt) {
  4695             QString iconPath;
  3520             QString iconPath;
  4696             switch (opt->orientation) {
  3521             switch (opt->orientation) {
  4697 
  3522 
  4725 }
  3550 }
  4726 
  3551 
  4727 /*!
  3552 /*!
  4728 \internal
  3553 \internal
  4729 */
  3554 */
  4730 QIcon::Mode HbStylePrivate::iconMode(QStyle::State state) const
  3555 QIcon::Mode HbStylePrivate::iconMode(QStyle::State state)
  4731 {
  3556 {
  4732     QIcon::Mode mode = QIcon::Disabled;
  3557     QIcon::Mode mode = QIcon::Disabled;
  4733     if (state & QStyle::State_Enabled)
  3558     if (state & QStyle::State_Enabled)
  4734         mode = QIcon::Normal;
  3559         mode = QIcon::Normal;
  4735     if (state & QStyle::State_Active)
  3560     if (state & QStyle::State_Active)
  4740 }
  3565 }
  4741 
  3566 
  4742 /*!
  3567 /*!
  4743 \internal
  3568 \internal
  4744 */
  3569 */
  4745 QIcon::State HbStylePrivate::iconState(QStyle::State state) const
  3570 QIcon::State HbStylePrivate::iconState(QStyle::State state)
  4746 {
  3571 {
  4747     QIcon::State icon = QIcon::Off;
  3572     QIcon::State icon = QIcon::Off;
  4748     if (state & QStyle::State_On)
  3573     if (state & QStyle::State_On)
  4749         icon = QIcon::On;
  3574         icon = QIcon::On;
  4750     return icon;
  3575     return icon;
  4751 }
       
  4752 
       
  4753 
       
  4754 /*!
       
  4755 \internal
       
  4756 */
       
  4757 void HbStylePrivate::ensureLayoutParameters(const HbDeviceProfile &profile) const
       
  4758 {
       
  4759     bool firstParse(layoutParameters.isEmpty());
       
  4760     bool addSpecialParams(firstParse);
       
  4761     if (firstParse) {
       
  4762         HbCss::Parser parser;
       
  4763         parser.init(GLOBAL_PARAMETERS_LOCATION, true);
       
  4764         HbCss::StyleSheet *styleSheet = HbMemoryUtils::create<HbCss::StyleSheet>(HbMemoryManager::HeapMemory);
       
  4765         parser.parse(styleSheet);
       
  4766 
       
  4767         HbStyleSelector selector;
       
  4768         selector.styleSheets.append(styleSheet);
       
  4769         selector.variableRuleSets(&layoutParameters);
       
  4770     }
       
  4771     if (!firstParse && (layoutParametersProfileName != profile.name())) {
       
  4772         addSpecialParams = true;
       
  4773     }
       
  4774     if (addSpecialParams) {
       
  4775         layoutParametersProfileName = profile.name();
       
  4776         QSizeF pSize = profile.logicalSize();
       
  4777 
       
  4778         {
       
  4779             HbCss::Declaration decl;
       
  4780             decl.property = "hb-param-screen-width";
       
  4781             decl.propertyId = HbCss::Property_Unknown;
       
  4782             HbCss::Value val;
       
  4783             val.type = HbCss::Value::Number;
       
  4784             val.variant = HbVariant((double)pSize.width(),HbMemoryManager::HeapMemory);
       
  4785             decl.values.append(val);
       
  4786             layoutParameters.insert(decl.property, decl);
       
  4787         }
       
  4788         {
       
  4789             HbCss::Declaration decl;
       
  4790             decl.property = "hb-param-screen-height";
       
  4791             decl.propertyId = HbCss::Property_Unknown;
       
  4792             HbCss::Value val;
       
  4793             val.type = HbCss::Value::Number;
       
  4794             val.variant = HbVariant((double)pSize.height(),HbMemoryManager::HeapMemory);
       
  4795             decl.values.append(val);
       
  4796             layoutParameters.insert(decl.property, decl);
       
  4797         }
       
  4798         {
       
  4799             HbCss::Declaration decl;
       
  4800             decl.property = "hb-param-screen-short-edge";
       
  4801             decl.propertyId = HbCss::Property_Unknown;
       
  4802             HbCss::Value val;
       
  4803             val.type = HbCss::Value::Number;
       
  4804             val.variant = HbVariant((double)qMin(pSize.height(),pSize.width()),HbMemoryManager::HeapMemory);
       
  4805             decl.values.append(val);
       
  4806             layoutParameters.insert(decl.property, decl);
       
  4807         }
       
  4808         {
       
  4809             HbCss::Declaration decl;
       
  4810             decl.property = "hb-param-screen-long-edge";
       
  4811             decl.propertyId = HbCss::Property_Unknown;
       
  4812             HbCss::Value val;
       
  4813             val.type = HbCss::Value::Number;
       
  4814             val.variant = HbVariant((double)qMax(pSize.height(),pSize.width()),HbMemoryManager::HeapMemory);
       
  4815             decl.values.append(val);
       
  4816             layoutParameters.insert(decl.property, decl);
       
  4817         }
       
  4818     }
       
  4819 }
  3576 }
  4820 
  3577 
  4821 /*!
  3578 /*!
  4822 \internal
  3579 \internal
  4823 */
  3580 */
  4824 void HbStylePrivate::clearStyleSheetCaches()
  3581 void HbStylePrivate::clearStyleSheetCaches()
  4825 {
  3582 {
  4826     styleRulesCache.clear();
  3583     styleRulesCache.clear();
  4827 }
  3584 }
  4828 
  3585 
  4829 HbWidgetBasePrivate *HbStylePrivate::widgetBasePrivate(HbWidgetBase *widgetBase) const
  3586 HbWidgetBasePrivate *HbStylePrivate::widgetBasePrivate(HbWidgetBase *widgetBase)
  4830 {
  3587 {
  4831     return HbWidgetBasePrivate::d_ptr(widgetBase);
  3588     return HbWidgetBasePrivate::d_ptr(widgetBase);
  4832 }
  3589 }
  4833 
  3590 
       
  3591 
  4834 #include "moc_hbstyle.cpp"
  3592 #include "moc_hbstyle.cpp"