1 module webkit2webextension.DOMCSSRule;
2 
3 private import glib.ErrorG;
4 private import glib.GException;
5 private import glib.Str;
6 private import gobject.ObjectG;
7 private import webkit2webextension.DOMCSSStyleSheet;
8 private import webkit2webextension.DOMObject;
9 private import webkit2webextension.c.functions;
10 public  import webkit2webextension.c.types;
11 
12 
13 /** */
14 public class DOMCSSRule : DOMObject
15 {
16 	/** the main Gtk struct */
17 	protected WebKitDOMCSSRule* webKitDOMCSSRule;
18 
19 	/** Get the main Gtk struct */
20 	public WebKitDOMCSSRule* getDOMCSSRuleStruct(bool transferOwnership = false)
21 	{
22 		if (transferOwnership)
23 			ownedRef = false;
24 		return webKitDOMCSSRule;
25 	}
26 
27 	/** the main Gtk struct as a void* */
28 	protected override void* getStruct()
29 	{
30 		return cast(void*)webKitDOMCSSRule;
31 	}
32 
33 	/**
34 	 * Sets our main struct and passes it to the parent class.
35 	 */
36 	public this (WebKitDOMCSSRule* webKitDOMCSSRule, bool ownedRef = false)
37 	{
38 		this.webKitDOMCSSRule = webKitDOMCSSRule;
39 		super(cast(WebKitDOMObject*)webKitDOMCSSRule, ownedRef);
40 	}
41 
42 
43 	/** */
44 	public static GType getType()
45 	{
46 		return webkit_dom_css_rule_get_type();
47 	}
48 
49 	/**
50 	 *
51 	 *
52 	 * Deprecated: Use JavaScriptCore API instead
53 	 *
54 	 * Returns: A #gchar
55 	 */
56 	public string getCssText()
57 	{
58 		auto retStr = webkit_dom_css_rule_get_css_text(webKitDOMCSSRule);
59 
60 		scope(exit) Str.freeString(retStr);
61 		return Str.toString(retStr);
62 	}
63 
64 	/**
65 	 *
66 	 *
67 	 * Deprecated: Use JavaScriptCore API instead
68 	 *
69 	 * Returns: A #WebKitDOMCSSRule
70 	 */
71 	public DOMCSSRule getParentRule()
72 	{
73 		auto __p = webkit_dom_css_rule_get_parent_rule(webKitDOMCSSRule);
74 
75 		if(__p is null)
76 		{
77 			return null;
78 		}
79 
80 		return ObjectG.getDObject!(DOMCSSRule)(cast(WebKitDOMCSSRule*) __p, true);
81 	}
82 
83 	/**
84 	 *
85 	 *
86 	 * Deprecated: Use JavaScriptCore API instead
87 	 *
88 	 * Returns: A #WebKitDOMCSSStyleSheet
89 	 */
90 	public DOMCSSStyleSheet getParentStyleSheet()
91 	{
92 		auto __p = webkit_dom_css_rule_get_parent_style_sheet(webKitDOMCSSRule);
93 
94 		if(__p is null)
95 		{
96 			return null;
97 		}
98 
99 		return ObjectG.getDObject!(DOMCSSStyleSheet)(cast(WebKitDOMCSSStyleSheet*) __p, true);
100 	}
101 
102 	/**
103 	 *
104 	 *
105 	 * Deprecated: Use JavaScriptCore API instead
106 	 *
107 	 * Returns: A #gushort
108 	 */
109 	public ushort getRuleType()
110 	{
111 		return webkit_dom_css_rule_get_rule_type(webKitDOMCSSRule);
112 	}
113 
114 	/**
115 	 *
116 	 *
117 	 * Deprecated: Use JavaScriptCore API instead
118 	 *
119 	 * Params:
120 	 *     value = A #gchar
121 	 *
122 	 * Throws: GException on failure.
123 	 */
124 	public void setCssText(string value)
125 	{
126 		GError* err = null;
127 
128 		webkit_dom_css_rule_set_css_text(webKitDOMCSSRule, Str.toStringz(value), &err);
129 
130 		if (err !is null)
131 		{
132 			throw new GException( new ErrorG(err) );
133 		}
134 	}
135 }