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