widget/windows/nsNativeThemeWin.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/windows/nsNativeThemeWin.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,125 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + *
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef nsNativeThemeWin_h
    1.11 +#define nsNativeThemeWin_h
    1.12 +
    1.13 +#include "nsITheme.h"
    1.14 +#include "nsCOMPtr.h"
    1.15 +#include "nsIAtom.h"
    1.16 +#include "nsNativeTheme.h"
    1.17 +#include "gfxTypes.h"
    1.18 +#include <windows.h>
    1.19 +#include "mozilla/TimeStamp.h"
    1.20 +
    1.21 +struct nsIntRect;
    1.22 +struct nsIntSize;
    1.23 +
    1.24 +class nsNativeThemeWin : private nsNativeTheme,
    1.25 +                         public nsITheme {
    1.26 +public:
    1.27 +  typedef mozilla::TimeStamp TimeStamp;
    1.28 +  typedef mozilla::TimeDuration TimeDuration;
    1.29 +
    1.30 +  NS_DECL_ISUPPORTS_INHERITED
    1.31 +
    1.32 +  // The nsITheme interface.
    1.33 +  NS_IMETHOD DrawWidgetBackground(nsRenderingContext* aContext,
    1.34 +                                  nsIFrame* aFrame,
    1.35 +                                  uint8_t aWidgetType,
    1.36 +                                  const nsRect& aRect,
    1.37 +                                  const nsRect& aDirtyRect);
    1.38 +
    1.39 +  NS_IMETHOD GetWidgetBorder(nsDeviceContext* aContext, 
    1.40 +                             nsIFrame* aFrame,
    1.41 +                             uint8_t aWidgetType,
    1.42 +                             nsIntMargin* aResult);
    1.43 +
    1.44 +  virtual bool GetWidgetPadding(nsDeviceContext* aContext,
    1.45 +                                  nsIFrame* aFrame,
    1.46 +                                  uint8_t aWidgetType,
    1.47 +                                  nsIntMargin* aResult);
    1.48 +
    1.49 +  virtual bool GetWidgetOverflow(nsDeviceContext* aContext,
    1.50 +                                   nsIFrame* aFrame,
    1.51 +                                   uint8_t aWidgetType,
    1.52 +                                   nsRect* aOverflowRect);
    1.53 +
    1.54 +  NS_IMETHOD GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* aFrame,
    1.55 +                                  uint8_t aWidgetType,
    1.56 +                                  nsIntSize* aResult,
    1.57 +                                  bool* aIsOverridable);
    1.58 +
    1.59 +  virtual Transparency GetWidgetTransparency(nsIFrame* aFrame, uint8_t aWidgetType);
    1.60 +
    1.61 +  NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType, 
    1.62 +                                nsIAtom* aAttribute, bool* aShouldRepaint);
    1.63 +
    1.64 +  NS_IMETHOD ThemeChanged();
    1.65 +
    1.66 +  bool ThemeSupportsWidget(nsPresContext* aPresContext, 
    1.67 +                             nsIFrame* aFrame,
    1.68 +                             uint8_t aWidgetType);
    1.69 +
    1.70 +  bool WidgetIsContainer(uint8_t aWidgetType);
    1.71 +
    1.72 +  bool ThemeDrawsFocusForWidget(uint8_t aWidgetType) MOZ_OVERRIDE;
    1.73 +
    1.74 +  bool ThemeNeedsComboboxDropmarker();
    1.75 +
    1.76 +  virtual bool WidgetAppearanceDependsOnWindowFocus(uint8_t aWidgetType) MOZ_OVERRIDE;
    1.77 +
    1.78 +  virtual bool ShouldHideScrollbars() MOZ_OVERRIDE;
    1.79 +
    1.80 +  nsNativeThemeWin();
    1.81 +  virtual ~nsNativeThemeWin();
    1.82 +
    1.83 +protected:
    1.84 +  HANDLE GetTheme(uint8_t aWidgetType);
    1.85 +  nsresult GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType,
    1.86 +                                int32_t& aPart, int32_t& aState);
    1.87 +  nsresult ClassicGetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType,
    1.88 +                                       int32_t& aPart, int32_t& aState, bool& aFocused);
    1.89 +  nsresult ClassicDrawWidgetBackground(nsRenderingContext* aContext,
    1.90 +                                       nsIFrame* aFrame,
    1.91 +                                       uint8_t aWidgetType,
    1.92 +                                       const nsRect& aRect,
    1.93 +                                       const nsRect& aClipRect);
    1.94 +  nsresult ClassicGetWidgetBorder(nsDeviceContext* aContext, 
    1.95 +                                  nsIFrame* aFrame,
    1.96 +                                  uint8_t aWidgetType,
    1.97 +                                  nsIntMargin* aResult);
    1.98 +  bool ClassicGetWidgetPadding(nsDeviceContext* aContext,
    1.99 +                               nsIFrame* aFrame,
   1.100 +                               uint8_t aWidgetType,
   1.101 +                               nsIntMargin* aResult);
   1.102 +  nsresult ClassicGetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* aFrame,
   1.103 +                                       uint8_t aWidgetType,
   1.104 +                                       nsIntSize* aResult,
   1.105 +                                       bool* aIsOverridable);
   1.106 +  bool ClassicThemeSupportsWidget(nsPresContext* aPresContext, 
   1.107 +                                  nsIFrame* aFrame,
   1.108 +                                  uint8_t aWidgetType);
   1.109 +  void DrawCheckedRect(HDC hdc, const RECT& rc, int32_t fore, int32_t back,
   1.110 +                       HBRUSH defaultBack);
   1.111 +  uint32_t GetWidgetNativeDrawingFlags(uint8_t aWidgetType);
   1.112 +  int32_t StandardGetState(nsIFrame* aFrame, uint8_t aWidgetType, bool wantFocused);
   1.113 +  bool IsMenuActive(nsIFrame* aFrame, uint8_t aWidgetType);
   1.114 +  RECT CalculateProgressOverlayRect(nsIFrame* aFrame, RECT* aWidgetRect,
   1.115 +                                    bool aIsVertical, bool aIsIndeterminate,
   1.116 +                                    bool aIsClassic);
   1.117 +  void DrawThemedProgressMeter(nsIFrame* aFrame, int aWidgetType,
   1.118 +                               HANDLE aTheme, HDC aHdc,
   1.119 +                               int aPart, int aState,
   1.120 +                               RECT* aWidgetRect, RECT* aClipRect,
   1.121 +                               gfxFloat aAppUnits);
   1.122 +
   1.123 +private:
   1.124 +  TimeStamp mProgressDeterminateTimeStamp;
   1.125 +  TimeStamp mProgressIndeterminateTimeStamp;
   1.126 +};
   1.127 +
   1.128 +#endif

mercurial