1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include <QApplication>
10 #include <QStyleOption>
11 #include <QStyleOptionFrameV2>
12 #include <QStyleOptionButton>
14 #include <QStyleOptionComboBox>
19 #include "nsNativeThemeQt.h"
20 #include "nsPresContext.h"
24 #include "nsTransform2D.h"
25 #include "nsThemeConstants.h"
26 #include "nsIServiceManager.h"
27 #include "nsIDOMHTMLInputElement.h"
30 #include "gfxASurface.h"
31 #include "gfxContext.h"
32 #include "gfxQtPlatform.h"
33 #include "gfxQPainterSurface.h"
35 #include "gfxXlibSurface.h"
37 #include "nsRenderingContext.h"
39 nsNativeThemeQt::nsNativeThemeQt()
41 mNoBackgroundPalette
.setColor(QPalette::Window
, Qt::transparent
);
45 nsNativeThemeQt::~nsNativeThemeQt()
49 NS_IMPL_ISUPPORTS_INHERITED1(nsNativeThemeQt
, nsNativeTheme
, nsITheme
)
51 static inline QRect
qRectInPixels(const nsRect
&aRect
,
54 return QRect(NSAppUnitsToIntPixels(aRect
.x
, p2a
),
55 NSAppUnitsToIntPixels(aRect
.y
, p2a
),
56 NSAppUnitsToIntPixels(aRect
.width
, p2a
),
57 NSAppUnitsToIntPixels(aRect
.height
, p2a
));
60 static inline QImage::Format
61 _qimage_from_gfximage_format (gfxImageFormat aFormat
)
64 case gfxImageFormatARGB32
:
65 return QImage::Format_ARGB32_Premultiplied
;
66 case gfxImageFormatRGB24
:
67 return QImage::Format_RGB32
;
68 case gfxImageFormatRGB16_565
:
69 return QImage::Format_RGB16
;
70 case gfxImageFormatA8
:
71 return QImage::Format_Indexed8
;
72 case gfxImageFormatA1
:
73 #ifdef WORDS_BIGENDIAN
74 return QImage::Format_Mono
;
76 return QImage::Format_MonoLSB
;
79 return QImage::Format_Invalid
;
82 return QImage::Format_Mono
;
86 nsNativeThemeQt::DrawWidgetBackground(nsRenderingContext
* aContext
,
90 const nsRect
& aClipRect
)
92 gfxContext
* context
= aContext
->ThebesContext();
93 nsRefPtr
<gfxASurface
> surface
= context
->CurrentSurface();
95 #ifdef CAIRO_HAS_QT_SURFACE
96 if (surface
->GetType() == gfxSurfaceTypeQPainter
) {
97 gfxQPainterSurface
* qSurface
= (gfxQPainterSurface
*) (surface
.get());
98 QPainter
*painter
= qSurface
->GetQPainter();
99 NS_ASSERTION(painter
, "Where'd my QPainter go?");
101 return NS_ERROR_FAILURE
;
102 return DrawWidgetBackground(painter
, aContext
,
107 if (surface
->GetType() == gfxSurfaceTypeImage
) {
108 gfxImageSurface
* qSurface
= (gfxImageSurface
*) (surface
.get());
109 QImage
tempQImage(qSurface
->Data(),
113 _qimage_from_gfximage_format(qSurface
->Format()));
114 QPainter
painter(&tempQImage
);
115 return DrawWidgetBackground(&painter
, aContext
,
119 #if defined(MOZ_X11) && defined(Q_WS_X11)
120 else if (surface
->GetType() == gfxSurfaceTypeXlib
) {
121 gfxXlibSurface
* qSurface
= (gfxXlibSurface
*) (surface
.get());
122 QPixmap
pixmap(QPixmap::fromX11Pixmap(qSurface
->XDrawable()));
123 QPainter
painter(&pixmap
);
124 return DrawWidgetBackground(&painter
, aContext
,
130 return NS_ERROR_NOT_IMPLEMENTED
;
134 nsNativeThemeQt::DrawWidgetBackground(QPainter
*qPainter
,
135 nsRenderingContext
* aContext
,
139 const nsRect
& aClipRect
)
142 gfxContext
* context
= aContext
->ThebesContext();
143 nsRefPtr
<gfxASurface
> surface
= context
->CurrentSurface();
145 context
->UpdateSurfaceClip();
147 QStyle
* style
= qApp
->style();
151 gfxPoint offs
= surface
->GetDeviceOffset();
152 qPainter
->translate(offs
.x
, offs
.y
);
154 gfxMatrix ctm
= context
->CurrentMatrix();
155 if (!ctm
.HasNonTranslation()) {
156 ctm
.x0
= NSToCoordRound(ctm
.x0
);
157 ctm
.y0
= NSToCoordRound(ctm
.y0
);
160 QMatrix
qctm(ctm
.xx
, ctm
.yx
, ctm
.xy
, ctm
.yy
, ctm
.x0
, ctm
.y0
);
161 qPainter
->setWorldMatrix(qctm
, true);
163 int32_t p2a
= aContext
->AppUnitsPerDevPixel();
165 QRect r
= qRectInPixels(aRect
, p2a
);
166 QRect cr
= qRectInPixels(aClipRect
, p2a
);
168 QStyle::State extraFlags
= QStyle::State_None
;
170 switch (aWidgetType
) {
172 case NS_THEME_CHECKBOX
: {
173 QStyleOptionButton opt
;
174 InitButtonStyle (aWidgetType
, aFrame
, r
, opt
);
176 if (aWidgetType
== NS_THEME_CHECKBOX
)
178 style
->drawPrimitive (QStyle::PE_IndicatorCheckBox
, &opt
, qPainter
);
180 style
->drawPrimitive (QStyle::PE_IndicatorRadioButton
, &opt
, qPainter
);
184 case NS_THEME_BUTTON
:
185 case NS_THEME_BUTTON_BEVEL
: {
186 QStyleOptionButton opt
;
187 InitButtonStyle (aWidgetType
, aFrame
, r
, opt
);
189 if (aWidgetType
== NS_THEME_BUTTON
) {
190 style
->drawPrimitive(QStyle::PE_PanelButtonCommand
, &opt
, qPainter
);
191 if (IsDefaultButton(aFrame
))
192 style
->drawPrimitive(QStyle::PE_FrameDefaultButton
, &opt
, qPainter
);
194 style
->drawPrimitive(QStyle::PE_PanelButtonBevel
, &opt
, qPainter
);
195 style
->drawPrimitive(QStyle::PE_FrameButtonBevel
, &opt
, qPainter
);
199 case NS_THEME_SCROLLBAR
: {
200 qPainter
->fillRect(r
, qApp
->palette().brush(QPalette::Normal
, QPalette::Window
));
203 case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL
: {
204 qPainter
->fillRect(r
, qApp
->palette().brush(QPalette::Active
, QPalette::Window
));
207 case NS_THEME_SCROLLBAR_TRACK_VERTICAL
: {
208 qPainter
->fillRect(r
, qApp
->palette().brush(QPalette::Active
, QPalette::Window
));
211 case NS_THEME_SCROLLBAR_BUTTON_LEFT
: {
212 QStyleOptionSlider opt
;
213 InitPlainStyle(aWidgetType
, aFrame
, r
, (QStyleOption
&)opt
, QStyle::State_Horizontal
);
214 opt
.orientation
= Qt::Horizontal
;
215 style
->drawControl(QStyle::CE_ScrollBarSubLine
, &opt
, qPainter
, nullptr);
218 case NS_THEME_SCROLLBAR_BUTTON_RIGHT
: {
219 QStyleOptionSlider opt
;
220 InitPlainStyle(aWidgetType
, aFrame
, r
, (QStyleOption
&)opt
, QStyle::State_Horizontal
);
221 opt
.orientation
= Qt::Horizontal
;
222 style
->drawControl(QStyle::CE_ScrollBarAddLine
, &opt
, qPainter
, nullptr);
225 case NS_THEME_SCROLLBAR_BUTTON_UP
: {
226 QStyleOptionSlider opt
;
227 InitPlainStyle(aWidgetType
, aFrame
, r
, (QStyleOption
&)opt
);
228 opt
.orientation
= Qt::Vertical
;
229 style
->drawControl(QStyle::CE_ScrollBarSubLine
, &opt
, qPainter
, nullptr);
232 case NS_THEME_SCROLLBAR_BUTTON_DOWN
: {
233 QStyleOptionSlider opt
;
234 InitPlainStyle(aWidgetType
, aFrame
, r
, (QStyleOption
&)opt
);
235 opt
.orientation
= Qt::Vertical
;
236 style
->drawControl(QStyle::CE_ScrollBarAddLine
, &opt
, qPainter
, nullptr);
239 case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL
: {
240 extraFlags
|= QStyle::State_Horizontal
;
241 QStyleOptionSlider option
;
242 InitPlainStyle(aWidgetType
, aFrame
, r
, (QStyleOption
&)option
, extraFlags
);
243 option
.orientation
= Qt::Horizontal
;
244 style
->drawControl(QStyle::CE_ScrollBarSlider
, &option
, qPainter
, nullptr);
247 case NS_THEME_SCROLLBAR_THUMB_VERTICAL
: {
248 QStyleOptionSlider option
;
249 InitPlainStyle(aWidgetType
, aFrame
, r
, (QStyleOption
&)option
, extraFlags
);
250 option
.orientation
= Qt::Vertical
;
251 style
->drawControl(QStyle::CE_ScrollBarSlider
, &option
, qPainter
, nullptr);
254 case NS_THEME_DROPDOWN
: {
255 QStyleOptionComboBox comboOpt
;
257 InitComboStyle(aWidgetType
, aFrame
, r
, comboOpt
);
259 style
->drawComplexControl(QStyle::CC_ComboBox
, &comboOpt
, qPainter
);
262 case NS_THEME_DROPDOWN_BUTTON
: {
263 QStyleOptionComboBox option
;
265 InitComboStyle(aWidgetType
, aFrame
, r
, option
);
267 style
->drawPrimitive(QStyle::PE_FrameDefaultButton
, &option
, qPainter
);
268 style
->drawPrimitive(QStyle::PE_IndicatorSpinDown
, &option
, qPainter
);
271 case NS_THEME_DROPDOWN_TEXT
:
272 case NS_THEME_DROPDOWN_TEXTFIELD
:
273 case NS_THEME_NUMBER_INPUT
:
274 case NS_THEME_TEXTFIELD
:
275 case NS_THEME_TEXTFIELD_MULTILINE
:
276 case NS_THEME_LISTBOX
: {
277 QStyleOptionFrameV2 frameOpt
;
278 nsEventStates eventState
= GetContentState(aFrame
, aWidgetType
);
280 if (!IsDisabled(aFrame
, eventState
))
281 frameOpt
.state
|= QStyle::State_Enabled
;
284 frameOpt
.features
= QStyleOptionFrameV2::Flat
;
286 if (aWidgetType
== NS_THEME_NUMBER_INPUT
||
287 aWidgetType
== NS_THEME_TEXTFIELD
||
288 aWidgetType
== NS_THEME_TEXTFIELD_MULTILINE
) {
289 QRect contentRect
= style
->subElementRect(QStyle::SE_LineEditContents
, &frameOpt
);
290 contentRect
.adjust(mFrameWidth
, mFrameWidth
, -mFrameWidth
, -mFrameWidth
);
291 qPainter
->fillRect(contentRect
, QBrush(Qt::white
));
294 frameOpt
.palette
= mNoBackgroundPalette
;
295 style
->drawPrimitive(QStyle::PE_FrameLineEdit
, &frameOpt
, qPainter
, nullptr);
298 case NS_THEME_MENUPOPUP
: {
299 QStyleOptionMenuItem option
;
300 InitPlainStyle(aWidgetType
, aFrame
, r
, (QStyleOption
&)option
, extraFlags
);
301 style
->drawPrimitive(QStyle::PE_FrameMenu
, &option
, qPainter
, nullptr);
313 nsNativeThemeQt::GetWidgetBorder(nsDeviceContext
* ,
316 nsIntMargin
* aResult
)
318 (*aResult
).top
= (*aResult
).bottom
= (*aResult
).left
= (*aResult
).right
= 0;
320 QStyle
* style
= qApp
->style();
321 switch(aWidgetType
) {
322 // case NS_THEME_TEXTFIELD:
323 // case NS_THEME_LISTBOX:
324 case NS_THEME_MENUPOPUP
: {
325 (*aResult
).top
= (*aResult
).bottom
= (*aResult
).left
= (*aResult
).right
= style
->pixelMetric(QStyle::PM_MenuPanelWidth
);
336 nsNativeThemeQt::GetWidgetPadding(nsDeviceContext
* ,
337 nsIFrame
*, uint8_t aWidgetType
,
338 nsIntMargin
* aResult
)
340 // XXX: Where to get padding values, framewidth?
341 if (aWidgetType
== NS_THEME_NUMBER_INPUT
||
342 aWidgetType
== NS_THEME_TEXTFIELD
||
343 aWidgetType
== NS_THEME_TEXTFIELD_MULTILINE
||
344 aWidgetType
== NS_THEME_DROPDOWN
) {
345 aResult
->SizeTo(2, 2, 2, 2);
353 nsNativeThemeQt::GetMinimumWidgetSize(nsRenderingContext
* aContext
, nsIFrame
* aFrame
,
355 nsIntSize
* aResult
, bool* aIsOverridable
)
357 (*aResult
).width
= (*aResult
).height
= 0;
358 *aIsOverridable
= true;
360 QStyle
*s
= qApp
->style();
362 int32_t p2a
= aContext
->AppUnitsPerDevPixel();
364 switch (aWidgetType
) {
366 case NS_THEME_CHECKBOX
: {
367 nsRect frameRect
= aFrame
->GetRect();
369 QRect qRect
= qRectInPixels(frameRect
, p2a
);
371 QStyleOptionButton option
;
373 InitButtonStyle(aWidgetType
, aFrame
, qRect
, option
);
375 QRect rect
= s
->subElementRect(
376 (aWidgetType
== NS_THEME_CHECKBOX
) ?
377 QStyle::SE_CheckBoxIndicator
:
378 QStyle::SE_RadioButtonIndicator
,
382 (*aResult
).width
= rect
.width();
383 (*aResult
).height
= rect
.height();
386 case NS_THEME_BUTTON
: {
387 nsRect frameRect
= aFrame
->GetRect();
389 QRect qRect
= qRectInPixels(frameRect
, p2a
);
391 QStyleOptionButton option
;
393 InitButtonStyle(aWidgetType
, aFrame
, qRect
, option
);
395 QRect rect
= s
->subElementRect(
396 QStyle::SE_PushButtonFocusRect
,
400 (*aResult
).width
= rect
.width();
401 (*aResult
).height
= rect
.height();
404 case NS_THEME_SCROLLBAR_BUTTON_UP
:
405 case NS_THEME_SCROLLBAR_BUTTON_DOWN
: {
406 (*aResult
).width
= s
->pixelMetric(QStyle::PM_ScrollBarExtent
);
407 (*aResult
).height
= (*aResult
).width
;
408 //*aIsOverridable = false;
411 case NS_THEME_SCROLLBAR_BUTTON_LEFT
:
412 case NS_THEME_SCROLLBAR_BUTTON_RIGHT
: {
413 (*aResult
).height
= s
->pixelMetric(QStyle::PM_ScrollBarExtent
);
414 (*aResult
).width
= (*aResult
).height
;
415 //*aIsOverridable = false;
418 case NS_THEME_SCROLLBAR_THUMB_VERTICAL
: {
419 (*aResult
).width
= s
->pixelMetric(QStyle::PM_ScrollBarExtent
);
420 (*aResult
).height
= s
->pixelMetric(QStyle::PM_ScrollBarSliderMin
);
421 //*aIsOverridable = false;
424 case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL
: {
425 (*aResult
).width
= s
->pixelMetric(QStyle::PM_ScrollBarSliderMin
);
426 (*aResult
).height
= s
->pixelMetric(QStyle::PM_ScrollBarExtent
);
427 //*aIsOverridable = false;
430 case NS_THEME_SCROLLBAR_TRACK_VERTICAL
: {
431 (*aResult
).width
= s
->pixelMetric(QStyle::PM_ScrollBarExtent
);
432 (*aResult
).height
= s
->pixelMetric(QStyle::PM_SliderLength
);
435 case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL
: {
436 (*aResult
).width
= s
->pixelMetric(QStyle::PM_SliderLength
);
437 (*aResult
).height
= s
->pixelMetric(QStyle::PM_ScrollBarExtent
);
440 case NS_THEME_DROPDOWN_BUTTON
: {
441 QStyleOptionComboBox comboOpt
;
443 nsRect frameRect
= aFrame
->GetRect();
444 QRect qRect
= qRectInPixels(frameRect
, p2a
);
445 comboOpt
.rect
= qRect
;
447 InitComboStyle(aWidgetType
, aFrame
, qRect
, comboOpt
);
449 QRect subRect
= s
->subControlRect(QStyle::CC_ComboBox
, &comboOpt
,
450 QStyle::SC_ComboBoxArrow
, nullptr);
452 (*aResult
).width
= subRect
.width();
453 (*aResult
).height
= subRect
.height();
454 //*aIsOverridable = false;
457 case NS_THEME_DROPDOWN
: {
458 QStyleOptionComboBox comboOpt
;
460 nsRect frameRect
= aFrame
->GetRect();
461 QRect qRect
= qRectInPixels(frameRect
, p2a
);
462 comboOpt
.rect
= qRect
;
464 InitComboStyle(aWidgetType
, aFrame
, qRect
, comboOpt
);
466 QRect subRect
= s
->subControlRect(QStyle::CC_ComboBox
,
468 QStyle::SC_ComboBoxFrame
,
471 (*aResult
).width
= subRect
.width();
472 (*aResult
).height
= subRect
.height();
473 //*aIsOverridable = false;
476 case NS_THEME_DROPDOWN_TEXT
: {
477 QStyleOptionComboBox comboOpt
;
479 nsRect frameRect
= aFrame
->GetRect();
481 QRect qRect
= qRectInPixels(frameRect
, p2a
);
483 comboOpt
.rect
= qRect
;
485 QRect subRect
= s
->subControlRect(QStyle::CC_ComboBox
, &comboOpt
,
486 QStyle::SC_ComboBoxEditField
, nullptr);
488 (*aResult
).width
= subRect
.width();
489 (*aResult
).height
= subRect
.height();
490 //*aIsOverridable = false;
493 case NS_THEME_DROPDOWN_TEXTFIELD
: {
494 QStyleOptionComboBox comboOpt
;
496 nsRect frameRect
= aFrame
->GetRect();
498 QRect qRect
= qRectInPixels(frameRect
, p2a
);
500 comboOpt
.rect
= qRect
;
502 QRect subRect
= s
->subControlRect(QStyle::CC_ComboBox
, &comboOpt
,
503 QStyle::SC_ComboBoxArrow
, nullptr);
504 QRect subRect2
= s
->subControlRect(QStyle::CC_ComboBox
, &comboOpt
,
505 QStyle::SC_ComboBoxFrame
, nullptr);
507 (*aResult
).width
= subRect
.width() + subRect2
.width();
508 (*aResult
).height
= std::max(subRect
.height(), subRect2
.height());
509 //*aIsOverridable = false;
512 case NS_THEME_NUMBER_INPUT
:
513 case NS_THEME_TEXTFIELD
:
514 case NS_THEME_TEXTFIELD_MULTILINE
:
521 nsNativeThemeQt::WidgetStateChanged(nsIFrame
* aFrame
, uint8_t aWidgetType
,
522 nsIAtom
* aAttribute
, bool* aShouldRepaint
)
524 *aShouldRepaint
= true;
530 nsNativeThemeQt::ThemeChanged()
532 QStyle
*s
= qApp
->style();
534 mFrameWidth
= s
->pixelMetric(QStyle::PM_DefaultFrameWidth
);
539 nsNativeThemeQt::ThemeSupportsWidget(nsPresContext
* aPresContext
,
543 switch (aWidgetType
) {
544 case NS_THEME_SCROLLBAR
:
545 case NS_THEME_SCROLLBAR_BUTTON_UP
:
546 case NS_THEME_SCROLLBAR_BUTTON_DOWN
:
547 case NS_THEME_SCROLLBAR_BUTTON_LEFT
:
548 case NS_THEME_SCROLLBAR_BUTTON_RIGHT
:
549 case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL
:
550 case NS_THEME_SCROLLBAR_THUMB_VERTICAL
:
551 //case NS_THEME_SCROLLBAR_GRIPPER_HORIZONTAL:
552 //case NS_THEME_SCROLLBAR_GRIPPER_VERTICAL:
553 case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL
:
554 case NS_THEME_SCROLLBAR_TRACK_VERTICAL
:
556 case NS_THEME_CHECKBOX
:
557 case NS_THEME_BUTTON_BEVEL
:
558 case NS_THEME_BUTTON
:
559 case NS_THEME_DROPDOWN
:
560 case NS_THEME_DROPDOWN_BUTTON
:
561 case NS_THEME_DROPDOWN_TEXT
:
562 case NS_THEME_DROPDOWN_TEXTFIELD
:
563 case NS_THEME_NUMBER_INPUT
:
564 case NS_THEME_TEXTFIELD
:
565 case NS_THEME_TEXTFIELD_MULTILINE
:
566 case NS_THEME_LISTBOX
:
567 case NS_THEME_MENUPOPUP
:
568 return !IsWidgetStyled(aPresContext
, aFrame
, aWidgetType
);
576 nsNativeThemeQt::WidgetIsContainer(uint8_t aWidgetType
)
578 // if (aWidgetType == NS_THEME_DROPDOWN_BUTTON ||
579 // aWidgetType == NS_THEME_RADIO ||
580 // aWidgetType == NS_THEME_CHECKBOX) {
588 nsNativeThemeQt::ThemeDrawsFocusForWidget(uint8_t aWidgetType
)
590 if (aWidgetType
== NS_THEME_DROPDOWN
||
591 aWidgetType
== NS_THEME_BUTTON
||
592 aWidgetType
== NS_THEME_TREEVIEW_HEADER_CELL
) {
600 nsNativeThemeQt::ThemeNeedsComboboxDropmarker()
606 nsNativeThemeQt::InitButtonStyle(uint8_t aWidgetType
,
609 QStyleOptionButton
&opt
)
611 nsEventStates eventState
= GetContentState(aFrame
, aWidgetType
);
614 opt
.palette
= mNoBackgroundPalette
;
616 bool isDisabled
= IsDisabled(aFrame
, eventState
);
619 opt
.state
|= QStyle::State_Enabled
;
620 if (eventState
.HasState(NS_EVENT_STATE_HOVER
))
621 opt
.state
|= QStyle::State_MouseOver
;
622 if (eventState
.HasState(NS_EVENT_STATE_FOCUS
))
623 opt
.state
|= QStyle::State_HasFocus
;
624 if (!isDisabled
&& eventState
.HasState(NS_EVENT_STATE_ACTIVE
))
625 // Don't allow sunken when disabled
626 opt
.state
|= QStyle::State_Sunken
;
628 switch (aWidgetType
) {
630 case NS_THEME_CHECKBOX
:
631 if (IsChecked(aFrame
))
632 opt
.state
|= QStyle::State_On
;
634 opt
.state
|= QStyle::State_Off
;
638 if (!eventState
.HasState(NS_EVENT_STATE_ACTIVE
))
639 opt
.state
|= QStyle::State_Raised
;
645 nsNativeThemeQt::InitPlainStyle(uint8_t aWidgetType
,
649 QStyle::State extraFlags
)
651 nsEventStates eventState
= GetContentState(aFrame
, aWidgetType
);
655 if (!IsDisabled(aFrame
, eventState
))
656 opt
.state
|= QStyle::State_Enabled
;
657 if (eventState
.HasState(NS_EVENT_STATE_HOVER
))
658 opt
.state
|= QStyle::State_MouseOver
;
659 if (eventState
.HasState(NS_EVENT_STATE_FOCUS
))
660 opt
.state
|= QStyle::State_HasFocus
;
662 opt
.state
|= extraFlags
;
666 nsNativeThemeQt::InitComboStyle(uint8_t aWidgetType
,
669 QStyleOptionComboBox
&opt
)
671 nsEventStates eventState
= GetContentState(aFrame
, aWidgetType
);
672 bool isDisabled
= IsDisabled(aFrame
, eventState
);
675 opt
.state
|= QStyle::State_Enabled
;
676 if (eventState
.HasState(NS_EVENT_STATE_HOVER
))
677 opt
.state
|= QStyle::State_MouseOver
;
678 if (eventState
.HasState(NS_EVENT_STATE_FOCUS
))
679 opt
.state
|= QStyle::State_HasFocus
;
680 if (!eventState
.HasState(NS_EVENT_STATE_ACTIVE
))
681 opt
.state
|= QStyle::State_Raised
;
682 if (!isDisabled
&& eventState
.HasState(NS_EVENT_STATE_ACTIVE
))
683 // Don't allow sunken when disabled
684 opt
.state
|= QStyle::State_Sunken
;
687 opt
.palette
= mNoBackgroundPalette
;