widget/gtk/nsNativeThemeGTK.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #include "nsITheme.h"
     7 #include "nsCOMPtr.h"
     8 #include "nsIAtom.h"
     9 #include "nsIObserver.h"
    10 #include "nsNativeTheme.h"
    12 #include <gtk/gtk.h>
    13 #include "gtkdrawing.h"
    15 class nsNativeThemeGTK: private nsNativeTheme,
    16                         public nsITheme,
    17                         public nsIObserver {
    18 public:
    19   NS_DECL_ISUPPORTS_INHERITED
    21   NS_DECL_NSIOBSERVER
    23   // The nsITheme interface.
    24   NS_IMETHOD DrawWidgetBackground(nsRenderingContext* aContext,
    25                                   nsIFrame* aFrame, uint8_t aWidgetType,
    26                                   const nsRect& aRect,
    27                                   const nsRect& aDirtyRect);
    29   NS_IMETHOD GetWidgetBorder(nsDeviceContext* aContext, nsIFrame* aFrame,
    30                              uint8_t aWidgetType, nsIntMargin* aResult);
    32   virtual NS_HIDDEN_(bool) GetWidgetPadding(nsDeviceContext* aContext,
    33                                               nsIFrame* aFrame,
    34                                               uint8_t aWidgetType,
    35                                               nsIntMargin* aResult);
    37   virtual NS_HIDDEN_(bool) GetWidgetOverflow(nsDeviceContext* aContext,
    38                                                nsIFrame* aFrame,
    39                                                uint8_t aWidgetType,
    40                                                nsRect* aOverflowRect);
    42   NS_IMETHOD GetMinimumWidgetSize(nsRenderingContext* aContext,
    43                                   nsIFrame* aFrame, uint8_t aWidgetType,
    44                                   nsIntSize* aResult, bool* aIsOverridable);
    46   NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType, 
    47                                 nsIAtom* aAttribute, bool* aShouldRepaint);
    49   NS_IMETHOD ThemeChanged();
    51   NS_IMETHOD_(bool) ThemeSupportsWidget(nsPresContext* aPresContext,
    52                                           nsIFrame* aFrame,
    53                                           uint8_t aWidgetType);
    55   NS_IMETHOD_(bool) WidgetIsContainer(uint8_t aWidgetType);
    57   NS_IMETHOD_(bool) ThemeDrawsFocusForWidget(uint8_t aWidgetType) MOZ_OVERRIDE;
    59   bool ThemeNeedsComboboxDropmarker();
    61   virtual Transparency GetWidgetTransparency(nsIFrame* aFrame,
    62                                              uint8_t aWidgetType);
    64   nsNativeThemeGTK();
    65   virtual ~nsNativeThemeGTK();
    67 private:
    68   gint GetTabMarginPixels(nsIFrame* aFrame);
    69   bool GetGtkWidgetAndState(uint8_t aWidgetType, nsIFrame* aFrame,
    70                               GtkThemeWidgetType& aGtkWidgetType,
    71                               GtkWidgetState* aState, gint* aWidgetFlags);
    72   bool GetExtraSizeForWidget(nsIFrame* aFrame, uint8_t aWidgetType,
    73                                nsIntMargin* aExtra);
    75   void RefreshWidgetWindow(nsIFrame* aFrame);
    77   uint8_t mDisabledWidgetTypes[32];
    78   uint8_t mSafeWidgetStates[1024];    // 256 widgets * 32 bits per widget
    79   static const char* sDisabledEngines[];
    80 };

mercurial