src/gui/styles/qs60style_p.h
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
--- a/src/gui/styles/qs60style_p.h	Tue Feb 02 00:43:10 2010 +0200
+++ b/src/gui/styles/qs60style_p.h	Wed Mar 31 11:06:36 2010 +0300
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -60,13 +60,8 @@
 QT_BEGIN_NAMESPACE
 
 const int MAX_NON_CUSTOM_PIXELMETRICS = 92;
-const int CUSTOMVALUESCOUNT = 4;
-enum {
-    PM_Custom_FrameCornerWidth = MAX_NON_CUSTOM_PIXELMETRICS,
-    PM_Custom_FrameCornerHeight,
-    PM_Custom_BoldLineWidth,
-    PM_Custom_ThinLineWidth
-    };
+const int CUSTOMVALUESCOUNT = 5;
+
 const int MAX_PIXELMETRICS = MAX_NON_CUSTOM_PIXELMETRICS + CUSTOMVALUESCOUNT;
 
 typedef struct {
@@ -74,7 +69,6 @@
     unsigned short width;
     int major_version;
     int minor_version;
-    bool mirroring; // TODO: (nice to have) Use Qt::LayoutDirection
     const char* layoutName;
 } layoutHeader;
 
@@ -93,6 +87,29 @@
 #endif // !Q_WS_S60
 
 public:
+
+    // S60 definitions within theme
+    enum ThemeDefinitions {
+        TD_AnimationData,
+    };
+
+    //Defines which values are contained within animation data (retrieved using TD_AnimationData).
+    //Additionally defines the order in which the items are given out in QList<QVariant>.
+    enum AnimationData {
+        AD_Interval = 0,
+        AD_NumberOfFrames,
+        AD_AnimationPlayMode,  //currently not used as themes seem to contain invalid data
+    };
+
+    // Animation modes
+    enum AnimationMode {
+        AM_PlayOnce = 0, //animation is played exactly once
+        AM_Looping,      //animation is repeated until stopped
+        AM_Bounce        //animation is played repeatedly until stopped,
+                         //but frames are played in reverse order every second time
+                         //(no support yet)
+    };
+
     // S60 look-and-feel font categories
     enum FontCategories {
         FC_Undefined,
@@ -104,11 +121,12 @@
     };
 
     enum SkinParts {
-        SP_QgnGrafBarWait,
+        SP_QgnGrafBarWaitAnim,
         SP_QgnGrafBarFrameCenter,
         SP_QgnGrafBarFrameSideL,
         SP_QgnGrafBarFrameSideR,
         SP_QgnGrafBarProgress,
+        SP_QgnGrafOrgBgGrid,
         SP_QgnGrafScrollArrowDown,
         SP_QgnGrafScrollArrowLeft,
         SP_QgnGrafScrollArrowRight,
@@ -287,7 +305,70 @@
     };
 };
 
+#ifdef Q_WS_S60
+class CAknBitmapAnimation;
+NONSHARABLE_CLASS (AnimationData) : public QObject
+{
+public:
+    AnimationData(const QS60StyleEnums::SkinParts part, int frames, int interval);
+
+    const QS60StyleEnums::SkinParts m_id;
+    int m_frames;
+    int m_interval;
+    QS60StyleEnums::AnimationMode m_mode;
+};
+
+
+NONSHARABLE_CLASS (AnimationDataV2) : public AnimationData
+{
+public:
+    AnimationDataV2(const AnimationData &data);
+    ~AnimationDataV2();
+
+    CAknBitmapAnimation *m_animation;
+    int m_currentFrame;
+    bool m_resourceBased;
+    int m_timerId;
+};
+
+
+class QS60StyleAnimation : public QObject
+{
+public:
+    QS60StyleAnimation(const QS60StyleEnums::SkinParts part, int frames, int interval);
+    ~QS60StyleAnimation();
+
+public:
+    QS60StyleEnums::SkinParts animationId() const {return m_currentData->m_id;}
+    int frameCount() const { return m_currentData->m_frames;}
+    int interval() const {return m_currentData->m_interval;}
+    QS60StyleEnums::AnimationMode playMode() const {return m_currentData->m_mode;}
+    CAknBitmapAnimation* animationObject() const {return m_currentData->m_animation;}
+    bool isResourceBased() const {return m_currentData->m_resourceBased;}
+    int timerId() const {return m_currentData->m_timerId;}
+    int currentFrame() const {return m_currentData->m_currentFrame;}
+
+    void setFrameCount(int frameCount) {m_currentData->m_frames = frameCount;}
+    void setInterval(int interval) {m_currentData->m_interval = interval;}
+    void setAnimationObject(CAknBitmapAnimation* animation);
+    void setResourceBased(bool resourceBased) {m_currentData->m_resourceBased = resourceBased;}
+    void setTimerId(int timerId) {m_currentData->m_timerId = timerId;}
+    void setCurrentFrame(int currentFrame) {m_currentData->m_currentFrame = currentFrame;}
+
+    void resetToDefaults();
+
+private: //data members
+    //TODO: consider changing these to non-pointers as the classes are rather small anyway
+    AnimationData *m_defaultData;
+    AnimationDataV2 *m_currentData;
+};
+
+#endif //Q_WS_S60
+
+
 class QFocusFrame;
+class QProgressBar;
+class QS60StyleAnimation;
 
 // Private class
 #ifdef Q_OS_SYMBIAN
@@ -330,7 +411,7 @@
         SE_TabBarTabWestActive,
         SE_TabBarTabWestInactive,
         SE_ListHighlight,
-        SE_OptionsMenu,
+        SE_PopupBackground,
         SE_SettingsList,
         SE_TableItem,
         SE_TableHeaderItem,
@@ -339,10 +420,11 @@
         SE_ToolBarButton,
         SE_ToolBarButtonPressed,
         SE_PanelBackground,
-        SE_ScrollBarHandlePressedHorizontal, //only for 5.0+
+        SE_ScrollBarHandlePressedHorizontal,
         SE_ScrollBarHandlePressedVertical,
         SE_ButtonInactive,
         SE_Editor,
+        SE_DropArea
     };
 
     enum SkinFrameElements {
@@ -350,7 +432,7 @@
         SF_ButtonPressed,
         SF_FrameLineEdit,
         SF_ListHighlight,
-        SF_OptionsMenu,
+        SF_PopupBackground,
         SF_SettingsList,
         SF_TableItem,
         SF_TableHeaderItem,
@@ -371,6 +453,7 @@
         SF_StateEnabled =     0x0010, // Enabled = the default
         SF_StateDisabled =    0x0020,
         SF_ColorSkinned =     0x0040, // pixmap is colored with foreground pen color
+        SF_Animation =        0x0080,
     };
 
     enum CacheClearReason {
@@ -401,7 +484,7 @@
     static bool drawsOwnThemeBackground(const QWidget *widget);
 
     QFont s60Font(QS60StyleEnums::FontCategories fontCategory,
-        int pointSize = -1) const;
+        int pointSize = -1, bool resolveFontSize = true) const;
     // clears all style caches (fonts, colors, pixmaps)
     void clearCaches(CacheClearReason reason = CC_UndefinedChange);
 
@@ -412,6 +495,7 @@
     static bool isTouchSupported();
     static bool isToolBarBackground();
     static bool hasSliderGrooveGraphic();
+    static bool isSingleClickUi();
 
     // calculates average color based on button skin graphics (minus borders).
     QColor colorFromFrameGraphics(SkinFrameElements frame) const;
@@ -453,7 +537,17 @@
 
     //Checks that the current brush is transparent or has BrushStyle NoBrush,
     //so that theme graphic background can be drawn.
-    static bool canDrawThemeBackground(const QBrush &backgroundBrush);
+    static bool canDrawThemeBackground(const QBrush &backgroundBrush, const QWidget *widget);
+
+    static int currentAnimationFrame(QS60StyleEnums::SkinParts part);
+#ifdef Q_WS_S60
+
+    //No support for animations on emulated style
+    void startAnimation(QS60StyleEnums::SkinParts animation);
+    void stopAnimation(QS60StyleEnums::SkinParts animation);
+    static QS60StyleAnimation* animationDefinition(QS60StyleEnums::SkinParts part);
+
+#endif
 
 private:
     static void drawPart(QS60StyleEnums::SkinParts part, QPainter *painter,
@@ -484,7 +578,8 @@
     static QPixmap part(QS60StyleEnums::SkinParts part, const QSize &size,
         QPainter *painter, SkinElementFlags flags = KDefaultSkinElementFlags);
 
-    static QFont s60Font_specific(QS60StyleEnums::FontCategories fontCategory, int pointSize);
+    static QFont s60Font_specific(QS60StyleEnums::FontCategories fontCategory,
+                                  int pointSize, bool resolveFontSize);
 
     static QSize screenSize();
 
@@ -496,6 +591,13 @@
     QPalette m_originalPalette;
 
     QPointer<QFocusFrame> m_focusFrame;
+    static qint64 m_webPaletteKey;
+
+#ifdef Q_WS_S60
+    //list of progress bars having animation running
+    QList<QProgressBar *> m_bars;
+#endif
+
 };
 
 QT_END_NAMESPACE