2005-08-20 11:11:56 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
2012-05-21 15:12:37 +04: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/. */
|
2005-08-20 11:11:56 +04:00
|
|
|
|
2013-12-16 04:00:54 +04:00
|
|
|
#ifndef nsNativeThemeWin_h
|
|
|
|
#define nsNativeThemeWin_h
|
|
|
|
|
2005-08-20 11:11:56 +04:00
|
|
|
#include "nsITheme.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIAtom.h"
|
2005-08-20 11:14:03 +04:00
|
|
|
#include "nsNativeTheme.h"
|
2013-02-25 04:27:22 +04:00
|
|
|
#include "gfxTypes.h"
|
2005-08-20 11:11:56 +04:00
|
|
|
#include <windows.h>
|
2013-02-25 04:27:10 +04:00
|
|
|
#include "mozilla/TimeStamp.h"
|
2015-03-29 17:59:08 +03:00
|
|
|
#include "nsSize.h"
|
2005-08-20 11:11:56 +04:00
|
|
|
|
2005-08-20 11:14:03 +04:00
|
|
|
class nsNativeThemeWin : private nsNativeTheme,
|
|
|
|
public nsITheme {
|
2014-07-16 00:37:58 +04:00
|
|
|
virtual ~nsNativeThemeWin();
|
|
|
|
|
2005-08-20 11:11:56 +04:00
|
|
|
public:
|
2013-02-25 04:27:10 +04:00
|
|
|
typedef mozilla::TimeStamp TimeStamp;
|
|
|
|
typedef mozilla::TimeDuration TimeDuration;
|
|
|
|
|
2010-11-13 11:19:38 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2005-08-20 11:11:56 +04:00
|
|
|
|
|
|
|
// The nsITheme interface.
|
2011-04-08 05:04:40 +04:00
|
|
|
NS_IMETHOD DrawWidgetBackground(nsRenderingContext* aContext,
|
2005-08-20 11:11:56 +04:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t aWidgetType,
|
2005-08-20 11:11:56 +04:00
|
|
|
const nsRect& aRect,
|
2015-12-16 19:58:46 +03:00
|
|
|
const nsRect& aDirtyRect) override;
|
2005-08-20 11:11:56 +04:00
|
|
|
|
2011-04-17 05:22:44 +04:00
|
|
|
NS_IMETHOD GetWidgetBorder(nsDeviceContext* aContext,
|
2005-08-20 11:11:57 +04:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t aWidgetType,
|
2015-12-16 19:58:46 +03:00
|
|
|
nsIntMargin* aResult) override;
|
2005-08-20 11:11:56 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool GetWidgetPadding(nsDeviceContext* aContext,
|
2005-08-20 11:14:07 +04:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t aWidgetType,
|
2015-12-16 19:58:46 +03:00
|
|
|
nsIntMargin* aResult) override;
|
2005-08-20 11:14:07 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool GetWidgetOverflow(nsDeviceContext* aContext,
|
2008-02-29 08:10:12 +03:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t aWidgetType,
|
2015-12-16 19:58:46 +03:00
|
|
|
nsRect* aOverflowRect) override;
|
2008-02-29 08:10:12 +03:00
|
|
|
|
2014-06-27 13:19:00 +04:00
|
|
|
NS_IMETHOD GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t aWidgetType,
|
2015-03-30 18:36:14 +03:00
|
|
|
mozilla::LayoutDeviceIntSize* aResult,
|
2015-12-16 19:58:46 +03:00
|
|
|
bool* aIsOverridable) override;
|
2005-08-20 11:11:56 +04:00
|
|
|
|
2015-12-16 19:58:46 +03:00
|
|
|
virtual Transparency GetWidgetTransparency(nsIFrame* aFrame, uint8_t aWidgetType) override;
|
2008-12-11 17:37:38 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType,
|
2015-12-16 19:58:46 +03:00
|
|
|
nsIAtom* aAttribute, bool* aShouldRepaint) override;
|
2005-08-20 11:11:56 +04:00
|
|
|
|
2015-12-16 19:58:46 +03:00
|
|
|
NS_IMETHOD ThemeChanged() override;
|
2005-08-20 11:11:56 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool ThemeSupportsWidget(nsPresContext* aPresContext,
|
2005-08-20 11:12:55 +04:00
|
|
|
nsIFrame* aFrame,
|
2015-12-16 19:58:46 +03:00
|
|
|
uint8_t aWidgetType) override;
|
2005-08-20 11:11:56 +04:00
|
|
|
|
2015-12-16 19:58:46 +03:00
|
|
|
bool WidgetIsContainer(uint8_t aWidgetType) override;
|
2005-08-20 11:12:07 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
bool ThemeDrawsFocusForWidget(uint8_t aWidgetType) override;
|
2007-02-16 04:53:43 +03:00
|
|
|
|
2015-12-16 19:58:46 +03:00
|
|
|
bool ThemeNeedsComboboxDropmarker() override;
|
2007-05-18 07:04:04 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool WidgetAppearanceDependsOnWindowFocus(uint8_t aWidgetType) override;
|
2013-09-27 19:24:32 +04:00
|
|
|
|
2015-02-05 01:25:18 +03:00
|
|
|
enum {
|
|
|
|
eThemeGeometryTypeWindowButtons = eThemeGeometryTypeUnknown + 1
|
|
|
|
};
|
|
|
|
virtual ThemeGeometryType ThemeGeometryTypeForWidget(nsIFrame* aFrame,
|
2015-03-21 19:28:04 +03:00
|
|
|
uint8_t aWidgetType) override;
|
2015-02-05 01:25:18 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool ShouldHideScrollbars() override;
|
2013-12-03 22:21:09 +04:00
|
|
|
|
2005-08-20 11:11:56 +04:00
|
|
|
nsNativeThemeWin();
|
|
|
|
|
|
|
|
protected:
|
2012-08-22 19:56:38 +04:00
|
|
|
HANDLE GetTheme(uint8_t aWidgetType);
|
|
|
|
nsresult GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType,
|
|
|
|
int32_t& aPart, int32_t& aState);
|
|
|
|
nsresult ClassicGetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType,
|
2013-02-25 04:27:10 +04:00
|
|
|
int32_t& aPart, int32_t& aState, bool& aFocused);
|
2011-04-08 05:04:40 +04:00
|
|
|
nsresult ClassicDrawWidgetBackground(nsRenderingContext* aContext,
|
2013-02-25 04:27:10 +04:00
|
|
|
nsIFrame* aFrame,
|
|
|
|
uint8_t aWidgetType,
|
|
|
|
const nsRect& aRect,
|
|
|
|
const nsRect& aClipRect);
|
|
|
|
nsresult ClassicGetWidgetBorder(nsDeviceContext* aContext,
|
2005-08-20 11:13:11 +04:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t aWidgetType,
|
2013-02-25 04:27:10 +04:00
|
|
|
nsIntMargin* aResult);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool ClassicGetWidgetPadding(nsDeviceContext* aContext,
|
2013-02-25 04:27:10 +04:00
|
|
|
nsIFrame* aFrame,
|
|
|
|
uint8_t aWidgetType,
|
|
|
|
nsIntMargin* aResult);
|
2015-12-07 04:15:53 +03:00
|
|
|
nsresult ClassicGetMinimumWidgetSize(nsIFrame* aFrame, uint8_t aWidgetType,
|
2015-03-30 18:36:14 +03:00
|
|
|
mozilla::LayoutDeviceIntSize* aResult,
|
2013-02-25 04:27:10 +04:00
|
|
|
bool* aIsOverridable);
|
2015-12-07 04:15:53 +03:00
|
|
|
bool ClassicThemeSupportsWidget(nsIFrame* aFrame, uint8_t aWidgetType);
|
2012-08-22 19:56:38 +04:00
|
|
|
void DrawCheckedRect(HDC hdc, const RECT& rc, int32_t fore, int32_t back,
|
2006-05-30 17:50:48 +04:00
|
|
|
HBRUSH defaultBack);
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t GetWidgetNativeDrawingFlags(uint8_t aWidgetType);
|
|
|
|
int32_t StandardGetState(nsIFrame* aFrame, uint8_t aWidgetType, bool wantFocused);
|
|
|
|
bool IsMenuActive(nsIFrame* aFrame, uint8_t aWidgetType);
|
2013-02-25 04:27:10 +04:00
|
|
|
RECT CalculateProgressOverlayRect(nsIFrame* aFrame, RECT* aWidgetRect,
|
|
|
|
bool aIsVertical, bool aIsIndeterminate,
|
|
|
|
bool aIsClassic);
|
2013-02-25 04:27:22 +04:00
|
|
|
void DrawThemedProgressMeter(nsIFrame* aFrame, int aWidgetType,
|
|
|
|
HANDLE aTheme, HDC aHdc,
|
|
|
|
int aPart, int aState,
|
|
|
|
RECT* aWidgetRect, RECT* aClipRect,
|
|
|
|
gfxFloat aAppUnits);
|
2013-02-25 04:27:10 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
TimeStamp mProgressDeterminateTimeStamp;
|
|
|
|
TimeStamp mProgressIndeterminateTimeStamp;
|
2005-08-20 11:11:56 +04:00
|
|
|
};
|
2013-12-16 04:00:54 +04:00
|
|
|
|
|
|
|
#endif
|