widget/windows/nsNativeThemeWin.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  *
     3  * This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef nsNativeThemeWin_h
     8 #define nsNativeThemeWin_h
    10 #include "nsITheme.h"
    11 #include "nsCOMPtr.h"
    12 #include "nsIAtom.h"
    13 #include "nsNativeTheme.h"
    14 #include "gfxTypes.h"
    15 #include <windows.h>
    16 #include "mozilla/TimeStamp.h"
    18 struct nsIntRect;
    19 struct nsIntSize;
    21 class nsNativeThemeWin : private nsNativeTheme,
    22                          public nsITheme {
    23 public:
    24   typedef mozilla::TimeStamp TimeStamp;
    25   typedef mozilla::TimeDuration TimeDuration;
    27   NS_DECL_ISUPPORTS_INHERITED
    29   // The nsITheme interface.
    30   NS_IMETHOD DrawWidgetBackground(nsRenderingContext* aContext,
    31                                   nsIFrame* aFrame,
    32                                   uint8_t aWidgetType,
    33                                   const nsRect& aRect,
    34                                   const nsRect& aDirtyRect);
    36   NS_IMETHOD GetWidgetBorder(nsDeviceContext* aContext, 
    37                              nsIFrame* aFrame,
    38                              uint8_t aWidgetType,
    39                              nsIntMargin* aResult);
    41   virtual bool GetWidgetPadding(nsDeviceContext* aContext,
    42                                   nsIFrame* aFrame,
    43                                   uint8_t aWidgetType,
    44                                   nsIntMargin* aResult);
    46   virtual bool GetWidgetOverflow(nsDeviceContext* aContext,
    47                                    nsIFrame* aFrame,
    48                                    uint8_t aWidgetType,
    49                                    nsRect* aOverflowRect);
    51   NS_IMETHOD GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* aFrame,
    52                                   uint8_t aWidgetType,
    53                                   nsIntSize* aResult,
    54                                   bool* aIsOverridable);
    56   virtual Transparency GetWidgetTransparency(nsIFrame* aFrame, uint8_t aWidgetType);
    58   NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType, 
    59                                 nsIAtom* aAttribute, bool* aShouldRepaint);
    61   NS_IMETHOD ThemeChanged();
    63   bool ThemeSupportsWidget(nsPresContext* aPresContext, 
    64                              nsIFrame* aFrame,
    65                              uint8_t aWidgetType);
    67   bool WidgetIsContainer(uint8_t aWidgetType);
    69   bool ThemeDrawsFocusForWidget(uint8_t aWidgetType) MOZ_OVERRIDE;
    71   bool ThemeNeedsComboboxDropmarker();
    73   virtual bool WidgetAppearanceDependsOnWindowFocus(uint8_t aWidgetType) MOZ_OVERRIDE;
    75   virtual bool ShouldHideScrollbars() MOZ_OVERRIDE;
    77   nsNativeThemeWin();
    78   virtual ~nsNativeThemeWin();
    80 protected:
    81   HANDLE GetTheme(uint8_t aWidgetType);
    82   nsresult GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType,
    83                                 int32_t& aPart, int32_t& aState);
    84   nsresult ClassicGetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType,
    85                                        int32_t& aPart, int32_t& aState, bool& aFocused);
    86   nsresult ClassicDrawWidgetBackground(nsRenderingContext* aContext,
    87                                        nsIFrame* aFrame,
    88                                        uint8_t aWidgetType,
    89                                        const nsRect& aRect,
    90                                        const nsRect& aClipRect);
    91   nsresult ClassicGetWidgetBorder(nsDeviceContext* aContext, 
    92                                   nsIFrame* aFrame,
    93                                   uint8_t aWidgetType,
    94                                   nsIntMargin* aResult);
    95   bool ClassicGetWidgetPadding(nsDeviceContext* aContext,
    96                                nsIFrame* aFrame,
    97                                uint8_t aWidgetType,
    98                                nsIntMargin* aResult);
    99   nsresult ClassicGetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* aFrame,
   100                                        uint8_t aWidgetType,
   101                                        nsIntSize* aResult,
   102                                        bool* aIsOverridable);
   103   bool ClassicThemeSupportsWidget(nsPresContext* aPresContext, 
   104                                   nsIFrame* aFrame,
   105                                   uint8_t aWidgetType);
   106   void DrawCheckedRect(HDC hdc, const RECT& rc, int32_t fore, int32_t back,
   107                        HBRUSH defaultBack);
   108   uint32_t GetWidgetNativeDrawingFlags(uint8_t aWidgetType);
   109   int32_t StandardGetState(nsIFrame* aFrame, uint8_t aWidgetType, bool wantFocused);
   110   bool IsMenuActive(nsIFrame* aFrame, uint8_t aWidgetType);
   111   RECT CalculateProgressOverlayRect(nsIFrame* aFrame, RECT* aWidgetRect,
   112                                     bool aIsVertical, bool aIsIndeterminate,
   113                                     bool aIsClassic);
   114   void DrawThemedProgressMeter(nsIFrame* aFrame, int aWidgetType,
   115                                HANDLE aTheme, HDC aHdc,
   116                                int aPart, int aState,
   117                                RECT* aWidgetRect, RECT* aClipRect,
   118                                gfxFloat aAppUnits);
   120 private:
   121   TimeStamp mProgressDeterminateTimeStamp;
   122   TimeStamp mProgressIndeterminateTimeStamp;
   123 };
   125 #endif

mercurial