91 Q_ENUMS(SkinParts) |
90 Q_ENUMS(SkinParts) |
92 Q_ENUMS(ColorLists) |
91 Q_ENUMS(ColorLists) |
93 #endif // !Q_WS_S60 |
92 #endif // !Q_WS_S60 |
94 |
93 |
95 public: |
94 public: |
|
95 |
|
96 // S60 definitions within theme |
|
97 enum ThemeDefinitions { |
|
98 TD_AnimationData, |
|
99 }; |
|
100 |
|
101 //Defines which values are contained within animation data (retrieved using TD_AnimationData). |
|
102 //Additionally defines the order in which the items are given out in QList<QVariant>. |
|
103 enum AnimationData { |
|
104 AD_Interval = 0, |
|
105 AD_NumberOfFrames, |
|
106 AD_AnimationPlayMode, //currently not used as themes seem to contain invalid data |
|
107 }; |
|
108 |
|
109 // Animation modes |
|
110 enum AnimationMode { |
|
111 AM_PlayOnce = 0, //animation is played exactly once |
|
112 AM_Looping, //animation is repeated until stopped |
|
113 AM_Bounce //animation is played repeatedly until stopped, |
|
114 //but frames are played in reverse order every second time |
|
115 //(no support yet) |
|
116 }; |
|
117 |
96 // S60 look-and-feel font categories |
118 // S60 look-and-feel font categories |
97 enum FontCategories { |
119 enum FontCategories { |
98 FC_Undefined, |
120 FC_Undefined, |
99 FC_Primary, |
121 FC_Primary, |
100 FC_Secondary, |
122 FC_Secondary, |
102 FC_PrimarySmall, |
124 FC_PrimarySmall, |
103 FC_Digital |
125 FC_Digital |
104 }; |
126 }; |
105 |
127 |
106 enum SkinParts { |
128 enum SkinParts { |
107 SP_QgnGrafBarWait, |
129 SP_QgnGrafBarWaitAnim, |
108 SP_QgnGrafBarFrameCenter, |
130 SP_QgnGrafBarFrameCenter, |
109 SP_QgnGrafBarFrameSideL, |
131 SP_QgnGrafBarFrameSideL, |
110 SP_QgnGrafBarFrameSideR, |
132 SP_QgnGrafBarFrameSideR, |
111 SP_QgnGrafBarProgress, |
133 SP_QgnGrafBarProgress, |
112 SP_QgnGrafScrollArrowDown, |
134 SP_QgnGrafScrollArrowDown, |
285 CL_QsnParentColors, |
307 CL_QsnParentColors, |
286 CL_QsnTextColors |
308 CL_QsnTextColors |
287 }; |
309 }; |
288 }; |
310 }; |
289 |
311 |
|
312 #ifdef Q_WS_S60 |
|
313 class CAknBitmapAnimation; |
|
314 NONSHARABLE_CLASS (AnimationData) : public QObject |
|
315 { |
|
316 public: |
|
317 AnimationData(const QS60StyleEnums::SkinParts part, int frames, int interval); |
|
318 |
|
319 const QS60StyleEnums::SkinParts m_id; |
|
320 int m_frames; |
|
321 int m_interval; |
|
322 QS60StyleEnums::AnimationMode m_mode; |
|
323 }; |
|
324 |
|
325 |
|
326 NONSHARABLE_CLASS (AnimationDataV2) : public AnimationData |
|
327 { |
|
328 public: |
|
329 AnimationDataV2(const AnimationData &data); |
|
330 ~AnimationDataV2(); |
|
331 |
|
332 CAknBitmapAnimation *m_animation; |
|
333 int m_currentFrame; |
|
334 bool m_resourceBased; |
|
335 int m_timerId; |
|
336 }; |
|
337 |
|
338 |
|
339 class QS60StyleAnimation : public QObject |
|
340 { |
|
341 public: |
|
342 QS60StyleAnimation(const QS60StyleEnums::SkinParts part, int frames, int interval); |
|
343 ~QS60StyleAnimation(); |
|
344 |
|
345 public: |
|
346 QS60StyleEnums::SkinParts animationId() const {return m_currentData->m_id;} |
|
347 int frameCount() const { return m_currentData->m_frames;} |
|
348 int interval() const {return m_currentData->m_interval;} |
|
349 QS60StyleEnums::AnimationMode playMode() const {return m_currentData->m_mode;} |
|
350 CAknBitmapAnimation* animationObject() const {return m_currentData->m_animation;} |
|
351 bool isResourceBased() const {return m_currentData->m_resourceBased;} |
|
352 int timerId() const {return m_currentData->m_timerId;} |
|
353 int currentFrame() const {return m_currentData->m_currentFrame;} |
|
354 |
|
355 void setFrameCount(int frameCount) {m_currentData->m_frames = frameCount;} |
|
356 void setInterval(int interval) {m_currentData->m_interval = interval;} |
|
357 void setAnimationObject(CAknBitmapAnimation* animation); |
|
358 void setResourceBased(bool resourceBased) {m_currentData->m_resourceBased = resourceBased;} |
|
359 void setTimerId(int timerId) {m_currentData->m_timerId = timerId;} |
|
360 void setCurrentFrame(int currentFrame) {m_currentData->m_currentFrame = currentFrame;} |
|
361 |
|
362 void resetToDefaults(); |
|
363 |
|
364 private: //data members |
|
365 //TODO: consider changing these to non-pointers as the classes are rather small anyway |
|
366 AnimationData *m_defaultData; |
|
367 AnimationDataV2 *m_currentData; |
|
368 }; |
|
369 |
|
370 #endif //Q_WS_S60 |
|
371 |
|
372 |
290 class QFocusFrame; |
373 class QFocusFrame; |
|
374 class QProgressBar; |
|
375 class QS60StyleAnimation; |
291 |
376 |
292 // Private class |
377 // Private class |
293 #ifdef Q_OS_SYMBIAN |
378 #ifdef Q_OS_SYMBIAN |
294 NONSHARABLE_CLASS (QS60StylePrivate) |
379 NONSHARABLE_CLASS (QS60StylePrivate) |
295 #else |
380 #else |
369 SF_PointWest = 0x0008, |
454 SF_PointWest = 0x0008, |
370 |
455 |
371 SF_StateEnabled = 0x0010, // Enabled = the default |
456 SF_StateEnabled = 0x0010, // Enabled = the default |
372 SF_StateDisabled = 0x0020, |
457 SF_StateDisabled = 0x0020, |
373 SF_ColorSkinned = 0x0040, // pixmap is colored with foreground pen color |
458 SF_ColorSkinned = 0x0040, // pixmap is colored with foreground pen color |
|
459 SF_Animation = 0x0080, |
374 }; |
460 }; |
375 |
461 |
376 enum CacheClearReason { |
462 enum CacheClearReason { |
377 CC_UndefinedChange = 0, |
463 CC_UndefinedChange = 0, |
378 CC_LayoutChange, |
464 CC_LayoutChange, |
410 static void deleteBackground(); |
496 static void deleteBackground(); |
411 |
497 |
412 static bool isTouchSupported(); |
498 static bool isTouchSupported(); |
413 static bool isToolBarBackground(); |
499 static bool isToolBarBackground(); |
414 static bool hasSliderGrooveGraphic(); |
500 static bool hasSliderGrooveGraphic(); |
|
501 static bool isSingleClickUi(); |
415 |
502 |
416 // calculates average color based on button skin graphics (minus borders). |
503 // calculates average color based on button skin graphics (minus borders). |
417 QColor colorFromFrameGraphics(SkinFrameElements frame) const; |
504 QColor colorFromFrameGraphics(SkinFrameElements frame) const; |
418 |
505 |
419 //set theme palette for application |
506 //set theme palette for application |
452 static QSize naviPaneSize(); |
539 static QSize naviPaneSize(); |
453 |
540 |
454 //Checks that the current brush is transparent or has BrushStyle NoBrush, |
541 //Checks that the current brush is transparent or has BrushStyle NoBrush, |
455 //so that theme graphic background can be drawn. |
542 //so that theme graphic background can be drawn. |
456 static bool canDrawThemeBackground(const QBrush &backgroundBrush); |
543 static bool canDrawThemeBackground(const QBrush &backgroundBrush); |
|
544 |
|
545 static int currentAnimationFrame(QS60StyleEnums::SkinParts part); |
|
546 #ifdef Q_WS_S60 |
|
547 |
|
548 //No support for animations on emulated style |
|
549 void startAnimation(QS60StyleEnums::SkinParts animation); |
|
550 void stopAnimation(QS60StyleEnums::SkinParts animation); |
|
551 static QS60StyleAnimation* animationDefinition(QS60StyleEnums::SkinParts part); |
|
552 |
|
553 #endif |
457 |
554 |
458 private: |
555 private: |
459 static void drawPart(QS60StyleEnums::SkinParts part, QPainter *painter, |
556 static void drawPart(QS60StyleEnums::SkinParts part, QPainter *painter, |
460 const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags); |
557 const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags); |
461 static void drawRow(QS60StyleEnums::SkinParts start, QS60StyleEnums::SkinParts middle, |
558 static void drawRow(QS60StyleEnums::SkinParts start, QS60StyleEnums::SkinParts middle, |
495 // defined theme palette |
592 // defined theme palette |
496 static QPalette *m_themePalette; |
593 static QPalette *m_themePalette; |
497 QPalette m_originalPalette; |
594 QPalette m_originalPalette; |
498 |
595 |
499 QPointer<QFocusFrame> m_focusFrame; |
596 QPointer<QFocusFrame> m_focusFrame; |
|
597 |
|
598 #ifdef Q_WS_S60 |
|
599 //list of progress bars having animation running |
|
600 QList<QProgressBar *> m_bars; |
|
601 #endif |
|
602 |
500 }; |
603 }; |
501 |
604 |
502 QT_END_NAMESPACE |
605 QT_END_NAMESPACE |
503 |
606 |
504 #endif // QS60STYLE_P_H |
607 #endif // QS60STYLE_P_H |