| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** All rights reserved.
|
|---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
|---|
| 6 | **
|
|---|
| 7 | ** This file is part of the QtGui module of the Qt Toolkit.
|
|---|
| 8 | **
|
|---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 10 | ** Commercial Usage
|
|---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 14 | ** a written agreement between you and Nokia.
|
|---|
| 15 | **
|
|---|
| 16 | ** GNU Lesser General Public License Usage
|
|---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 18 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 20 | ** packaging of this file. Please review the following information to
|
|---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 23 | **
|
|---|
| 24 | ** In addition, as a special exception, Nokia gives you certain additional
|
|---|
| 25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
|---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|---|
| 27 | **
|
|---|
| 28 | ** GNU General Public License Usage
|
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ** packaging of this file. Please review the following information to
|
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | **
|
|---|
| 36 | ** If you have questions regarding the use of this file, please contact
|
|---|
| 37 | ** Nokia at [email protected].
|
|---|
| 38 | ** $QT_END_LICENSE$
|
|---|
| 39 | **
|
|---|
| 40 | ****************************************************************************/
|
|---|
| 41 |
|
|---|
| 42 | #include "qs60style.h"
|
|---|
| 43 | #include "qs60style_p.h"
|
|---|
| 44 | #include "qpainter.h"
|
|---|
| 45 | #include "qstyleoption.h"
|
|---|
| 46 | #include "qstyle.h"
|
|---|
| 47 | #include "private/qt_s60_p.h"
|
|---|
| 48 | #include "private/qpixmap_s60_p.h"
|
|---|
| 49 | #include "private/qcore_symbian_p.h"
|
|---|
| 50 | #include "qapplication.h"
|
|---|
| 51 |
|
|---|
| 52 | #include <w32std.h>
|
|---|
| 53 | #include <aknsconstants.h>
|
|---|
| 54 | #include <aknconsts.h>
|
|---|
| 55 | #include <aknsitemid.h>
|
|---|
| 56 | #include <aknsutils.h>
|
|---|
| 57 | #include <aknsdrawutils.h>
|
|---|
| 58 | #include <aknsskininstance.h>
|
|---|
| 59 | #include <aknsbasicbackgroundcontrolcontext.h>
|
|---|
| 60 | #include <avkon.mbg>
|
|---|
| 61 | #include <AknFontAccess.h>
|
|---|
| 62 | #include <AknLayoutFont.h>
|
|---|
| 63 | #include <aknutils.h>
|
|---|
| 64 | #include <aknnavi.h>
|
|---|
| 65 | #include <gulicon.h>
|
|---|
| 66 | #include <AknBitmapAnimation.h>
|
|---|
| 67 |
|
|---|
| 68 | #if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN)
|
|---|
| 69 |
|
|---|
| 70 | QT_BEGIN_NAMESPACE
|
|---|
| 71 |
|
|---|
| 72 | enum TDrawType {
|
|---|
| 73 | EDrawIcon,
|
|---|
| 74 | EDrawGulIcon,
|
|---|
| 75 | EDrawBackground,
|
|---|
| 76 | EDrawAnimation,
|
|---|
| 77 | ENoDraw
|
|---|
| 78 | };
|
|---|
| 79 |
|
|---|
| 80 | enum TSupportRelease {
|
|---|
| 81 | ES60_None = 0x0000, //indicates that the commonstyle should draw the graphics
|
|---|
| 82 | ES60_3_1 = 0x0001,
|
|---|
| 83 | ES60_3_2 = 0x0002,
|
|---|
| 84 | ES60_5_0 = 0x0004,
|
|---|
| 85 | ES60_5_1 = 0x0008,
|
|---|
| 86 | ES60_5_2 = 0x0010,
|
|---|
| 87 | ES60_3_X = ES60_3_1 | ES60_3_2,
|
|---|
| 88 | // Releases before Symbian Foundation
|
|---|
| 89 | ES60_PreSF = ES60_3_1 | ES60_3_2 | ES60_5_0,
|
|---|
| 90 | // Add all new releases here
|
|---|
| 91 | ES60_All = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2
|
|---|
| 92 | };
|
|---|
| 93 |
|
|---|
| 94 | typedef struct {
|
|---|
| 95 | const TAknsItemID &skinID;
|
|---|
| 96 | TDrawType drawType;
|
|---|
| 97 | int supportInfo;
|
|---|
| 98 | int newMajorSkinId;
|
|---|
| 99 | int newMinorSkinId;
|
|---|
| 100 | } partMapEntry;
|
|---|
| 101 |
|
|---|
| 102 | AnimationData::AnimationData(const QS60StyleEnums::SkinParts part, int frames, int interval) : m_id(part),
|
|---|
| 103 | m_frames(frames), m_interval(interval), m_mode(QS60StyleEnums::AM_Looping)
|
|---|
| 104 | {
|
|---|
| 105 | }
|
|---|
| 106 |
|
|---|
| 107 | AnimationDataV2::AnimationDataV2(const AnimationData &data) : AnimationData(data.m_id, data.m_frames, data.m_interval),
|
|---|
| 108 | m_resourceBased(false), m_animation(0), m_timerId(0)
|
|---|
| 109 | {
|
|---|
| 110 | }
|
|---|
| 111 | AnimationDataV2::~AnimationDataV2()
|
|---|
| 112 | {
|
|---|
| 113 | delete m_animation;
|
|---|
| 114 | }
|
|---|
| 115 |
|
|---|
| 116 | QS60StyleAnimation::QS60StyleAnimation(const QS60StyleEnums::SkinParts part, int frames, int interval)
|
|---|
| 117 | {
|
|---|
| 118 | QT_TRAP_THROWING(m_defaultData = new (ELeave) AnimationData(part, frames, interval));
|
|---|
| 119 | QT_TRAP_THROWING(m_currentData = new (ELeave) AnimationDataV2(*m_defaultData));
|
|---|
| 120 | }
|
|---|
| 121 |
|
|---|
| 122 | QS60StyleAnimation::~QS60StyleAnimation()
|
|---|
| 123 | {
|
|---|
| 124 | delete m_currentData;
|
|---|
| 125 | delete m_defaultData;
|
|---|
| 126 | }
|
|---|
| 127 |
|
|---|
| 128 | void QS60StyleAnimation::setAnimationObject(CAknBitmapAnimation* animation)
|
|---|
| 129 | {
|
|---|
| 130 | Q_ASSERT(animation);
|
|---|
| 131 | if (m_currentData->m_animation)
|
|---|
| 132 | delete m_currentData->m_animation;
|
|---|
| 133 | m_currentData->m_animation = animation;
|
|---|
| 134 | }
|
|---|
| 135 |
|
|---|
| 136 | void QS60StyleAnimation::resetToDefaults()
|
|---|
| 137 | {
|
|---|
| 138 | delete m_currentData;
|
|---|
| 139 | m_currentData = 0;
|
|---|
| 140 | QT_TRAP_THROWING(m_currentData = new (ELeave) AnimationDataV2(*m_defaultData));
|
|---|
| 141 | }
|
|---|
| 142 |
|
|---|
| 143 | class QS60StyleModeSpecifics
|
|---|
| 144 | {
|
|---|
| 145 | public:
|
|---|
| 146 | static QPixmap skinnedGraphics(QS60StyleEnums::SkinParts stylepart,
|
|---|
| 147 | const QSize &size, QS60StylePrivate::SkinElementFlags flags);
|
|---|
| 148 | static QPixmap skinnedGraphics(QS60StylePrivate::SkinFrameElements frameElement, const QSize &size, QS60StylePrivate::SkinElementFlags flags);
|
|---|
| 149 | static QPixmap colorSkinnedGraphics(const QS60StyleEnums::SkinParts &stylepart,
|
|---|
| 150 | const QSize &size, QPainter *painter, QS60StylePrivate::SkinElementFlags flags);
|
|---|
| 151 | static QColor colorValue(const TAknsItemID &colorGroup, int colorIndex);
|
|---|
| 152 | static QPixmap fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, const TSize& targetSize);
|
|---|
| 153 | static bool disabledPartGraphic(QS60StyleEnums::SkinParts &part);
|
|---|
| 154 | static bool disabledFrameGraphic(QS60StylePrivate::SkinFrameElements &frame);
|
|---|
| 155 | static QPixmap generateMissingThemeGraphic(QS60StyleEnums::SkinParts &part, const QSize &size, QS60StylePrivate::SkinElementFlags flags);
|
|---|
| 156 | static QSize naviPaneSize();
|
|---|
| 157 | static TAknsItemID partSpecificThemeId(int part);
|
|---|
| 158 |
|
|---|
| 159 | static QVariant themeDefinition(QS60StyleEnums::ThemeDefinitions definition, QS60StyleEnums::SkinParts part);
|
|---|
| 160 |
|
|---|
| 161 | private:
|
|---|
| 162 | static QPixmap createSkinnedGraphicsLX(QS60StyleEnums::SkinParts part,
|
|---|
| 163 | const QSize &size, QS60StylePrivate::SkinElementFlags flags);
|
|---|
| 164 | static QPixmap createSkinnedGraphicsLX(QS60StylePrivate::SkinFrameElements frameElement, const QSize &size, QS60StylePrivate::SkinElementFlags flags);
|
|---|
| 165 | static QPixmap colorSkinnedGraphicsLX(const QS60StyleEnums::SkinParts &stylepart,
|
|---|
| 166 | const QSize &size, QPainter *painter, QS60StylePrivate::SkinElementFlags flags);
|
|---|
| 167 | static void frameIdAndCenterId(QS60StylePrivate::SkinFrameElements frameElement, TAknsItemID &frameId, TAknsItemID ¢erId);
|
|---|
| 168 | static TRect innerRectFromElement(QS60StylePrivate::SkinFrameElements frameElement, const TRect &outerRect);
|
|---|
| 169 | static void fallbackInfo(const QS60StyleEnums::SkinParts &stylePart, TInt &fallbackIndex);
|
|---|
| 170 | static bool checkSupport(const int supportedRelease);
|
|---|
| 171 | // Array to match the skin ID, fallback graphics and Qt widget graphics.
|
|---|
| 172 | static const partMapEntry m_partMap[];
|
|---|
| 173 | };
|
|---|
| 174 |
|
|---|
| 175 | const partMapEntry QS60StyleModeSpecifics::m_partMap[] = {
|
|---|
| 176 | /* SP_QgnGrafBarWaitAnim */ {KAknsIIDQgnGrafBarWaitAnim, EDrawAnimation, ES60_All, -1,-1},
|
|---|
| 177 | /* SP_QgnGrafBarFrameCenter */ {KAknsIIDQgnGrafBarFrameCenter, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 178 | /* SP_QgnGrafBarFrameSideL */ {KAknsIIDQgnGrafBarFrameSideL, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 179 | /* SP_QgnGrafBarFrameSideR */ {KAknsIIDQgnGrafBarFrameSideR, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 180 | /* SP_QgnGrafBarProgress */ {KAknsIIDQgnGrafBarProgress, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 181 | /* SP_QgnGrafScrollArrowDown */ {KAknsIIDQgnGrafScrollArrowDown, EDrawGulIcon, ES60_All, -1,-1},
|
|---|
| 182 | /* SP_QgnGrafScrollArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawGulIcon, ES60_All, -1,-1},
|
|---|
| 183 | /* SP_QgnGrafScrollArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawGulIcon, ES60_All, -1,-1},
|
|---|
| 184 | /* SP_QgnGrafScrollArrowUp */ {KAknsIIDQgnGrafScrollArrowUp, EDrawGulIcon, ES60_All, -1,-1},
|
|---|
| 185 | /* SP_QgnGrafTabActiveL */ {KAknsIIDQgnGrafTabActiveL, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 186 | /* SP_QgnGrafTabActiveM */ {KAknsIIDQgnGrafTabActiveM, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 187 | /* SP_QgnGrafTabActiveR */ {KAknsIIDQgnGrafTabActiveR, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 188 | /* SP_QgnGrafTabPassiveL */ {KAknsIIDQgnGrafTabPassiveL, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 189 | /* SP_QgnGrafTabPassiveM */ {KAknsIIDQgnGrafTabPassiveM, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 190 | /* SP_QgnGrafTabPassiveR */ {KAknsIIDQgnGrafTabPassiveR, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 191 |
|
|---|
| 192 | // In 3.1 there is no slider groove.
|
|---|
| 193 | /* SP_QgnGrafNsliderEndLeft */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19cf /* KAknsIIDQgnGrafNsliderEndLeft */},
|
|---|
| 194 | /* SP_QgnGrafNsliderEndRight */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d0 /* KAknsIIDQgnGrafNsliderEndRight */},
|
|---|
| 195 | /* SP_QgnGrafNsliderMiddle */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d2 /* KAknsIIDQgnGrafNsliderMiddle */},
|
|---|
| 196 | /* SP_QgnIndiCheckboxOff */ {KAknsIIDQgnIndiCheckboxOff, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 197 | /* SP_QgnIndiCheckboxOn */ {KAknsIIDQgnIndiCheckboxOn, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 198 |
|
|---|
| 199 | // Following 5 items (SP_QgnIndiHlColSuper - SP_QgnIndiHlLineStraight) are available starting from S60 release 3.2.
|
|---|
| 200 | // In 3.1 CommonStyle drawing is used for these QTreeView elements, since no similar icons in AVKON UI.
|
|---|
| 201 | /* SP_QgnIndiHlColSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d5 /* KAknsIIDQgnIndiHlColSuper */},
|
|---|
| 202 | /* SP_QgnIndiHlExpSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d6 /* KAknsIIDQgnIndiHlExpSuper */},
|
|---|
| 203 | /* SP_QgnIndiHlLineBranch */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d7 /* KAknsIIDQgnIndiHlLineBranch */},
|
|---|
| 204 | /* SP_QgnIndiHlLineEnd */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d8 /* KAknsIIDQgnIndiHlLineEnd */},
|
|---|
| 205 | /* SP_QgnIndiHlLineStraight */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d9 /* KAknsIIDQgnIndiHlLineStraight */},
|
|---|
| 206 | /* SP_QgnIndiMarkedAdd */ {KAknsIIDQgnIndiMarkedAdd, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 207 | /* SP_QgnIndiNaviArrowLeft */ {KAknsIIDQgnIndiNaviArrowLeft, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 208 | /* SP_QgnIndiNaviArrowRight */ {KAknsIIDQgnIndiNaviArrowRight, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 209 | /* SP_QgnIndiRadiobuttOff */ {KAknsIIDQgnIndiRadiobuttOff, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 210 | /* SP_QgnIndiRadiobuttOn */ {KAknsIIDQgnIndiRadiobuttOn, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 211 |
|
|---|
| 212 | // In 3.1 there different slider graphic and no pressed state.
|
|---|
| 213 | /* SP_QgnGrafNsliderMarker */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d1 /* KAknsIIDQgnGrafNsliderMarker */},
|
|---|
| 214 | /* SP_QgnGrafNsliderMarkerSelected */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x1a4a /* KAknsIIDQgnGrafNsliderMarkerSelected */},
|
|---|
| 215 | /* SP_QgnIndiSubMenu */ {KAknsIIDQgnIndiSubmenu, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 216 | /* SP_QgnNoteErased */ {KAknsIIDQgnNoteErased, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 217 | /* SP_QgnNoteError */ {KAknsIIDQgnNoteError, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 218 | /* SP_QgnNoteInfo */ {KAknsIIDQgnNoteInfo, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 219 | /* SP_QgnNoteOk */ {KAknsIIDQgnNoteOk, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 220 | /* SP_QgnNoteQuery */ {KAknsIIDQgnNoteQuery, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 221 | /* SP_QgnNoteWarning */ {KAknsIIDQgnNoteWarning, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 222 | /* SP_QgnPropFileSmall */ {KAknsIIDQgnPropFileSmall, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 223 | /* SP_QgnPropFolderCurrent */ {KAknsIIDQgnPropFolderCurrent, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 224 | /* SP_QgnPropFolderSmall */ {KAknsIIDQgnPropFolderSmall, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 225 | /* SP_QgnPropFolderSmallNew */ {KAknsIIDQgnPropFolderSmallNew, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 226 | /* SP_QgnPropPhoneMemcLarge */ {KAknsIIDQgnPropPhoneMemcLarge, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 227 |
|
|---|
| 228 | // 3.1 & 3.2 do not have pressed state for scrollbar, so use normal scrollbar graphics instead.
|
|---|
| 229 | /* SP_QsnCpScrollHandleBottomPressed*/ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_3_X, EAknsMajorGeneric, 0x20f8}, /*KAknsIIDQsnCpScrollHandleBottomPressed*/
|
|---|
| 230 | /* SP_QsnCpScrollHandleMiddlePressed*/ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_3_X, EAknsMajorGeneric, 0x20f9}, /*KAknsIIDQsnCpScrollHandleMiddlePressed*/
|
|---|
| 231 | /* SP_QsnCpScrollHandleTopPressed*/ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_3_X, EAknsMajorGeneric, 0x20fa}, /*KAknsIIDQsnCpScrollHandleTopPressed*/
|
|---|
| 232 |
|
|---|
| 233 | /* SP_QsnBgScreen */ {KAknsIIDQsnBgScreen, EDrawBackground, ES60_All, -1,-1},
|
|---|
| 234 |
|
|---|
| 235 | /* SP_QsnCpScrollBgBottom */ {KAknsIIDQsnCpScrollBgBottom, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 236 | /* SP_QsnCpScrollBgMiddle */ {KAknsIIDQsnCpScrollBgMiddle, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 237 | /* SP_QsnCpScrollBgTop */ {KAknsIIDQsnCpScrollBgTop, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 238 |
|
|---|
| 239 | /* SP_QsnCpScrollHandleBottom */ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 240 | /* SP_QsnCpScrollHandleMiddle */ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 241 | /* SP_QsnCpScrollHandleTop */ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 242 |
|
|---|
| 243 | /* SP_QsnFrButtonTbCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_All, -1, -1},
|
|---|
| 244 | /* SP_QsnFrButtonTbCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_All, -1, -1},
|
|---|
| 245 | /* SP_QsnFrButtonTbCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_All, -1, -1},
|
|---|
| 246 | /* SP_QsnFrButtonTbCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_All, -1, -1},
|
|---|
| 247 | /* SP_QsnFrButtonTbSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_All, -1, -1},
|
|---|
| 248 | /* SP_QsnFrButtonTbSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_All, -1, -1},
|
|---|
| 249 | /* SP_QsnFrButtonTbSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_All, -1, -1},
|
|---|
| 250 | /* SP_QsnFrButtonTbSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_All, -1, -1},
|
|---|
| 251 | /* SP_QsnFrButtonTbCenter */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_All, -1, -1},
|
|---|
| 252 |
|
|---|
| 253 | /* SP_QsnFrButtonTbCornerTlPressed */{KAknsIIDQsnFrButtonTbCornerTlPressed, ENoDraw, ES60_All, -1,-1},
|
|---|
| 254 | /* SP_QsnFrButtonTbCornerTrPressed */{KAknsIIDQsnFrButtonTbCornerTrPressed, ENoDraw, ES60_All, -1,-1},
|
|---|
| 255 | /* SP_QsnFrButtonTbCornerBlPressed */{KAknsIIDQsnFrButtonTbCornerBlPressed, ENoDraw, ES60_All, -1,-1},
|
|---|
| 256 | /* SP_QsnFrButtonTbCornerBrPressed */{KAknsIIDQsnFrButtonTbCornerBrPressed, ENoDraw, ES60_All, -1,-1},
|
|---|
| 257 | /* SP_QsnFrButtonTbSideTPressed */ {KAknsIIDQsnFrButtonTbSideTPressed, ENoDraw, ES60_All, -1,-1},
|
|---|
| 258 | /* SP_QsnFrButtonTbSideBPressed */ {KAknsIIDQsnFrButtonTbSideBPressed, ENoDraw, ES60_All, -1,-1},
|
|---|
| 259 | /* SP_QsnFrButtonTbSideLPressed */ {KAknsIIDQsnFrButtonTbSideLPressed, ENoDraw, ES60_All, -1,-1},
|
|---|
| 260 | /* SP_QsnFrButtonTbSideRPressed */ {KAknsIIDQsnFrButtonTbSideRPressed, ENoDraw, ES60_All, -1,-1},
|
|---|
| 261 | /* SP_QsnFrButtonTbCenterPressed */ {KAknsIIDQsnFrButtonTbCenterPressed, EDrawIcon, ES60_All, -1,-1},
|
|---|
| 262 |
|
|---|
| 263 | /* SP_QsnFrCaleCornerTl */ {KAknsIIDQsnFrCaleCornerTl, ENoDraw, ES60_All, -1,-1},
|
|---|
| 264 | /* SP_QsnFrCaleCornerTr */ {KAknsIIDQsnFrCaleCornerTr, ENoDraw, ES60_All, -1,-1},
|
|---|
| 265 | /* SP_QsnFrCaleCornerBl */ {KAknsIIDQsnFrCaleCornerBl, ENoDraw, ES60_All, -1,-1},
|
|---|
| 266 | /* SP_QsnFrCaleCornerBr */ {KAknsIIDQsnFrCaleCornerBr, ENoDraw, ES60_All, -1,-1},
|
|---|
| 267 | /* SP_QsnFrCaleGSideT */ {KAknsIIDQsnFrCaleSideT, ENoDraw, ES60_All, -1,-1},
|
|---|
| 268 | /* SP_QsnFrCaleGSideB */ {KAknsIIDQsnFrCaleSideB, ENoDraw, ES60_All, -1,-1},
|
|---|
| 269 | /* SP_QsnFrCaleGSideL */ {KAknsIIDQsnFrCaleSideL, ENoDraw, ES60_All, -1,-1},
|
|---|
| 270 | /* SP_QsnFrCaleGSideR */ {KAknsIIDQsnFrCaleSideR, ENoDraw, ES60_All, -1,-1},
|
|---|
| 271 | /* SP_QsnFrCaleCenter */ {KAknsIIDQsnFrCaleCenter, ENoDraw, ES60_All, -1,-1},
|
|---|
| 272 |
|
|---|
| 273 | /* SP_QsnFrCaleHeadingCornerTl */ {KAknsIIDQsnFrCaleHeadingCornerTl, ENoDraw, ES60_All, -1,-1},
|
|---|
| 274 | /* SP_QsnFrCaleHeadingCornerTr */ {KAknsIIDQsnFrCaleHeadingCornerTr, ENoDraw, ES60_All, -1,-1},
|
|---|
| 275 | /* SP_QsnFrCaleHeadingCornerBl */ {KAknsIIDQsnFrCaleHeadingCornerBl, ENoDraw, ES60_All, -1,-1},
|
|---|
| 276 | /* SP_QsnFrCaleHeadingCornerBr */ {KAknsIIDQsnFrCaleHeadingCornerBr, ENoDraw, ES60_All, -1,-1},
|
|---|
| 277 | /* SP_QsnFrCaleHeadingSideT */ {KAknsIIDQsnFrCaleHeadingSideT, ENoDraw, ES60_All, -1,-1},
|
|---|
| 278 | /* SP_QsnFrCaleHeadingSideB */ {KAknsIIDQsnFrCaleHeadingSideB, ENoDraw, ES60_All, -1,-1},
|
|---|
| 279 | /* SP_QsnFrCaleHeadingSideL */ {KAknsIIDQsnFrCaleHeadingSideL, ENoDraw, ES60_All, -1,-1},
|
|---|
| 280 | /* SP_QsnFrCaleHeadingSideR */ {KAknsIIDQsnFrCaleHeadingSideR, ENoDraw, ES60_All, -1,-1},
|
|---|
| 281 | /* SP_QsnFrCaleHeadingCenter */ {KAknsIIDQsnFrCaleHeadingCenter, ENoDraw, ES60_All, -1,-1},
|
|---|
| 282 |
|
|---|
| 283 | /* SP_QsnFrInputCornerTl */ {KAknsIIDQsnFrInputCornerTl, ENoDraw, ES60_All, -1,-1},
|
|---|
| 284 | /* SP_QsnFrInputCornerTr */ {KAknsIIDQsnFrInputCornerTr, ENoDraw, ES60_All, -1,-1},
|
|---|
| 285 | /* SP_QsnFrInputCornerBl */ {KAknsIIDQsnFrInputCornerBl, ENoDraw, ES60_All, -1,-1},
|
|---|
| 286 | /* SP_QsnFrInputCornerBr */ {KAknsIIDQsnFrInputCornerBr, ENoDraw, ES60_All, -1,-1},
|
|---|
| 287 | /* SP_QsnFrInputSideT */ {KAknsIIDQsnFrInputSideT, ENoDraw, ES60_All, -1,-1},
|
|---|
| 288 | /* SP_QsnFrInputSideB */ {KAknsIIDQsnFrInputSideB, ENoDraw, ES60_All, -1,-1},
|
|---|
| 289 | /* SP_QsnFrInputSideL */ {KAknsIIDQsnFrInputSideL, ENoDraw, ES60_All, -1,-1},
|
|---|
| 290 | /* SP_QsnFrInputSideR */ {KAknsIIDQsnFrInputSideR, ENoDraw, ES60_All, -1,-1},
|
|---|
| 291 | /* SP_QsnFrInputCenter */ {KAknsIIDQsnFrInputCenter, ENoDraw, ES60_All, -1,-1},
|
|---|
| 292 |
|
|---|
| 293 | /* SP_QsnFrListCornerTl */ {KAknsIIDQsnFrListCornerTl, ENoDraw, ES60_All, -1,-1},
|
|---|
| 294 | /* SP_QsnFrListCornerTr */ {KAknsIIDQsnFrListCornerTr, ENoDraw, ES60_All, -1,-1},
|
|---|
| 295 | /* SP_QsnFrListCornerBl */ {KAknsIIDQsnFrListCornerBl, ENoDraw, ES60_All, -1,-1},
|
|---|
| 296 | /* SP_QsnFrListCornerBr */ {KAknsIIDQsnFrListCornerBr, ENoDraw, ES60_All, -1,-1},
|
|---|
| 297 | /* SP_QsnFrListSideT */ {KAknsIIDQsnFrListSideT, ENoDraw, ES60_All, -1,-1},
|
|---|
| 298 | /* SP_QsnFrListSideB */ {KAknsIIDQsnFrListSideB, ENoDraw, ES60_All, -1,-1},
|
|---|
| 299 | /* SP_QsnFrListSideL */ {KAknsIIDQsnFrListSideL, ENoDraw, ES60_All, -1,-1},
|
|---|
| 300 | /* SP_QsnFrListSideR */ {KAknsIIDQsnFrListSideR, ENoDraw, ES60_All, -1,-1},
|
|---|
| 301 | /* SP_QsnFrListCenter */ {KAknsIIDQsnFrListCenter, ENoDraw, ES60_All, -1,-1},
|
|---|
| 302 |
|
|---|
| 303 | /* SP_QsnFrPopupCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_All, -1,-1},
|
|---|
| 304 | /* SP_QsnFrPopupCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_All, -1,-1},
|
|---|
| 305 | /* SP_QsnFrPopupCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_All, -1,-1},
|
|---|
| 306 | /* SP_QsnFrPopupCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_All, -1,-1},
|
|---|
| 307 | /* SP_QsnFrPopupSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_All, -1,-1},
|
|---|
| 308 | /* SP_QsnFrPopupSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_All, -1,-1},
|
|---|
| 309 | /* SP_QsnFrPopupSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_All, -1,-1},
|
|---|
| 310 | /* SP_QsnFrPopupSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_All, -1,-1},
|
|---|
| 311 | /* SP_QsnFrPopupCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_All, -1,-1},
|
|---|
| 312 |
|
|---|
| 313 | // ToolTip graphics different in 3.1 vs. 3.2+.
|
|---|
| 314 | /* SP_QsnFrPopupPreviewCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c5}, /* KAknsIIDQsnFrPopupPreviewCornerTl */
|
|---|
| 315 | /* SP_QsnFrPopupPreviewCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c6},
|
|---|
| 316 | /* SP_QsnFrPopupPreviewCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c3},
|
|---|
| 317 | /* SP_QsnFrPopupPreviewCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c4},
|
|---|
| 318 | /* SP_QsnFrPopupPreviewSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19ca},
|
|---|
| 319 | /* SP_QsnFrPopupPreviewSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c7},
|
|---|
| 320 | /* SP_QsnFrPopupPreviewSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c8},
|
|---|
| 321 | /* SP_QsnFrPopupPreviewSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c9},
|
|---|
| 322 | /* SP_QsnFrPopupPreviewCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c2},
|
|---|
| 323 |
|
|---|
| 324 | /* SP_QsnFrSetOptCornerTl */ {KAknsIIDQsnFrSetOptCornerTl, ENoDraw, ES60_All, -1,-1},
|
|---|
| 325 | /* SP_QsnFrSetOptCornerTr */ {KAknsIIDQsnFrSetOptCornerTr, ENoDraw, ES60_All, -1,-1},
|
|---|
| 326 | /* SP_QsnFrSetOptCornerBl */ {KAknsIIDQsnFrSetOptCornerBl, ENoDraw, ES60_All, -1,-1},
|
|---|
| 327 | /* SP_QsnFrSetOptCornerBr */ {KAknsIIDQsnFrSetOptCornerBr, ENoDraw, ES60_All, -1,-1},
|
|---|
| 328 | /* SP_QsnFrSetOptSideT */ {KAknsIIDQsnFrSetOptSideT, ENoDraw, ES60_All, -1,-1},
|
|---|
| 329 | /* SP_QsnFrSetOptSideB */ {KAknsIIDQsnFrSetOptSideB, ENoDraw, ES60_All, -1,-1},
|
|---|
| 330 | /* SP_QsnFrSetOptSideL */ {KAknsIIDQsnFrSetOptSideL, ENoDraw, ES60_All, -1,-1},
|
|---|
| 331 | /* SP_QsnFrSetOptSideR */ {KAknsIIDQsnFrSetOptSideR, ENoDraw, ES60_All, -1,-1},
|
|---|
| 332 | /* SP_QsnFrSetOptCenter */ {KAknsIIDQsnFrSetOptCenter, ENoDraw, ES60_All, -1,-1},
|
|---|
| 333 |
|
|---|
| 334 | // No toolbar frame for 5.0+ releases.
|
|---|
| 335 | /* SP_QsnFrPopupSubCornerTl */ {KAknsIIDQsnFrPopupSubCornerTl, ENoDraw, ES60_3_X, -1,-1},
|
|---|
| 336 | /* SP_QsnFrPopupSubCornerTr */ {KAknsIIDQsnFrPopupSubCornerTr, ENoDraw, ES60_3_X, -1,-1},
|
|---|
| 337 | /* SP_QsnFrPopupSubCornerBl */ {KAknsIIDQsnFrPopupSubCornerBl, ENoDraw, ES60_3_X, -1,-1},
|
|---|
| 338 | /* SP_QsnFrPopupSubCornerBr */ {KAknsIIDQsnFrPopupSubCornerBr, ENoDraw, ES60_3_X, -1,-1},
|
|---|
| 339 | /* SP_QsnFrPopupSubSideT */ {KAknsIIDQsnFrPopupSubSideT, ENoDraw, ES60_3_X, -1,-1},
|
|---|
| 340 | /* SP_QsnFrPopupSubSideB */ {KAknsIIDQsnFrPopupSubSideB, ENoDraw, ES60_3_X, -1,-1},
|
|---|
| 341 | /* SP_QsnFrPopupSubSideL */ {KAknsIIDQsnFrPopupSubSideL, ENoDraw, ES60_3_X, -1,-1},
|
|---|
| 342 | /* SP_QsnFrPopupSubSideR */ {KAknsIIDQsnFrPopupSubSideR, ENoDraw, ES60_3_X, -1,-1},
|
|---|
| 343 | /* SP_QsnFrPopupSubCenter */ {KAknsIIDQsnFrPopupCenterSubmenu, ENoDraw, ES60_3_X, -1,-1},
|
|---|
| 344 |
|
|---|
| 345 | // Toolbar graphics is different in 3.1/3.2 vs. 5.0
|
|---|
| 346 | /* SP_QsnFrSctrlButtonCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2301}, /* KAknsIIDQgnFrSctrlButtonCornerTl*/
|
|---|
| 347 | /* SP_QsnFrSctrlButtonCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2302},
|
|---|
| 348 | /* SP_QsnFrSctrlButtonCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2303},
|
|---|
| 349 | /* SP_QsnFrSctrlButtonCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2304},
|
|---|
| 350 | /* SP_QsnFrSctrlButtonSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2305},
|
|---|
| 351 | /* SP_QsnFrSctrlButtonSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2306},
|
|---|
| 352 | /* SP_QsnFrSctrlButtonSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2307},
|
|---|
| 353 | /* SP_QsnFrSctrlButtonSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2308},
|
|---|
| 354 | /* SP_QsnFrSctrlButtonCenter */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2309}, /*KAknsIIDQgnFrSctrlButtonCenter*/
|
|---|
| 355 |
|
|---|
| 356 | // No pressed state for toolbar button in 3.1/3.2.
|
|---|
| 357 | /* SP_QsnFrSctrlButtonCornerTlPressed */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2621}, /*KAknsIIDQsnFrSctrlButtonCornerTlPressed*/
|
|---|
| 358 | /* SP_QsnFrSctrlButtonCornerTrPressed */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2622},
|
|---|
| 359 | /* SP_QsnFrSctrlButtonCornerBlPressed */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2623},
|
|---|
| 360 | /* SP_QsnFrSctrlButtonCornerBrPressed */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2624},
|
|---|
| 361 | /* SP_QsnFrSctrlButtonSideTPressed */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2625},
|
|---|
| 362 | /* SP_QsnFrSctrlButtonSideBPressed */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2626},
|
|---|
| 363 | /* SP_QsnFrSctrlButtonSideLPressed */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2627},
|
|---|
| 364 | /* SP_QsnFrSctrlButtonSideRPressed */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2628},
|
|---|
| 365 | /* SP_QsnFrSctrlButtonCenterPressed */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2629},
|
|---|
| 366 |
|
|---|
| 367 | // No inactive button graphics in 3.1/3.2
|
|---|
| 368 | /* SP_QsnFrButtonCornerTlInactive */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b1}, /*KAknsIIDQsnFrButtonCornerTlInactive*/
|
|---|
| 369 | /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b2},
|
|---|
| 370 | /* SP_QsnFrButtonCornerBlInactive */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b3},
|
|---|
| 371 | /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b4},
|
|---|
| 372 | /* SP_QsnFrButtonSideTInactive */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b5},
|
|---|
| 373 | /* SP_QsnFrButtonSideBInactive */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b6},
|
|---|
| 374 | /* SP_QsnFrButtonSideLInactive */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b7},
|
|---|
| 375 | /* SP_QsnFrButtonSideRInactive */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b8},
|
|---|
| 376 | /* SP_QsnFrButtonCenterInactive */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_3_X, EAknsMajorSkin, 0x21b9},
|
|---|
| 377 |
|
|---|
| 378 | };
|
|---|
| 379 |
|
|---|
| 380 | QPixmap QS60StyleModeSpecifics::skinnedGraphics(
|
|---|
| 381 | QS60StyleEnums::SkinParts stylepart, const QSize &size,
|
|---|
| 382 | QS60StylePrivate::SkinElementFlags flags)
|
|---|
| 383 | {
|
|---|
| 384 | QPixmap themedImage;
|
|---|
| 385 | TRAPD( error, QT_TRYCATCH_LEAVING({
|
|---|
| 386 | const QPixmap skinnedImage = createSkinnedGraphicsLX(stylepart, size, flags);
|
|---|
| 387 | themedImage = skinnedImage;
|
|---|
| 388 | }));
|
|---|
| 389 | if (error)
|
|---|
| 390 | return themedImage = QPixmap();
|
|---|
| 391 | return themedImage;
|
|---|
| 392 | }
|
|---|
| 393 |
|
|---|
| 394 | QPixmap QS60StyleModeSpecifics::skinnedGraphics(
|
|---|
| 395 | QS60StylePrivate::SkinFrameElements frame, const QSize &size, QS60StylePrivate::SkinElementFlags flags)
|
|---|
| 396 | {
|
|---|
| 397 | QPixmap themedImage;
|
|---|
| 398 | TRAPD( error, QT_TRYCATCH_LEAVING({
|
|---|
| 399 | const QPixmap skinnedImage = createSkinnedGraphicsLX(frame, size, flags);
|
|---|
| 400 | themedImage = skinnedImage;
|
|---|
| 401 | }));
|
|---|
| 402 | if (error)
|
|---|
| 403 | return themedImage = QPixmap();
|
|---|
| 404 | return themedImage;
|
|---|
| 405 | }
|
|---|
| 406 |
|
|---|
| 407 | QPixmap QS60StyleModeSpecifics::colorSkinnedGraphics(
|
|---|
| 408 | const QS60StyleEnums::SkinParts &stylepart, const QSize &size, QPainter *painter,
|
|---|
| 409 | QS60StylePrivate::SkinElementFlags flags)
|
|---|
| 410 | {
|
|---|
| 411 | QPixmap colorGraphics;
|
|---|
| 412 | TRAPD(error, QT_TRYCATCH_LEAVING(colorGraphics = colorSkinnedGraphicsLX(stylepart, size, painter, flags)));
|
|---|
| 413 | return error ? QPixmap() : colorGraphics;
|
|---|
| 414 | }
|
|---|
| 415 |
|
|---|
| 416 | void QS60StyleModeSpecifics::fallbackInfo(const QS60StyleEnums::SkinParts &stylePart, TInt &fallbackIndex)
|
|---|
| 417 | {
|
|---|
| 418 | switch(stylePart) {
|
|---|
| 419 | case QS60StyleEnums::SP_QgnGrafBarWaitAnim:
|
|---|
| 420 | fallbackIndex = EMbmAvkonQgn_graf_bar_wait_1;
|
|---|
| 421 | break;
|
|---|
| 422 | case QS60StyleEnums::SP_QgnGrafBarFrameCenter:
|
|---|
| 423 | fallbackIndex = EMbmAvkonQgn_graf_bar_frame_center;
|
|---|
| 424 | break;
|
|---|
| 425 | case QS60StyleEnums::SP_QgnGrafBarFrameSideL:
|
|---|
| 426 | fallbackIndex = EMbmAvkonQgn_graf_bar_frame_side_l;
|
|---|
| 427 | break;
|
|---|
| 428 | case QS60StyleEnums::SP_QgnGrafBarFrameSideR:
|
|---|
| 429 | fallbackIndex = EMbmAvkonQgn_graf_bar_frame_side_r;
|
|---|
| 430 | break;
|
|---|
| 431 | case QS60StyleEnums::SP_QgnGrafBarProgress:
|
|---|
| 432 | fallbackIndex = EMbmAvkonQgn_graf_bar_progress;
|
|---|
| 433 | break;
|
|---|
| 434 | case QS60StyleEnums::SP_QgnGrafTabActiveL:
|
|---|
| 435 | fallbackIndex = EMbmAvkonQgn_graf_tab_active_l;
|
|---|
| 436 | break;
|
|---|
| 437 | case QS60StyleEnums::SP_QgnGrafTabActiveM:
|
|---|
| 438 | fallbackIndex = EMbmAvkonQgn_graf_tab_active_m;
|
|---|
| 439 | break;
|
|---|
| 440 | case QS60StyleEnums::SP_QgnGrafTabActiveR:
|
|---|
| 441 | fallbackIndex = EMbmAvkonQgn_graf_tab_active_r;
|
|---|
| 442 | break;
|
|---|
| 443 | case QS60StyleEnums::SP_QgnGrafTabPassiveL:
|
|---|
| 444 | fallbackIndex = EMbmAvkonQgn_graf_tab_passive_l;
|
|---|
| 445 | break;
|
|---|
| 446 | case QS60StyleEnums::SP_QgnGrafTabPassiveM:
|
|---|
| 447 | fallbackIndex = EMbmAvkonQgn_graf_tab_passive_m;
|
|---|
| 448 | break;
|
|---|
| 449 | case QS60StyleEnums::SP_QgnGrafTabPassiveR:
|
|---|
| 450 | fallbackIndex = EMbmAvkonQgn_graf_tab_passive_r;
|
|---|
| 451 | break;
|
|---|
| 452 | case QS60StyleEnums::SP_QgnIndiCheckboxOff:
|
|---|
| 453 | fallbackIndex = EMbmAvkonQgn_indi_checkbox_off;
|
|---|
| 454 | break;
|
|---|
| 455 | case QS60StyleEnums::SP_QgnIndiCheckboxOn:
|
|---|
| 456 | fallbackIndex = EMbmAvkonQgn_indi_checkbox_on;
|
|---|
| 457 | break;
|
|---|
| 458 | case QS60StyleEnums::SP_QgnIndiHlColSuper:
|
|---|
| 459 | fallbackIndex = 0x4456; /* EMbmAvkonQgn_indi_hl_col_super */
|
|---|
| 460 | break;
|
|---|
| 461 | case QS60StyleEnums::SP_QgnIndiHlExpSuper:
|
|---|
| 462 | fallbackIndex = 0x4458; /* EMbmAvkonQgn_indi_hl_exp_super */
|
|---|
| 463 | break;
|
|---|
| 464 | case QS60StyleEnums::SP_QgnIndiHlLineBranch:
|
|---|
| 465 | fallbackIndex = 0x445A; /* EMbmAvkonQgn_indi_hl_line_branch */
|
|---|
| 466 | break;
|
|---|
| 467 | case QS60StyleEnums::SP_QgnIndiHlLineEnd:
|
|---|
| 468 | fallbackIndex = 0x445C; /* EMbmAvkonQgn_indi_hl_line_end */
|
|---|
| 469 | break;
|
|---|
| 470 | case QS60StyleEnums::SP_QgnIndiHlLineStraight:
|
|---|
| 471 | fallbackIndex = 0x445E; /* EMbmAvkonQgn_indi_hl_line_straight */
|
|---|
| 472 | break;
|
|---|
| 473 | case QS60StyleEnums::SP_QgnIndiMarkedAdd:
|
|---|
| 474 | fallbackIndex = EMbmAvkonQgn_indi_marked_add;
|
|---|
| 475 | break;
|
|---|
| 476 | case QS60StyleEnums::SP_QgnIndiNaviArrowLeft:
|
|---|
| 477 | fallbackIndex = EMbmAvkonQgn_indi_navi_arrow_left;
|
|---|
| 478 | break;
|
|---|
| 479 | case QS60StyleEnums::SP_QgnIndiNaviArrowRight:
|
|---|
| 480 | fallbackIndex = EMbmAvkonQgn_indi_navi_arrow_right;
|
|---|
| 481 | break;
|
|---|
| 482 | case QS60StyleEnums::SP_QgnIndiRadiobuttOff:
|
|---|
| 483 | fallbackIndex = EMbmAvkonQgn_indi_radiobutt_off;
|
|---|
| 484 | break;
|
|---|
| 485 | case QS60StyleEnums::SP_QgnIndiRadiobuttOn:
|
|---|
| 486 | fallbackIndex = EMbmAvkonQgn_indi_radiobutt_on;
|
|---|
| 487 | break;
|
|---|
| 488 | case QS60StyleEnums::SP_QgnGrafNsliderMarker:
|
|---|
| 489 | fallbackIndex = 17572; /* EMbmAvkonQgn_graf_nslider_marker */
|
|---|
| 490 | break;
|
|---|
| 491 | case QS60StyleEnums::SP_QgnGrafNsliderMarkerSelected:
|
|---|
| 492 | fallbackIndex = 17574; /* EMbmAvkonQgn_graf_nslider_marker_selected */
|
|---|
| 493 | break;
|
|---|
| 494 | case QS60StyleEnums::SP_QgnIndiSubMenu:
|
|---|
| 495 | fallbackIndex = EMbmAvkonQgn_indi_submenu;
|
|---|
| 496 | break;
|
|---|
| 497 | case QS60StyleEnums::SP_QgnNoteErased:
|
|---|
| 498 | fallbackIndex = EMbmAvkonQgn_note_erased;
|
|---|
| 499 | break;
|
|---|
| 500 | case QS60StyleEnums::SP_QgnNoteError:
|
|---|
| 501 | fallbackIndex = EMbmAvkonQgn_note_error;
|
|---|
| 502 | break;
|
|---|
| 503 | case QS60StyleEnums::SP_QgnNoteInfo:
|
|---|
| 504 | fallbackIndex = EMbmAvkonQgn_note_info;
|
|---|
| 505 | break;
|
|---|
| 506 | case QS60StyleEnums::SP_QgnNoteOk:
|
|---|
| 507 | fallbackIndex = EMbmAvkonQgn_note_ok;
|
|---|
| 508 | break;
|
|---|
| 509 | case QS60StyleEnums::SP_QgnNoteQuery:
|
|---|
| 510 | fallbackIndex = EMbmAvkonQgn_note_query;
|
|---|
| 511 | break;
|
|---|
| 512 | case QS60StyleEnums::SP_QgnNoteWarning:
|
|---|
| 513 | fallbackIndex = EMbmAvkonQgn_note_warning;
|
|---|
| 514 | break;
|
|---|
| 515 | case QS60StyleEnums::SP_QgnPropFileSmall:
|
|---|
| 516 | fallbackIndex = EMbmAvkonQgn_prop_file_small;
|
|---|
| 517 | break;
|
|---|
| 518 | case QS60StyleEnums::SP_QgnPropFolderCurrent:
|
|---|
| 519 | fallbackIndex = EMbmAvkonQgn_prop_folder_current;
|
|---|
| 520 | break;
|
|---|
| 521 | case QS60StyleEnums::SP_QgnPropFolderSmall:
|
|---|
| 522 | fallbackIndex = EMbmAvkonQgn_prop_folder_small;
|
|---|
| 523 | break;
|
|---|
| 524 | case QS60StyleEnums::SP_QgnPropFolderSmallNew:
|
|---|
| 525 | fallbackIndex = EMbmAvkonQgn_prop_folder_small_new;
|
|---|
| 526 | break;
|
|---|
| 527 | case QS60StyleEnums::SP_QgnPropPhoneMemcLarge:
|
|---|
| 528 | fallbackIndex = EMbmAvkonQgn_prop_phone_memc_large;
|
|---|
| 529 | break;
|
|---|
| 530 | default:
|
|---|
| 531 | fallbackIndex = -1;
|
|---|
| 532 | break;
|
|---|
| 533 | }
|
|---|
| 534 | }
|
|---|
| 535 |
|
|---|
| 536 | QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsLX(
|
|---|
| 537 | const QS60StyleEnums::SkinParts &stylepart,
|
|---|
| 538 | const QSize &size, QPainter *painter, QS60StylePrivate::SkinElementFlags flags)
|
|---|
| 539 | {
|
|---|
| 540 | // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts.
|
|---|
| 541 | const int stylepartIndex = (int)stylepart;
|
|---|
| 542 | const TAknsItemID skinId = m_partMap[stylepartIndex].skinID;
|
|---|
| 543 |
|
|---|
| 544 | TInt fallbackGraphicID = -1;
|
|---|
| 545 | HBufC* iconFile = HBufC::NewLC( KMaxFileName );
|
|---|
| 546 | fallbackInfo(stylepart, fallbackGraphicID);
|
|---|
| 547 |
|
|---|
| 548 | TAknsItemID colorGroup = KAknsIIDQsnIconColors;
|
|---|
| 549 | TRgb defaultColor = KRgbBlack;
|
|---|
| 550 | int colorIndex = -1; //set a bogus value to color index to ensure that painter color is used
|
|---|
| 551 | //to color the icon
|
|---|
| 552 | if (painter) {
|
|---|
| 553 | QRgb widgetColor = painter->pen().color().rgb();
|
|---|
| 554 | defaultColor = TRgb(qRed(widgetColor), qGreen(widgetColor), qBlue(widgetColor));
|
|---|
| 555 | }
|
|---|
| 556 |
|
|---|
| 557 | const bool rotatedBy90or270 =
|
|---|
| 558 | (flags & (QS60StylePrivate::SF_PointEast | QS60StylePrivate::SF_PointWest));
|
|---|
| 559 | const TSize targetSize =
|
|---|
| 560 | rotatedBy90or270?TSize(size.height(), size.width()):TSize(size.width(), size.height());
|
|---|
| 561 | CFbsBitmap *icon = 0;
|
|---|
| 562 | CFbsBitmap *iconMask = 0;
|
|---|
| 563 | const TInt fallbackGraphicsMaskID =
|
|---|
| 564 | fallbackGraphicID == KErrNotFound?KErrNotFound:fallbackGraphicID+1; //masks are auto-generated as next in mif files
|
|---|
| 565 | MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
|
|---|
| 566 | AknsUtils::CreateColorIconLC(
|
|---|
| 567 | skinInstance,
|
|---|
| 568 | skinId,
|
|---|
| 569 | colorGroup,
|
|---|
| 570 | colorIndex,
|
|---|
| 571 | icon,
|
|---|
| 572 | iconMask,
|
|---|
| 573 | AknIconUtils::AvkonIconFileName(),
|
|---|
| 574 | fallbackGraphicID,
|
|---|
| 575 | fallbackGraphicsMaskID,
|
|---|
| 576 | defaultColor);
|
|---|
| 577 |
|
|---|
| 578 | QPixmap result = fromFbsBitmap(icon, iconMask, flags, targetSize);
|
|---|
| 579 | CleanupStack::PopAndDestroy(3); //icon, iconMask, iconFile
|
|---|
| 580 | return result;
|
|---|
| 581 | }
|
|---|
| 582 |
|
|---|
| 583 | QColor QS60StyleModeSpecifics::colorValue(const TAknsItemID &colorGroup, int colorIndex)
|
|---|
| 584 | {
|
|---|
| 585 | TRgb skinnedColor;
|
|---|
| 586 | MAknsSkinInstance* skin = AknsUtils::SkinInstance();
|
|---|
| 587 | AknsUtils::GetCachedColor(skin, skinnedColor, colorGroup, colorIndex);
|
|---|
| 588 | return QColor(skinnedColor.Red(),skinnedColor.Green(),skinnedColor.Blue());
|
|---|
| 589 | }
|
|---|
| 590 |
|
|---|
| 591 | struct QAutoFbsBitmapHeapLock
|
|---|
| 592 | {
|
|---|
| 593 | QAutoFbsBitmapHeapLock(CFbsBitmap* aBmp) : mBmp(aBmp) { mBmp->LockHeap(); }
|
|---|
| 594 | ~QAutoFbsBitmapHeapLock() { mBmp->UnlockHeap(); }
|
|---|
| 595 | CFbsBitmap* mBmp;
|
|---|
| 596 | };
|
|---|
| 597 |
|
|---|
| 598 | QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, const TSize &targetSize)
|
|---|
| 599 | {
|
|---|
| 600 | Q_ASSERT(icon);
|
|---|
| 601 |
|
|---|
| 602 | AknIconUtils::DisableCompression(icon);
|
|---|
| 603 | TInt error = AknIconUtils::SetSize(icon, targetSize, EAspectRatioNotPreserved);
|
|---|
| 604 |
|
|---|
| 605 | if (mask && !error) {
|
|---|
| 606 | AknIconUtils::DisableCompression(mask);
|
|---|
| 607 | error = AknIconUtils::SetSize(mask, targetSize, EAspectRatioNotPreserved);
|
|---|
| 608 | }
|
|---|
| 609 | if (error)
|
|---|
| 610 | return QPixmap();
|
|---|
| 611 |
|
|---|
| 612 | QPixmap pixmap = QPixmap::fromSymbianCFbsBitmap(icon);
|
|---|
| 613 | if (mask)
|
|---|
| 614 | pixmap.setAlphaChannel(QPixmap::fromSymbianCFbsBitmap(mask));
|
|---|
| 615 |
|
|---|
| 616 | if ((flags & QS60StylePrivate::SF_PointEast) ||
|
|---|
| 617 | (flags & QS60StylePrivate::SF_PointSouth) ||
|
|---|
| 618 | (flags & QS60StylePrivate::SF_PointWest)) {
|
|---|
| 619 | QImage iconImage = pixmap.toImage();
|
|---|
| 620 | QTransform imageTransform;
|
|---|
| 621 | if (flags & QS60StylePrivate::SF_PointEast) {
|
|---|
| 622 | imageTransform.rotate(90);
|
|---|
| 623 | } else if (flags & QS60StylePrivate::SF_PointSouth) {
|
|---|
| 624 | imageTransform.rotate(180);
|
|---|
| 625 | iconImage = iconImage.transformed(imageTransform);
|
|---|
| 626 | } else if (flags & QS60StylePrivate::SF_PointWest) {
|
|---|
| 627 | imageTransform.rotate(270);
|
|---|
| 628 | }
|
|---|
| 629 | if (imageTransform.isRotating())
|
|---|
| 630 | iconImage = iconImage.transformed(imageTransform);
|
|---|
| 631 |
|
|---|
| 632 | pixmap = QPixmap::fromImage(iconImage);
|
|---|
| 633 | }
|
|---|
| 634 | return pixmap;
|
|---|
| 635 | }
|
|---|
| 636 |
|
|---|
| 637 | bool QS60StylePrivate::isTouchSupported()
|
|---|
| 638 | {
|
|---|
| 639 | return bool(AknLayoutUtils::PenEnabled());
|
|---|
| 640 | }
|
|---|
| 641 |
|
|---|
| 642 | bool QS60StylePrivate::isToolBarBackground()
|
|---|
| 643 | {
|
|---|
| 644 | return (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2);
|
|---|
| 645 | }
|
|---|
| 646 |
|
|---|
| 647 | bool QS60StylePrivate::hasSliderGrooveGraphic()
|
|---|
| 648 | {
|
|---|
| 649 | return QSysInfo::s60Version() != QSysInfo::SV_S60_3_1;
|
|---|
| 650 | }
|
|---|
| 651 |
|
|---|
| 652 | bool QS60StylePrivate::isSingleClickUi()
|
|---|
| 653 | {
|
|---|
| 654 | return (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0);
|
|---|
| 655 | }
|
|---|
| 656 |
|
|---|
| 657 | QPoint qt_s60_fill_background_offset(const QWidget *targetWidget)
|
|---|
| 658 | {
|
|---|
| 659 | CCoeControl *control = targetWidget->effectiveWinId();
|
|---|
| 660 | TPoint pos(0,0);
|
|---|
| 661 | if (control) {
|
|---|
| 662 | // FIXME properly: S60 3.1 has a bug that CCoeControl::PositionRelativeToScreen sometimes
|
|---|
| 663 | // freezes the device, possibly in cases where we run out of memory.
|
|---|
| 664 | // We use CCoeControl::Position instead in S60 3.1, which returns same values
|
|---|
| 665 | // in most cases.
|
|---|
| 666 | if (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1)
|
|---|
| 667 | pos = control->Position();
|
|---|
| 668 | else
|
|---|
| 669 | pos = control->PositionRelativeToScreen();
|
|---|
| 670 | }
|
|---|
| 671 | return QPoint(pos.iX, pos.iY);
|
|---|
| 672 | }
|
|---|
| 673 |
|
|---|
| 674 | QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(
|
|---|
| 675 | QS60StyleEnums::SkinParts part, const QSize &size,
|
|---|
| 676 | QS60StylePrivate::SkinElementFlags flags)
|
|---|
| 677 | {
|
|---|
| 678 | // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts.
|
|---|
| 679 | if (!size.isValid())
|
|---|
| 680 | return QPixmap();
|
|---|
| 681 |
|
|---|
| 682 | // Check release support and change part, if necessary.
|
|---|
| 683 | const TAknsItemID skinId = partSpecificThemeId((int)part);
|
|---|
| 684 | const int stylepartIndex = (int)part;
|
|---|
| 685 | const TDrawType drawType = m_partMap[stylepartIndex].drawType;
|
|---|
| 686 | Q_ASSERT(drawType != ENoDraw);
|
|---|
| 687 | const bool rotatedBy90or270 =
|
|---|
| 688 | (flags & (QS60StylePrivate::SF_PointEast | QS60StylePrivate::SF_PointWest));
|
|---|
| 689 | const TSize targetSize =
|
|---|
| 690 | rotatedBy90or270 ? TSize(size.height(), size.width()) : qt_QSize2TSize(size);
|
|---|
| 691 |
|
|---|
| 692 | MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
|
|---|
| 693 |
|
|---|
| 694 | QPixmap result;
|
|---|
| 695 |
|
|---|
| 696 | switch (drawType) {
|
|---|
| 697 | case EDrawGulIcon: {
|
|---|
| 698 | CGulIcon* icon = AknsUtils::CreateGulIconL( AknsUtils::SkinInstance(), skinId, EFalse );
|
|---|
| 699 | if (icon)
|
|---|
| 700 | result = fromFbsBitmap(icon->Bitmap(), icon->Mask(), flags, targetSize);
|
|---|
| 701 | delete icon;
|
|---|
| 702 | break;
|
|---|
| 703 | }
|
|---|
| 704 | case EDrawIcon: {
|
|---|
| 705 | TInt fallbackGraphicID = -1;
|
|---|
| 706 | fallbackInfo(part, fallbackGraphicID);
|
|---|
| 707 |
|
|---|
| 708 | CFbsBitmap *icon = 0;
|
|---|
| 709 | CFbsBitmap *iconMask = 0;
|
|---|
| 710 | const TInt fallbackGraphicsMaskID =
|
|---|
| 711 | fallbackGraphicID == KErrNotFound?KErrNotFound:fallbackGraphicID+1; //masks are auto-generated as next in mif files
|
|---|
| 712 |
|
|---|
| 713 | AknsUtils::CreateIconL(
|
|---|
| 714 | skinInstance,
|
|---|
| 715 | skinId,
|
|---|
| 716 | icon,
|
|---|
| 717 | iconMask,
|
|---|
| 718 | AknIconUtils::AvkonIconFileName(),
|
|---|
| 719 | fallbackGraphicID ,
|
|---|
| 720 | fallbackGraphicsMaskID);
|
|---|
| 721 |
|
|---|
| 722 | result = fromFbsBitmap(icon, iconMask, flags, targetSize);
|
|---|
| 723 | delete icon;
|
|---|
| 724 | delete iconMask;
|
|---|
| 725 | break;
|
|---|
| 726 | }
|
|---|
| 727 | case EDrawBackground: {
|
|---|
| 728 | // QS60WindowSurface::unlockBitmapHeap();
|
|---|
| 729 | CFbsBitmap *background = new (ELeave) CFbsBitmap(); //offscreen
|
|---|
| 730 | CleanupStack::PushL(background);
|
|---|
| 731 | User::LeaveIfError(background->Create(targetSize, EColor16MA));
|
|---|
| 732 |
|
|---|
| 733 | CFbsBitmapDevice *dev = CFbsBitmapDevice::NewL(background);
|
|---|
| 734 | CleanupStack::PushL(dev);
|
|---|
| 735 | CFbsBitGc *gc = NULL;
|
|---|
| 736 | User::LeaveIfError(dev->CreateContext(gc));
|
|---|
| 737 | CleanupStack::PushL(gc);
|
|---|
| 738 |
|
|---|
| 739 | CAknsBasicBackgroundControlContext *bgContext = CAknsBasicBackgroundControlContext::NewL(
|
|---|
| 740 | skinId,
|
|---|
| 741 | targetSize,
|
|---|
| 742 | EFalse);
|
|---|
| 743 | CleanupStack::PushL(bgContext);
|
|---|
| 744 |
|
|---|
| 745 | const TBool drawn = AknsDrawUtils::DrawBackground(
|
|---|
| 746 | skinInstance,
|
|---|
| 747 | bgContext,
|
|---|
| 748 | NULL,
|
|---|
| 749 | *gc,
|
|---|
| 750 | TPoint(),
|
|---|
| 751 | targetSize,
|
|---|
| 752 | KAknsDrawParamDefault | KAknsDrawParamRGBOnly);
|
|---|
| 753 |
|
|---|
| 754 | if (drawn)
|
|---|
| 755 | result = fromFbsBitmap(background, NULL, flags, targetSize);
|
|---|
| 756 | // if drawing fails in skin server, just ignore the background (probably OOM occured)
|
|---|
| 757 |
|
|---|
| 758 | CleanupStack::PopAndDestroy(4, background); //background, dev, gc, bgContext
|
|---|
| 759 | // QS60WindowSurface::lockBitmapHeap();
|
|---|
| 760 | break;
|
|---|
| 761 | }
|
|---|
| 762 | case EDrawAnimation: {
|
|---|
| 763 | CFbsBitmap* animationFrame;
|
|---|
| 764 | CFbsBitmap* frameMask;
|
|---|
| 765 | CAknBitmapAnimation* aknAnimation = 0;
|
|---|
| 766 | TBool constructedFromTheme = ETrue;
|
|---|
| 767 |
|
|---|
| 768 | QS60StyleAnimation* animation = QS60StylePrivate::animationDefinition(part); //ownership is not passed
|
|---|
| 769 | if (animation) {
|
|---|
| 770 | if (!animation->animationObject() && !animation->isResourceBased()) {// no pre-made item exists, create new animation
|
|---|
| 771 | CAknBitmapAnimation* newAnimation = CAknBitmapAnimation::NewL();
|
|---|
| 772 | CleanupStack::PushL(newAnimation);
|
|---|
| 773 | if (newAnimation)
|
|---|
| 774 | constructedFromTheme = newAnimation->ConstructFromSkinL(skinId);
|
|---|
| 775 | if (constructedFromTheme && newAnimation->BitmapAnimData()->FrameArray().Count() > 0) {
|
|---|
| 776 | animation->setResourceBased(false);
|
|---|
| 777 | animation->setAnimationObject(newAnimation); //animation takes ownership
|
|---|
| 778 | }
|
|---|
| 779 | CleanupStack::Pop(newAnimation);
|
|---|
| 780 | }
|
|---|
| 781 | //fill-in stored information
|
|---|
| 782 | aknAnimation = animation->animationObject();
|
|---|
| 783 | constructedFromTheme = !animation->isResourceBased();
|
|---|
| 784 | }
|
|---|
| 785 |
|
|---|
| 786 | const int currentFrame = QS60StylePrivate::currentAnimationFrame(part);
|
|---|
| 787 | if (constructedFromTheme && aknAnimation && aknAnimation->BitmapAnimData()->FrameArray().Count() > 0) {
|
|---|
| 788 | //Animation was created succesfully and contains frames, just fetch current frame
|
|---|
| 789 | if(currentFrame >= aknAnimation->BitmapAnimData()->FrameArray().Count())
|
|---|
| 790 | User::Leave(KErrOverflow);
|
|---|
| 791 | const CBitmapFrameData* frameData = aknAnimation->BitmapAnimData()->FrameArray().At(currentFrame);
|
|---|
| 792 | if (frameData) {
|
|---|
| 793 | animationFrame = frameData->Bitmap();
|
|---|
| 794 | frameMask = frameData->Mask();
|
|---|
| 795 | }
|
|---|
| 796 | } else {
|
|---|
| 797 | //Theme does not contain animation theming, create frames from resource file
|
|---|
| 798 | TInt fallbackGraphicID = -1;
|
|---|
| 799 | fallbackInfo(part, fallbackGraphicID);
|
|---|
| 800 | fallbackGraphicID = fallbackGraphicID + (currentFrame * 2); //skip masks
|
|---|
| 801 | TInt fallbackGraphicsMaskID =
|
|---|
| 802 | (fallbackGraphicID == KErrNotFound) ? KErrNotFound : fallbackGraphicID + 1; //masks are auto-generated as next in mif files
|
|---|
| 803 | if (fallbackGraphicsMaskID != KErrNotFound)
|
|---|
| 804 | fallbackGraphicsMaskID = fallbackGraphicsMaskID + (currentFrame * 2); //skip actual graphics
|
|---|
| 805 |
|
|---|
| 806 | //Then draw animation frame
|
|---|
| 807 | AknsUtils::CreateIconL(
|
|---|
| 808 | skinInstance,
|
|---|
| 809 | KAknsIIDDefault, //animation is not themed, lets force fallback graphics
|
|---|
| 810 | animationFrame,
|
|---|
| 811 | frameMask,
|
|---|
| 812 | AknIconUtils::AvkonIconFileName(),
|
|---|
| 813 | fallbackGraphicID ,
|
|---|
| 814 | fallbackGraphicsMaskID);
|
|---|
| 815 | }
|
|---|
| 816 | result = fromFbsBitmap(animationFrame, frameMask, flags, targetSize);
|
|---|
| 817 | if (!constructedFromTheme) {
|
|---|
| 818 | delete animationFrame;
|
|---|
| 819 | animationFrame = 0;
|
|---|
| 820 | delete frameMask;
|
|---|
| 821 | frameMask = 0;
|
|---|
| 822 | }
|
|---|
| 823 | break;
|
|---|
| 824 | }
|
|---|
| 825 | }
|
|---|
| 826 | if (!result)
|
|---|
| 827 | result = QPixmap();
|
|---|
| 828 |
|
|---|
| 829 | return result;
|
|---|
| 830 | }
|
|---|
| 831 |
|
|---|
| 832 | QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(QS60StylePrivate::SkinFrameElements frameElement,
|
|---|
| 833 | const QSize &size, QS60StylePrivate::SkinElementFlags flags)
|
|---|
| 834 | {
|
|---|
| 835 | // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts.
|
|---|
| 836 | if (!size.isValid())
|
|---|
| 837 | return QPixmap();
|
|---|
| 838 |
|
|---|
| 839 | const bool rotatedBy90or270 =
|
|---|
| 840 | (flags & (QS60StylePrivate::SF_PointEast | QS60StylePrivate::SF_PointWest));
|
|---|
| 841 | const TSize targetSize =
|
|---|
| 842 | rotatedBy90or270 ? TSize(size.height(), size.width()) : qt_QSize2TSize(size);
|
|---|
| 843 |
|
|---|
| 844 | MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
|
|---|
| 845 | QPixmap result;
|
|---|
| 846 |
|
|---|
| 847 | static const TDisplayMode displayMode = S60->supportsPremultipliedAlpha ? Q_SYMBIAN_ECOLOR16MAP : EColor16MA;
|
|---|
| 848 | static const TInt drawParam = S60->supportsPremultipliedAlpha ? KAknsDrawParamDefault : KAknsDrawParamNoClearUnderImage|KAknsDrawParamRGBOnly;
|
|---|
| 849 |
|
|---|
| 850 | CFbsBitmap *frame = new (ELeave) CFbsBitmap(); //offscreen
|
|---|
| 851 | CleanupStack::PushL(frame);
|
|---|
| 852 | User::LeaveIfError(frame->Create(targetSize, displayMode));
|
|---|
| 853 |
|
|---|
| 854 | CFbsBitmapDevice* bitmapDev = CFbsBitmapDevice::NewL(frame);
|
|---|
| 855 | CleanupStack::PushL(bitmapDev);
|
|---|
| 856 | CFbsBitGc* bitmapGc = NULL;
|
|---|
| 857 | User::LeaveIfError(bitmapDev->CreateContext(bitmapGc));
|
|---|
| 858 | CleanupStack::PushL(bitmapGc);
|
|---|
| 859 |
|
|---|
| 860 | #ifndef Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE
|
|---|
| 861 | frame->LockHeap();
|
|---|
| 862 | memset(frame->DataAddress(), 0, frame->SizeInPixels().iWidth * frame->SizeInPixels().iHeight * 4); // 4: argb bytes
|
|---|
| 863 | frame->UnlockHeap();
|
|---|
| 864 | #endif
|
|---|
| 865 |
|
|---|
| 866 | const TRect outerRect(TPoint(0, 0), targetSize);
|
|---|
| 867 | const TRect innerRect = innerRectFromElement(frameElement, outerRect);
|
|---|
| 868 |
|
|---|
| 869 | TAknsItemID frameSkinID, centerSkinID;
|
|---|
| 870 | frameSkinID = centerSkinID = partSpecificThemeId(QS60StylePrivate::m_frameElementsData[frameElement].center);
|
|---|
| 871 | frameIdAndCenterId(frameElement, frameSkinID, centerSkinID);
|
|---|
| 872 |
|
|---|
| 873 | TBool drawn = AknsDrawUtils::DrawFrame(
|
|---|
| 874 | skinInstance,
|
|---|
| 875 | *bitmapGc,
|
|---|
| 876 | outerRect,
|
|---|
| 877 | innerRect,
|
|---|
| 878 | frameSkinID,
|
|---|
| 879 | centerSkinID,
|
|---|
| 880 | drawParam );
|
|---|
| 881 |
|
|---|
| 882 | if (S60->supportsPremultipliedAlpha) {
|
|---|
| 883 | if (drawn) {
|
|---|
| 884 | result = fromFbsBitmap(frame, NULL, flags, targetSize);
|
|---|
| 885 | } else {
|
|---|
| 886 | // Drawing might fail due to OOM (we can do nothing about that),
|
|---|
| 887 | // or due to skin item not being available.
|
|---|
| 888 | // If the latter occurs, lets try switch to non-release specific items (if available)
|
|---|
| 889 | // and re-try the drawing.
|
|---|
| 890 | frameSkinID = centerSkinID = m_partMap[(int)QS60StylePrivate::m_frameElementsData[frameElement].center].skinID;
|
|---|
| 891 | frameIdAndCenterId(frameElement, frameSkinID, centerSkinID);
|
|---|
| 892 | drawn = AknsDrawUtils::DrawFrame( skinInstance,
|
|---|
| 893 | *bitmapGc, outerRect, innerRect,
|
|---|
| 894 | frameSkinID, centerSkinID,
|
|---|
| 895 | drawParam );
|
|---|
| 896 | // in case drawing fails, even after using default graphics, ignore the error
|
|---|
| 897 | if (drawn)
|
|---|
| 898 | result = fromFbsBitmap(frame, NULL, flags, targetSize);
|
|---|
| 899 | }
|
|---|
| 900 | } else {
|
|---|
| 901 | TDisplayMode maskDepth = EGray2;
|
|---|
| 902 | // Query the skin item for possible frame graphics mask details.
|
|---|
| 903 | if (skinInstance) {
|
|---|
| 904 | CAknsMaskedBitmapItemData* skinMaskedBmp = static_cast<CAknsMaskedBitmapItemData*>(
|
|---|
| 905 | skinInstance->GetCachedItemData(frameSkinID,EAknsITMaskedBitmap));
|
|---|
| 906 | if (skinMaskedBmp && skinMaskedBmp->Mask())
|
|---|
| 907 | maskDepth = skinMaskedBmp->Mask()->DisplayMode();
|
|---|
| 908 | }
|
|---|
| 909 | if (maskDepth != ENone) {
|
|---|
| 910 | CFbsBitmap *frameMask = new (ELeave) CFbsBitmap(); //offscreen
|
|---|
| 911 | CleanupStack::PushL(frameMask);
|
|---|
| 912 | User::LeaveIfError(frameMask->Create(targetSize, maskDepth));
|
|---|
| 913 |
|
|---|
| 914 | CFbsBitmapDevice* maskBitmapDevice = CFbsBitmapDevice::NewL(frameMask);
|
|---|
| 915 | CleanupStack::PushL(maskBitmapDevice);
|
|---|
| 916 | CFbsBitGc* maskBitGc = NULL;
|
|---|
| 917 | User::LeaveIfError(maskBitmapDevice->CreateContext(maskBitGc));
|
|---|
| 918 | CleanupStack::PushL(maskBitGc);
|
|---|
| 919 |
|
|---|
| 920 | if (drawn) {
|
|---|
| 921 | //ensure that the mask is really transparent
|
|---|
| 922 | maskBitGc->Activate( maskBitmapDevice );
|
|---|
| 923 | maskBitGc->SetPenStyle(CGraphicsContext::ENullPen);
|
|---|
| 924 | maskBitGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
|---|
| 925 | maskBitGc->SetBrushColor(KRgbWhite);
|
|---|
| 926 | maskBitGc->Clear();
|
|---|
| 927 | maskBitGc->SetBrushStyle(CGraphicsContext::ENullBrush);
|
|---|
| 928 |
|
|---|
| 929 | drawn = AknsDrawUtils::DrawFrame(skinInstance,
|
|---|
| 930 | *maskBitGc, outerRect, innerRect,
|
|---|
| 931 | frameSkinID, centerSkinID,
|
|---|
| 932 | KAknsSDMAlphaOnly |KAknsDrawParamNoClearUnderImage);
|
|---|
| 933 | if (drawn)
|
|---|
| 934 | result = fromFbsBitmap(frame, frameMask, flags, targetSize);
|
|---|
| 935 | }
|
|---|
| 936 | CleanupStack::PopAndDestroy(3, frameMask);
|
|---|
| 937 | }
|
|---|
| 938 | }
|
|---|
| 939 | CleanupStack::PopAndDestroy(3, frame); //frame, bitmapDev, bitmapGc
|
|---|
| 940 | return result;
|
|---|
| 941 | }
|
|---|
| 942 |
|
|---|
| 943 | void QS60StyleModeSpecifics::frameIdAndCenterId(QS60StylePrivate::SkinFrameElements frameElement, TAknsItemID &frameId, TAknsItemID ¢erId)
|
|---|
| 944 | {
|
|---|
| 945 | // There are some major mix-ups in skin declarations for some frames.
|
|---|
| 946 | // First, the frames are not declared in sequence.
|
|---|
| 947 | // Second, the parts use different major than the frame-master.
|
|---|
| 948 |
|
|---|
| 949 | switch(frameElement) {
|
|---|
| 950 | case QS60StylePrivate::SF_ToolTip:
|
|---|
| 951 | if (QSysInfo::s60Version()!=QSysInfo::SV_S60_3_1) {
|
|---|
| 952 | centerId.Set(EAknsMajorGeneric, 0x19c2);
|
|---|
| 953 | frameId.Set(EAknsMajorSkin, 0x5300);
|
|---|
| 954 | } else {
|
|---|
| 955 | centerId.Set(KAknsIIDQsnFrPopupCenter);
|
|---|
| 956 | frameId.iMinor = centerId.iMinor - 9;
|
|---|
| 957 | }
|
|---|
| 958 | break;
|
|---|
| 959 | case QS60StylePrivate::SF_ToolBar:
|
|---|
| 960 | if (QSysInfo::s60Version()==QSysInfo::SV_S60_3_1 || QSysInfo::s60Version()==QSysInfo::SV_S60_3_2) {
|
|---|
| 961 | centerId.Set(KAknsIIDQsnFrPopupCenterSubmenu);
|
|---|
| 962 | frameId.Set(KAknsIIDQsnFrPopupSub);
|
|---|
| 963 | }
|
|---|
| 964 | break;
|
|---|
| 965 | case QS60StylePrivate::SF_PanelBackground:
|
|---|
| 966 | // remove center piece for panel graphics, so that only border is drawn
|
|---|
| 967 | centerId.Set(KAknsIIDNone);
|
|---|
| 968 | frameId.Set(KAknsIIDQsnFrSetOpt);
|
|---|
| 969 | break;
|
|---|
| 970 | default:
|
|---|
| 971 | // center should be correct here
|
|---|
| 972 | frameId.iMinor = centerId.iMinor - 9;
|
|---|
| 973 | break;
|
|---|
| 974 | }
|
|---|
| 975 | }
|
|---|
| 976 |
|
|---|
| 977 | TRect QS60StyleModeSpecifics::innerRectFromElement(QS60StylePrivate::SkinFrameElements frameElement, const TRect &outerRect)
|
|---|
| 978 | {
|
|---|
| 979 | TInt widthShrink = QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerWidth);
|
|---|
| 980 | TInt heightShrink = QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerHeight);
|
|---|
| 981 | switch(frameElement) {
|
|---|
| 982 | case QS60StylePrivate::SF_PanelBackground:
|
|---|
| 983 | // panel should have slightly slimmer border to enable thin line of background graphics between closest component
|
|---|
| 984 | widthShrink = widthShrink-2;
|
|---|
| 985 | heightShrink = heightShrink-2;
|
|---|
| 986 | break;
|
|---|
| 987 | case QS60StylePrivate::SF_ToolTip:
|
|---|
| 988 | widthShrink = widthShrink>>1;
|
|---|
| 989 | heightShrink = heightShrink>>1;
|
|---|
| 990 | break;
|
|---|
| 991 | case QS60StylePrivate::SF_ListHighlight:
|
|---|
| 992 | widthShrink = widthShrink-2;
|
|---|
| 993 | heightShrink = heightShrink-2;
|
|---|
| 994 | break;
|
|---|
| 995 | default:
|
|---|
| 996 | break;
|
|---|
| 997 | }
|
|---|
| 998 | TRect innerRect(outerRect);
|
|---|
| 999 | innerRect.Shrink(widthShrink, heightShrink);
|
|---|
| 1000 | return innerRect;
|
|---|
| 1001 | }
|
|---|
| 1002 |
|
|---|
| 1003 | bool QS60StyleModeSpecifics::checkSupport(const int supportedRelease)
|
|---|
| 1004 | {
|
|---|
| 1005 | const QSysInfo::S60Version currentRelease = QSysInfo::s60Version();
|
|---|
| 1006 | return ( (currentRelease == QSysInfo::SV_S60_3_1 && supportedRelease & ES60_3_1) ||
|
|---|
| 1007 | (currentRelease == QSysInfo::SV_S60_3_2 && supportedRelease & ES60_3_2) ||
|
|---|
| 1008 | (currentRelease == QSysInfo::SV_S60_5_0 && supportedRelease & ES60_5_0) ||
|
|---|
| 1009 | (currentRelease == QSysInfo::SV_S60_5_1 && supportedRelease & ES60_5_1) ||
|
|---|
| 1010 | (currentRelease == QSysInfo::SV_S60_5_2 && supportedRelease & ES60_5_2));
|
|---|
| 1011 | }
|
|---|
| 1012 |
|
|---|
| 1013 | TAknsItemID QS60StyleModeSpecifics::partSpecificThemeId(int part)
|
|---|
| 1014 | {
|
|---|
| 1015 | TAknsItemID newSkinId;
|
|---|
| 1016 | if (!checkSupport(m_partMap[(int)part].supportInfo))
|
|---|
| 1017 | newSkinId.Set(m_partMap[(int)part].newMajorSkinId, m_partMap[(int)part].newMinorSkinId);
|
|---|
| 1018 | else
|
|---|
| 1019 | newSkinId.Set(m_partMap[(int)part].skinID);
|
|---|
| 1020 | return newSkinId;
|
|---|
| 1021 | }
|
|---|
| 1022 |
|
|---|
| 1023 | QFont QS60StylePrivate::s60Font_specific(
|
|---|
| 1024 | QS60StyleEnums::FontCategories fontCategory,
|
|---|
| 1025 | int pointSize, bool resolveFontSize)
|
|---|
| 1026 | {
|
|---|
| 1027 | Q_UNUSED(resolveFontSize);
|
|---|
| 1028 |
|
|---|
| 1029 | TAknFontCategory aknFontCategory = EAknFontCategoryUndefined;
|
|---|
| 1030 | switch (fontCategory) {
|
|---|
| 1031 | case QS60StyleEnums::FC_Primary:
|
|---|
| 1032 | aknFontCategory = EAknFontCategoryPrimary;
|
|---|
| 1033 | break;
|
|---|
| 1034 | case QS60StyleEnums::FC_Secondary:
|
|---|
| 1035 | aknFontCategory = EAknFontCategorySecondary;
|
|---|
| 1036 | break;
|
|---|
| 1037 | case QS60StyleEnums::FC_Title:
|
|---|
| 1038 | aknFontCategory = EAknFontCategoryTitle;
|
|---|
| 1039 | break;
|
|---|
| 1040 | case QS60StyleEnums::FC_PrimarySmall:
|
|---|
| 1041 | aknFontCategory = EAknFontCategoryPrimarySmall;
|
|---|
| 1042 | break;
|
|---|
| 1043 | case QS60StyleEnums::FC_Digital:
|
|---|
| 1044 | aknFontCategory = EAknFontCategoryDigital;
|
|---|
| 1045 | break;
|
|---|
| 1046 | case QS60StyleEnums::FC_Undefined:
|
|---|
| 1047 | default:
|
|---|
| 1048 | break;
|
|---|
| 1049 | }
|
|---|
| 1050 |
|
|---|
| 1051 | // Create AVKON font according the given parameters
|
|---|
| 1052 | CWsScreenDevice* dev = CCoeEnv::Static()->ScreenDevice();
|
|---|
| 1053 | TAknFontSpecification spec(aknFontCategory, TFontSpec(), NULL);
|
|---|
| 1054 | if (pointSize > 0) {
|
|---|
| 1055 | const TInt pixelSize = dev->VerticalTwipsToPixels(pointSize * KTwipsPerPoint);
|
|---|
| 1056 | spec.SetTextPaneHeight(pixelSize + 4); // TODO: Is 4 a reasonable top+bottom margin?
|
|---|
| 1057 | }
|
|---|
| 1058 |
|
|---|
| 1059 | QFont result;
|
|---|
| 1060 | TRAPD( error, QT_TRYCATCH_LEAVING({
|
|---|
| 1061 | const CAknLayoutFont* aknFont =
|
|---|
| 1062 | AknFontAccess::CreateLayoutFontFromSpecificationL(*dev, spec);
|
|---|
| 1063 |
|
|---|
| 1064 | result = qt_TFontSpec2QFontL(aknFont->DoFontSpecInTwips());
|
|---|
| 1065 | if (result.pointSize() != pointSize)
|
|---|
| 1066 | result.setPointSize(pointSize); // Correct the font size returned by CreateLayoutFontFromSpecificationL()
|
|---|
| 1067 |
|
|---|
| 1068 | delete aknFont;
|
|---|
| 1069 | }));
|
|---|
| 1070 | if (error) result = QFont();
|
|---|
| 1071 | return result;
|
|---|
| 1072 | }
|
|---|
| 1073 |
|
|---|
| 1074 | void QS60StylePrivate::setActiveLayout()
|
|---|
| 1075 | {
|
|---|
| 1076 | const QSize activeScreenSize(screenSize());
|
|---|
| 1077 | int activeLayoutIndex = -1;
|
|---|
| 1078 | const short screenHeight = (short)activeScreenSize.height();
|
|---|
| 1079 | const short screenWidth = (short)activeScreenSize.width();
|
|---|
| 1080 | for (int i=0; i<m_numberOfLayouts; i++) {
|
|---|
| 1081 | if (screenHeight==m_layoutHeaders[i].height &&
|
|---|
| 1082 | screenWidth==m_layoutHeaders[i].width) {
|
|---|
| 1083 | activeLayoutIndex = i;
|
|---|
| 1084 | break;
|
|---|
| 1085 | }
|
|---|
| 1086 | }
|
|---|
| 1087 |
|
|---|
| 1088 | //not found, lets try with either of dimensions
|
|---|
| 1089 | if (activeLayoutIndex==-1){
|
|---|
| 1090 | const QSysInfo::S60Version currentRelease = QSysInfo::s60Version();
|
|---|
| 1091 | const bool landscape = screenHeight < screenWidth;
|
|---|
| 1092 |
|
|---|
| 1093 | activeLayoutIndex = (currentRelease == QSysInfo::SV_S60_3_1 || currentRelease == QSysInfo::SV_S60_3_2) ? 0 : 2;
|
|---|
| 1094 | activeLayoutIndex += (!landscape) ? 1 : 0;
|
|---|
| 1095 | }
|
|---|
| 1096 |
|
|---|
| 1097 | m_pmPointer = data[activeLayoutIndex];
|
|---|
| 1098 | }
|
|---|
| 1099 |
|
|---|
| 1100 | Q_GLOBAL_STATIC(QList<QS60StyleAnimation *>, m_animations)
|
|---|
| 1101 |
|
|---|
| 1102 | QS60StylePrivate::QS60StylePrivate()
|
|---|
| 1103 | {
|
|---|
| 1104 | //Animation defaults need to be created when style is instantiated
|
|---|
| 1105 | QS60StyleAnimation* progressBarAnimation = new QS60StyleAnimation(QS60StyleEnums::SP_QgnGrafBarWaitAnim, 7, 100);
|
|---|
| 1106 | m_animations()->append(progressBarAnimation);
|
|---|
| 1107 | // No need to set active layout, if dynamic metrics API is available
|
|---|
| 1108 | setActiveLayout();
|
|---|
| 1109 | }
|
|---|
| 1110 |
|
|---|
| 1111 | QColor QS60StylePrivate::s60Color(QS60StyleEnums::ColorLists list,
|
|---|
| 1112 | int index, const QStyleOption *option)
|
|---|
| 1113 | {
|
|---|
| 1114 | static const TAknsItemID *idMap[] = {
|
|---|
| 1115 | &KAknsIIDQsnHighlightColors,
|
|---|
| 1116 | &KAknsIIDQsnIconColors,
|
|---|
| 1117 | &KAknsIIDQsnLineColors,
|
|---|
| 1118 | &KAknsIIDQsnOtherColors,
|
|---|
| 1119 | &KAknsIIDQsnParentColors,
|
|---|
| 1120 | &KAknsIIDQsnTextColors
|
|---|
| 1121 | };
|
|---|
| 1122 | Q_ASSERT((int)list <= (int)sizeof(idMap)/sizeof(idMap[0]));
|
|---|
| 1123 | const QColor color = QS60StyleModeSpecifics::colorValue(*idMap[(int) list], index - 1);
|
|---|
| 1124 | return option ? QS60StylePrivate::stateColor(color, option) : color;
|
|---|
| 1125 | }
|
|---|
| 1126 |
|
|---|
| 1127 | // In some cases, the AVKON UI themegraphic is already in 'disabled state'.
|
|---|
| 1128 | // If so, return true for these parts.
|
|---|
| 1129 | bool QS60StyleModeSpecifics::disabledPartGraphic(QS60StyleEnums::SkinParts &part)
|
|---|
| 1130 | {
|
|---|
| 1131 | bool disabledGraphic = false;
|
|---|
| 1132 | switch(part){
|
|---|
| 1133 | // inactive button graphics are available from 5.0 onwards
|
|---|
| 1134 | case QS60StyleEnums::SP_QsnFrButtonCornerTlInactive:
|
|---|
| 1135 | case QS60StyleEnums::SP_QsnFrButtonCornerTrInactive:
|
|---|
| 1136 | case QS60StyleEnums::SP_QsnFrButtonCornerBlInactive:
|
|---|
| 1137 | case QS60StyleEnums::SP_QsnFrButtonCornerBrInactive:
|
|---|
| 1138 | case QS60StyleEnums::SP_QsnFrButtonSideTInactive:
|
|---|
| 1139 | case QS60StyleEnums::SP_QsnFrButtonSideBInactive:
|
|---|
| 1140 | case QS60StyleEnums::SP_QsnFrButtonSideLInactive:
|
|---|
| 1141 | case QS60StyleEnums::SP_QsnFrButtonSideRInactive:
|
|---|
| 1142 | case QS60StyleEnums::SP_QsnFrButtonCenterInactive:
|
|---|
| 1143 | if (!(QSysInfo::s60Version()==QSysInfo::SV_S60_3_1 ||
|
|---|
| 1144 | QSysInfo::s60Version()==QSysInfo::SV_S60_3_2))
|
|---|
| 1145 | disabledGraphic = true;
|
|---|
| 1146 | break;
|
|---|
| 1147 | default:
|
|---|
| 1148 | break;
|
|---|
| 1149 | }
|
|---|
| 1150 | return disabledGraphic;
|
|---|
| 1151 | }
|
|---|
| 1152 |
|
|---|
| 1153 | // In some cases, the AVKON UI themegraphic is already in 'disabled state'.
|
|---|
| 1154 | // If so, return true for these frames.
|
|---|
| 1155 | bool QS60StyleModeSpecifics::disabledFrameGraphic(QS60StylePrivate::SkinFrameElements &frame)
|
|---|
| 1156 | {
|
|---|
| 1157 | bool disabledGraphic = false;
|
|---|
| 1158 | switch(frame){
|
|---|
| 1159 | // inactive button graphics are available from 5.0 onwards
|
|---|
| 1160 | case QS60StylePrivate::SF_ButtonInactive:
|
|---|
| 1161 | if (!(QSysInfo::s60Version()==QSysInfo::SV_S60_3_1 ||
|
|---|
| 1162 | QSysInfo::s60Version()==QSysInfo::SV_S60_3_2))
|
|---|
| 1163 | disabledGraphic = true;
|
|---|
| 1164 | break;
|
|---|
| 1165 | default:
|
|---|
| 1166 | break;
|
|---|
| 1167 | }
|
|---|
| 1168 | return disabledGraphic;
|
|---|
| 1169 | }
|
|---|
| 1170 |
|
|---|
| 1171 | QPixmap QS60StyleModeSpecifics::generateMissingThemeGraphic(QS60StyleEnums::SkinParts &part,
|
|---|
| 1172 | const QSize &size, QS60StylePrivate::SkinElementFlags flags)
|
|---|
| 1173 | {
|
|---|
| 1174 | if (!QS60StylePrivate::isTouchSupported())
|
|---|
| 1175 | return QPixmap();
|
|---|
| 1176 |
|
|---|
| 1177 | QS60StyleEnums::SkinParts updatedPart = part;
|
|---|
| 1178 | switch(part){
|
|---|
| 1179 | // AVKON UI has a abnormal handling for scrollbar graphics. It is possible that the root
|
|---|
| 1180 | // skin does not contain mandatory graphics for scrollbar pressed states. Therefore, AVKON UI
|
|---|
| 1181 | // creates dynamically these graphics by modifying the normal state scrollbar graphics slightly.
|
|---|
| 1182 | // S60Style needs to work similarly. Therefore if skingraphics call provides to be a miss
|
|---|
| 1183 | // (i.e. result is not valid), style needs to draw normal graphics instead and apply some
|
|---|
| 1184 | // modifications (similar to generatedIconPixmap()) to the result.
|
|---|
| 1185 | case QS60StyleEnums::SP_QsnCpScrollHandleBottomPressed:
|
|---|
| 1186 | updatedPart = QS60StyleEnums::SP_QsnCpScrollHandleBottom;
|
|---|
| 1187 | break;
|
|---|
| 1188 | case QS60StyleEnums::SP_QsnCpScrollHandleMiddlePressed:
|
|---|
| 1189 | updatedPart = QS60StyleEnums::SP_QsnCpScrollHandleMiddle;
|
|---|
| 1190 | break;
|
|---|
| 1191 | case QS60StyleEnums::SP_QsnCpScrollHandleTopPressed:
|
|---|
| 1192 | updatedPart = QS60StyleEnums::SP_QsnCpScrollHandleTop;
|
|---|
| 1193 | break;
|
|---|
| 1194 | default:
|
|---|
| 1195 | break;
|
|---|
| 1196 | }
|
|---|
| 1197 | if (part==updatedPart) {
|
|---|
| 1198 | return QPixmap();
|
|---|
| 1199 | } else {
|
|---|
| 1200 | QPixmap result = skinnedGraphics(updatedPart, size, flags);
|
|---|
| 1201 | QStyleOption opt;
|
|---|
| 1202 | QPalette *themePalette = QS60StylePrivate::themePalette();
|
|---|
| 1203 | if (themePalette)
|
|---|
| 1204 | opt.palette = *themePalette;
|
|---|
| 1205 |
|
|---|
| 1206 | // For now, always generate new icon based on "selected". In the future possibly, expand
|
|---|
| 1207 | // this to consist other possibilities as well.
|
|---|
| 1208 | result = QApplication::style()->generatedIconPixmap(QIcon::Selected, result, &opt);
|
|---|
| 1209 | return result;
|
|---|
| 1210 | }
|
|---|
| 1211 | }
|
|---|
| 1212 |
|
|---|
| 1213 | QPixmap QS60StylePrivate::part(QS60StyleEnums::SkinParts part,
|
|---|
| 1214 | const QSize &size, QPainter *painter, SkinElementFlags flags)
|
|---|
| 1215 | {
|
|---|
| 1216 | QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
|
|---|
| 1217 |
|
|---|
| 1218 | QPixmap result = (flags & SF_ColorSkinned)?
|
|---|
| 1219 | QS60StyleModeSpecifics::colorSkinnedGraphics(part, size, painter, flags)
|
|---|
| 1220 | : QS60StyleModeSpecifics::skinnedGraphics(part, size, flags);
|
|---|
| 1221 |
|
|---|
| 1222 | lock.relock();
|
|---|
| 1223 |
|
|---|
| 1224 | if (flags & SF_StateDisabled && !QS60StyleModeSpecifics::disabledPartGraphic(part)) {
|
|---|
| 1225 | QStyleOption opt;
|
|---|
| 1226 | QPalette *themePalette = QS60StylePrivate::themePalette();
|
|---|
| 1227 | if (themePalette)
|
|---|
| 1228 | opt.palette = *themePalette;
|
|---|
| 1229 | result = QApplication::style()->generatedIconPixmap(QIcon::Disabled, result, &opt);
|
|---|
| 1230 | }
|
|---|
| 1231 |
|
|---|
| 1232 | if (!result)
|
|---|
| 1233 | result = QS60StyleModeSpecifics::generateMissingThemeGraphic(part, size, flags);
|
|---|
| 1234 |
|
|---|
| 1235 | return result;
|
|---|
| 1236 | }
|
|---|
| 1237 |
|
|---|
| 1238 | QPixmap QS60StylePrivate::frame(SkinFrameElements frame, const QSize &size, SkinElementFlags flags)
|
|---|
| 1239 | {
|
|---|
| 1240 | QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
|
|---|
| 1241 | QPixmap result = QS60StyleModeSpecifics::skinnedGraphics(frame, size, flags);
|
|---|
| 1242 | lock.relock();
|
|---|
| 1243 |
|
|---|
| 1244 | if (flags & SF_StateDisabled && !QS60StyleModeSpecifics::disabledFrameGraphic(frame)) {
|
|---|
| 1245 | QStyleOption opt;
|
|---|
| 1246 | QPalette *themePalette = QS60StylePrivate::themePalette();
|
|---|
| 1247 | if (themePalette)
|
|---|
| 1248 | opt.palette = *themePalette;
|
|---|
| 1249 | result = QApplication::style()->generatedIconPixmap(QIcon::Disabled, result, &opt);
|
|---|
| 1250 | }
|
|---|
| 1251 | return result;
|
|---|
| 1252 | }
|
|---|
| 1253 |
|
|---|
| 1254 | QPixmap QS60StylePrivate::backgroundTexture()
|
|---|
| 1255 | {
|
|---|
| 1256 | bool createNewBackground = false;
|
|---|
| 1257 | if (!m_background) {
|
|---|
| 1258 | createNewBackground = true;
|
|---|
| 1259 | } else {
|
|---|
| 1260 | //if background brush does not match screensize, re-create it
|
|---|
| 1261 | if (m_background->width() != S60->screenWidthInPixels ||
|
|---|
| 1262 | m_background->height() != S60->screenHeightInPixels) {
|
|---|
| 1263 | delete m_background;
|
|---|
| 1264 | createNewBackground = true;
|
|---|
| 1265 | }
|
|---|
| 1266 | }
|
|---|
| 1267 |
|
|---|
| 1268 | if (createNewBackground) {
|
|---|
| 1269 | QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen,
|
|---|
| 1270 | QSize(S60->screenWidthInPixels, S60->screenHeightInPixels), 0, SkinElementFlags());
|
|---|
| 1271 | m_background = new QPixmap(background);
|
|---|
| 1272 | }
|
|---|
| 1273 | return *m_background;
|
|---|
| 1274 | }
|
|---|
| 1275 |
|
|---|
| 1276 | QSize QS60StylePrivate::screenSize()
|
|---|
| 1277 | {
|
|---|
| 1278 | return QSize(S60->screenWidthInPixels, S60->screenHeightInPixels);
|
|---|
| 1279 | }
|
|---|
| 1280 |
|
|---|
| 1281 | QS60Style::QS60Style()
|
|---|
| 1282 | : QCommonStyle(*new QS60StylePrivate)
|
|---|
| 1283 | {
|
|---|
| 1284 | }
|
|---|
| 1285 |
|
|---|
| 1286 | #ifdef Q_WS_S60
|
|---|
| 1287 | void QS60StylePrivate::handleDynamicLayoutVariantSwitch()
|
|---|
| 1288 | {
|
|---|
| 1289 | clearCaches(QS60StylePrivate::CC_LayoutChange);
|
|---|
| 1290 | setBackgroundTexture(qApp);
|
|---|
| 1291 | setActiveLayout();
|
|---|
| 1292 | refreshUI();
|
|---|
| 1293 | foreach (QWidget *widget, QApplication::allWidgets())
|
|---|
| 1294 | widget->ensurePolished();
|
|---|
| 1295 | }
|
|---|
| 1296 |
|
|---|
| 1297 | void QS60StylePrivate::handleSkinChange()
|
|---|
| 1298 | {
|
|---|
| 1299 | clearCaches(QS60StylePrivate::CC_ThemeChange);
|
|---|
| 1300 | setThemePalette(qApp);
|
|---|
| 1301 | foreach (QWidget *topLevelWidget, QApplication::allWidgets()){
|
|---|
| 1302 | QEvent e(QEvent::StyleChange);
|
|---|
| 1303 | QApplication::sendEvent(topLevelWidget, &e);
|
|---|
| 1304 | setThemePalette(topLevelWidget);
|
|---|
| 1305 | topLevelWidget->ensurePolished();
|
|---|
| 1306 | }
|
|---|
| 1307 | #ifndef QT_NO_PROGRESSBAR
|
|---|
| 1308 | //re-start animation timer
|
|---|
| 1309 | stopAnimation(QS60StyleEnums::SP_QgnGrafBarWaitAnim); //todo: once we have more animations, we could say "stop all running ones"
|
|---|
| 1310 | startAnimation(QS60StyleEnums::SP_QgnGrafBarWaitAnim); //and "re-start all previously running ones"
|
|---|
| 1311 | #endif
|
|---|
| 1312 | }
|
|---|
| 1313 |
|
|---|
| 1314 | QSize QS60StylePrivate::naviPaneSize()
|
|---|
| 1315 | {
|
|---|
| 1316 | return QS60StyleModeSpecifics::naviPaneSize();
|
|---|
| 1317 | }
|
|---|
| 1318 |
|
|---|
| 1319 | QSize QS60StyleModeSpecifics::naviPaneSize()
|
|---|
| 1320 | {
|
|---|
| 1321 | CAknNavigationControlContainer* naviContainer;
|
|---|
| 1322 | if (S60->statusPane()) {
|
|---|
| 1323 | TRAPD(err, naviContainer = static_cast<CAknNavigationControlContainer*>
|
|---|
| 1324 | (S60->statusPane()->ControlL(TUid::Uid(EEikStatusPaneUidNavi))));
|
|---|
| 1325 | if (err==KErrNone)
|
|---|
| 1326 | return QSize(naviContainer->Size().iWidth, naviContainer->Size().iHeight);
|
|---|
| 1327 | }
|
|---|
| 1328 | return QSize(0,0);
|
|---|
| 1329 | }
|
|---|
| 1330 |
|
|---|
| 1331 | int QS60StylePrivate::currentAnimationFrame(QS60StyleEnums::SkinParts part)
|
|---|
| 1332 | {
|
|---|
| 1333 | QS60StyleAnimation *animation = animationDefinition(part);
|
|---|
| 1334 | // todo: looping could be done in QS60Style::timerEvent
|
|---|
| 1335 | if (animation->frameCount() == animation->currentFrame())
|
|---|
| 1336 | animation->setCurrentFrame(0);
|
|---|
| 1337 | return animation->currentFrame();
|
|---|
| 1338 | }
|
|---|
| 1339 |
|
|---|
| 1340 | QS60StyleAnimation* QS60StylePrivate::animationDefinition(QS60StyleEnums::SkinParts part)
|
|---|
| 1341 | {
|
|---|
| 1342 | int i = 0;
|
|---|
| 1343 | const int animationsCount = m_animations()->isEmpty() ? 0 : m_animations()->count();
|
|---|
| 1344 | for(; i < animationsCount; i++) {
|
|---|
| 1345 | if (part == m_animations()->at(i)->animationId())
|
|---|
| 1346 | break;
|
|---|
| 1347 | }
|
|---|
| 1348 | return m_animations()->at(i);
|
|---|
| 1349 | }
|
|---|
| 1350 |
|
|---|
| 1351 | void QS60StylePrivate::startAnimation(QS60StyleEnums::SkinParts animationPart)
|
|---|
| 1352 | {
|
|---|
| 1353 | Q_Q(QS60Style);
|
|---|
| 1354 |
|
|---|
| 1355 | //Query animation data from theme and store values to local struct.
|
|---|
| 1356 | QVariant themeAnimationDataVariant = QS60StyleModeSpecifics::themeDefinition(
|
|---|
| 1357 | QS60StyleEnums::TD_AnimationData, animationPart);
|
|---|
| 1358 | QList<QVariant> themeAnimationData = themeAnimationDataVariant.toList();
|
|---|
| 1359 |
|
|---|
| 1360 | QS60StyleAnimation *animation = QS60StylePrivate::animationDefinition(animationPart);
|
|---|
| 1361 | if (animation) {
|
|---|
| 1362 | if (themeAnimationData.at(QS60StyleEnums::AD_Interval).toInt() != 0)
|
|---|
| 1363 | animation->setInterval(themeAnimationData.at(QS60StyleEnums::AD_Interval).toInt());
|
|---|
| 1364 |
|
|---|
| 1365 | if (themeAnimationData.at(QS60StyleEnums::AD_NumberOfFrames).toInt() != 0)
|
|---|
| 1366 | animation->setFrameCount(themeAnimationData.at(QS60StyleEnums::AD_NumberOfFrames).toInt());
|
|---|
| 1367 |
|
|---|
| 1368 | //todo: playmode is ignored for now, since it seems to return invalid data on some themes
|
|---|
| 1369 | //lets use the table values for play mode
|
|---|
| 1370 |
|
|---|
| 1371 | animation->setCurrentFrame(0); //always initialize
|
|---|
| 1372 | const int timerId = q->startTimer(animation->interval());
|
|---|
| 1373 | animation->setTimerId(timerId);
|
|---|
| 1374 | }
|
|---|
| 1375 | }
|
|---|
| 1376 |
|
|---|
| 1377 | void QS60StylePrivate::stopAnimation(QS60StyleEnums::SkinParts animationPart)
|
|---|
| 1378 | {
|
|---|
| 1379 | Q_Q(QS60Style);
|
|---|
| 1380 |
|
|---|
| 1381 | QS60StyleAnimation *animation = QS60StylePrivate::animationDefinition(animationPart);
|
|---|
| 1382 | if (animation) {
|
|---|
| 1383 | animation->setCurrentFrame(0);
|
|---|
| 1384 | if (animation->timerId() != 0) {
|
|---|
| 1385 | q->killTimer(animation->timerId());
|
|---|
| 1386 | animation->setTimerId(0);
|
|---|
| 1387 | }
|
|---|
| 1388 | animation->resetToDefaults();
|
|---|
| 1389 | }
|
|---|
| 1390 | }
|
|---|
| 1391 |
|
|---|
| 1392 | QVariant QS60StyleModeSpecifics::themeDefinition(
|
|---|
| 1393 | QS60StyleEnums::ThemeDefinitions definition, QS60StyleEnums::SkinParts part)
|
|---|
| 1394 | {
|
|---|
| 1395 | MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
|
|---|
| 1396 |
|
|---|
| 1397 | Q_ASSERT(skinInstance);
|
|---|
| 1398 |
|
|---|
| 1399 | switch(definition) {
|
|---|
| 1400 | //Animation definitions
|
|---|
| 1401 | case QS60StyleEnums::TD_AnimationData:
|
|---|
| 1402 | {
|
|---|
| 1403 | CAknsBmpAnimItemData *animationData;
|
|---|
| 1404 | TAknsItemID animationSkinId = partSpecificThemeId(part);
|
|---|
| 1405 | QList<QVariant> list;
|
|---|
| 1406 |
|
|---|
| 1407 | TRAPD( error, QT_TRYCATCH_LEAVING(
|
|---|
| 1408 | animationData = static_cast<CAknsBmpAnimItemData*>(skinInstance->CreateUncachedItemDataL(
|
|---|
| 1409 | animationSkinId, EAknsITBmpAnim))));
|
|---|
| 1410 | if (error)
|
|---|
| 1411 | return list;
|
|---|
| 1412 |
|
|---|
| 1413 | if (animationData) {
|
|---|
| 1414 | list.append((int)animationData->FrameInterval());
|
|---|
| 1415 | list.append((int)animationData->NumberOfImages());
|
|---|
| 1416 |
|
|---|
| 1417 | QS60StyleEnums::AnimationMode playMode;
|
|---|
| 1418 | switch(animationData->PlayMode()) {
|
|---|
| 1419 | case CBitmapAnimClientData::EPlay:
|
|---|
| 1420 | playMode = QS60StyleEnums::AM_PlayOnce;
|
|---|
| 1421 | break;
|
|---|
| 1422 | case CBitmapAnimClientData::ECycle:
|
|---|
| 1423 | playMode = QS60StyleEnums::AM_Looping;
|
|---|
| 1424 | break;
|
|---|
| 1425 | case CBitmapAnimClientData::EBounce:
|
|---|
| 1426 | playMode = QS60StyleEnums::AM_Bounce;
|
|---|
| 1427 | break;
|
|---|
| 1428 | default:
|
|---|
| 1429 | break;
|
|---|
| 1430 | }
|
|---|
| 1431 | list.append(QVariant((int)playMode));
|
|---|
| 1432 | delete animationData;
|
|---|
| 1433 | } else {
|
|---|
| 1434 | list.append(0);
|
|---|
| 1435 | list.append(0);
|
|---|
| 1436 | }
|
|---|
| 1437 | return list;
|
|---|
| 1438 | }
|
|---|
| 1439 | break;
|
|---|
| 1440 | default:
|
|---|
| 1441 | break;
|
|---|
| 1442 | }
|
|---|
| 1443 | return QVariant();
|
|---|
| 1444 | }
|
|---|
| 1445 |
|
|---|
| 1446 | #endif // Q_WS_S60
|
|---|
| 1447 |
|
|---|
| 1448 | QT_END_NAMESPACE
|
|---|
| 1449 |
|
|---|
| 1450 | #endif // QT_NO_STYLE_S60 || QT_PLUGIN
|
|---|