2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the QtGui of the Qt Toolkit. |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
8 ** |
8 ** |
9 ** $QT_BEGIN_LICENSE:LGPL$ |
9 ** $QT_BEGIN_LICENSE:LGPL$ |
10 ** No Commercial Usage |
10 ** No Commercial Usage |
11 ** This file contains pre-release code and may not be distributed. |
11 ** This file contains pre-release code and may not be distributed. |
12 ** You may use this file in accordance with the terms and conditions |
12 ** You may use this file in accordance with the terms and conditions |
117 SP_QgnGrafTabActiveM, |
117 SP_QgnGrafTabActiveM, |
118 SP_QgnGrafTabActiveR, |
118 SP_QgnGrafTabActiveR, |
119 SP_QgnGrafTabPassiveL, |
119 SP_QgnGrafTabPassiveL, |
120 SP_QgnGrafTabPassiveM, |
120 SP_QgnGrafTabPassiveM, |
121 SP_QgnGrafTabPassiveR, |
121 SP_QgnGrafTabPassiveR, |
|
122 SP_QgnGrafNsliderEndLeft, |
|
123 SP_QgnGrafNsliderEndRight, |
|
124 SP_QgnGrafNsliderMiddle, |
122 SP_QgnIndiCheckboxOff, |
125 SP_QgnIndiCheckboxOff, |
123 SP_QgnIndiCheckboxOn, |
126 SP_QgnIndiCheckboxOn, |
124 SP_QgnIndiHlColSuper, // Available in S60 release 3.2 and later. |
127 SP_QgnIndiHlColSuper, // Available in S60 release 3.2 and later. |
125 SP_QgnIndiHlExpSuper, // Available in S60 release 3.2 and later. |
128 SP_QgnIndiHlExpSuper, // Available in S60 release 3.2 and later. |
126 SP_QgnIndiHlLineBranch, // Available in S60 release 3.2 and later. |
129 SP_QgnIndiHlLineBranch, // Available in S60 release 3.2 and later. |
129 SP_QgnIndiMarkedAdd, |
132 SP_QgnIndiMarkedAdd, |
130 SP_QgnIndiNaviArrowLeft, |
133 SP_QgnIndiNaviArrowLeft, |
131 SP_QgnIndiNaviArrowRight, |
134 SP_QgnIndiNaviArrowRight, |
132 SP_QgnIndiRadiobuttOff, |
135 SP_QgnIndiRadiobuttOff, |
133 SP_QgnIndiRadiobuttOn, |
136 SP_QgnIndiRadiobuttOn, |
134 SP_QgnIndiSliderEdit, |
137 SP_QgnGrafNsliderMarker, |
|
138 SP_QgnGrafNsliderMarkerSelected, |
135 SP_QgnIndiSubMenu, |
139 SP_QgnIndiSubMenu, |
136 SP_QgnNoteErased, |
140 SP_QgnNoteErased, |
137 SP_QgnNoteError, |
141 SP_QgnNoteError, |
138 SP_QgnNoteInfo, |
142 SP_QgnNoteInfo, |
139 SP_QgnNoteOk, |
143 SP_QgnNoteOk, |
269 SP_QsnFrButtonSideTInactive, |
273 SP_QsnFrButtonSideTInactive, |
270 SP_QsnFrButtonSideBInactive, |
274 SP_QsnFrButtonSideBInactive, |
271 SP_QsnFrButtonSideLInactive, |
275 SP_QsnFrButtonSideLInactive, |
272 SP_QsnFrButtonSideRInactive, |
276 SP_QsnFrButtonSideRInactive, |
273 SP_QsnFrButtonCenterInactive, |
277 SP_QsnFrButtonCenterInactive, |
274 SP_QsnFrNotepadCornerTl, |
|
275 SP_QsnFrNotepadCornerTr, |
|
276 SP_QsnFrNotepadCornerBl, |
|
277 SP_QsnFrNotepadCornerBr, |
|
278 SP_QsnFrNotepadSideT, |
|
279 SP_QsnFrNotepadSideB, |
|
280 SP_QsnFrNotepadSideL, |
|
281 SP_QsnFrNotepadSideR, |
|
282 SP_QsnFrNotepadCenter |
|
283 }; |
278 }; |
284 |
279 |
285 enum ColorLists { |
280 enum ColorLists { |
286 CL_QsnHighlightColors, |
281 CL_QsnHighlightColors, |
287 CL_QsnIconColors, |
282 CL_QsnIconColors, |
320 SE_ScrollBarGrooveVertical, |
315 SE_ScrollBarGrooveVertical, |
321 SE_ScrollBarHandleHorizontal, |
316 SE_ScrollBarHandleHorizontal, |
322 SE_ScrollBarHandleVertical, |
317 SE_ScrollBarHandleVertical, |
323 SE_SliderHandleHorizontal, |
318 SE_SliderHandleHorizontal, |
324 SE_SliderHandleVertical, |
319 SE_SliderHandleVertical, |
|
320 SE_SliderHandleSelectedHorizontal, |
|
321 SE_SliderHandleSelectedVertical, |
|
322 SE_SliderGrooveVertical, |
|
323 SE_SliderGrooveHorizontal, |
325 SE_TabBarTabEastActive, |
324 SE_TabBarTabEastActive, |
326 SE_TabBarTabEastInactive, |
325 SE_TabBarTabEastInactive, |
327 SE_TabBarTabNorthActive, |
326 SE_TabBarTabNorthActive, |
328 SE_TabBarTabNorthInactive, |
327 SE_TabBarTabNorthInactive, |
329 SE_TabBarTabSouthActive, |
328 SE_TabBarTabSouthActive, |
359 SF_ToolBar, |
358 SF_ToolBar, |
360 SF_ToolBarButton, |
359 SF_ToolBarButton, |
361 SF_ToolBarButtonPressed, |
360 SF_ToolBarButtonPressed, |
362 SF_PanelBackground, |
361 SF_PanelBackground, |
363 SF_ButtonInactive, |
362 SF_ButtonInactive, |
364 SF_Editor, |
|
365 }; |
363 }; |
366 |
364 |
367 enum SkinElementFlag { |
365 enum SkinElementFlag { |
368 SF_PointNorth = 0x0001, // North = the default |
366 SF_PointNorth = 0x0001, // North = the default |
369 SF_PointEast = 0x0002, |
367 SF_PointEast = 0x0002, |
370 SF_PointSouth = 0x0004, |
368 SF_PointSouth = 0x0004, |
371 SF_PointWest = 0x0008, |
369 SF_PointWest = 0x0008, |
372 |
370 |
373 SF_StateEnabled = 0x0010, // Enabled = the default |
371 SF_StateEnabled = 0x0010, // Enabled = the default |
374 SF_StateDisabled = 0x0020, |
372 SF_StateDisabled = 0x0020, |
375 SF_ColorSkinned = 0x0040, |
373 SF_ColorSkinned = 0x0040, // pixmap is colored with foreground pen color |
376 }; |
374 }; |
377 |
375 |
378 enum CacheClearReason { |
376 enum CacheClearReason { |
379 CC_UndefinedChange = 0, |
377 CC_UndefinedChange = 0, |
380 CC_LayoutChange, |
378 CC_LayoutChange, |
387 static void drawSkinElement(SkinElements element, QPainter *painter, |
385 static void drawSkinElement(SkinElements element, QPainter *painter, |
388 const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags); |
386 const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags); |
389 // draws a specific skin part |
387 // draws a specific skin part |
390 static void drawSkinPart(QS60StyleEnums::SkinParts part, QPainter *painter, |
388 static void drawSkinPart(QS60StyleEnums::SkinParts part, QPainter *painter, |
391 const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags); |
389 const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags); |
392 // sets style property |
|
393 void setStyleProperty(const char *name, const QVariant &value); |
|
394 // sets specific style property |
|
395 void setStyleProperty_specific(const char *name, const QVariant &value); |
|
396 // gets style property |
|
397 QVariant styleProperty(const char *name) const; |
|
398 // gets specific style property |
|
399 QVariant styleProperty_specific(const char *name) const; |
|
400 // gets pixel metrics value |
390 // gets pixel metrics value |
401 static short pixelMetric(int metric); |
391 static short pixelMetric(int metric); |
402 // gets color. 'index' is NOT 0-based. |
392 // gets color. 'index' is NOT 0-based. |
403 // It corresponds to the enum key 1-based numbers of TAknsQsnXYZColorsIndex, not the values. |
393 // It corresponds to the enum key 1-based numbers of TAknsQsnXYZColorsIndex, not the values. |
404 static QColor s60Color(QS60StyleEnums::ColorLists list, |
394 static QColor s60Color(QS60StyleEnums::ColorLists list, |
419 void setBackgroundTexture(QApplication *application) const; |
409 void setBackgroundTexture(QApplication *application) const; |
420 static void deleteBackground(); |
410 static void deleteBackground(); |
421 |
411 |
422 static bool isTouchSupported(); |
412 static bool isTouchSupported(); |
423 static bool isToolBarBackground(); |
413 static bool isToolBarBackground(); |
|
414 static bool hasSliderGrooveGraphic(); |
424 |
415 |
425 // calculates average color based on button skin graphics (minus borders). |
416 // calculates average color based on button skin graphics (minus borders). |
426 QColor colorFromFrameGraphics(SkinFrameElements frame) const; |
417 QColor colorFromFrameGraphics(SkinFrameElements frame) const; |
427 |
418 |
428 //set theme palette for application |
419 //set theme palette for application |
429 void setThemePalette(QApplication *application) const; |
420 void setThemePalette(QApplication *application) const; |
430 //set theme palette for style option |
|
431 void setThemePalette(QStyleOption *option) const; |
|
432 //access to theme palette |
421 //access to theme palette |
433 static QPalette* themePalette(); |
422 static QPalette* themePalette(); |
434 |
423 |
435 static const layoutHeader m_layoutHeaders[]; |
424 static const layoutHeader m_layoutHeaders[]; |
436 static const short data[][MAX_PIXELMETRICS]; |
425 static const short data[][MAX_PIXELMETRICS]; |
459 void handleDynamicLayoutVariantSwitch(); |
448 void handleDynamicLayoutVariantSwitch(); |
460 void handleSkinChange(); |
449 void handleSkinChange(); |
461 #endif // Q_WS_S60 |
450 #endif // Q_WS_S60 |
462 |
451 |
463 static QSize naviPaneSize(); |
452 static QSize naviPaneSize(); |
|
453 |
|
454 //Checks that the current brush is transparent or has BrushStyle NoBrush, |
|
455 //so that theme graphic background can be drawn. |
|
456 static bool canDrawThemeBackground(const QBrush &backgroundBrush); |
464 |
457 |
465 private: |
458 private: |
466 static void drawPart(QS60StyleEnums::SkinParts part, QPainter *painter, |
459 static void drawPart(QS60StyleEnums::SkinParts part, QPainter *painter, |
467 const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags); |
460 const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags); |
468 static void drawRow(QS60StyleEnums::SkinParts start, QS60StyleEnums::SkinParts middle, |
461 static void drawRow(QS60StyleEnums::SkinParts start, QS60StyleEnums::SkinParts middle, |
470 const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags); |
463 const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags); |
471 static void drawFrame(SkinFrameElements frame, QPainter *painter, |
464 static void drawFrame(SkinFrameElements frame, QPainter *painter, |
472 const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags); |
465 const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags); |
473 |
466 |
474 static QPixmap cachedPart(QS60StyleEnums::SkinParts part, const QSize &size, |
467 static QPixmap cachedPart(QS60StyleEnums::SkinParts part, const QSize &size, |
475 SkinElementFlags flags = KDefaultSkinElementFlags); |
468 QPainter *painter, SkinElementFlags flags = KDefaultSkinElementFlags); |
476 static QPixmap cachedFrame(SkinFrameElements frame, const QSize &size, |
469 static QPixmap cachedFrame(SkinFrameElements frame, const QSize &size, |
477 SkinElementFlags flags = KDefaultSkinElementFlags); |
470 SkinElementFlags flags = KDefaultSkinElementFlags); |
478 |
471 |
479 static void refreshUI(); |
472 static void refreshUI(); |
480 |
473 |
487 static void deleteThemePalette(); |
480 static void deleteThemePalette(); |
488 |
481 |
489 static QSize partSize(QS60StyleEnums::SkinParts part, |
482 static QSize partSize(QS60StyleEnums::SkinParts part, |
490 SkinElementFlags flags = KDefaultSkinElementFlags); |
483 SkinElementFlags flags = KDefaultSkinElementFlags); |
491 static QPixmap part(QS60StyleEnums::SkinParts part, const QSize &size, |
484 static QPixmap part(QS60StyleEnums::SkinParts part, const QSize &size, |
492 SkinElementFlags flags = KDefaultSkinElementFlags); |
485 QPainter *painter, SkinElementFlags flags = KDefaultSkinElementFlags); |
493 |
486 |
494 static QFont s60Font_specific(QS60StyleEnums::FontCategories fontCategory, int pointSize); |
487 static QFont s60Font_specific(QS60StyleEnums::FontCategories fontCategory, int pointSize); |
495 |
488 |
496 static QSize screenSize(); |
489 static QSize screenSize(); |
497 |
490 |