1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 WidgetStyleCache_h
8 #define WidgetStyleCache_h
11 #include "gtkdrawing.h"
13 GtkWidget
* GetWidget(WidgetNodeType aNodeType
);
15 cairo_surface_t
* GetWidgetIconSurface(GtkWidget
* aWidgetIcon
, int aScale
);
18 * Return a new style context based on aWidget, as a child of aParentStyle.
19 * If aWidget still has a floating reference, then it is sunk and released.
21 GtkStyleContext
* CreateStyleForWidget(GtkWidget
* aWidget
,
22 GtkStyleContext
* aParentStyle
);
24 GtkStyleContext
* CreateCSSNode(const char* aName
, GtkStyleContext
* aParentStyle
,
25 GType aType
= G_TYPE_NONE
);
28 * Returns a pointer to a style context for the specified node and state.
29 * aStateFlags is applied only to last widget in css style path,
30 * for instance GetStyleContext(MOZ_GTK_BUTTON, .., GTK_STATE_FLAG_HOVER)
31 * you get "window button:hover" css selector.
32 * If you want aStateFlags applied to all path elements use
33 * CreateStyleContextWithStates().
35 * The context is owned by WidgetStyleCache. Do not unref.
37 GtkStyleContext
* GetStyleContext(
38 WidgetNodeType aNodeType
, int aScale
= 1,
39 GtkTextDirection aDirection
= GTK_TEXT_DIR_NONE
,
40 GtkStateFlags aStateFlags
= GTK_STATE_FLAG_NORMAL
);
43 * Returns a pointer to a style context for the specified node
44 * and state applied to all elements at widget style path.
46 * The context is owned by caller and must be released by g_object_unref().
48 GtkStyleContext
* CreateStyleContextWithStates(
49 WidgetNodeType aNodeType
, int aScale
= 1,
50 GtkTextDirection aDirection
= GTK_TEXT_DIR_NONE
,
51 GtkStateFlags aStateFlags
= GTK_STATE_FLAG_NORMAL
);
53 void ResetWidgetCache();
55 bool IsSolidCSDStyleUsed();
57 void StyleContextSetScale(GtkStyleContext
* style
, gint aScaleFactor
);
59 gint
GetBorderRadius(GtkStyleContext
* aStyle
);
61 bool HeaderBarShouldDrawContainer(WidgetNodeType
);
63 #endif // WidgetStyleCache_h