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