2008-04-19 19:43:48 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
2012-05-21 15:12:37 +04: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 19:43:48 +04:00
|
|
|
|
2008-04-19 19:44:16 +04:00
|
|
|
#include <QStyle>
|
2008-04-19 20:07:29 +04:00
|
|
|
#include <QPalette>
|
2008-04-19 19:44:16 +04:00
|
|
|
|
2008-04-19 19:43:48 +04:00
|
|
|
#include "nsITheme.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIAtom.h"
|
|
|
|
#include "nsNativeTheme.h"
|
|
|
|
|
|
|
|
class QComboBox;
|
2008-04-19 19:44:07 +04:00
|
|
|
class QStyleOptionButton;
|
2008-04-21 18:48:12 +04:00
|
|
|
class QStyleOptionComboBox;
|
2008-04-19 19:44:07 +04:00
|
|
|
class QRect;
|
|
|
|
class nsIFrame;
|
2011-04-17 05:22:44 +04:00
|
|
|
class nsDeviceContext;
|
2008-04-19 19:43:48 +04:00
|
|
|
|
|
|
|
class nsNativeThemeQt : private nsNativeTheme,
|
|
|
|
public nsITheme
|
|
|
|
{
|
|
|
|
public:
|
2010-11-13 11:19:38 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2008-04-19 19:43:48 +04:00
|
|
|
|
|
|
|
// The nsITheme interface.
|
2011-04-08 05:04:40 +04:00
|
|
|
NS_IMETHOD DrawWidgetBackground(nsRenderingContext* aContext,
|
2008-04-19 19:43:48 +04:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t aWidgetType,
|
2008-04-19 19:43:48 +04:00
|
|
|
const nsRect& aRect,
|
|
|
|
const nsRect& aClipRect);
|
|
|
|
|
2011-04-17 05:22:44 +04:00
|
|
|
NS_IMETHOD GetWidgetBorder(nsDeviceContext* aContext,
|
2008-04-19 19:43:48 +04:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t aWidgetType,
|
2009-02-11 16:51:06 +03:00
|
|
|
nsIntMargin* aResult);
|
2008-04-19 19:43:48 +04:00
|
|
|
|
2011-04-08 05:04:40 +04:00
|
|
|
NS_IMETHOD GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* aFrame,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t aWidgetType,
|
2009-02-11 16:51:06 +03:00
|
|
|
nsIntSize* aResult,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool* aIsOverridable);
|
2008-04-19 19:43:48 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType,
|
2011-09-29 10:19:26 +04:00
|
|
|
nsIAtom* aAttribute, bool* aShouldRepaint);
|
2008-04-19 19:43:48 +04:00
|
|
|
|
|
|
|
NS_IMETHOD ThemeChanged();
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool ThemeSupportsWidget(nsPresContext* aPresContext,
|
2008-04-19 19:43:48 +04:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t aWidgetType);
|
2008-04-19 19:43:48 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
bool WidgetIsContainer(uint8_t aWidgetType);
|
2008-04-19 19:43:48 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual NS_HIDDEN_(bool) GetWidgetPadding(nsDeviceContext* aContext,
|
2008-04-19 19:43:48 +04:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t aWidgetType,
|
2009-02-11 16:51:06 +03:00
|
|
|
nsIntMargin* aResult);
|
2008-04-19 19:43:48 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD_(bool) ThemeDrawsFocusForWidget(nsPresContext* aPresContext,
|
2012-08-22 19:56:38 +04:00
|
|
|
nsIFrame* aFrame, uint8_t aWidgetType);
|
2008-04-19 19:43:48 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool ThemeNeedsComboboxDropmarker();
|
2008-04-19 19:43:48 +04:00
|
|
|
|
|
|
|
nsNativeThemeQt();
|
|
|
|
virtual ~nsNativeThemeQt();
|
|
|
|
|
|
|
|
private:
|
2008-04-19 19:44:07 +04:00
|
|
|
|
2010-02-20 06:46:54 +03:00
|
|
|
inline nsresult DrawWidgetBackground(QPainter *qPainter,
|
2011-04-08 05:04:40 +04:00
|
|
|
nsRenderingContext* aContext,
|
2010-02-20 06:46:54 +03:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t aWidgetType,
|
2010-02-20 06:46:54 +03:00
|
|
|
const nsRect& aRect,
|
|
|
|
const nsRect& aClipRect);
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void InitButtonStyle(uint8_t widgetType,
|
2008-04-19 20:07:29 +04:00
|
|
|
nsIFrame* aFrame,
|
|
|
|
QRect rect,
|
|
|
|
QStyleOptionButton &opt);
|
2008-04-19 19:44:16 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void InitPlainStyle(uint8_t aWidgetType,
|
2008-04-19 20:07:29 +04:00
|
|
|
nsIFrame* aFrame,
|
|
|
|
QRect rect,
|
|
|
|
QStyleOption &opt,
|
|
|
|
QStyle::State extraFlags = QStyle::State_None);
|
2008-04-19 19:44:07 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void InitComboStyle(uint8_t aWidgetType,
|
2008-04-21 18:48:12 +04:00
|
|
|
nsIFrame* aFrame,
|
|
|
|
QRect rect,
|
2008-04-22 13:42:28 +04:00
|
|
|
QStyleOptionComboBox &opt);
|
2008-04-19 19:44:07 +04:00
|
|
|
|
2008-04-21 18:48:12 +04:00
|
|
|
private:
|
2008-04-19 19:44:07 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mFrameWidth;
|
2008-04-19 19:44:07 +04:00
|
|
|
|
2008-04-19 20:07:29 +04:00
|
|
|
QPalette mNoBackgroundPalette;
|
2008-04-19 19:43:48 +04:00
|
|
|
};
|
|
|
|
|