summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorSami Merilä <sami.merila@nokia.com>2009-05-15 10:02:45 (GMT)
committerSami Merilä <sami.merila@nokia.com>2009-05-15 10:02:45 (GMT)
commit9765faecf15fbd54b8817fdea66669cab91b5235 (patch)
treed33e7a26904dd23498426c616fd1378b4395732d /src/gui
parent7ec86ec5ebeaa383c9c7f3792de222c228692c3b (diff)
downloadQt-9765faecf15fbd54b8817fdea66669cab91b5235.zip
Qt-9765faecf15fbd54b8817fdea66669cab91b5235.tar.gz
Qt-9765faecf15fbd54b8817fdea66669cab91b5235.tar.bz2
S60Style: Scrollbar pressed state.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/styles/qs60style.cpp19
-rw-r--r--src/gui/styles/qs60style_symbian.cpp51
2 files changed, 69 insertions, 1 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 6bf9263..7e98d9a 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -323,6 +323,14 @@ void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter,
case SE_PanelBackground:
drawFrame(SF_PanelBackground, painter, rect, flags | SF_PointNorth);
break;
+ case SE_ScrollBarHandlePressedHorizontal:
+ drawRow(QS60StyleEnums::SP_QsnCpScrollHandleBottomPressed, QS60StyleEnums::SP_QsnCpScrollHandleMiddlePressed,
+ QS60StyleEnums::SP_QsnCpScrollHandleTopPressed, Qt::Horizontal, painter, rect, flags | SF_PointEast);
+ break;
+ case SE_ScrollBarHandlePressedVertical:
+ drawRow(QS60StyleEnums::SP_QsnCpScrollHandleTopPressed, QS60StyleEnums::SP_QsnCpScrollHandleMiddlePressed,
+ QS60StyleEnums::SP_QsnCpScrollHandleBottomPressed, Qt::Vertical, painter, rect, flags | SF_PointNorth);
+ break;
default:
break;
}
@@ -795,8 +803,17 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom
const QS60StylePrivate::SkinElements grooveElement =
horizontal ? QS60StylePrivate::SE_ScrollBarGrooveHorizontal : QS60StylePrivate::SE_ScrollBarGrooveVertical;
QS60StylePrivate::drawSkinElement(grooveElement, painter, grooveRect, flags);
+
+ // select correct slider (horizontal/vertical/pressed)
+ const bool sliderPressed = ((optionSlider->state & QStyle::State_Sunken) && (subControls & SC_ScrollBarSlider));
const QS60StylePrivate::SkinElements handleElement =
- horizontal ? QS60StylePrivate::SE_ScrollBarHandleHorizontal : QS60StylePrivate::SE_ScrollBarHandleVertical;
+ horizontal ?
+ ( sliderPressed ?
+ QS60StylePrivate::SE_ScrollBarHandlePressedHorizontal :
+ QS60StylePrivate::SE_ScrollBarHandleHorizontal ) :
+ ( sliderPressed ?
+ QS60StylePrivate::SE_ScrollBarHandlePressedVertical :
+ QS60StylePrivate::SE_ScrollBarHandleVertical);
QS60StylePrivate::drawSkinElement(handleElement, painter, scrollBarSlider, flags);
}
break;
diff --git a/src/gui/styles/qs60style_symbian.cpp b/src/gui/styles/qs60style_symbian.cpp
index 99dfc54..199e7ff 100644
--- a/src/gui/styles/qs60style_symbian.cpp
+++ b/src/gui/styles/qs60style_symbian.cpp
@@ -80,6 +80,7 @@ public:
const QSize &size, QS60StylePrivate::SkinElementFlags flags);
static QColor colorValue(const TAknsItemID &colorGroup, int colorIndex);
static QPixmap fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, QImage::Format format);
+ static QPixmap generateMissingThemeGraphic(QS60StyleEnums::SkinParts &part, const QSize &size, QS60StylePrivate::SkinElementFlags flags);
private:
static QPixmap createSkinnedGraphicsL(QS60StyleEnums::SkinParts part,
@@ -141,6 +142,11 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = {
/* SP_QgnPropFolderSmallNew */ {KAknsIIDQgnPropFolderSmallNew, EDrawIcon, ES60_AllReleases, -1,-1},
/* SP_QgnPropPhoneMemcLarge */ {KAknsIIDQgnPropPhoneMemcLarge, EDrawIcon, ES60_AllReleases, -1,-1},
+ // 3.1 & 3.2 do not have pressed state for scrollbar, so use normal scrollbar graphics instead.
+ /* SP_QsnCpScrollHandleBottomPressed*/ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20f8}, /*KAknsIIDQsnCpScrollHandleBottomPressed*/
+ /* SP_QsnCpScrollHandleMiddlePressed*/ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20f9}, /*KAknsIIDQsnCpScrollHandleMiddlePressed*/
+ /* SP_QsnCpScrollHandleTopPressed*/ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20fa}, /*KAknsIIDQsnCpScrollHandleTopPressed*/
+
/* SP_QsnBgScreen */ {KAknsIIDQsnBgScreen, EDrawBackground, ES60_AllReleases, -1,-1},
/* SP_QsnCpScrollBgBottom */ {KAknsIIDQsnCpScrollBgBottom, EDrawIcon, ES60_AllReleases, -1,-1},
@@ -981,6 +987,47 @@ short QS60StylePrivate::pixelMetric(int metric)
#endif // QT_S60STYLE_LAYOUTDATA_SIMULATED
}
+QPixmap QS60StyleModeSpecifics::generateMissingThemeGraphic(QS60StyleEnums::SkinParts &part,
+ const QSize &size, QS60StylePrivate::SkinElementFlags flags)
+{
+ if (!QS60StylePrivate::isTouchSupported())
+ return QPixmap();
+
+ QS60StyleEnums::SkinParts updatedPart = part;
+ switch(part){
+ // AVKON UI has a abnormal handling for scrollbar graphics. It is possible that the root
+ // skin does not contain mandatory graphics for scrollbar pressed states. Therefore, AVKON UI
+ // creates dynamically these graphics by modifying the normal state scrollbar graphics slightly.
+ // S60Style needs to work similarly. Therefore if skingraphics call provides to be a miss
+ // (i.e. result is not valid), style needs to draw normal graphics instead and apply some
+ // modifications (similar to generatedIconPixmap()) to the result.
+ case QS60StyleEnums::SP_QsnCpScrollHandleBottomPressed:
+ updatedPart = QS60StyleEnums::SP_QsnCpScrollHandleBottom;
+ break;
+ case QS60StyleEnums::SP_QsnCpScrollHandleMiddlePressed:
+ updatedPart = QS60StyleEnums::SP_QsnCpScrollHandleMiddle;
+ break;
+ case QS60StyleEnums::SP_QsnCpScrollHandleTopPressed:
+ updatedPart = QS60StyleEnums::SP_QsnCpScrollHandleTop;
+ break;
+ default:
+ break;
+ }
+ if (part==updatedPart) {
+ return QPixmap();
+ } else {
+ QPixmap result = skinnedGraphics(updatedPart, size, flags);
+ // TODO: fix this
+ QStyleOption opt;
+ // opt.palette = q->standardPalette();
+
+ // For now, always generate new icon based on "selected". In the future possibly, expand
+ // this to consist other possibilities as well.
+ result = QApplication::style()->generatedIconPixmap(QIcon::Selected, result, &opt);
+ return result;
+ }
+}
+
QPixmap QS60StylePrivate::part(QS60StyleEnums::SkinParts part,
const QSize &size, SkinElementFlags flags)
{
@@ -996,6 +1043,10 @@ QPixmap QS60StylePrivate::part(QS60StyleEnums::SkinParts part,
// opt.palette = q->standardPalette();
result = QApplication::style()->generatedIconPixmap(QIcon::Disabled, result, &opt);
}
+
+ if (!result)
+ result = QS60StyleModeSpecifics::generateMissingThemeGraphic(part, size, flags);
+
return result;
}