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