152 |
152 |
153 QS60StylePrivate::~QS60StylePrivate() |
153 QS60StylePrivate::~QS60StylePrivate() |
154 { |
154 { |
155 clearCaches(); //deletes also background image |
155 clearCaches(); //deletes also background image |
156 deleteThemePalette(); |
156 deleteThemePalette(); |
|
157 #ifdef Q_WS_S60 |
|
158 removeAnimations(); |
|
159 #endif |
157 } |
160 } |
158 |
161 |
159 void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter, |
162 void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter, |
160 const QRect &rect, SkinElementFlags flags) |
163 const QRect &rect, SkinElementFlags flags) |
161 { |
164 { |
1095 bflags &= ~State_Raised; |
1098 bflags &= ~State_Raised; |
1096 } |
1099 } |
1097 } |
1100 } |
1098 State mflags = bflags; |
1101 State mflags = bflags; |
1099 if (toolBtn->state & State_Sunken) { |
1102 if (toolBtn->state & State_Sunken) { |
1100 if (toolBtn->activeSubControls & SC_ToolButton) |
1103 bflags |= State_Sunken; |
1101 bflags |= State_Sunken; |
|
1102 mflags |= State_Sunken; |
1104 mflags |= State_Sunken; |
1103 } |
1105 } |
1104 |
1106 |
1105 const QRect button(subControlRect(control, toolBtn, SC_ToolButton, widget)); |
1107 const QRect button(subControlRect(control, toolBtn, SC_ToolButton, widget)); |
1106 QRect menuRect = QRect(); |
1108 QRect menuRect = QRect(); |
1112 tool.palette = toolBtn->palette; |
1114 tool.palette = toolBtn->palette; |
1113 |
1115 |
1114 if (bflags & (State_Sunken | State_On | State_Raised | State_Enabled)) { |
1116 if (bflags & (State_Sunken | State_On | State_Raised | State_Enabled)) { |
1115 tool.rect = button.unite(menuRect); |
1117 tool.rect = button.unite(menuRect); |
1116 tool.state = bflags; |
1118 tool.state = bflags; |
1117 const QToolButton *toolButtonWidget = qobject_cast<const QToolButton *>(widget); |
|
1118 const QS60StylePrivate::SkinElements element = |
|
1119 ((toolButtonWidget && toolButtonWidget->isDown()) || (option->state & State_Sunken)) ? |
|
1120 QS60StylePrivate::SE_ToolBarButtonPressed : QS60StylePrivate::SE_ToolBarButton; |
|
1121 QS60StylePrivate::drawSkinElement(element, painter, tool.rect, flags); |
|
1122 drawPrimitive(PE_PanelButtonTool, &tool, painter, widget); |
1119 drawPrimitive(PE_PanelButtonTool, &tool, painter, widget); |
1123 } |
1120 } |
1124 if (toolBtn->subControls & SC_ToolButtonMenu) { |
1121 if (toolBtn->subControls & SC_ToolButtonMenu) { |
1125 tool.rect = menuRect; |
1122 tool.rect = menuRect; |
1126 tool.state = mflags; |
1123 tool.state = mflags; |
2172 case PE_PanelButtonCommand: |
2169 case PE_PanelButtonCommand: |
2173 case PE_PanelButtonTool: |
2170 case PE_PanelButtonTool: |
2174 case PE_PanelButtonBevel: |
2171 case PE_PanelButtonBevel: |
2175 case PE_FrameButtonBevel: |
2172 case PE_FrameButtonBevel: |
2176 if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget)) { |
2173 if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget)) { |
2177 const bool isPressed = option->state & State_Sunken; |
2174 const bool isPressed = (option->state & State_Sunken) || (option->state & State_On); |
2178 const QS60StylePrivate::SkinElements skinElement = |
2175 QS60StylePrivate::SkinElements skinElement; |
2179 isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal; |
2176 if (element == PE_PanelButtonTool) |
|
2177 skinElement = isPressed ? QS60StylePrivate::SE_ToolBarButtonPressed : QS60StylePrivate::SE_ToolBarButton; |
|
2178 else |
|
2179 skinElement = isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal; |
2180 QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags); |
2180 QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags); |
2181 } else { |
2181 } else { |
2182 commonStyleDraws = true; |
2182 commonStyleDraws = true; |
2183 } |
2183 } |
2184 break; |
2184 break; |
2338 bool tableView = false; |
2338 bool tableView = false; |
2339 if (itemView && qobject_cast<const QTableView *>(widget)) |
2339 if (itemView && qobject_cast<const QTableView *>(widget)) |
2340 tableView = true; |
2340 tableView = true; |
2341 |
2341 |
2342 QS60StylePrivate::SkinElements element; |
2342 QS60StylePrivate::SkinElements element; |
|
2343 bool themeGraphicDefined = false; |
2343 QRect elementRect = option->rect; |
2344 QRect elementRect = option->rect; |
2344 |
2345 |
2345 //draw item is drawn as pressed, if it already has focus. |
2346 //draw item is drawn as pressed, if it already has focus. |
2346 if (isPressed && (hasFocus || isSelected)) { |
2347 if (isPressed && (hasFocus || isSelected)) { |
|
2348 themeGraphicDefined = true; |
2347 element = tableView ? QS60StylePrivate::SE_TableItemPressed : QS60StylePrivate::SE_ListItemPressed; |
2349 element = tableView ? QS60StylePrivate::SE_TableItemPressed : QS60StylePrivate::SE_ListItemPressed; |
2348 } else if (hasFocus || (isSelected && selectionBehavior != QAbstractItemView::SelectItems)) { |
2350 } else if (hasFocus || (isSelected && selectionBehavior != QAbstractItemView::SelectItems)) { |
2349 element = QS60StylePrivate::SE_ListHighlight; |
2351 element = QS60StylePrivate::SE_ListHighlight; |
2350 elementRect = highlightRect; |
2352 elementRect = highlightRect; |
|
2353 themeGraphicDefined = true; |
2351 } |
2354 } |
2352 QS60StylePrivate::drawSkinElement(element, painter, elementRect, flags); |
2355 if (themeGraphicDefined) |
|
2356 QS60StylePrivate::drawSkinElement(element, painter, elementRect, flags); |
2353 } else { |
2357 } else { |
2354 QCommonStyle::drawPrimitive(element, option, painter, widget); |
2358 QCommonStyle::drawPrimitive(element, option, painter, widget); |
2355 } |
2359 } |
2356 } |
2360 } |
2357 break; |
2361 break; |