src/hbcore/style/hbstyle.cpp
changeset 21 4633027730f5
parent 7 923ff622b8b9
child 23 e6ad4ef83b23
equal deleted inserted replaced
7:923ff622b8b9 21:4633027730f5
    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"
    96 #include "hbrepeaticonitem_p.h"
    97 #include "hbnamespace_p.h"
    97 #include "hbnamespace_p.h"
    98 
    98 
    99 
       
   100 #include "hbanchorlayout.h"
    99 #include "hbanchorlayout.h"
   101 #include <hbanchor.h>
   100 #include <hbanchor.h>
   102 
   101 
   103 #include <QGraphicsWidget>
   102 #include <QGraphicsWidget>
   104 #include <hbwidget.h>
   103 #include <hbwidget.h>
   107 #include "hbrepeatitem_p.h"
   106 #include "hbrepeatitem_p.h"
   108 
   107 
   109 #include <QDebug>
   108 #include <QDebug>
   110 #include <QMetaClassInfo>
   109 #include <QMetaClassInfo>
   111 
   110 
       
   111 #ifdef HB_TEXT_MEASUREMENT_UTILITY
       
   112 #include "hbinstance_p.h"
       
   113 #include "hbfeaturemanager_r.h"
       
   114 #endif
       
   115 
   112 Q_DECLARE_METATYPE(QGraphicsLayout*)
   116 Q_DECLARE_METATYPE(QGraphicsLayout*)
   113 
   117 
   114 //Uncomment next define(s) in order to get more debug prints.
   118 //Uncomment next define(s) in order to get more debug prints.
   115 //Similar define exists also in the engine side.
   119 //Similar define exists also in the engine side.
   116 //#define HBSTYLE_DEBUG
   120 //#define HBSTYLE_DEBUG
   132     Whenever the widget's state changes in a way that needs changes in drawing the primitive
   136     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
   137     (such as button pressed down -> change the button background image) then the widget needs to
   134     call the updatePrimitive method.
   138     call the updatePrimitive method.
   135 
   139 
   136     Generally primitives should be updated only when a state change occurs. When a widget uses primitives to construct
   140     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. 
   141     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.
   142     Painting for the primitives occurs from the graphics scene.
   139 
   143 
   140     HbStyle has some caching functionality and thus it should not be instantiated explicitly, but 
   144     HbStyle has some caching functionality and thus it should not be instantiated explicitly, but
   141     accessed only through HbWidget::style() or HbInstance::style() APIs.
   145     accessed only through HbWidget::style() or HbInstance::style() APIs.
   142 
   146 
   143 */
       
   144 
       
   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 */
   147 */
   790 
   148 
   791 // TODO: margins should be defined in layout data once layout specification exists.
   149 // TODO: margins should be defined in layout data once layout specification exists.
   792 static const int ItemName = 0xfffe;
   150 static const int ItemName = 0xfffe;
   793 static const QString STYLE_LOCATION = QLatin1String(":/themes/style/hbdefault/rules/widgets/%w/%w");
   151 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");
   152 static const QString COLOR_STYLE_LOCATION = QLatin1String(":/themes/style/hbdefault/rules/widgets/%w/%w_color.css");
   795 static const int TOUCHAREA_ZVALUE = 1000;
   153 static const int TOUCHAREA_ZVALUE = 1000;
   796 
   154 
   797 static const QString GLOBAL_PARAMETERS_LOCATION = QLatin1String(":/themes/style/hbdefault/variables/layout/zoom/0/hbglobalparameters.css");
   155 static const QString GLOBAL_PARAMETERS_LOCATION = QLatin1String(":/themes/style/hbdefault/variables/layout/zoom/0/hbglobalparameters.css");
   798 
   156 
   799 static const char* LAYOUT_PTR_PROPERTY = "HbStyle_layout_ptr";
   157 static const char* LAYOUT_PTR_PROPERTY = "HbStyle_layout_ptr";
   800 static const char* LAYOUT_NAME_PROPERTY = "HbStyle_layout_name";
   158 static const char* LAYOUT_NAME_PROPERTY = "HbStyle_layout_name";
       
   159 
       
   160 #ifdef HB_TEXT_MEASUREMENT_UTILITY
       
   161 static const int AUTOMATIC_TEXT_MEASUREMENT = 2;
       
   162 #endif
   801 
   163 
   802 inline void overrideSpacing( HbAnchorLayout *layout, const QString &name, Hb::Edge edge, qreal val )
   164 inline void overrideSpacing( HbAnchorLayout *layout, const QString &name, Hb::Edge edge, qreal val )
   803 {
   165 {
   804     if( name.isNull() ) {
   166     if( name.isNull() ) {
   805         return;
   167         return;
   838 */
   200 */
   839 HbStyle::~HbStyle()
   201 HbStyle::~HbStyle()
   840 {
   202 {
   841     delete d_ptr;
   203     delete d_ptr;
   842 }
   204 }
   843 
       
   844 
       
   845 /*!
   205 /*!
   846 
   206 
   847   \deprecated HbStyle::createPrimitive(HbStyle::Primitive, QGraphicsItem*)
   207   \deprecated HbStyle::createPrimitive(HbStyle::Primitive, QGraphicsItem*)
   848   is deprecated. This method will be replaced with an altered version which will use new base primitive enumerations.
   208   is deprecated. This method will be made private and later replaced with new version.
   849 
       
   850   Creates instances of primitive graphics items. This method should be used by all widgets that support styling.
       
   851   When changing the style the returned primitives can be replaced with an altered version of the primitives, or with a completely
       
   852   different primitive, to create a custom appearance. This shouldn't cause changes to the widget if the functional design
       
   853   remains the same.
       
   854 
       
   855   This method returns HbWidgetBase objects. A widget can store the returned items as HbWidgetBase. If a widget
       
   856   does not require any functionality from HbWidgetBase then it should store the primitives as QGraphicsItems.
       
   857 
       
   858   \note This method is used to replace the conventional Qt-style paint indirection via drawPrimitive.
       
   859   \sa HbStyle::updatePrimitive method which is to be used in conjunction with this method
       
   860   \sa HbWidgetBase
       
   861   \param primitive, to identify the primitive to create
       
   862   \param parent of the item
       
   863   \return HbWidgetBase is returned.
       
   864 
   209 
   865  */
   210  */
   866 QGraphicsItem *HbStyle::createPrimitive( HbStyle::Primitive primitive, QGraphicsItem *parent ) const
   211 QGraphicsItem *HbStyle::createPrimitive( HbStyle::Primitive primitive, QGraphicsItem *parent ) const
   867 {
   212 {
   868 
   213     Q_UNUSED(primitive);
       
   214     Q_UNUSED(parent);
       
   215     return 0;
       
   216 
       
   217 }
       
   218 /*!
       
   219 \deprecated HbStyle::updatePrimitive(QGraphicsItem*, HbStyle::Primitive, const QStyleOption*)
       
   220 is deprecated. This method will be made private and later replaced with a new version.
       
   221 
       
   222  */
       
   223 void HbStyle::updatePrimitive( QGraphicsItem *item, HbStyle::Primitive primitive, const QStyleOption *option ) const
       
   224 {
       
   225     Q_UNUSED(item);
       
   226     Q_UNUSED(primitive);
       
   227     Q_UNUSED(option);
       
   228 }
       
   229 
       
   230 
       
   231 QGraphicsItem *HbStylePrivate::createPrimitive( HbStylePrivate::Primitive primitive, QGraphicsItem *parent )
       
   232 {
       
   233         
   869         switch (primitive){
   234         switch (primitive){
   870             case P_MenuItem_submenuindicator:
   235             case P_MenuItem_submenuindicator:
   871                 {
   236                 {
   872                 HbIconItem *item = new HbIconItem(parent);
   237                 HbIconItem *item = new HbIconItem(parent);
   873                 setItemName(item, QLatin1String("submenu-indicator"));
   238                 HbStyle::setItemName(item, QLatin1String("submenu-indicator"));
   874                 return item;
   239                 return item;
   875                 }
   240                 }
   876 
   241 
   877             case P_MenuItem_checkindicator:
   242             case P_MenuItem_checkindicator:
   878                 {
   243                 {
   879                 HbIconItem *item = new HbIconItem(parent);
   244                 HbIconItem *item = new HbIconItem(parent);
   880                 setItemName(item, QLatin1String("check-indicator"));
   245                 HbStyle::setItemName(item, QLatin1String("check-indicator"));
   881                 return item;
   246                 return item;
   882                 }
   247                 }
   883 
   248 
   884             case P_MenuItem_separator:
   249             case P_MenuItem_separator:
   885                 {
   250                 {
   886                 HbIconItem *item = new HbIconItem(parent);
   251                 HbIconItem *item = new HbIconItem(parent);
   887                 setItemName(item, QLatin1String("separator"));
   252                 HbStyle::setItemName(item, QLatin1String("separator"));
   888                 return item;
   253                 return item;
   889                 }
   254                 }
   890             case P_ToolButton_icon:
   255             case P_ToolButton_icon:
   891             case P_PushButton_icon:
   256             case P_PushButton_icon:
   892             case P_ProgressDialog_icon: {
   257             case P_ProgressDialog_icon: {
   893                 HbIconItem *iconItem = new HbIconItem(HbIcon(),parent);
   258                 HbIconItem *iconItem = new HbIconItem(HbIcon(),parent);
   894                 setItemName(iconItem, QLatin1String("icon"));
   259                 HbStyle::setItemName(iconItem, QLatin1String("icon"));
   895                 return iconItem;
   260                 return iconItem;
   896                 }
   261                 }
   897 
   262 
   898             case P_CheckBox_icon:
   263             case P_CheckBox_icon:
   899             case P_GroupBoxHeading_icon:
   264             case P_GroupBoxHeading_icon:
   900             case P_Label_icon:
   265             case P_Label_icon:
   901             case P_GridViewItem_icon: {
   266             case P_GridViewItem_icon: {
   902                 HbIconItem *item = q_check_ptr(new HbIconItem(HbIcon(),parent));
   267                 HbIconItem *item = q_check_ptr(new HbIconItem(HbIcon(),parent));
   903                 setItemName(item, QLatin1String("icon"));
   268                 HbStyle::setItemName(item, QLatin1String("icon"));
   904                 return item;
   269                 return item;
   905                 }
   270                 }
   906             case P_DataGroup_icon:
   271             case P_DataGroup_icon:
   907                 {
   272                 {
   908                 HbIconItem *item = new HbIconItem(HbIcon(), parent);
   273                 HbIconItem *item = new HbIconItem(HbIcon(), parent);
   909                 setItemName(item, QLatin1String("dataGroup_Icon"));
   274                 HbStyle::setItemName(item, QLatin1String("dataGroup_Icon"));
   910                 return item;
   275                 return item;
   911                 }
   276                 }
   912             case P_DataItem_icon:
   277             case P_DataItem_icon:
   913                 {
   278                 {
   914                 HbIconItem *item = new HbIconItem(HbIcon(), parent);
   279                 HbIconItem *item = new HbIconItem(HbIcon(), parent);
   915                 setItemName(item, QLatin1String("dataItem_Icon"));
   280                 HbStyle::setItemName(item, QLatin1String("dataItem_Icon"));
   916                 return item;
   281                 return item;
   917                 }
   282                 }
   918             case P_ComboBox_text:
   283             case P_ComboBox_text:
   919                 {
   284                 {
   920                     HbTextItem *textItem = new HbTextItem(parent);
   285                     HbTextItem *textItem = new HbTextItem(parent);
   921                     setItemName(textItem, QLatin1String("combobox_labelfield"));
   286                     HbStyle::setItemName(textItem, QLatin1String("combobox_labelfield"));
   922                     return  textItem;
   287                     return  textItem;
   923                 }
   288                 }
   924             case P_ToolButton_text:
   289             case P_ToolButton_text:
   925             case P_CheckBox_text:
   290             case P_CheckBox_text:
   926             case P_ProgressDialog_text:
   291             case P_ProgressDialog_text:
   927                 {
   292                 {
   928                     HbTextItem *textItem = new HbTextItem(parent);
   293                     HbTextItem *textItem = new HbTextItem(parent);
   929                     setItemName(textItem, QLatin1String("text"));
   294                     HbStyle::setItemName(textItem, QLatin1String("text"));
   930                     return  textItem;
   295                     return  textItem;
   931                 }
   296                 }
   932             case P_PushButton_text:
   297             case P_PushButton_text:
   933                 {
   298                 {
   934                 HbTextItem *ti = new HbTextItem(parent);
   299                 HbTextItem *ti = new HbTextItem(parent);
   935                 setItemName(ti, QLatin1String("text"));
   300                 HbStyle::setItemName(ti, QLatin1String("text"));
   936                 return  ti;
   301                 return  ti;
   937                 }
   302                 }
   938             case P_DataGroup_heading:
   303             case P_DataGroup_heading:
   939                 {
   304                 {
   940                 HbTextItem *ti = new HbTextItem(parent);
   305                 HbTextItem *ti = new HbTextItem(parent);
   941                 setItemName(ti, QLatin1String("dataGroup_HeadingLabel"));
   306                 HbStyle::setItemName(ti, QLatin1String("dataGroup_HeadingLabel"));
   942                 return  ti;
   307                 return  ti;
   943                 }
   308                 }
   944             case P_DataGroup_description:
   309             case P_DataGroup_description:
   945                 {
   310                 {
   946                 HbTextItem *ti = new HbTextItem(parent);
   311                 HbTextItem *ti = new HbTextItem(parent);
   947                 setItemName(ti, QLatin1String("dataGroup_Description"));
   312                 HbStyle::setItemName(ti, QLatin1String("dataGroup_Description"));
   948                 return  ti;
   313                 return  ti;
   949                 }
   314                 }
   950             case P_DataForm_heading:
   315             case P_DataForm_heading:
   951                 {
   316                 {
   952                 HbTextItem *ti = new HbTextItem(parent);
   317                 HbTextItem *ti = new HbTextItem(parent);
   953                 setItemName(ti, QLatin1String("dataForm_Heading"));
   318                 HbStyle::setItemName(ti, QLatin1String("dataForm_Heading"));
   954                 //ti->setZValue(2);
   319                 //ti->setZValue(2);
   955                 return  ti;
   320                 return  ti;
   956                 }
   321                 }
   957             case P_DataForm_description:
   322             case P_DataForm_description:
   958                 {
   323                 {
   959                 HbTextItem *ti = new HbTextItem(parent);
   324                 HbTextItem *ti = new HbTextItem(parent);
   960                 setItemName(ti, QLatin1String("dataForm_Desc"));
   325                 HbStyle::setItemName(ti, QLatin1String("dataForm_Desc"));
   961                 return  ti;
   326                 return  ti;
   962                 }
   327                 }
   963             case P_PushButton_additionaltext:
   328             case P_PushButton_additionaltext:
   964                 {
   329                 {
   965                 HbTextItem *ti = new HbTextItem(parent);
   330                 HbTextItem *ti = new HbTextItem(parent);
   966                 setItemName(ti, QLatin1String("additional-text"));
   331                 HbStyle::setItemName(ti, QLatin1String("additional-text"));
   967                 return  ti;
   332                 return  ti;
   968                 }
   333                 }
   969             case P_ProgressSlider_toucharea:
   334             case P_ProgressSlider_toucharea:
   970                 {
   335                 {
   971                 HbTouchArea *ta = new HbTouchArea(parent);
   336                 HbTouchArea *ta = new HbTouchArea(parent);
   972                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
   337                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
   973                 setItemName(ta, QLatin1String("toucharea"));
   338                 HbStyle::setItemName(ta, QLatin1String("toucharea"));
   974                 ta->setZValue(TOUCHAREA_ZVALUE);
   339                 ta->setZValue(TOUCHAREA_ZVALUE);
   975                 return ta;
   340                 return ta;
   976                 }
   341                 }
   977             case P_ProgressSliderHandle_toucharea:
   342             case P_ProgressSliderHandle_toucharea:
   978                 {
   343                 {
   979                 HbTouchArea *ta = new HbTouchArea(parent);
   344                 HbTouchArea *ta = new HbTouchArea(parent);
   980                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
   345                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
   981                 setItemName(ta, QLatin1String("toucharea"));
   346                 HbStyle::setItemName(ta, QLatin1String("toucharea"));
   982                 ta->setZValue(TOUCHAREA_ZVALUE);
   347                 ta->setZValue(TOUCHAREA_ZVALUE);
   983                 if(parent){
   348                 if(parent){
   984                     parent->setFiltersChildEvents(true);
   349                     parent->setFiltersChildEvents(true);
   985                 }
   350                 }
   986                 return ta;
   351                 return ta;
   997             case P_RatingSlider_toucharea:
   362             case P_RatingSlider_toucharea:
   998             case P_SliderElement_touchhandle:
   363             case P_SliderElement_touchhandle:
   999                 {
   364                 {
  1000                 HbTouchArea *ta = new HbTouchArea(parent);
   365                 HbTouchArea *ta = new HbTouchArea(parent);
  1001                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
   366                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
  1002                 setItemName(ta, QLatin1String("toucharea"));
   367                 HbStyle::setItemName(ta, QLatin1String("toucharea"));
  1003                 if(parent){
   368                 if(parent){
  1004                     parent->setFiltersChildEvents(true);
   369                     parent->setFiltersChildEvents(true);
  1005                 }
   370                 }
  1006                 return ta;
   371                 return ta;
  1007                 }
   372                 }
  1008             case P_ScrollBar_toucharea:
   373             case P_ScrollBar_toucharea:
  1009                 {
   374                 {
  1010                 HbTouchArea *ta = new HbTouchArea(parent);
   375                 HbTouchArea *ta = new HbTouchArea(parent);
  1011                 ta->setFlags(QGraphicsItem::ItemIsFocusable);
   376                 ta->setFlags(QGraphicsItem::ItemIsFocusable);
  1012                 setItemName(ta, QLatin1String("toucharea"));
   377                 HbStyle::setItemName(ta, QLatin1String("toucharea"));
  1013                 // NOTE:: This is a temporary fix
   378                 // NOTE:: This is a temporary fix
  1014                 //if(parent){
   379                 //if(parent){
  1015                 //    parent->setHandlesChildEvents(true);
   380                 //    parent->setHandlesChildEvents(true);
  1016                 //}
   381                 //}
  1017                 return ta;
   382                 return ta;
  1018                 }
   383                 }
  1019             case P_ComboBoxButton_toucharea:
   384             case P_ComboBoxButton_toucharea:
  1020                 {
   385                 {
  1021                 HbTouchArea *ta = new HbTouchArea(parent);
   386                 HbTouchArea *ta = new HbTouchArea(parent);
  1022                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
   387                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
  1023                 setItemName(ta, QLatin1String("combobox_button_toucharea"));
   388                 HbStyle::setItemName(ta, QLatin1String("combobox_button_toucharea"));
  1024                 if(parent){
   389                 if(parent){
  1025                     parent->setFiltersChildEvents(true);
   390                     parent->setFiltersChildEvents(true);
  1026                 }
   391                 }
  1027                 return ta;
   392                 return ta;
  1028                 }
   393                 }
  1029              case P_TitleBar_toucharea: 
   394              case P_TitleBar_toucharea:
  1030                 {
   395                 {
  1031                 HbTouchArea *ta = new HbTouchArea(parent);
   396                 HbTouchArea *ta = new HbTouchArea(parent);
  1032                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
   397                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
  1033                 setItemName(ta, QLatin1String("toucharea"));
   398                 ta->grabGesture(Qt::SwipeGesture);
       
   399                 HbStyle::setItemName(ta, QLatin1String("toucharea"));
  1034                 return ta;
   400                 return ta;
  1035                 }
   401                 }
  1036              case P_IndicatorButton_toucharea:
   402              case P_IndicatorButton_toucharea:
  1037              case P_TitlePane_toucharea:
       
  1038              case P_NavigationButton_toucharea:
   403              case P_NavigationButton_toucharea:
  1039                 {
   404                 {
  1040                 HbTouchArea *ta = new HbTouchArea(parent);
   405                 HbTouchArea *ta = new HbTouchArea(parent);
  1041                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
   406                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
  1042                 setItemName(ta, QLatin1String("toucharea"));
   407                 ta->grabGesture(Qt::TapGesture);
       
   408                 HbStyle::setItemName(ta, QLatin1String("toucharea"));
       
   409                 if (parent){
       
   410                     parent->setHandlesChildEvents(true);
       
   411                 }
       
   412                 return ta;
       
   413                 }
       
   414              case P_TitlePane_toucharea:
       
   415                 {
       
   416                 HbTouchArea *ta = new HbTouchArea(parent);
       
   417                 ta->setFlag(QGraphicsItem::ItemIsFocusable);
       
   418                 ta->grabGesture(Qt::TapGesture);
       
   419                 ta->grabGesture(Qt::SwipeGesture);
       
   420                 ta->grabGesture(Qt::PanGesture);
       
   421                 HbStyle::setItemName(ta, QLatin1String("toucharea"));
  1043                 if (parent){
   422                 if (parent){
  1044                     parent->setHandlesChildEvents(true);
   423                     parent->setHandlesChildEvents(true);
  1045                 }
   424                 }
  1046                 return ta;
   425                 return ta;
  1047                 }
   426                 }
  1063                 return  ti;
   442                 return  ti;
  1064             }
   443             }
  1065             case P_DataItem_label:
   444             case P_DataItem_label:
  1066             {
   445             {
  1067                 HbTextItem *ti = new HbTextItem(parent);
   446                 HbTextItem *ti = new HbTextItem(parent);
  1068                 setItemName(ti, QLatin1String("dataItem_Label"));
   447                 HbStyle::setItemName(ti, QLatin1String("dataItem_Label"));
  1069                 return  ti;
   448                 return  ti;
  1070             }
   449             }
  1071             case P_DataItem_description:
   450             case P_DataItem_description:
  1072             {
   451             {
  1073                 HbTextItem *ti = new HbTextItem(parent);
   452                 HbTextItem *ti = new HbTextItem(parent);
  1074                 setItemName(ti, QLatin1String("dataItem_Description"));
   453                 HbStyle::setItemName(ti, QLatin1String("dataItem_Description"));
  1075                 return  ti;
   454                 return  ti;
  1076             }
   455             }
  1077             case P_ProgressBar_mintext:
   456             case P_ProgressBar_mintext:
  1078             {
   457             {
  1079                 HbTextItem *ti = new HbTextItem(parent);
   458                 HbTextItem *ti = new HbTextItem(parent);
  1080                 setItemName(ti, QLatin1String("min-text"));
   459                 HbStyle::setItemName(ti, QLatin1String("min-text"));
  1081                 return  ti;
   460                 return  ti;
  1082             }
   461             }
  1083             case P_ProgressBar_maxtext:
   462             case P_ProgressBar_maxtext:
  1084             {
   463             {
  1085                 HbTextItem *ti = new HbTextItem(parent);
   464                 HbTextItem *ti = new HbTextItem(parent);
  1086                 setItemName(ti, QLatin1String("max-text"));
   465                 HbStyle::setItemName(ti, QLatin1String("max-text"));
  1087                 return  ti;
   466                 return  ti;
  1088             }
   467             }
  1089             case P_Label_text: {
   468             case P_Label_text: {
  1090                 HbTextItem *ti = new HbTextItem(parent);
   469                 HbTextItem *ti = new HbTextItem(parent);
  1091                 setItemName(ti, QLatin1String("text"));
   470                 HbStyle::setItemName(ti, QLatin1String("text"));
  1092                 ti->setAlignment(Qt::AlignCenter);
   471                 ti->setAlignment(Qt::AlignCenter);
  1093                 return ti;
   472                 return ti;
  1094             }
   473             }
  1095 
   474 
  1096             case P_Label_richtext:
   475             case P_Label_richtext:
  1097             {
   476             {
  1098                 HbRichTextItem *rti = new HbRichTextItem(parent);
   477                 HbRichTextItem *rti = new HbRichTextItem(parent);
  1099                 setItemName(rti, QLatin1String("text"));
   478                 HbStyle::setItemName(rti, QLatin1String("text"));
  1100                 return rti;
   479                 return rti;
  1101             }
   480             }
  1102 
   481 
  1103             case P_MenuItem_text:
   482             case P_MenuItem_text:
  1104                 {
   483                 {
  1105                 HbTextItem *item = new HbTextItem(parent);
   484                 HbTextItem *item = new HbTextItem(parent);
  1106                 setItemName(item, QLatin1String("text"));
   485                 HbStyle::setItemName(item, QLatin1String("text"));
  1107 
   486 
  1108                 return item;
   487                 return item;
  1109                 }
   488                 }
  1110 
   489 
  1111             case P_Slider_thumb:
   490             case P_Slider_thumb:
  1134             case P_ProgressBar_frame:
   513             case P_ProgressBar_frame:
  1135             {
   514             {
  1136                 HbFrameItem *n = new HbFrameItem(parent);
   515                 HbFrameItem *n = new HbFrameItem(parent);
  1137                 n->setZValue(-1);
   516                 n->setZValue(-1);
  1138                 n->frameDrawer().setFillWholeRect(true);
   517                 n->frameDrawer().setFillWholeRect(true);
  1139                 setItemName(n, "frame");
   518                 HbStyle::setItemName(n, "frame");
  1140                 return n;
   519                 return n;
  1141             }
   520             }
  1142 
   521 
  1143             case P_ComboBoxPopup_background:
   522             case P_ComboBoxPopup_background:
  1144             {
   523             {
  1145                 HbFrameItem *n = new HbFrameItem(parent);
   524                 HbFrameItem *n = new HbFrameItem(parent);
  1146                 n->setZValue(-1);
   525                 n->setZValue(-1);
  1147                 setItemName(n , "dropdown_background");
   526                 HbStyle::setItemName(n , "dropdown_background");
  1148                 return n;
   527                 return n;
  1149             }
   528             }
  1150 
   529 
  1151             case P_TumbleView_background:
   530             case P_TumbleView_background:
  1152             case P_TumbleView_frame:
   531             case P_TumbleView_frame:
  1168             }
   547             }
  1169             case P_DataGroup_background :
   548             case P_DataGroup_background :
  1170             {
   549             {
  1171                 HbFrameItem *n = new HbFrameItem(parent);
   550                 HbFrameItem *n = new HbFrameItem(parent);
  1172                 n->setZValue(-1);
   551                 n->setZValue(-1);
  1173                 setItemName(n, QLatin1String("dataGroup_Background"));
   552                 HbStyle::setItemName(n, QLatin1String("dataGroup_Background"));
  1174                 return n;
   553                 return n;
  1175             }
   554             }
  1176             case P_DataGroupComboBackground:
   555             case P_DataGroupComboBackground:
  1177             {
   556             {
  1178                 HbFrameItem *n = new HbFrameItem(parent);
   557                 HbFrameItem *n = new HbFrameItem(parent);
  1179                 n->setZValue(-1);
   558                 n->setZValue(-1);
  1180                 setItemName(n, QLatin1String("dataGroup_ComboBackground"));
   559                 HbStyle::setItemName(n, QLatin1String("dataGroup_ComboBackground"));
  1181                 return n;
   560                 return n;
  1182             }
   561             }
  1183             case P_DataForm_heading_background :
   562             case P_DataForm_heading_background :
  1184             {
   563             {
  1185                 HbFrameItem *n = new HbFrameItem(parent);
   564                 HbFrameItem *n = new HbFrameItem(parent);
  1186                 n->setZValue(-1);
   565                 n->setZValue(-1);
  1187                 setItemName(n, QLatin1String("dataFormHeading_Background"));
   566                 HbStyle::setItemName(n, QLatin1String("dataFormHeading_Background"));
  1188                 return n;
   567                 return n;
  1189             }
   568             }
  1190             case P_DataItem_background:
   569             case P_DataItem_background:
  1191             {
   570             {
  1192                 HbFrameItem *n = new HbFrameItem(parent);
   571                 HbFrameItem *n = new HbFrameItem(parent);
  1193                 n->setZValue(-2);
   572                 n->setZValue(-2);
  1194                 setItemName(n, QLatin1String("dataItem_Background"));
   573                 HbStyle::setItemName(n, QLatin1String("dataItem_Background"));
  1195                 return n;
   574                 return n;
  1196             }
   575             }
  1197             case P_GroupBoxContent_background:
   576             case P_GroupBoxContent_background:
  1198             case P_GroupBoxHeading_background:
   577             case P_GroupBoxHeading_background:
  1199             case P_PushButton_background:
   578             case P_PushButton_background:
  1200             {
   579             {
  1201                 HbFrameItem *n = new HbFrameItem(parent);
   580                 HbFrameItem *n = new HbFrameItem(parent);
  1202                 n->setZValue(-1);
   581                 n->setZValue(-1);
  1203                 setItemName(n, QLatin1String("background"));
   582                 HbStyle::setItemName(n, QLatin1String("background"));
  1204                 return n;
   583                 return n;
  1205             }
   584             }
  1206             case P_ProgressBar_track:
   585             case P_ProgressBar_track:
  1207             {
   586             {
  1208                 HbProgressTrackItem *n = new HbProgressTrackItem(parent);
   587                 HbProgressTrackItem *n = new HbProgressTrackItem(parent);
  1224             }
   603             }
  1225             case P_ToolButton_frame:
   604             case P_ToolButton_frame:
  1226             {
   605             {
  1227                 HbFrameItem *n = new HbFrameItem(parent);
   606                 HbFrameItem *n = new HbFrameItem(parent);
  1228                 n->setZValue(-1);
   607                 n->setZValue(-1);
  1229                 setItemName(n, QLatin1String("background"));
   608                 HbStyle::setItemName(n, QLatin1String("background"));
  1230                 return n;
   609                 return n;
  1231             }
   610             }
  1232             case P_NavigationButton_background:
   611             case P_NavigationButton_background:
  1233             case P_IndicatorButton_background:
   612             case P_IndicatorButton_background:
  1234             {
   613             {
  1235                 HbIconItem *n = new HbIconItem(HbIcon(), parent);
   614                 HbIconItem *n = new HbIconItem(HbIcon(), parent);
  1236                 n->setZValue(-1);
   615                 n->setZValue(-1);
  1237                 setItemName(n, QLatin1String("background"));
   616                 HbStyle::setItemName(n, QLatin1String("background"));
  1238                 return n;
   617                 return n;
  1239             }
   618             }
  1240             case P_IndicatorButton_handleindication:
   619             case P_IndicatorButton_handleindication:
  1241             {
   620             {
  1242                 HbIconItem *n = new HbIconItem(parent);
   621                 HbIconItem *n = new HbIconItem(parent);
  1243                 setItemName(n, QLatin1String("handleindication"));
   622                 HbStyle::setItemName(n, QLatin1String("handleindication"));
  1244                 return n;
   623                 return n;
  1245             }
   624             }
  1246             case P_IndicatorButton_eventindication:
   625             case P_IndicatorButton_eventindication:
  1247             {
   626             {
  1248                 HbIconItem *n = new HbIconItem(parent);
   627                 HbIconItem *n = new HbIconItem(parent);
  1249                 n->setFlags(HbIcon::Colorized);
   628                 n->setFlags(HbIcon::Colorized);
  1250                 setItemName(n, QLatin1String("eventindication"));
   629                 HbStyle::setItemName(n, QLatin1String("eventindication"));
  1251                 return n;
   630                 return n;
  1252             }
   631             }
  1253             case P_IndicatorGroup_icon1:
   632             case P_IndicatorGroup_icon1:
  1254             {
   633             {
  1255                 HbIconItem *n = new HbIconItem(parent);
   634                 HbIconItem *n = new HbIconItem(parent);
  1256                 n->setFlags(HbIcon::Colorized);
   635                 n->setFlags(HbIcon::Colorized);
  1257                 setItemName(n, QLatin1String("icon1"));
   636                 HbStyle::setItemName(n, QLatin1String("icon1"));
  1258                 return n;
   637                 return n;
  1259             }
   638             }
  1260             case P_IndicatorGroup_icon2:
   639             case P_IndicatorGroup_icon2:
  1261             {
   640             {
  1262                 HbIconItem *n = new HbIconItem(parent);
   641                 HbIconItem *n = new HbIconItem(parent);
  1263                 n->setFlags(HbIcon::Colorized);
   642                 n->setFlags(HbIcon::Colorized);
  1264                 setItemName(n, QLatin1String("icon2"));
   643                 HbStyle::setItemName(n, QLatin1String("icon2"));
  1265                 return n;
   644                 return n;
  1266             }
   645             }
  1267             case P_IndicatorGroup_icon3:
   646             case P_IndicatorGroup_icon3:
  1268             {
   647             {
  1269                 HbIconItem *n = new HbIconItem(parent);
   648                 HbIconItem *n = new HbIconItem(parent);
  1270                 n->setFlags(HbIcon::Colorized);
   649                 n->setFlags(HbIcon::Colorized);
  1271                 setItemName(n, QLatin1String("icon3"));
   650                 HbStyle::setItemName(n, QLatin1String("icon3"));
  1272                 return n;
   651                 return n;
  1273             }
   652             }
  1274             case P_IndicatorGroup_icon4:
   653             case P_IndicatorGroup_icon4:
  1275             {
   654             {
  1276                 HbIconItem *n = new HbIconItem(parent);
   655                 HbIconItem *n = new HbIconItem(parent);
  1277                 n->setFlags(HbIcon::Colorized);
   656                 n->setFlags(HbIcon::Colorized);
  1278                 setItemName(n, QLatin1String("icon4"));
   657                 HbStyle::setItemName(n, QLatin1String("icon4"));
  1279                 return n;
   658                 return n;
  1280             }
   659             }
  1281             case P_SignalIndicator_icon:
   660             case P_SignalIndicator_icon:
  1282             {
   661             {
  1283                 HbIconItem *n = new HbIconItem(parent);
   662                 HbIconItem *n = new HbIconItem(parent);
  1284                 n->setFlags(HbIcon::Colorized);
   663                 n->setFlags(HbIcon::Colorized);
  1285                 setItemName(n, QLatin1String("icon"));
   664                 HbStyle::setItemName(n, QLatin1String("icon"));
  1286                 return n;
   665                 return n;
  1287             }
   666             }
  1288             case P_SignalLevel_background:
   667             case P_SignalLevel_background:
  1289             {
   668             {
  1290                 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent);
   669                 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent);
  1291                 n->setZValue(-1);
   670                 n->setZValue(-1);
  1292                 setItemName(n, QLatin1String("background"));
   671                 HbStyle::setItemName(n, QLatin1String("background"));
  1293                 return n;
   672                 return n;
  1294             }
   673             }
  1295             case P_SignalLevel_icon:
   674             case P_SignalLevel_icon:
  1296             {
   675             {
  1297                 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent);
   676                 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent);
  1298                 setItemName(n, QLatin1String("levelicon"));
   677                 HbStyle::setItemName(n, QLatin1String("levelicon"));
  1299                 return n;
   678                 return n;
  1300             }
   679             }
  1301             case P_BatteryIndicator_icon:
   680             case P_BatteryIndicator_icon:
  1302             {
   681             {
  1303                 HbIconItem *n = new HbIconItem(parent);
   682                 HbIconItem *n = new HbIconItem(parent);
  1304                 n->setFlags(HbIcon::Colorized);
   683                 n->setFlags(HbIcon::Colorized);
  1305                 setItemName(n, QLatin1String("icon"));
   684                 HbStyle::setItemName(n, QLatin1String("icon"));
  1306                 return n;
   685                 return n;
  1307             }
   686             }
  1308             case P_BatteryLevel_background:
   687             case P_BatteryLevel_background:
  1309             {
   688             {
  1310                 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent);
   689                 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent);
  1311                 n->setZValue(-1);
   690                 n->setZValue(-1);
  1312                 setItemName(n, QLatin1String("background"));
   691                 HbStyle::setItemName(n, QLatin1String("background"));
  1313                 return n;
   692                 return n;
  1314             }
   693             }
  1315             case P_BatteryLevel_icon:
   694             case P_BatteryLevel_icon:
  1316             {
   695             {
  1317                 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent);
   696                 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent);
  1318                 setItemName(n, QLatin1String("levelicon"));
   697                 HbStyle::setItemName(n, QLatin1String("levelicon"));
  1319                 return n;
   698                 return n;
  1320             }
   699             }
  1321             case P_TitlePane_background:
   700             case P_TitlePane_background:
  1322                 {
   701                 {
  1323                     HbFrameItem *n = new HbFrameItem(parent);
   702                     HbFrameItem *n = new HbFrameItem(parent);
  1324                     n->setZValue(-1);
   703                     n->setZValue(-1);
  1325                     setItemName(n, QLatin1String("background"));
   704                     HbStyle::setItemName(n, QLatin1String("background"));
  1326                     return n;
   705                     return n;
  1327                 }
   706                 }
  1328             case P_LineEdit_frame_normal:
   707             case P_LineEdit_frame_normal:
  1329             case P_LineEdit_frame_highlight:
   708             case P_LineEdit_frame_highlight:
  1330             case P_TextEdit_frame_normal:
   709             case P_TextEdit_frame_normal:
  1336             }
   715             }
  1337             case P_GroupBoxMarquee_text:
   716             case P_GroupBoxMarquee_text:
  1338             case P_TitlePane_text:
   717             case P_TitlePane_text:
  1339             {
   718             {
  1340                 HbMarqueeItem *n = new HbMarqueeItem(parent);
   719                 HbMarqueeItem *n = new HbMarqueeItem(parent);
  1341                 setItemName(n, QLatin1String("text"));
   720                 HbStyle::setItemName(n, QLatin1String("text"));
  1342                 return n;
   721                 return n;
  1343             }
   722             }
  1344             case P_TitlePane_icon:
   723             case P_TitlePane_icon:
  1345             {
   724             {
  1346                 HbIconItem *n = new HbIconItem(parent);
   725                 HbIconItem *n = new HbIconItem(parent);
  1347                 n->setFlags(HbIcon::Colorized);
   726                 n->setFlags(HbIcon::Colorized);
  1348                 setItemName(n, QLatin1String("icon"));
   727                 HbStyle::setItemName(n, QLatin1String("icon"));
  1349                 return n;
   728                 return n;
  1350             }
   729             }
  1351             case P_StatusBar_background:
   730             case P_StatusBar_background:
  1352             {
   731             {
  1353                 HbFrameItem *n = new HbFrameItem(parent);
   732                 HbFrameItem *n = new HbFrameItem(parent);
  1354                 n->setZValue(-1);
   733                 n->setZValue(-1);
  1355                 setItemName(n, QLatin1String("background"));
   734                 HbStyle::setItemName(n, QLatin1String("background"));
  1356                 return n;
   735                 return n;
  1357             }
   736             }
  1358             case P_StatusBar_timetext:
   737             case P_StatusBar_timetext:
  1359             {
   738             {
  1360                 HbTextItem *textItem = new HbTextItem(parent);
   739                 HbTextItem *textItem = new HbTextItem(parent);
  1361                 setItemName(textItem, QLatin1String("timetext"));
   740                 HbStyle::setItemName(textItem, QLatin1String("timetext"));
  1362                 textItem->setAlignment(Qt::AlignCenter);
   741                 textItem->setAlignment(Qt::AlignCenter);
  1363                 return textItem;
   742                 return textItem;
  1364             }
   743             }
  1365             case P_Fade_background:
   744             case P_Fade_background:
  1366                 return new HbIconItem(QString(), parent);
   745                 return new HbIconItem(QString(), parent);
  1369             case P_SliderElement_decrease:
   748             case P_SliderElement_decrease:
  1370                 return new HbIconItem(QString(), parent);
   749                 return new HbIconItem(QString(), parent);
  1371 
   750 
  1372             case P_SliderTickMark_majoricon: {
   751             case P_SliderTickMark_majoricon: {
  1373                 HbIconItem *iconItem = new HbIconItem(parent);
   752                 HbIconItem *iconItem = new HbIconItem(parent);
  1374                 setItemName(iconItem,QLatin1String("tickmark-majoricon"));
   753                 HbStyle::setItemName(iconItem,QLatin1String("tickmark-majoricon"));
  1375                 return iconItem;
   754                 return iconItem;
  1376             }
   755             }
  1377             case P_SliderTickMark_minoricon: {
   756             case P_SliderTickMark_minoricon: {
  1378                 HbIconItem *iconItem = new HbIconItem(parent);
   757                 HbIconItem *iconItem = new HbIconItem(parent);
  1379                 setItemName(iconItem,QLatin1String("tickmark-minoricon"));
   758                 HbStyle::setItemName(iconItem,QLatin1String("tickmark-minoricon"));
  1380                 return iconItem;
   759                 return iconItem;
  1381             }
   760             }
  1382             case P_SliderTickMark_majorlabel: {
   761             case P_SliderTickMark_majorlabel: {
  1383                 HbTextItem *textItem = new HbTextItem(parent);
   762                 HbTextItem *textItem = new HbTextItem(parent);
  1384                 setItemName(textItem,QLatin1String("tickmark-majorlabel"));
   763                 HbStyle::setItemName(textItem,QLatin1String("tickmark-majorlabel"));
  1385                 return textItem;
   764                 return textItem;
  1386             }
   765             }
  1387             case P_SliderTickMark_minorlabel: {
   766             case P_SliderTickMark_minorlabel: {
  1388                 HbTextItem *textItem = new HbTextItem(parent);
   767                 HbTextItem *textItem = new HbTextItem(parent);
  1389                 setItemName(textItem,QLatin1String("tickmark-minorlabel"));
   768                 HbStyle::setItemName(textItem,QLatin1String("tickmark-minorlabel"));
  1390                 return textItem;
   769                 return textItem;
  1391             }
   770             }
  1392 
   771 
  1393             case P_ProgressBar_waittrack:
   772             case P_ProgressBar_waittrack:
  1394                 return new HbRepeatIconItem(QLatin1String("qtg_graf_progbar_h_wait"), parent);
   773                 return new HbRepeatIconItem(QLatin1String("qtg_graf_progbar_h_wait"), parent);
  1399             case P_RatingSlider_track:
   778             case P_RatingSlider_track:
  1400                 return new HbRepeatMaskItem(parent);
   779                 return new HbRepeatMaskItem(parent);
  1401 
   780 
  1402             case P_RatingSlider_layout: {
   781             case P_RatingSlider_layout: {
  1403                 HbWidgetBase *layout = new HbWidgetBase(parent);
   782                 HbWidgetBase *layout = new HbWidgetBase(parent);
  1404                 setItemName(layout, "frame");
   783                 HbStyle::setItemName(layout, "frame");
  1405                 return layout;
   784                 return layout;
  1406             }
   785             }
  1407 
   786 
  1408             case P_ItemViewItem_checkbox: {
   787             case P_ItemViewItem_checkbox: {
  1409                 qDebug() << "Primitive P_ItemViewItem_checkbox is deprecated and will cease to exist in the near future.";
   788                 qDebug() << "Primitive P_ItemViewItem_checkbox is deprecated and will cease to exist in the near future.";
  1410                 HbIconItem *iconItem = new HbIconItem(parent);
   789                 HbIconItem *iconItem = new HbIconItem(parent);
  1411                 setItemName(iconItem, QLatin1String("checkbox-icon"));
   790                 HbStyle::setItemName(iconItem, QLatin1String("checkbox-icon"));
  1412                 return iconItem;
   791                 return iconItem;
  1413             }
   792             }
  1414 
   793 
  1415             case P_ItemViewItem_radiobutton:
   794             case P_ItemViewItem_radiobutton:
  1416             case P_ItemViewItem_selection: {
   795             case P_ItemViewItem_selection: {
  1417                 HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent));
   796                 HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent));
  1418                 setItemName(iconItem, QLatin1String("selection-icon"));
   797                 HbStyle::setItemName(iconItem, QLatin1String("selection-icon"));
  1419                 return iconItem;
   798                 return iconItem;
  1420             }
   799             }
  1421 
   800 
  1422             case P_Edit_text:{
   801             case P_Edit_text:{
  1423                 return 0;
   802                 return 0;
  1424             }
   803             }
  1425             case P_GroupBoxHeading_text:
   804             case P_GroupBoxHeading_text:
  1426             case P_NotificationDialog_text:{
   805             case P_NotificationDialog_text:{
  1427                 HbTextItem *n = new HbTextItem(parent);
   806                 HbTextItem *n = new HbTextItem(parent);
  1428                 setItemName(n, QLatin1String("text"));
   807                 HbStyle::setItemName(n, QLatin1String("text"));
  1429                 n->setMinimumLines(1);
   808                 n->setMinimumLines(1);
  1430                 n->setMaximumLines(1);
   809                 n->setMaximumLines(1);
  1431                 n->setTextWrapping(Hb::TextNoWrap);
   810                 n->setTextWrapping(Hb::TextNoWrap);
  1432                 return n;
   811                 return n;
  1433             }
   812             }
  1434             case P_NotificationDialog_title:{
   813             case P_NotificationDialog_title:{
  1435                 HbTextItem *n = new HbTextItem(parent);
   814                 HbTextItem *n = new HbTextItem(parent);
  1436                 setItemName(n, QLatin1String("title"));
   815                 HbStyle::setItemName(n, QLatin1String("title"));
  1437                 return n;
   816                 return n;
  1438             }
   817             }
  1439             case P_NotificationDialog_icon:{
   818             case P_NotificationDialog_icon:{
  1440                 HbIconItem *n = new HbIconItem(QString(), parent);
   819                 HbIconItem *n = new HbIconItem(QString(), parent);
  1441                 setItemName(n, QLatin1String("icon"));
   820                 HbStyle::setItemName(n, QLatin1String("icon"));
  1442                 return n;
   821                 return n;
  1443             }
   822             }
  1444             case P_MessageBox_text:{    //deprecated
   823             case P_MessageBox_text:{    //deprecated
  1445                 HbTextItem *rti = new HbTextItem(parent);
   824                 HbTextItem *rti = new HbTextItem(parent);
  1446                 return rti;
   825                 return rti;
  1451             }
   830             }
  1452 
   831 
  1453             case P_ItemViewItem_background: {
   832             case P_ItemViewItem_background: {
  1454                 HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent));
   833                 HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent));
  1455                 iconItem->setZValue(-3.0);
   834                 iconItem->setZValue(-3.0);
  1456                 setItemName(iconItem, QLatin1String("background"));
   835                 HbStyle::setItemName(iconItem, QLatin1String("background"));
       
   836                 iconItem->setAspectRatioMode(Qt::IgnoreAspectRatio);
  1457                 return iconItem;
   837                 return iconItem;
  1458             }
   838             }
  1459 
   839 
  1460             case P_ListViewItem_text: {
   840             case P_ListViewItem_text: {
  1461                 HbTextItem *textItem = q_check_ptr(new HbTextItem(parent));
   841                 HbTextItem *textItem = q_check_ptr(new HbTextItem(parent));
  1470 
   850 
  1471             case P_GridViewItem_text: {
   851             case P_GridViewItem_text: {
  1472                 HbTextItem *textItem = q_check_ptr(new HbTextItem(parent));
   852                 HbTextItem *textItem = q_check_ptr(new HbTextItem(parent));
  1473                 // caching do not work properly - text is not refreshed immediatelly
   853                 // caching do not work properly - text is not refreshed immediatelly
  1474                 //textItem->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
   854                 //textItem->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
  1475                 setItemName(textItem, QLatin1String("text"));
   855                 HbStyle::setItemName(textItem, QLatin1String("text"));
  1476                 return textItem;
   856                 return textItem;
  1477             }
   857             }
  1478 
   858 
  1479             case P_ListViewItem_icon:
   859             case P_ListViewItem_icon:
  1480                 return q_check_ptr(new HbIconItem(parent));
   860                 return q_check_ptr(new HbIconItem(parent));
  1486             case P_ColorGridViewItem_checkIcon:
   866             case P_ColorGridViewItem_checkIcon:
  1487                 return new HbIconItem("qtg_small_tick", parent);
   867                 return new HbIconItem("qtg_small_tick", parent);
  1488 
   868 
  1489             case P_TreeViewItem_expandicon: {
   869             case P_TreeViewItem_expandicon: {
  1490                 HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent));
   870                 HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent));
  1491                 setItemName(iconItem, QLatin1String("subitem-indicator"));
   871                 HbStyle::setItemName(iconItem, QLatin1String("subitem-indicator"));
  1492                 return iconItem;
   872                 return iconItem;
  1493             }
   873             }
  1494 
   874 
  1495             case P_SelectionControl_selectionstart://fallthrough
   875             case P_SelectionControl_selectionstart://fallthrough
  1496             case P_SelectionControl_selectionend://fallthrough
   876             case P_SelectionControl_selectionend://fallthrough
  1505                         break;
   885                         break;
  1506                     default:
   886                     default:
  1507                         qWarning("Unknown HbSelectionControl primitive %i", primitive);
   887                         qWarning("Unknown HbSelectionControl primitive %i", primitive);
  1508                         break;
   888                         break;
  1509                 }
   889                 }
  1510                 setItemName(iconItem, QLatin1String("handle-icon"));
   890                 HbStyle::setItemName(iconItem, QLatin1String("handle-icon"));
  1511                 return iconItem;
   891                 return iconItem;
  1512             }
   892             }
  1513             case P_ComboBox_button: {
   893             case P_ComboBox_button: {
  1514                 HbIconItem *n = new HbIconItem(QString(), parent);
   894                 HbIconItem *n = new HbIconItem(QString(), parent);
  1515                 return n;
   895                 return n;
  1523                 return new HbFrameItem(parent);
   903                 return new HbFrameItem(parent);
  1524 
   904 
  1525             case P_ItemViewItem_frame: {
   905             case P_ItemViewItem_frame: {
  1526                 HbFrameItem *item = q_check_ptr(new HbFrameItem(parent));
   906                 HbFrameItem *item = q_check_ptr(new HbFrameItem(parent));
  1527                 item->setZValue(-4.0);
   907                 item->setZValue(-4.0);
  1528                 setItemName(item,"frame");
   908                 HbStyle::setItemName(item,"frame");
  1529                 return item;
   909                 return item;
  1530             }
   910             }
  1531             case P_ScrollArea_continuationbottom:
   911             case P_ScrollArea_continuationbottom:
  1532             {
   912             {
  1533                 HbFrameItem *n = new HbFrameItem(parent);
   913                 HbFrameItem *n = new HbFrameItem(parent);
  1534                 setItemName(n, QLatin1String("continuation-indicator-bottom"));
   914                 HbStyle::setItemName(n, QLatin1String("continuation-indicator-bottom"));
  1535                 n->setZValue(-1);
   915                 n->setZValue(-1);
  1536                 return n;
   916                 return n;
  1537             }
   917             }
  1538             case P_ScrollArea_continuationtop:
   918             case P_ScrollArea_continuationtop:
  1539             {
   919             {
  1540                 HbFrameItem *n = new HbFrameItem(parent);
   920                 HbFrameItem *n = new HbFrameItem(parent);
  1541                 setItemName(n, QLatin1String("continuation-indicator-top"));
   921                 HbStyle::setItemName(n, QLatin1String("continuation-indicator-top"));
  1542                 n->setZValue(-1);
   922                 n->setZValue(-1);
  1543                 return n;
   923                 return n;
  1544             }
   924             }
  1545             case P_ScrollArea_continuationleft:
   925             case P_ScrollArea_continuationleft:
  1546             {
   926             {
  1547                 HbFrameItem *n = new HbFrameItem(parent);
   927                 HbFrameItem *n = new HbFrameItem(parent);
  1548                 setItemName(n, QLatin1String("continuation-indicator-left"));
   928                 HbStyle::setItemName(n, QLatin1String("continuation-indicator-left"));
  1549                 n->setZValue(-1);
   929                 n->setZValue(-1);
  1550                 return n;
   930                 return n;
  1551             }
   931             }
  1552             case P_ScrollArea_continuationright:
   932             case P_ScrollArea_continuationright:
  1553                 {
   933                 {
  1554                 HbFrameItem *n = new HbFrameItem(parent);
   934                 HbFrameItem *n = new HbFrameItem(parent);
  1555                 setItemName(n, QLatin1String("continuation-indicator-right"));
   935                 HbStyle::setItemName(n, QLatin1String("continuation-indicator-right"));
  1556                 n->setZValue(-1);
   936                 n->setZValue(-1);
  1557                 return n;
   937                 return n;
  1558             }
   938             }
  1559             case P_ItemViewItem_touchmultiselection:
   939             case P_ItemViewItem_touchmultiselection:
  1560             {
   940             {
  1561                 HbTouchArea *area = q_check_ptr(new HbTouchArea(parent));
   941                 HbTouchArea *area = q_check_ptr(new HbTouchArea(parent));
  1562                 setItemName(area, "multiselection-toucharea");
   942                 HbStyle::setItemName(area, "multiselection-toucharea");
  1563                 return area;
   943                 return area;
  1564             }
   944             }
  1565             case P_IndexFeedback_popup_text:
   945             case P_IndexFeedback_popup_text:
  1566             {
   946             {
  1567                 HbTextItem *textItem = new HbTextItem(parent);
   947                 HbTextItem *textItem = new HbTextItem(parent);
  1568                 textItem->setAlignment(Qt::AlignCenter);
   948                 textItem->setAlignment(Qt::AlignCenter);
  1569                 textItem->setTextWrapping(Hb::TextNoWrap);
   949                 textItem->setTextWrapping(Hb::TextNoWrap);
  1570                 setItemName(textItem, QLatin1String("index-text"));
   950                 HbStyle::setItemName(textItem, QLatin1String("index-text"));
  1571 
   951 
  1572                 //TODO:: make this a sane value
   952                 //TODO:: make this a sane value
  1573                 textItem->setZValue(4);
   953                 textItem->setZValue(4);
  1574                 return textItem;
   954                 return textItem;
  1575             }
   955             }
  1576             case P_IndexFeedback_popup_background:
   956             case P_IndexFeedback_popup_background:
  1577             {
   957             {
       
   958                
  1578                 HbFrameItem *n = new HbFrameItem(parent);
   959                 HbFrameItem *n = new HbFrameItem(parent);
  1579                 n->frameDrawer().setFrameGraphicsName("qtg_fr_popup_preview");
   960                 n->frameDrawer().setFrameGraphicsName("qtg_fr_popup_preview");
  1580                 n->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
   961                 n->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  1581                 qreal cornerPieceSize = 0;
   962                 qreal cornerPieceSize = 0;
  1582                 parameter(QLatin1String("hb-param-background-popup-preview"),cornerPieceSize);
   963                 hbInstance->style()->parameter(QLatin1String("hb-param-background-popup-preview"),cornerPieceSize);
  1583                 n->frameDrawer().setBorderWidths(cornerPieceSize, cornerPieceSize);
   964                 n->frameDrawer().setBorderWidths(cornerPieceSize, cornerPieceSize);
  1584                 setItemName(n, QLatin1String("index-background"));
   965                 HbStyle::setItemName(n, QLatin1String("index-background"));
  1585                 n->setZValue(3);
   966                 n->setZValue(3);
  1586                 return n;
   967                 return n;
  1587             }
   968             }
  1588             case P_InputDialog_text:
   969             case P_InputDialog_text:
  1589             {
   970             {
  1590                 HbTextItem *n = new HbTextItem(parent);
   971                 HbTextItem *n = new HbTextItem(parent);
  1591                 setItemName(n, QLatin1String("label-1"));
   972                 HbStyle::setItemName(n, QLatin1String("label-1"));
  1592                 return n;
   973                 return n;
  1593             }
   974             }
  1594             case P_InputDialog_additionaltext:
   975             case P_InputDialog_additionaltext:
  1595             {
   976             {
  1596                 HbTextItem *n = new HbTextItem(parent);
   977                 HbTextItem *n = new HbTextItem(parent);
  1597                 setItemName(n, QLatin1String("label-2"));
   978                 HbStyle::setItemName(n, QLatin1String("label-2"));
  1598                 return n;
   979                 return n;
  1599             }
   980             }
  1600             default:
   981             default:
  1601                 return 0;
   982                 return 0;
  1602         }
   983         }
  1603 }
   984 }
  1604 
   985 
  1605 /*!
   986 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 {
   987 {
  1625     Q_D( const HbStyle );
   988     
  1626 
       
  1627     switch(primitive){
   989     switch(primitive){
  1628             case P_PushButton_icon:
   990             case P_PushButton_icon:
  1629                 {
   991                 {
  1630                     if (const HbStyleOptionPushButton *opt =
   992                     if (const HbStyleOptionPushButton *opt =
  1631                         qstyleoption_cast<const HbStyleOptionPushButton*>(option)) {
   993                         qstyleoption_cast<const HbStyleOptionPushButton*>(option)) {
  1632                         HbIconItem *iconItem = static_cast<HbIconItem*>(item);
   994                         HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1633                         //iconItem->setIconName(opt->icon.iconName());
   995                         //iconItem->setIconName(opt->icon.iconName());
  1634                         iconItem->setIcon(opt->icon); // with this call iconitem refresh issue is there
   996                         iconItem->setIcon(opt->icon); // with this call iconitem refresh issue is there
  1635                         iconItem->setMode(d->iconMode(opt->state));
   997                         iconItem->setMode(iconMode(opt->state));
  1636                         iconItem->setState(d->iconState(opt->state));
   998                         iconItem->setState(iconState(opt->state));
  1637                         iconItem->setAlignment(Qt::AlignCenter);
   999                         iconItem->setAlignment(Qt::AlignCenter);
  1638                     }
  1000                     }
  1639                 break;
  1001                 break;
  1640                 }
  1002                 }
  1641             case P_GroupBoxHeading_icon:
  1003             case P_GroupBoxHeading_icon:
  1674             case P_Label_icon:
  1036             case P_Label_icon:
  1675                 if (const HbStyleOptionLabel *opt = qstyleoption_cast<const HbStyleOptionLabel*>(option)) {
  1037                 if (const HbStyleOptionLabel *opt = qstyleoption_cast<const HbStyleOptionLabel*>(option)) {
  1676                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1038                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1677                     iconItem->setIcon(opt->icon);
  1039                     iconItem->setIcon(opt->icon);
  1678                     if (!opt->icon.isNull()) {
  1040                     if (!opt->icon.isNull()) {
  1679                         iconItem->setMode(d->iconMode(opt->state));
  1041                         iconItem->setMode(iconMode(opt->state));
  1680                         iconItem->setState(d->iconState(opt->state));
  1042                         iconItem->setState(iconState(opt->state));
  1681                         iconItem->setAspectRatioMode(opt->aspectRatioMode);
  1043                         iconItem->setAspectRatioMode(opt->aspectRatioMode);
  1682                         iconItem->setAlignment(opt->alignment);
  1044                         iconItem->setAlignment(opt->alignment);
  1683                     }
  1045                     }
  1684                 }
  1046                 }
  1685                 break;
  1047                 break;
  1686             case P_ToolButton_icon:
  1048             case P_ToolButton_icon:
  1687                 if (const HbStyleOptionToolButton *opt = qstyleoption_cast<const HbStyleOptionToolButton*>(option)) {
  1049                 if (const HbStyleOptionToolButton *opt = qstyleoption_cast<const HbStyleOptionToolButton*>(option)) {
  1688                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1050                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1689                     iconItem->setIcon(opt->icon);
  1051                     iconItem->setIcon(opt->icon);
  1690                     iconItem->setMode(d->iconMode(opt->state));
  1052                     iconItem->setMode(iconMode(opt->state));
  1691                     iconItem->setState(d->iconState(opt->state));
  1053                     iconItem->setState(iconState(opt->state));
  1692                 }
  1054                 }
  1693                 break;
  1055                 break;
  1694             case P_ComboBox_text:
  1056             case P_ComboBox_text:
  1695                 if (const HbStyleOptionComboBox *opt = qstyleoption_cast<const HbStyleOptionComboBox*>(option)) {
  1057                 if (const HbStyleOptionComboBox *opt = qstyleoption_cast<const HbStyleOptionComboBox*>(option)) {
  1696                     HbTextItem *comboTextItem = static_cast<HbTextItem*>(item);
  1058                     HbTextItem *comboTextItem = static_cast<HbTextItem*>(item);
  1833                     if (opt->state & QStyle::State_Enabled) {
  1195                     if (opt->state & QStyle::State_Enabled) {
  1834                         mode = QIcon::Normal;
  1196                         mode = QIcon::Normal;
  1835                     }
  1197                     }
  1836                     if (opt->state & QStyle::State_Active) {
  1198                     if (opt->state & QStyle::State_Active) {
  1837                         mode = QIcon::Active;
  1199                         mode = QIcon::Active;
  1838                     } 
  1200                     }
  1839                     if (opt->state & QStyle::State_Selected) {
  1201                     if (opt->state & QStyle::State_Selected) {
  1840                         mode = QIcon::Selected;
  1202                         mode = QIcon::Selected;
  1841                     }
  1203                     }
  1842                     frameItem->setZValue(-1.0);
  1204                     frameItem->setZValue(-1.0);
  1843                     if(mode == QIcon::Disabled) {
  1205                     if(mode == QIcon::Disabled) {
  1844                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_disabled"));
  1206                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_disabled"));
  1845                     }                   
  1207                     }
  1846                     else if(opt->pressed ) {
  1208                     else if(opt->pressed ) {
  1847                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_pressed"));
  1209                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_pressed"));
  1848                     } else {
  1210                     } else {
  1849                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_parent_normal"));
  1211                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_parent_normal"));
  1850                     }
  1212                     }
  1851                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  1213                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  1852                     frameItem->setGeometry(opt->rect);
       
  1853                 }
  1214                 }
  1854                 break;
  1215                 break;
  1855             }
  1216             }
  1856             case P_DataGroupComboBackground: {
  1217             case P_DataGroupComboBackground: {
  1857                 if (const HbStyleOptionDataGroup *opt = qstyleoption_cast<const HbStyleOptionDataGroup *>(option)) {
  1218                 if (const HbStyleOptionDataGroup *opt = qstyleoption_cast<const HbStyleOptionDataGroup *>(option)) {
  1932                 if (const HbStyleOptionDataFormViewItem *opt = qstyleoption_cast<const HbStyleOptionDataFormViewItem *>(option)) {
  1293                 if (const HbStyleOptionDataFormViewItem *opt = qstyleoption_cast<const HbStyleOptionDataFormViewItem *>(option)) {
  1933                     QString frameGraphicsName;
  1294                     QString frameGraphicsName;
  1934                     HbFrameItem *frameItem = static_cast<HbFrameItem*>( item );
  1295                     HbFrameItem *frameItem = static_cast<HbFrameItem*>( item );
  1935                     if(!frameItem){
  1296                     if(!frameItem){
  1936                         return;
  1297                         return;
  1937                     } 
  1298                     }
  1938                     QIcon::Mode mode = QIcon::Disabled;
  1299                     QIcon::Mode mode = QIcon::Disabled;
  1939                     if (opt->state & QStyle::State_Enabled) {
  1300                     if (opt->state & QStyle::State_Enabled) {
  1940                         mode = QIcon::Normal;
  1301                         mode = QIcon::Normal;
  1941                     }
  1302                     }
  1942                     if (opt->state & QStyle::State_Active) {
  1303                     if (opt->state & QStyle::State_Active) {
  2090                     iconItem->setIconName("qtg_graf_titlebar_minimize");
  1451                     iconItem->setIconName("qtg_graf_titlebar_minimize");
  2091                 }
  1452                 }
  2092                 break;
  1453                 break;
  2093             }
  1454             }
  2094 
  1455 
  2095             case P_IndicatorButton_eventindication: {  
  1456             case P_IndicatorButton_eventindication: {
  2096                 const HbStyleOptionIndicatorButton *opt = qstyleoption_cast<const HbStyleOptionIndicatorButton *>(option);
  1457                 const HbStyleOptionIndicatorButton *opt = qstyleoption_cast<const HbStyleOptionIndicatorButton *>(option);
  2097                 if (opt) {
  1458                 if (opt) {
  2098                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1459                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2099                     if (opt->twoIcons) {
  1460                     if (opt->twoIcons) {
  2100                         iconItem->setIconName("qtg_mono_new_event");
  1461                         iconItem->setIconName("qtg_mono_new_event");
  2261                             iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_l"));
  1622                             iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_l"));
  2262                         } else {
  1623                         } else {
  2263                             iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_l"));
  1624                             iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_l"));
  2264                         }
  1625                         }
  2265                     }
  1626                     }
       
  1627                     iconItem->update();
  2266                 }
  1628                 }
  2267                 break;
  1629                 break;
  2268             }
  1630             }
  2269 
  1631 
  2270             case P_TitlePane_text: {
  1632             case P_TitlePane_text: {
  2271                 const HbStyleOptionTitlePane *opt = qstyleoption_cast<const HbStyleOptionTitlePane *>(option);
  1633                 const HbStyleOptionTitlePane *opt = qstyleoption_cast<const HbStyleOptionTitlePane *>(option);
  2272 
  1634 
  2273                 if (opt) {
  1635                 if (opt) {
  2274                     HbMarqueeItem *marqueeItem = static_cast<HbMarqueeItem*>( item );
  1636                     HbMarqueeItem *marqueeItem = static_cast<HbMarqueeItem*>(item);
  2275                     if (marqueeItem) {
  1637                     if (marqueeItem) {
  2276                         marqueeItem->setText(opt->caption);
  1638                         marqueeItem->setText(opt->caption);
       
  1639                         if (opt->margueeAnimation) {
       
  1640                             marqueeItem->startAnimation();
       
  1641                         }
  2277                     }
  1642                     }
  2278                 }
  1643                 }
  2279                 break;
  1644                 break;
  2280             }
  1645             }
  2281 
  1646 
  2336                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
  1701                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
  2337                 }
  1702                 }
  2338 
  1703 
  2339                 QStringList list;
  1704                 QStringList list;
  2340                 QString frameGraphicsFooter;
  1705                 QString frameGraphicsFooter;
  2341                 QIcon::Mode mode = d->iconMode(opt->state);
  1706                 QIcon::Mode mode = iconMode(opt->state);
  2342                 QIcon::State state = d->iconState(opt->state);
  1707                 QIcon::State state = iconState(opt->state);
  2343 
  1708 
  2344                 if (!opt->customBackground.isNull()) {
  1709                 if (!opt->customBackground.isNull()) {
  2345                     QString customName = opt->customBackground.iconName(mode, state);
  1710                     QString customName = opt->customBackground.iconName(mode, state);
  2346                     frameItem->frameDrawer().setFrameGraphicsName(customName);
  1711                     frameItem->frameDrawer().setFrameGraphicsName(customName);
  2347                     break;
  1712                     break;
  2454 
  1819 
  2455             case P_SliderTickMark_majoricon: {
  1820             case P_SliderTickMark_majoricon: {
  2456                  if (const HbStyleOptionSlider *opt =
  1821                  if (const HbStyleOptionSlider *opt =
  2457                         qstyleoption_cast<const HbStyleOptionSlider*>(option)) {
  1822                         qstyleoption_cast<const HbStyleOptionSlider*>(option)) {
  2458                         HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(item);
  1823                         HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(item);
  2459                         iconItem->setMode(d->iconMode(opt->state));
  1824                         iconItem->setMode(iconMode(opt->state));
  2460                         if ( opt->orientation ==Qt::Horizontal ){
  1825                         if ( opt->orientation ==Qt::Horizontal ){
  2461                             iconItem->setIconName( "qtg_graf_slider_h_tick_major" );
  1826                             iconItem->setIconName( "qtg_graf_slider_h_tick_major" );
  2462                         } else {
  1827                         } else {
  2463                             iconItem->setIconName ( "qtg_graf_slider_v_tick_major" );
  1828                             iconItem->setIconName ( "qtg_graf_slider_v_tick_major" );
  2464                         }
  1829                         }
  2465                         iconItem->setState(d->iconState(opt->state));
  1830                         iconItem->setState(iconState(opt->state));
  2466                     }
  1831                     }
  2467                  break;
  1832                  break;
  2468 
  1833 
  2469              }
  1834              }
  2470 
  1835 
  2471             case P_SliderTickMark_minoricon: {
  1836             case P_SliderTickMark_minoricon: {
  2472                  if (const HbStyleOptionSlider *opt =
  1837                  if (const HbStyleOptionSlider *opt =
  2473                         qstyleoption_cast<const HbStyleOptionSlider*>(option)) {
  1838                         qstyleoption_cast<const HbStyleOptionSlider*>(option)) {
  2474                         HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(item);
  1839                         HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(item);
  2475                         iconItem->setMode(d->iconMode(opt->state));
  1840                         iconItem->setMode(iconMode(opt->state));
  2476                         if ( opt->orientation ==Qt::Horizontal ){
  1841                         if ( opt->orientation ==Qt::Horizontal ){
  2477                             iconItem->setIconName( "qtg_graf_slider_h_tick_minor" );
  1842                             iconItem->setIconName( "qtg_graf_slider_h_tick_minor" );
  2478                         } else {
  1843                         } else {
  2479                             iconItem->setIconName ( "qtg_graf_slider_v_tick_minor" );
  1844                             iconItem->setIconName ( "qtg_graf_slider_v_tick_minor" );
  2480                         }
  1845                         }
  2481                         iconItem->setState(d->iconState(opt->state));
  1846                         iconItem->setState(iconState(opt->state));
  2482                     }
  1847                     }
  2483                  break;
  1848                  break;
  2484 
  1849 
  2485              }
  1850              }
  2486 
  1851 
  2560                             else {
  1925                             else {
  2561                                 name = QLatin1String("qtg_fr_slider_v_frame_pressed");
  1926                                 name = QLatin1String("qtg_fr_slider_v_frame_pressed");
  2562                             }
  1927                             }
  2563                         } else {
  1928                         } else {
  2564                                 name = QLatin1String("qtg_fr_slider_v_frame_disabled");
  1929                                 name = QLatin1String("qtg_fr_slider_v_frame_disabled");
  2565                         
  1930 
  2566                         }
  1931                         }
  2567                         type = HbFrameDrawer::ThreePiecesVertical;
  1932                         type = HbFrameDrawer::ThreePiecesVertical;
  2568                     }
  1933                     }
  2569 
  1934 
  2570                     frameItem->frameDrawer().setFrameGraphicsName(name);
  1935                     frameItem->frameDrawer().setFrameGraphicsName(name);
  2579                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1944                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2580                     // Set pixmap name and bounding rect
  1945                     // Set pixmap name and bounding rect
  2581                     QString thumbPath;
  1946                     QString thumbPath;
  2582                     if(opt->thumbPath.isNull())
  1947                     if(opt->thumbPath.isNull())
  2583                     {
  1948                     {
  2584                         thumbPath=d->logicalName(HbStyle::P_Slider_thumb, option);
  1949                         thumbPath=logicalName(HbStylePrivate::P_Slider_thumb, option);
  2585                     }
  1950                     }
  2586                     else
  1951                     else
  2587                     {
  1952                     {
  2588                         thumbPath=opt->thumbPath;
  1953                         thumbPath=opt->thumbPath;
  2589                         iconItem->setAlignment(Qt::AlignCenter);
  1954                         iconItem->setAlignment(Qt::AlignCenter);
  2591                     iconItem->setIconName(thumbPath);
  1956                     iconItem->setIconName(thumbPath);
  2592                     iconItem->setAspectRatioMode(Qt::KeepAspectRatio);
  1957                     iconItem->setAspectRatioMode(Qt::KeepAspectRatio);
  2593                  }
  1958                  }
  2594                 break;
  1959                 break;
  2595             }
  1960             }
  2596             case HbStyle::P_SliderElement_increase:
  1961             case HbStylePrivate::P_SliderElement_increase:
  2597                 {
  1962                 {
  2598                     if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider*>(option)) {
  1963                     if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider*>(option)) {
  2599                         HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1964                         HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2600                         iconItem->setZValue(1.0);
  1965                         iconItem->setZValue(1.0);
  2601                         iconItem->setMode(d->iconMode(opt->state));
  1966                         iconItem->setMode(iconMode(opt->state));
  2602                         iconItem->setState(d->iconState(opt->state));
  1967                         iconItem->setState(iconState(opt->state));
  2603                         if ( !opt->sliderElementIcon.isNull() ){
  1968                         if ( !opt->sliderElementIcon.isNull() ){
  2604                             iconItem->setIcon(opt->sliderElementIcon);
  1969                             iconItem->setIcon(opt->sliderElementIcon);
  2605                         } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) {
  1970                         } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) {
  2606                             iconItem->setIconName(QLatin1String("qtg_mono_vol_up"));
  1971                             iconItem->setIconName(QLatin1String("qtg_mono_vol_up"));
  2607                         } else if (opt->sliderType == HbStyleOptionSlider::ZoomType) {
  1972                         } else if (opt->sliderType == HbStyleOptionSlider::ZoomType) {
  2608                             iconItem->setIconName(QLatin1String("qtg_mono_zoom_in"));
  1973                             iconItem->setIconName(QLatin1String("qtg_mono_zoom_in"));
  2609                         }
  1974                         }
  2610                     }
  1975                     }
  2611                 break;
  1976                 break;
  2612                 }
  1977                 }
  2613             case HbStyle::P_SliderElement_decrease:
  1978             case HbStylePrivate::P_SliderElement_decrease:
  2614                 {
  1979                 {
  2615                     if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider*>(option)) {
  1980                     if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider*>(option)) {
  2616                         HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1981                         HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2617                         iconItem->setZValue(1.0);
  1982                         iconItem->setZValue(1.0);
  2618                         iconItem->setMode(d->iconMode(opt->state));
  1983                         iconItem->setMode(iconMode(opt->state));
  2619                         iconItem->setState(d->iconState(opt->state));
  1984                         iconItem->setState(iconState(opt->state));
  2620                         if ( !opt->sliderElementIcon.isNull() ){
  1985                         if ( !opt->sliderElementIcon.isNull() ){
  2621                             iconItem->setIcon(opt->sliderElementIcon);
  1986                             iconItem->setIcon(opt->sliderElementIcon);
  2622                         } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) {
  1987                         } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) {
  2623                             iconItem->setIconName(QLatin1String("qtg_mono_vol_down"));
  1988                             iconItem->setIconName(QLatin1String("qtg_mono_vol_down"));
  2624                         } else if (opt->sliderType == HbStyleOptionSlider::ZoomType) {
  1989                         } else if (opt->sliderType == HbStyleOptionSlider::ZoomType) {
  2625                             iconItem->setIconName(QLatin1String("qtg_mono_zoom_out"));
  1990                             iconItem->setIconName(QLatin1String("qtg_mono_zoom_out"));
  2626                         }
  1991                         }
  2627                     }
  1992                     }
  2628                 break;
  1993                 break;
  2629                 }
  1994                 }
  2630             case HbStyle::P_SliderElement_icon:
  1995             case HbStylePrivate::P_SliderElement_icon:
  2631                 {
  1996                 {
  2632                     if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider*>(option)) {
  1997                     if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider*>(option)) {
  2633                         HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1998                         HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2634                         iconItem->setZValue(1.0);
  1999                         iconItem->setZValue(1.0);
  2635                         iconItem->setMode(d->iconMode(opt->state));
  2000                         iconItem->setMode(iconMode(opt->state));
  2636                         iconItem->setState(d->iconState(opt->state));
  2001                         iconItem->setState(iconState(opt->state));
  2637                         if ( !opt->sliderElementIcon.isNull() ){
  2002                         if ( !opt->sliderElementIcon.isNull() ){
  2638                             iconItem->setIcon(opt->sliderElementIcon);
  2003                             iconItem->setIcon(opt->sliderElementIcon);
  2639                         } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) {
  2004                         } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) {
  2640                             if( opt->state & QStyle::State_Sunken) {
  2005                             if( opt->state & QStyle::State_Sunken) {
  2641                                 iconItem->setIconName(QLatin1String("qtg_mono_speaker_off"));
  2006                                 iconItem->setIconName(QLatin1String("qtg_mono_speaker_off"));
  2735                 break;
  2100                 break;
  2736             }
  2101             }
  2737 
  2102 
  2738             case P_LineEdit_frame_normal:{
  2103             case P_LineEdit_frame_normal:{
  2739                 if (HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>( item ) ) {
  2104                 if (HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>( item ) ) {
  2740                     frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_lineedit_normal"));
  2105                     if(frameItem->isEnabled()) {
       
  2106                         qDebug() << "Update primitive bagckground enabled";
       
  2107                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_lineedit_normal"));
       
  2108                     } else {
       
  2109                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_lineedit_disabled"));
       
  2110                     }
  2741                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  2111                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  2742                 }
  2112                 }
  2743             break;
  2113             break;
  2744             }
  2114             }
  2745 
  2115 
  2754             break;
  2124             break;
  2755             }
  2125             }
  2756 
  2126 
  2757             case P_TextEdit_frame_normal:{
  2127             case P_TextEdit_frame_normal:{
  2758                 if (HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>( item ) ) {
  2128                 if (HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>( item ) ) {
  2759                     frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_textedit_normal"));
  2129                     if(frameItem->isEnabled()) {
       
  2130                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_textedit_normal"));
       
  2131                     } else {
       
  2132                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_textedit_disabled"));
       
  2133                     }
  2760                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  2134                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  2761                 }
  2135                 }
  2762             break;
  2136             break;
  2763             }
  2137             }
  2764 
  2138 
  2842                     }
  2216                     }
  2843                     if (opt->color.isValid()) {
  2217                     if (opt->color.isValid()) {
  2844                         textItem->setTextColor(opt->color);
  2218                         textItem->setTextColor(opt->color);
  2845                     }
  2219                     }
  2846                     textItem->setText(opt->text);
  2220                     textItem->setText(opt->text);
       
  2221                     textItem->setMaximumLines(opt->maximumLines);
  2847                  }
  2222                  }
  2848                  break;
  2223                  break;
  2849             case P_Label_richtext:
  2224             case P_Label_richtext:
  2850                 if (const HbStyleOptionLabel *opt = qstyleoption_cast<const HbStyleOptionLabel*>(option)) {
  2225                 if (const HbStyleOptionLabel *opt = qstyleoption_cast<const HbStyleOptionLabel*>(option)) {
  2851                     HbRichTextItem *textItem = static_cast<HbRichTextItem*>(item);
  2226                     HbRichTextItem *textItem = static_cast<HbRichTextItem*>(item);
  2989                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_heading_normal"));
  2364                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_heading_normal"));
  2990                     }
  2365                     }
  2991                 }
  2366                 }
  2992                 break;
  2367                 break;
  2993 
  2368 
  2994             case P_ComboBoxPopup_background:
  2369             case P_ComboBoxPopup_background: {         
  2995                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) {
       
  2996                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
  2370                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
  2997                         if(!frameItem){
  2371                     if(!frameItem){
  2998                            return;
  2372                            return;
  2999                         }
  2373                     }
  3000                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  2374                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  3001                     frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_secondary"));
  2375                     frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_secondary"));
  3002                     frameItem->setGeometry(opt->boundingRect);
       
  3003                 }
  2376                 }
  3004                 break;
  2377                 break;
  3005 
  2378 
  3006             case P_ToolTip_background:
  2379             case P_ToolTip_background:
  3007                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) {
  2380                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) {
  3126                                 textItem->setMaximumLines(opt->maximumLines);
  2499                                 textItem->setMaximumLines(opt->maximumLines);
  3127                             } else {
  2500                             } else {
  3128                                 // min & max secondary text row counts not set by app. Allow setting those from .css
  2501                                 // 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
  2502                                 // Needed when multilineSecondaryTextSupported changed from FALSE to TRUE and
  3130                                 // min & max secondary text row counts has not bee set by app
  2503                                 // min & max secondary text row counts has not bee set by app
  3131                                 HbWidgetBasePrivate *widgetBasePrivate = d->widgetBasePrivate(textItem);
  2504                                 HbWidgetBasePrivate *widgetBaseP = widgetBasePrivate(textItem);
  3132                                 widgetBasePrivate->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode, false);
  2505                                 widgetBaseP->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode, false);
  3133                                 widgetBasePrivate->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMin, false);
  2506                                 widgetBaseP->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMin, false);
  3134                                 widgetBasePrivate->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMax, false);
  2507                                 widgetBaseP->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMax, false);
  3135                             }
  2508                             }
  3136                         } else {
  2509                         } else {
  3137                             // min & max secondary text row counts must always be 1. They cannot be overridden by .css
  2510                             // min & max secondary text row counts must always be 1. They cannot be overridden by .css
  3138                             textItem->setTextWrapping(Hb::TextNoWrap);
  2511                             textItem->setTextWrapping(Hb::TextNoWrap);
  3139                             textItem->setMinimumLines(1);
  2512                             textItem->setMinimumLines(1);
  3140                             textItem->setMaximumLines(1);
  2513                             textItem->setMaximumLines(1);
  3141                         }
  2514                         }
  3142                     } // else - default values from .css still in use
  2515                     } // else - default values from .css still in use
  3143                     setItemName(textItem, QLatin1String("text-") + QString::number(opt->index + 1));
  2516 
       
  2517                     // Below optimizes the most common cases.
       
  2518                     if (opt->index == 0) {
       
  2519                         HbStyle::setItemName(textItem, QLatin1String("text-1"));
       
  2520                     } else if (opt->index == 1) {
       
  2521                         HbStyle::setItemName(textItem, QLatin1String("text-2"));
       
  2522                     } else if (opt->index == 2) {
       
  2523                         HbStyle::setItemName(textItem, QLatin1String("text-3"));
       
  2524                     } else {
       
  2525                         HbStyle::setItemName(textItem, QLatin1String("text-") + QString::number(opt->index + 1));
       
  2526                     }
       
  2527 
  3144                     textItem->setText(opt->content.value<QString>());
  2528                     textItem->setText(opt->content.value<QString>());
  3145                 }
  2529                 }
  3146                 break;
  2530                 break;
  3147             case P_ListViewItem_richtext:
  2531             case P_ListViewItem_richtext:
  3148                 if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) {
  2532                 if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) {
  3149                     HbRichTextItem *label = static_cast<HbRichTextItem*>(item);
  2533                     HbRichTextItem *label = static_cast<HbRichTextItem*>(item);
  3150                     label->setText(opt->content.value<QString>());
  2534                     label->setText(opt->content.value<QString>());
  3151 
  2535 
  3152                     setItemName(label, QLatin1String("text-") + QString::number(opt->index + 1));
  2536                     // Below optimizes the most common cases.
       
  2537                     if (opt->index == 0) {
       
  2538                         HbStyle::setItemName(label, QLatin1String("text-1"));
       
  2539                     } else if (opt->index == 1) {
       
  2540                         HbStyle::setItemName(label, QLatin1String("text-2"));
       
  2541                     } else if (opt->index == 2) {
       
  2542                         HbStyle::setItemName(label, QLatin1String("text-3"));
       
  2543                     } else {
       
  2544                         HbStyle::setItemName(label, QLatin1String("text-") + QString::number(opt->index + 1));
       
  2545                     }
  3153                 }
  2546                 }
  3154                 break;
  2547                 break;
  3155             case P_ListViewItem_icon:
  2548             case P_ListViewItem_icon:
  3156                 if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) {
  2549                 if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) {
  3157                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2550                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  3158 
  2551 
  3159                     setItemName(iconItem, QLatin1String("icon-") + QString::number(opt->index + 1));
  2552                     // Below optimizes the most common cases.
       
  2553                     if (opt->index == 0) {
       
  2554                         HbStyle::setItemName(iconItem, QLatin1String("icon-1"));
       
  2555                     } else if (opt->index == 1) {
       
  2556                         HbStyle::setItemName(iconItem, QLatin1String("icon-2"));
       
  2557                     } else {
       
  2558                         HbStyle::setItemName(iconItem, QLatin1String("icon-") + QString::number(opt->index + 1));
       
  2559                     }
       
  2560 
  3160                     if (iconItem->zValue() != opt->index + 1) {
  2561                     if (iconItem->zValue() != opt->index + 1) {
  3161                         iconItem->setZValue(opt->index + 1);
  2562                         iconItem->setZValue(opt->index + 1);
  3162                     }
  2563                     }
  3163 
  2564 
  3164                     if (opt->content.canConvert<HbIcon>()){
  2565                     if (opt->content.canConvert<HbIcon>()){
  3243             case P_ProgressBar_frame:
  2644             case P_ProgressBar_frame:
  3244                 if (const HbStyleOptionProgressBar *opt = qstyleoption_cast<const HbStyleOptionProgressBar *>(option)) {
  2645                 if (const HbStyleOptionProgressBar *opt = qstyleoption_cast<const HbStyleOptionProgressBar *>(option)) {
  3245                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
  2646                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
  3246                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
  2647                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
  3247                         if(opt->orientation == Qt::Horizontal){
  2648                         if(opt->orientation == Qt::Horizontal){
  3248                        
  2649 
  3249                                 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_h_frame"));
  2650                                 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_h_frame"));
  3250                          }
  2651                          }
  3251                       
  2652 
  3252                         else{
  2653                         else{
  3253                             frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
  2654                             frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
  3254                             frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_v_frame"));
  2655                             frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_v_frame"));
  3255                         }
  2656                         }
  3256                   //  frameItem->frameDrawer().setFillWholeRect(true);
  2657                   //  frameItem->frameDrawer().setFillWholeRect(true);
  3261                 if (const HbStyleOptionProgressBar *opt = qstyleoption_cast<const HbStyleOptionProgressBar *>(option)) {
  2662                 if (const HbStyleOptionProgressBar *opt = qstyleoption_cast<const HbStyleOptionProgressBar *>(option)) {
  3262                     HbProgressTrackItem* frameItem = static_cast<HbProgressTrackItem*>(item);
  2663                     HbProgressTrackItem* frameItem = static_cast<HbProgressTrackItem*>(item);
  3263                     if(!frameItem->isVisible()) {
  2664                     if(!frameItem->isVisible()) {
  3264                         break;
  2665                         break;
  3265                     }
  2666                     }
  3266                     
  2667 
  3267                     if(opt->orientation == Qt::Horizontal){
  2668                     if(opt->orientation == Qt::Horizontal){
  3268                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
  2669                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
  3269                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_h_filled"));
  2670                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_h_filled"));
  3270                      }
  2671                      }
  3271                      else{
  2672                      else{
  3272                                frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
  2673                                frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
  3273                                frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_v_filled"));
  2674                                frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_v_filled"));
  3274                      }
  2675                      }
  3275                     
  2676 
  3276                     frameItem->setMaximum(opt->maximum);
  2677                     frameItem->setMaximum(opt->maximum);
  3277                     frameItem->setMinimum(opt->minimum);
  2678                     frameItem->setMinimum(opt->minimum);
  3278                     frameItem->setValue(opt->progressValue);
  2679                     frameItem->setValue(opt->progressValue);
  3279                     frameItem->setInverted(opt->inverted);
  2680                     frameItem->setInverted(opt->inverted);
  3280                     //frameItem->setGeometry(opt->rect);
  2681                     //frameItem->setGeometry(opt->rect);
  3303 
  2704 
  3304             case P_ProgressSlider_frame:
  2705             case P_ProgressSlider_frame:
  3305                 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) {
  2706                 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) {
  3306                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
  2707                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
  3307                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
  2708                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
  3308                    	if (opt->disableState ) {
  2709                         if (opt->disableState ) {
  3309                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_disabled"));
  2710                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_disabled"));
  3310 					}
  2711                                         }
  3311 					else {
  2712                                         else {
  3312 					     if(opt->pressedState) {
  2713                                              if(opt->pressedState) {
  3313                                frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_pressed"));
  2714                                frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_pressed"));
  3314                          }
  2715                          }
  3315                          else {
  2716                          else {
  3316                                frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_normal"));
  2717                                frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_normal"));
  3317                          }
  2718                          }
  3318 					}
  2719                                         }
  3319                     frameItem->frameDrawer().setFillWholeRect(true);
  2720                     frameItem->frameDrawer().setFillWholeRect(true);
  3320                     //frameItem->update();
  2721                     //frameItem->update();
  3321                     }
  2722                     }
  3322                     break;
  2723                     break;
  3323             case P_ProgressSlider_track: // The ProgressValue Mask
  2724             case P_ProgressSlider_track: // The ProgressValue Mask
  3324                 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) {
  2725                 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) {
  3325                     HbProgressTrackItem* frameItem = static_cast<HbProgressTrackItem*>(item);
  2726                     HbProgressTrackItem* frameItem = static_cast<HbProgressTrackItem*>(item);
  3326                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
  2727                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
  3327 
  2728 
  3328 					if (opt->disableState ) {
  2729                                         if (opt->disableState ) {
  3329                          frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_loaded_disabled"));
  2730                          frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_loaded_disabled"));
  3330 					}
  2731                                         }
  3331 					else {
  2732                                         else {
  3332                          frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_loaded"));
  2733                          frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_loaded"));
  3333 					}
  2734                                         }
  3334                     frameItem->frameDrawer().setFillWholeRect(true);
  2735                     frameItem->frameDrawer().setFillWholeRect(true);
  3335                     frameItem->setMaximum(opt->maximum);
  2736                     frameItem->setMaximum(opt->maximum);
  3336                     frameItem->setMinimum(opt->minimum);
  2737                     frameItem->setMinimum(opt->minimum);
  3337                     frameItem->setValue(opt->progressValue);
  2738                     frameItem->setValue(opt->progressValue);
  3338                     frameItem->setInverted(opt->inverted);
  2739                     frameItem->setInverted(opt->inverted);
  3343 
  2744 
  3344             case P_ProgressSlider_slidertrack: // The Slider Position Mask
  2745             case P_ProgressSlider_slidertrack: // The Slider Position Mask
  3345                 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) {
  2746                 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) {
  3346                     HbProgressTrackItem* frameItem = static_cast<HbProgressTrackItem*>(item);
  2747                     HbProgressTrackItem* frameItem = static_cast<HbProgressTrackItem*>(item);
  3347                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
  2748                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
  3348 					if (opt->disableState ) {
  2749                                         if (opt->disableState ) {
  3349                          frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_played_disabled"));
  2750                          frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_played_disabled"));
  3350 					}
  2751                                         }
  3351 					else {
  2752                                         else {
  3352                          frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_played"));
  2753                          frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_played"));
  3353 					}
  2754                                         }
  3354                     frameItem->frameDrawer().setFillWholeRect(true);
  2755                     frameItem->frameDrawer().setFillWholeRect(true);
  3355                     frameItem->setMaximum(opt->maximum);
  2756                     frameItem->setMaximum(opt->maximum);
  3356                     frameItem->setMinimum(opt->minimum);
  2757                     frameItem->setMinimum(opt->minimum);
  3357                     frameItem->setValue(opt->progressSliderValue);
  2758                     frameItem->setValue(opt->progressSliderValue);
  3358                     frameItem->setInverted(opt->inverted);
  2759                     frameItem->setInverted(opt->inverted);
  3397                         if(opt->disableState) {
  2798                         if(opt->disableState) {
  3398                              repeatItem->setName(QLatin1String("qtg_graf_ratingslider_unrated_disabled"));
  2799                              repeatItem->setName(QLatin1String("qtg_graf_ratingslider_unrated_disabled"));
  3399 
  2800 
  3400                         }
  2801                         }
  3401                         else {
  2802                         else {
  3402 							if(opt->pressedState) {
  2803                                                         if(opt->pressedState) {
  3403 
  2804 
  3404 								repeatItem->setName(QLatin1String("qtg_graf_ratingslider_unrated_pressed"));
  2805                                                                 repeatItem->setName(QLatin1String("qtg_graf_ratingslider_unrated_pressed"));
  3405 							}
  2806                                                         }
  3406 							else {
  2807                                                         else {
  3407                             
  2808 
  3408 								repeatItem->setName(QLatin1String("qtg_graf_ratingslider_unrated"));
  2809                                                                 repeatItem->setName(QLatin1String("qtg_graf_ratingslider_unrated"));
  3409 							}
  2810                                                         }
  3410                         }
  2811                         }
  3411                     }
  2812                     }
  3412                     repeatItem->setGeometry(opt->boundingRect);
  2813                     repeatItem->setGeometry(opt->boundingRect);
  3413                     repeatItem->update();
  2814                     repeatItem->update();
  3414                 }
  2815                 }
  3431 
  2832 
  3432 
  2833 
  3433                         }
  2834                         }
  3434                         else {
  2835                         else {
  3435 
  2836 
  3436 							if(opt->pressedState) {
  2837                                                         if(opt->pressedState) {
  3437 
  2838 
  3438 								repeatItem->setName(QLatin1String("qtg_graf_ratingslider_rated_pressed"));
  2839                                                                 repeatItem->setName(QLatin1String("qtg_graf_ratingslider_rated_pressed"));
  3439 							}
  2840                                                         }
  3440 							else {
  2841                                                         else {
  3441 								repeatItem->setName(QLatin1String("qtg_graf_ratingslider_rated"));
  2842                                                                 repeatItem->setName(QLatin1String("qtg_graf_ratingslider_rated"));
  3442 							}
  2843                                                         }
  3443                         }
  2844                         }
  3444                     }
  2845                     }
  3445                     repeatItem->setGeometry(opt->boundingRect);
  2846                     repeatItem->setGeometry(opt->boundingRect);
  3446                     repeatItem->update();
  2847                     repeatItem->update();
  3447                 }
  2848                 }
  3543                                 ||  opt->viewItemType == HbPrivate::ItemType_ColorGridViewItem) {
  2944                                 ||  opt->viewItemType == HbPrivate::ItemType_ColorGridViewItem) {
  3544                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  2945                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
  3545                         frameItem->frameDrawer().setFrameGraphicsName(opt->insidePopup ?
  2946                         frameItem->frameDrawer().setFrameGraphicsName(opt->insidePopup ?
  3546                             QLatin1String("qtg_fr_popup_grid_pressed") : QLatin1String("qtg_fr_grid_pressed"));
  2947                             QLatin1String("qtg_fr_popup_grid_pressed") : QLatin1String("qtg_fr_grid_pressed"));
  3547                     } else {
  2948                     } else {
  3548                         setItemName(frameItem,QString());
  2949                         HbStyle::setItemName(frameItem,QString());
  3549                         frameItem->frameDrawer().setFrameGraphicsName(QString());
  2950                         frameItem->frameDrawer().setFrameGraphicsName(QString());
  3550                     }
  2951                     }
  3551                 }
  2952                 }
  3552                 break;
  2953                 break;
  3553             case P_SelectionControl_selectionstart://fallthrough
  2954             case P_SelectionControl_selectionstart://fallthrough
  3608                         QString className;
  3009                         QString className;
  3609                         if(obj){
  3010                         if(obj){
  3610                             className = obj->className();
  3011                             className = obj->className();
  3611                         }
  3012                         }
  3612                         ///////////////////////////////////////////////////////////
  3013                         ///////////////////////////////////////////////////////////
  3613                         
  3014 
  3614                         if( !className.compare("HbTumbleView") ){
  3015                         if( !className.compare("HbTumbleView") ){
  3615                             frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_bg");
  3016                             frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_bg");
  3616                         }
  3017                         }
  3617                         else if( !className.compare("HbSelectionDialogMarkWidget") )
  3018                         else if( !className.compare("HbSelectionDialogMarkWidget") )
  3618                         {
  3019                         {
  3642             case P_TumbleView_highlight:
  3043             case P_TumbleView_highlight:
  3643                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
  3044                 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
  3644                     if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) {
  3045                     if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) {
  3645                         frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_highlight_pri");
  3046                         frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_highlight_pri");
  3646                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
  3047                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
  3647                         frameItem->setZValue(3);
  3048                         frameItem->setZValue(-1);
  3648                         //TODO:temp fix, issue with css rule picking in derived class
  3049                         //TODO:temp fix, issue with css rule picking in derived class
  3649 
  3050 
  3650                         //frameItem->setGeometry(0,(opt->boundingRect.height()-frameItem->boundingRect().height())/2,opt->boundingRect.width(),opt->boundingRect.height());
  3051                         //frameItem->setGeometry(0,(opt->boundingRect.height()-frameItem->boundingRect().height())/2,opt->boundingRect.width(),opt->boundingRect.height());
  3651                         Q_UNUSED(opt);
  3052                         Q_UNUSED(opt);
  3652                     }
  3053                     }
  4161     classes should not call this method directly, but use the HbWidget's
  3562     classes should not call this method directly, but use the HbWidget's
  4162     polish loop instead.
  3563     polish loop instead.
  4163 
  3564 
  4164     This method reads the CSS and WidgetML definition for a given widget and positions
  3565     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
  3566     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.
  3567     with HbStyle::HbStyle::setItemName method before this method is called.
  4167 
  3568 
  4168     Note that this method is heavy on the system resources and should be called
  3569     Note that this method is heavy on the system resources and should be called
  4169     absolutely when necessary by the widget.
  3570     absolutely when necessary by the widget.
  4170 
  3571 
  4171     \param widget, HbWidget to be polished
  3572     \param widget, HbWidget to be polished
  4217     }
  3618     }
  4218     const HbVector<HbCss::Declaration> decl = declarations(styleRules, "", widget, profile);
  3619     const HbVector<HbCss::Declaration> decl = declarations(styleRules, "", widget, profile);
  4219 #ifdef HBSTYLE_DEBUG
  3620 #ifdef HBSTYLE_DEBUG
  4220     qDebug() << "HbStyle::polish : Number of matching CSS declarations: " << decl.count();
  3621     qDebug() << "HbStyle::polish : Number of matching CSS declarations: " << decl.count();
  4221 #endif
  3622 #endif
  4222     d->ensureLayoutParameters(profile);
  3623     d->layoutParameters.init(profile);
  4223 
  3624 
  4224     HbCss::ValueExtractor extractor(decl, d->layoutParameters, profile);
  3625     HbCss::ValueExtractor extractor(decl, d->layoutParameters, profile);
  4225     QString layoutName;
  3626     QString layoutName;
  4226     QString sectionName;
  3627     QString sectionName;
  4227 
  3628 
  4316             if ( !anchor->anchorId().isEmpty() ) {
  3717             if ( !anchor->anchorId().isEmpty() ) {
  4317                 d->polishAnchor(styleRules, widget, anchor, profile);
  3718                 d->polishAnchor(styleRules, widget, anchor, profile);
  4318             }
  3719             }
  4319         }
  3720         }
  4320     }
  3721     }
       
  3722 
       
  3723 #ifdef HB_TEXT_MEASUREMENT_UTILITY
       
  3724     if ( d->mAutomaticTextMeasurementEnabled ) {
       
  3725         HbInstancePrivate::d_ptr()->startLocalizationMeasurement();
       
  3726     }
       
  3727 #endif // HB_TEXT_MEASUREMENT_UTILITY
       
  3728 
  4321 }
  3729 }
  4322 
  3730 
  4323 /*!
  3731 /*!
  4324     updateThemedItems updates themable children items of widget
  3732     updateThemedItems updates themable children items of widget
  4325 
  3733 
  4498                 HbAnchorLayout* layout = static_cast<HbAnchorLayout*>(parentW->layout());
  3906                 HbAnchorLayout* layout = static_cast<HbAnchorLayout*>(parentW->layout());
  4499                 if ( layout->indexOf(lItem) != -1 ) {
  3907                 if ( layout->indexOf(lItem) != -1 ) {
  4500                     if( name.isEmpty() ) {
  3908                     if( name.isEmpty() ) {
  4501                         layout->removeMapping(originalName);
  3909                         layout->removeMapping(originalName);
  4502                     } else {
  3910                     } else {
  4503                         if ( !originalName.isEmpty() ) {
       
  4504                             layout->removeMapping(originalName);
       
  4505                         }
       
  4506                         layout->setMapping(lItem, name);
  3911                         layout->setMapping(lItem, name);
  4507                     }
  3912                     }
  4508                 }
  3913                 }
  4509             }
  3914             }
  4510         }
  3915         }
  4543     HbDeviceProfile effectiveProfile = profile;
  3948     HbDeviceProfile effectiveProfile = profile;
  4544     if ( effectiveProfile.isNull() ) {
  3949     if ( effectiveProfile.isNull() ) {
  4545         effectiveProfile = HbDeviceProfile::current();
  3950         effectiveProfile = HbDeviceProfile::current();
  4546     }
  3951     }
  4547     Q_D( const HbStyle );
  3952     Q_D( const HbStyle );
  4548     d->ensureLayoutParameters(effectiveProfile);
  3953     d->layoutParameters.init(effectiveProfile);
  4549     HbCss::ValueExtractor valueExtractor(d->layoutParameters, true, effectiveProfile);
  3954     HbCss::ValueExtractor valueExtractor(d->layoutParameters, true, effectiveProfile);
  4550     // todo: parsing variable/expression is done here so that there is no need to change API
  3955     // todo: parsing variable/expression is done here so that there is no need to change API
  4551     // also parameters method not changed (this change is done for docml/widgetml parsing)
  3956     // also parameters method not changed (this change is done for docml/widgetml parsing)
  4552     if (param.startsWith(QLatin1String("var(")) && param.endsWith(QLatin1String(")"))) {
  3957     if (param.startsWith(QLatin1String("var(")) && param.endsWith(QLatin1String(")"))) {
  4553         return valueExtractor.extractVariableValue(param.mid(4,param.length()-5), value);
  3958         return valueExtractor.extractVariableValue(param.mid(4,param.length()-5), value);
  4587     if ( effectiveProfile.isNull() ) {
  3992     if ( effectiveProfile.isNull() ) {
  4588         effectiveProfile = HbDeviceProfile::current();
  3993         effectiveProfile = HbDeviceProfile::current();
  4589     }
  3994     }
  4590 
  3995 
  4591     Q_D( const HbStyle );
  3996     Q_D( const HbStyle );
  4592     d->ensureLayoutParameters(effectiveProfile);
  3997     d->layoutParameters.init(effectiveProfile);
  4593     HbCss::ValueExtractor valueExtractor(d->layoutParameters, true, effectiveProfile);
  3998     HbCss::ValueExtractor valueExtractor(d->layoutParameters, true, effectiveProfile);
  4594     qreal value = 0;
  3999     qreal value = 0;
  4595     QHash<QString, HbCss::Declaration>::const_iterator i = d->layoutParameters.constBegin();
  4000     HbLayoutParameters::const_iterator i = d->layoutParameters.constBegin();
  4596     while (i != d->layoutParameters.constEnd()) {
  4001     while (i != d->layoutParameters.constEnd()) {
  4597         if (valueExtractor.extractVariableValue(i.key(), value)) {
  4002         QString name(d->layoutParameters.name(i));
  4598             params.addParameter(i.key(), value);
  4003         if (valueExtractor.extractVariableValue(name, value)) {
       
  4004             params.addParameter(name, value);
  4599         }
  4005         }
  4600         ++i;
  4006         ++i;
  4601     }
  4007     }
  4602 }
  4008 }
  4603 
  4009 
  4643     }
  4049     }
  4644     const HbVector<HbCss::Declaration> decl = declarations(styleRules, "", widget, profile);
  4050     const HbVector<HbCss::Declaration> decl = declarations(styleRules, "", widget, profile);
  4645 #ifdef HBSTYLE_DEBUG
  4051 #ifdef HBSTYLE_DEBUG
  4646     qDebug() << "HbStyle::widgetParameters : Number of matching CSS declarations: " << decl.count();
  4052     qDebug() << "HbStyle::widgetParameters : Number of matching CSS declarations: " << decl.count();
  4647 #endif
  4053 #endif
  4648     d->ensureLayoutParameters(profile);
  4054     d->layoutParameters.init(profile);
  4649 
  4055 
  4650     HbCss::ValueExtractor extractor(decl, d->layoutParameters, profile);
  4056     HbCss::ValueExtractor extractor(decl, d->layoutParameters, profile);
  4651     extractor.extractCustomProperties( params.keys(), params.values() );
  4057     extractor.extractCustomProperties( params.keys(), params.values() );
  4652 }
  4058 }
  4653 
  4059 
  4654 
  4060 
  4655 /*!
  4061 /*!
  4656 \internal
  4062 \internal
  4657 */
  4063 */
  4658 HbStylePrivate::HbStylePrivate()
  4064 HbStylePrivate::HbStylePrivate() : mAutomaticTextMeasurementEnabled(false)
  4659 {
  4065 {
  4660     HbWidgetStyleLoader *loader = HbWidgetStyleLoader::instance();
  4066     HbWidgetStyleLoader *loader = HbWidgetStyleLoader::instance();
  4661     if(loader){
  4067     if(loader){
  4662         loader->addFilePath(STYLE_LOCATION, HbLayeredStyleLoader::Concern_Layouts,
  4068         loader->addFilePath(STYLE_LOCATION, HbLayeredStyleLoader::Concern_Layouts,
  4663                 HbLayeredStyleLoader::Priority_Core);
  4069                 HbLayeredStyleLoader::Priority_Core);
  4664         loader->addFilePath(COLOR_STYLE_LOCATION, HbLayeredStyleLoader::Concern_Colors,
  4070         loader->addFilePath(COLOR_STYLE_LOCATION, HbLayeredStyleLoader::Concern_Colors,
  4665                 HbLayeredStyleLoader::Priority_Core);
  4071                 HbLayeredStyleLoader::Priority_Core);
  4666     }
  4072     }
       
  4073 
       
  4074 #ifdef HB_TEXT_MEASUREMENT_UTILITY
       
  4075     mAutomaticTextMeasurementEnabled = (HbFeatureManager::instance()->featureStatus(HbFeatureManager::TextMeasurement) ==
       
  4076         AUTOMATIC_TEXT_MEASUREMENT);
       
  4077 #endif
  4667 }
  4078 }
  4668 
  4079 
  4669 /*!
  4080 /*!
  4670 \internal
  4081 \internal
  4671 */
  4082 */
  4672 HbStylePrivate::~HbStylePrivate()
  4083 HbStylePrivate::~HbStylePrivate()
  4673 {
  4084 {
  4674     layoutParameters.clear();
       
  4675 
       
  4676     HbWidgetStyleLoader *loader = HbWidgetStyleLoader::instance();
  4085     HbWidgetStyleLoader *loader = HbWidgetStyleLoader::instance();
  4677     if(loader){
  4086     if(loader){
  4678         loader->removeFilePath(STYLE_LOCATION, HbLayeredStyleLoader::Concern_Layouts,
  4087         loader->removeFilePath(STYLE_LOCATION, HbLayeredStyleLoader::Concern_Layouts,
  4679                 HbLayeredStyleLoader::Priority_Core);
  4088                 HbLayeredStyleLoader::Priority_Core);
  4680         loader->removeFilePath(COLOR_STYLE_LOCATION, HbLayeredStyleLoader::Concern_Colors,
  4089         loader->removeFilePath(COLOR_STYLE_LOCATION, HbLayeredStyleLoader::Concern_Colors,
  4683 }
  4092 }
  4684 
  4093 
  4685 /*!
  4094 /*!
  4686 \internal
  4095 \internal
  4687 */
  4096 */
  4688 QString HbStylePrivate::logicalName(HbStyle::Primitive primitive, const QStyleOption *option) const
  4097 QString HbStylePrivate::logicalName(HbStylePrivate::Primitive primitive, const QStyleOption *option)
  4689 {
  4098 {
  4690     switch (primitive) {
  4099     switch (primitive) {
  4691 
  4100 
  4692     case HbStyle::P_Slider_thumb: {
  4101     case HbStylePrivate::P_Slider_thumb: {
  4693         const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider *>(option);
  4102         const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider *>(option);
  4694         if (opt) {
  4103         if (opt) {
  4695             QString iconPath;
  4104             QString iconPath;
  4696             switch (opt->orientation) {
  4105             switch (opt->orientation) {
  4697 
  4106 
  4725 }
  4134 }
  4726 
  4135 
  4727 /*!
  4136 /*!
  4728 \internal
  4137 \internal
  4729 */
  4138 */
  4730 QIcon::Mode HbStylePrivate::iconMode(QStyle::State state) const
  4139 QIcon::Mode HbStylePrivate::iconMode(QStyle::State state)
  4731 {
  4140 {
  4732     QIcon::Mode mode = QIcon::Disabled;
  4141     QIcon::Mode mode = QIcon::Disabled;
  4733     if (state & QStyle::State_Enabled)
  4142     if (state & QStyle::State_Enabled)
  4734         mode = QIcon::Normal;
  4143         mode = QIcon::Normal;
  4735     if (state & QStyle::State_Active)
  4144     if (state & QStyle::State_Active)
  4740 }
  4149 }
  4741 
  4150 
  4742 /*!
  4151 /*!
  4743 \internal
  4152 \internal
  4744 */
  4153 */
  4745 QIcon::State HbStylePrivate::iconState(QStyle::State state) const
  4154 QIcon::State HbStylePrivate::iconState(QStyle::State state)
  4746 {
  4155 {
  4747     QIcon::State icon = QIcon::Off;
  4156     QIcon::State icon = QIcon::Off;
  4748     if (state & QStyle::State_On)
  4157     if (state & QStyle::State_On)
  4749         icon = QIcon::On;
  4158         icon = QIcon::On;
  4750     return icon;
  4159     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 }
  4160 }
  4820 
  4161 
  4821 /*!
  4162 /*!
  4822 \internal
  4163 \internal
  4823 */
  4164 */
  4824 void HbStylePrivate::clearStyleSheetCaches()
  4165 void HbStylePrivate::clearStyleSheetCaches()
  4825 {
  4166 {
  4826     styleRulesCache.clear();
  4167     styleRulesCache.clear();
  4827 }
  4168 }
  4828 
  4169 
  4829 HbWidgetBasePrivate *HbStylePrivate::widgetBasePrivate(HbWidgetBase *widgetBase) const
  4170 HbWidgetBasePrivate *HbStylePrivate::widgetBasePrivate(HbWidgetBase *widgetBase)
  4830 {
  4171 {
  4831     return HbWidgetBasePrivate::d_ptr(widgetBase);
  4172     return HbWidgetBasePrivate::d_ptr(widgetBase);
  4832 }
  4173 }
  4833 
  4174 
  4834 #include "moc_hbstyle.cpp"
  4175 #include "moc_hbstyle.cpp"