2005-08-20 11:11:46 +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/. */
|
2005-08-20 11:11:46 +04:00
|
|
|
|
|
|
|
#include "nsITheme.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIAtom.h"
|
2005-08-20 11:13:34 +04:00
|
|
|
#include "nsIObserver.h"
|
2005-08-20 11:14:11 +04:00
|
|
|
#include "nsNativeTheme.h"
|
2005-08-20 11:12:11 +04:00
|
|
|
|
2009-01-03 10:37:52 +03:00
|
|
|
#include <gtk/gtk.h>
|
2005-08-20 11:13:04 +04:00
|
|
|
#include "gtkdrawing.h"
|
2005-08-20 11:11:46 +04:00
|
|
|
|
2005-08-20 11:14:11 +04:00
|
|
|
class nsNativeThemeGTK: private nsNativeTheme,
|
2012-03-08 05:15:57 +04:00
|
|
|
public nsITheme,
|
|
|
|
public nsIObserver {
|
2005-08-20 11:11:46 +04:00
|
|
|
public:
|
2010-11-13 11:19:38 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2012-03-08 05:15:57 +04:00
|
|
|
|
|
|
|
NS_DECL_NSIOBSERVER
|
2005-08-20 11:13:34 +04:00
|
|
|
|
2005-08-20 11:11:46 +04:00
|
|
|
// The nsITheme interface.
|
2011-04-08 05:04:40 +04:00
|
|
|
NS_IMETHOD DrawWidgetBackground(nsRenderingContext* aContext,
|
2012-08-22 19:56:38 +04:00
|
|
|
nsIFrame* aFrame, uint8_t aWidgetType,
|
2005-08-20 11:11:46 +04:00
|
|
|
const nsRect& aRect,
|
2008-07-25 03:01:59 +04:00
|
|
|
const nsRect& aDirtyRect);
|
2005-08-20 11:11:46 +04:00
|
|
|
|
2011-04-17 05:22:44 +04:00
|
|
|
NS_IMETHOD GetWidgetBorder(nsDeviceContext* aContext, nsIFrame* aFrame,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t aWidgetType, nsIntMargin* aResult);
|
2005-08-20 11:11:46 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual NS_HIDDEN_(bool) GetWidgetPadding(nsDeviceContext* aContext,
|
2005-08-20 11:14:07 +04:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t aWidgetType,
|
2009-01-15 06:27:09 +03:00
|
|
|
nsIntMargin* aResult);
|
2005-08-20 11:14:07 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual NS_HIDDEN_(bool) GetWidgetOverflow(nsDeviceContext* aContext,
|
2005-09-01 01:00:52 +04:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t aWidgetType,
|
2008-04-02 03:34:20 +04:00
|
|
|
nsRect* aOverflowRect);
|
2005-09-01 01:00:52 +04:00
|
|
|
|
2011-04-08 05:04:40 +04:00
|
|
|
NS_IMETHOD GetMinimumWidgetSize(nsRenderingContext* aContext,
|
2012-08-22 19:56:38 +04:00
|
|
|
nsIFrame* aFrame, uint8_t aWidgetType,
|
2011-09-29 10:19:26 +04:00
|
|
|
nsIntSize* aResult, bool* aIsOverridable);
|
2005-08-20 11:11:46 +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);
|
2005-08-20 11:11:46 +04:00
|
|
|
|
|
|
|
NS_IMETHOD ThemeChanged();
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD_(bool) ThemeSupportsWidget(nsPresContext* aPresContext,
|
2005-08-20 11:13:04 +04:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t aWidgetType);
|
2005-08-20 11:11:46 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD_(bool) WidgetIsContainer(uint8_t aWidgetType);
|
2007-02-16 04:53:43 +03: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);
|
2005-08-20 11:11:46 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool ThemeNeedsComboboxDropmarker();
|
2007-05-18 07:04:04 +04:00
|
|
|
|
2010-06-18 05:19:21 +04:00
|
|
|
virtual Transparency GetWidgetTransparency(nsIFrame* aFrame,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t aWidgetType);
|
2010-06-18 05:19:21 +04:00
|
|
|
|
2005-08-20 11:11:46 +04:00
|
|
|
nsNativeThemeGTK();
|
|
|
|
virtual ~nsNativeThemeGTK();
|
|
|
|
|
2005-08-20 11:14:11 +04:00
|
|
|
private:
|
2010-07-15 02:31:41 +04:00
|
|
|
gint GetTabMarginPixels(nsIFrame* aFrame);
|
2012-08-22 19:56:38 +04:00
|
|
|
bool GetGtkWidgetAndState(uint8_t aWidgetType, nsIFrame* aFrame,
|
2005-08-20 11:13:06 +04:00
|
|
|
GtkThemeWidgetType& aGtkWidgetType,
|
2005-08-20 11:13:04 +04:00
|
|
|
GtkWidgetState* aState, gint* aWidgetFlags);
|
2012-08-22 19:56:38 +04:00
|
|
|
bool GetExtraSizeForWidget(nsIFrame* aFrame, uint8_t aWidgetType,
|
2010-07-15 02:31:41 +04:00
|
|
|
nsIntMargin* aExtra);
|
2005-08-20 11:12:27 +04:00
|
|
|
|
2005-08-20 11:14:11 +04:00
|
|
|
void RefreshWidgetWindow(nsIFrame* aFrame);
|
2005-08-20 11:11:46 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mDisabledWidgetTypes[32];
|
|
|
|
uint8_t mSafeWidgetStates[1024]; // 256 widgets * 32 bits per widget
|
2005-08-20 11:13:00 +04:00
|
|
|
static const char* sDisabledEngines[];
|
2005-08-20 11:11:46 +04:00
|
|
|
};
|