2008-04-19 08:43:48 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
2012-05-21 04:12:37 -07:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2008-04-19 08:43:48 -07:00
|
|
|
|
2008-04-19 08:44:16 -07:00
|
|
|
#include <QStyle>
|
2008-04-19 09:07:29 -07:00
|
|
|
#include <QPalette>
|
2008-04-19 08:44:16 -07:00
|
|
|
|
2008-04-19 08:43:48 -07:00
|
|
|
#include "nsITheme.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIAtom.h"
|
|
|
|
#include "nsNativeTheme.h"
|
|
|
|
|
|
|
|
class QComboBox;
|
2008-04-19 08:44:07 -07:00
|
|
|
class QStyleOptionButton;
|
2008-04-21 07:48:12 -07:00
|
|
|
class QStyleOptionComboBox;
|
2008-04-19 08:44:07 -07:00
|
|
|
class QRect;
|
|
|
|
class nsIFrame;
|
2011-04-16 18:22:44 -07:00
|
|
|
class nsDeviceContext;
|
2008-04-19 08:43:48 -07:00
|
|
|
|
|
|
|
class nsNativeThemeQt : private nsNativeTheme,
|
|
|
|
public nsITheme
|
|
|
|
{
|
|
|
|
public:
|
2010-11-13 00:19:38 -08:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2008-04-19 08:43:48 -07:00
|
|
|
|
|
|
|
// The nsITheme interface.
|
2011-04-07 18:04:40 -07:00
|
|
|
NS_IMETHOD DrawWidgetBackground(nsRenderingContext* aContext,
|
2008-04-19 08:43:48 -07:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint8_t aWidgetType,
|
2008-04-19 08:43:48 -07:00
|
|
|
const nsRect& aRect,
|
|
|
|
const nsRect& aClipRect);
|
|
|
|
|
2011-04-16 18:22:44 -07:00
|
|
|
NS_IMETHOD GetWidgetBorder(nsDeviceContext* aContext,
|
2008-04-19 08:43:48 -07:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint8_t aWidgetType,
|
2009-02-11 05:51:06 -08:00
|
|
|
nsIntMargin* aResult);
|
2008-04-19 08:43:48 -07:00
|
|
|
|
2011-04-07 18:04:40 -07:00
|
|
|
NS_IMETHOD GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* aFrame,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint8_t aWidgetType,
|
2009-02-11 05:51:06 -08:00
|
|
|
nsIntSize* aResult,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool* aIsOverridable);
|
2008-04-19 08:43:48 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType,
|
2011-09-28 23:19:26 -07:00
|
|
|
nsIAtom* aAttribute, bool* aShouldRepaint);
|
2008-04-19 08:43:48 -07:00
|
|
|
|
|
|
|
NS_IMETHOD ThemeChanged();
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool ThemeSupportsWidget(nsPresContext* aPresContext,
|
2008-04-19 08:43:48 -07:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint8_t aWidgetType);
|
2008-04-19 08:43:48 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
bool WidgetIsContainer(uint8_t aWidgetType);
|
2008-04-19 08:43:48 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual NS_HIDDEN_(bool) GetWidgetPadding(nsDeviceContext* aContext,
|
2008-04-19 08:43:48 -07:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint8_t aWidgetType,
|
2009-02-11 05:51:06 -08:00
|
|
|
nsIntMargin* aResult);
|
2008-04-19 08:43:48 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD_(bool) ThemeDrawsFocusForWidget(nsPresContext* aPresContext,
|
2012-08-22 08:56:38 -07:00
|
|
|
nsIFrame* aFrame, uint8_t aWidgetType);
|
2008-04-19 08:43:48 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool ThemeNeedsComboboxDropmarker();
|
2008-04-19 08:43:48 -07:00
|
|
|
|
|
|
|
nsNativeThemeQt();
|
|
|
|
virtual ~nsNativeThemeQt();
|
|
|
|
|
|
|
|
private:
|
2008-04-19 08:44:07 -07:00
|
|
|
|
2010-02-19 19:46:54 -08:00
|
|
|
inline nsresult DrawWidgetBackground(QPainter *qPainter,
|
2011-04-07 18:04:40 -07:00
|
|
|
nsRenderingContext* aContext,
|
2010-02-19 19:46:54 -08:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint8_t aWidgetType,
|
2010-02-19 19:46:54 -08:00
|
|
|
const nsRect& aRect,
|
|
|
|
const nsRect& aClipRect);
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
void InitButtonStyle(uint8_t widgetType,
|
2008-04-19 09:07:29 -07:00
|
|
|
nsIFrame* aFrame,
|
|
|
|
QRect rect,
|
|
|
|
QStyleOptionButton &opt);
|
2008-04-19 08:44:16 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
void InitPlainStyle(uint8_t aWidgetType,
|
2008-04-19 09:07:29 -07:00
|
|
|
nsIFrame* aFrame,
|
|
|
|
QRect rect,
|
|
|
|
QStyleOption &opt,
|
|
|
|
QStyle::State extraFlags = QStyle::State_None);
|
2008-04-19 08:44:07 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
void InitComboStyle(uint8_t aWidgetType,
|
2008-04-21 07:48:12 -07:00
|
|
|
nsIFrame* aFrame,
|
|
|
|
QRect rect,
|
2008-04-22 02:42:28 -07:00
|
|
|
QStyleOptionComboBox &opt);
|
2008-04-19 08:44:07 -07:00
|
|
|
|
2008-04-21 07:48:12 -07:00
|
|
|
private:
|
2008-04-19 08:44:07 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mFrameWidth;
|
2008-04-19 08:44:07 -07:00
|
|
|
|
2008-04-19 09:07:29 -07:00
|
|
|
QPalette mNoBackgroundPalette;
|
2008-04-19 08:43:48 -07:00
|
|
|
};
|
|
|
|
|