2005-08-20 11:11:46 +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:46 +04:00
|
|
|
|
2014-10-02 06:01:21 +04:00
|
|
|
#ifndef _GTK_NSNATIVETHEMEGTK_H_
|
|
|
|
#define _GTK_NSNATIVETHEMEGTK_H_
|
|
|
|
|
2005-08-20 11:11:46 +04:00
|
|
|
#include "nsITheme.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2017-10-03 01:05:19 +03:00
|
|
|
#include "nsAtom.h"
|
2005-08-20 11:13:34 +04:00
|
|
|
#include "nsIObserver.h"
|
2005-08-20 11:14:11 +04:00
|
|
|
#include "nsNativeTheme.h"
|
2018-07-25 16:03:45 +03:00
|
|
|
#include "nsStyleConsts.h"
|
2005-08-20 11:12:11 +04:00
|
|
|
|
2009-01-03 10:37:52 +03:00
|
|
|
#include <gtk/gtk.h>
|
2005-08-20 11:13:04 +04:00
|
|
|
#include "gtkdrawing.h"
|
2005-08-20 11:11:46 +04:00
|
|
|
|
2017-06-07 08:27:18 +03:00
|
|
|
class nsNativeThemeGTK final : private nsNativeTheme,
|
|
|
|
public nsITheme,
|
|
|
|
public nsIObserver {
|
2005-08-20 11:11:46 +04:00
|
|
|
public:
|
2010-11-13 11:19:38 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2012-03-08 05:15:57 +04:00
|
|
|
|
|
|
|
NS_DECL_NSIOBSERVER
|
2005-08-20 11:13:34 +04:00
|
|
|
|
2005-08-20 11:11:46 +04:00
|
|
|
// The nsITheme interface.
|
2017-06-09 22:14:53 +03:00
|
|
|
NS_IMETHOD DrawWidgetBackground(gfxContext* aContext, nsIFrame* aFrame,
|
2018-10-24 18:24:57 +03:00
|
|
|
StyleAppearance aAppearance,
|
2005-08-20 11:11:46 +04:00
|
|
|
const nsRect& aRect,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsRect& aDirtyRect) override;
|
2005-08-20 11:11:46 +04:00
|
|
|
|
2018-01-22 16:01:09 +03:00
|
|
|
bool CreateWebRenderCommandsForWidget(
|
|
|
|
mozilla::wr::DisplayListBuilder& aBuilder,
|
|
|
|
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
|
|
|
const mozilla::layers::StackingContextHelper& aSc,
|
2019-01-08 00:33:10 +03:00
|
|
|
mozilla::layers::RenderRootStateManager* aManager, nsIFrame* aFrame,
|
2018-01-22 16:01:09 +03:00
|
|
|
StyleAppearance aAppearance, const nsRect& aRect) override;
|
|
|
|
|
2018-06-02 20:10:48 +03:00
|
|
|
MOZ_MUST_USE LayoutDeviceIntMargin
|
|
|
|
GetWidgetBorder(nsDeviceContext* aContext, nsIFrame* aFrame,
|
2018-10-24 18:24:57 +03:00
|
|
|
StyleAppearance aAppearance) override;
|
2005-08-20 11:11:46 +04:00
|
|
|
|
2018-05-17 18:30:35 +03:00
|
|
|
bool GetWidgetPadding(nsDeviceContext* aContext, nsIFrame* aFrame,
|
2018-10-24 18:24:57 +03:00
|
|
|
StyleAppearance aAppearance,
|
2018-06-02 20:10:48 +03:00
|
|
|
LayoutDeviceIntMargin* aResult) override;
|
2005-08-20 11:14:07 +04:00
|
|
|
|
2014-06-02 16:08:21 +04:00
|
|
|
virtual bool GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame* aFrame,
|
2018-10-24 18:24:57 +03:00
|
|
|
StyleAppearance aAppearance,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsRect* aOverflowRect) override;
|
2005-09-01 01:00:52 +04:00
|
|
|
|
2014-06-27 13:19:00 +04:00
|
|
|
NS_IMETHOD GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame,
|
2018-10-24 18:24:57 +03:00
|
|
|
StyleAppearance aAppearance,
|
2015-03-30 18:36:14 +03:00
|
|
|
mozilla::LayoutDeviceIntSize* aResult,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool* aIsOverridable) override;
|
2005-08-20 11:11:46 +04:00
|
|
|
|
2018-10-24 14:47:20 +03:00
|
|
|
NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, StyleAppearance aAppearance,
|
2016-04-21 02:49:09 +03:00
|
|
|
nsAtom* aAttribute, bool* aShouldRepaint,
|
|
|
|
const nsAttrValue* aOldValue) override;
|
2005-08-20 11:11:46 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD ThemeChanged() override;
|
2005-08-20 11:11:46 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD_(bool)
|
|
|
|
ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* aFrame,
|
2018-10-24 18:24:57 +03:00
|
|
|
StyleAppearance aAppearance) override;
|
2005-08-20 11:11:46 +04:00
|
|
|
|
2018-10-24 18:24:57 +03:00
|
|
|
NS_IMETHOD_(bool) WidgetIsContainer(StyleAppearance aAppearance) override;
|
2017-12-19 13:38:59 +03:00
|
|
|
|
2018-10-24 18:24:57 +03:00
|
|
|
NS_IMETHOD_(bool)
|
|
|
|
ThemeDrawsFocusForWidget(StyleAppearance aAppearance) override;
|
2005-08-20 11:11:46 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool ThemeNeedsComboboxDropmarker() override;
|
2007-05-18 07:04:04 +04:00
|
|
|
|
2010-06-18 05:19:21 +04:00
|
|
|
virtual Transparency GetWidgetTransparency(
|
2018-10-24 18:24:57 +03:00
|
|
|
nsIFrame* aFrame, StyleAppearance aAppearance) override;
|
2018-09-12 14:03:56 +03:00
|
|
|
|
2018-10-24 18:24:57 +03:00
|
|
|
virtual bool WidgetAppearanceDependsOnWindowFocus(
|
|
|
|
StyleAppearance aAppearance) override;
|
2018-09-12 14:03:56 +03:00
|
|
|
|
2005-08-20 11:11:46 +04:00
|
|
|
nsNativeThemeGTK();
|
2014-07-09 01:23:18 +04:00
|
|
|
|
|
|
|
protected:
|
2005-08-20 11:11:46 +04:00
|
|
|
virtual ~nsNativeThemeGTK();
|
|
|
|
|
2005-08-20 11:14:11 +04:00
|
|
|
private:
|
2016-10-20 07:57:55 +03:00
|
|
|
GtkTextDirection GetTextDirection(nsIFrame* aFrame);
|
2010-07-15 02:31:41 +04:00
|
|
|
gint GetTabMarginPixels(nsIFrame* aFrame);
|
2018-10-24 18:24:57 +03:00
|
|
|
bool GetGtkWidgetAndState(StyleAppearance aAppearance, nsIFrame* aFrame,
|
2016-04-14 08:47:20 +03:00
|
|
|
WidgetNodeType& aGtkWidgetType,
|
2018-10-24 14:47:20 +03:00
|
|
|
GtkWidgetState* aState, gint* aWidgetFlags);
|
|
|
|
bool GetExtraSizeForWidget(nsIFrame* aFrame, StyleAppearance aAppearance,
|
|
|
|
nsIntMargin* aExtra);
|
2018-12-18 13:48:28 +03:00
|
|
|
bool IsWidgetVisible(StyleAppearance aAppearance);
|
2005-08-20 11:12:27 +04:00
|
|
|
|
2005-08-20 11:14:11 +04:00
|
|
|
void RefreshWidgetWindow(nsIFrame* aFrame);
|
2018-10-24 18:24:57 +03:00
|
|
|
WidgetNodeType NativeThemeToGtkTheme(StyleAppearance aAppearance,
|
2018-10-24 14:47:20 +03:00
|
|
|
nsIFrame* aFrame);
|
2005-08-20 11:11:46 +04:00
|
|
|
|
2018-07-25 16:03:45 +03:00
|
|
|
uint8_t mDisabledWidgetTypes
|
|
|
|
[(static_cast<size_t>(mozilla::StyleAppearance::Count) + 7) / 8];
|
|
|
|
uint8_t
|
|
|
|
mSafeWidgetStates[static_cast<size_t>(mozilla::StyleAppearance::Count) *
|
|
|
|
4]; // 32 bits per widget
|
2005-08-20 11:13:00 +04:00
|
|
|
static const char* sDisabledEngines[];
|
2017-06-07 08:27:17 +03:00
|
|
|
|
2017-06-07 08:27:18 +03:00
|
|
|
// Because moz_gtk_get_widget_border can be slow, we cache its results
|
|
|
|
// by widget type. Each bit in mBorderCacheValid says whether the
|
|
|
|
// corresponding entry in mBorderCache is valid.
|
2018-10-24 14:47:20 +03:00
|
|
|
void GetCachedWidgetBorder(nsIFrame* aFrame, StyleAppearance aAppearance,
|
2018-05-17 18:30:35 +03:00
|
|
|
GtkTextDirection aDirection,
|
2018-06-02 20:10:48 +03:00
|
|
|
LayoutDeviceIntMargin* aResult);
|
2017-06-07 08:27:18 +03:00
|
|
|
uint8_t mBorderCacheValid[(MOZ_GTK_WIDGET_NODE_COUNT + 7) / 8];
|
2018-06-02 20:10:48 +03:00
|
|
|
LayoutDeviceIntMargin mBorderCache[MOZ_GTK_WIDGET_NODE_COUNT];
|
2005-08-20 11:11:46 +04:00
|
|
|
};
|
2014-10-02 06:01:21 +04:00
|
|
|
|
|
|
|
#endif
|