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/. */
6 
7 
8 #ifndef WidgetStyleCache_h
9 #define WidgetStyleCache_h
10 
11 #include <gtk/gtk.h>
12 #include "gtkdrawing.h"
13 
14 
15 typedef unsigned StyleFlags;
16 enum : StyleFlags {
17   NO_STYLE_FLAGS,
18   WHATEVER_MIGHT_BE_NEEDED = 1U << 0,
19 };
20 
21 GtkWidget*
22 GetWidget(WidgetNodeType aNodeType);
23 
24 /*
25  * Return a new style context based on aWidget, as a child of aParentStyle.
26  * If aWidget still has a floating reference, then it is sunk and released.
27  */
28 GtkStyleContext*
29 CreateStyleForWidget(GtkWidget* aWidget, GtkStyleContext* aParentStyle);
30 
31 GtkStyleContext*
32 CreateCSSNode(const char*      aName,
33               GtkStyleContext* aParentStyle,
34               GType            aType = G_TYPE_NONE);
35 
36 // Callers must call ReleaseStyleContext() on the returned context.
37 GtkStyleContext*
38 ClaimStyleContext(WidgetNodeType aNodeType,
39                   GtkTextDirection aDirection = GTK_TEXT_DIR_NONE,
40                   GtkStateFlags aStateFlags = GTK_STATE_FLAG_NORMAL,
41                   StyleFlags aFlags = NO_STYLE_FLAGS);
42 void
43 ReleaseStyleContext(GtkStyleContext* style);
44 
45 void
46 ResetWidgetCache(void);
47 
48 #endif // WidgetStyleCache_h
49