michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsITheme.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIAtom.h" michael@0: #include "nsIObserver.h" michael@0: #include "nsNativeTheme.h" michael@0: michael@0: #include michael@0: #include "gtkdrawing.h" michael@0: michael@0: class nsNativeThemeGTK: private nsNativeTheme, michael@0: public nsITheme, michael@0: public nsIObserver { michael@0: public: michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: michael@0: NS_DECL_NSIOBSERVER michael@0: michael@0: // The nsITheme interface. michael@0: NS_IMETHOD DrawWidgetBackground(nsRenderingContext* aContext, michael@0: nsIFrame* aFrame, uint8_t aWidgetType, michael@0: const nsRect& aRect, michael@0: const nsRect& aDirtyRect); michael@0: michael@0: NS_IMETHOD GetWidgetBorder(nsDeviceContext* aContext, nsIFrame* aFrame, michael@0: uint8_t aWidgetType, nsIntMargin* aResult); michael@0: michael@0: virtual NS_HIDDEN_(bool) GetWidgetPadding(nsDeviceContext* aContext, michael@0: nsIFrame* aFrame, michael@0: uint8_t aWidgetType, michael@0: nsIntMargin* aResult); michael@0: michael@0: virtual NS_HIDDEN_(bool) GetWidgetOverflow(nsDeviceContext* aContext, michael@0: nsIFrame* aFrame, michael@0: uint8_t aWidgetType, michael@0: nsRect* aOverflowRect); michael@0: michael@0: NS_IMETHOD GetMinimumWidgetSize(nsRenderingContext* aContext, michael@0: nsIFrame* aFrame, uint8_t aWidgetType, michael@0: nsIntSize* aResult, bool* aIsOverridable); michael@0: michael@0: NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType, michael@0: nsIAtom* aAttribute, bool* aShouldRepaint); michael@0: michael@0: NS_IMETHOD ThemeChanged(); michael@0: michael@0: NS_IMETHOD_(bool) ThemeSupportsWidget(nsPresContext* aPresContext, michael@0: nsIFrame* aFrame, michael@0: uint8_t aWidgetType); michael@0: michael@0: NS_IMETHOD_(bool) WidgetIsContainer(uint8_t aWidgetType); michael@0: michael@0: NS_IMETHOD_(bool) ThemeDrawsFocusForWidget(uint8_t aWidgetType) MOZ_OVERRIDE; michael@0: michael@0: bool ThemeNeedsComboboxDropmarker(); michael@0: michael@0: virtual Transparency GetWidgetTransparency(nsIFrame* aFrame, michael@0: uint8_t aWidgetType); michael@0: michael@0: nsNativeThemeGTK(); michael@0: virtual ~nsNativeThemeGTK(); michael@0: michael@0: private: michael@0: gint GetTabMarginPixels(nsIFrame* aFrame); michael@0: bool GetGtkWidgetAndState(uint8_t aWidgetType, nsIFrame* aFrame, michael@0: GtkThemeWidgetType& aGtkWidgetType, michael@0: GtkWidgetState* aState, gint* aWidgetFlags); michael@0: bool GetExtraSizeForWidget(nsIFrame* aFrame, uint8_t aWidgetType, michael@0: nsIntMargin* aExtra); michael@0: michael@0: void RefreshWidgetWindow(nsIFrame* aFrame); michael@0: michael@0: uint8_t mDisabledWidgetTypes[32]; michael@0: uint8_t mSafeWidgetStates[1024]; // 256 widgets * 32 bits per widget michael@0: static const char* sDisabledEngines[]; michael@0: };