1 module webkit2webextension.DOMCSSStyleSheet;
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.DOMCSSRule;
8 private import webkit2webextension.DOMCSSRuleList;
9 private import webkit2webextension.DOMStyleSheet;
10 private import webkit2webextension.c.functions;
11 public  import webkit2webextension.c.types;
12 
13 
14 /** */
15 public class DOMCSSStyleSheet : DOMStyleSheet
16 {
17 	/** the main Gtk struct */
18 	protected WebKitDOMCSSStyleSheet* webKitDOMCSSStyleSheet;
19 
20 	/** Get the main Gtk struct */
21 	public WebKitDOMCSSStyleSheet* getDOMCSSStyleSheetStruct(bool transferOwnership = false)
22 	{
23 		if (transferOwnership)
24 			ownedRef = false;
25 		return webKitDOMCSSStyleSheet;
26 	}
27 
28 	/** the main Gtk struct as a void* */
29 	protected override void* getStruct()
30 	{
31 		return cast(void*)webKitDOMCSSStyleSheet;
32 	}
33 
34 	/**
35 	 * Sets our main struct and passes it to the parent class.
36 	 */
37 	public this (WebKitDOMCSSStyleSheet* webKitDOMCSSStyleSheet, bool ownedRef = false)
38 	{
39 		this.webKitDOMCSSStyleSheet = webKitDOMCSSStyleSheet;
40 		super(cast(WebKitDOMStyleSheet*)webKitDOMCSSStyleSheet, ownedRef);
41 	}
42 
43 
44 	/** */
45 	public static GType getType()
46 	{
47 		return webkit_dom_css_style_sheet_get_type();
48 	}
49 
50 	/**
51 	 *
52 	 *
53 	 * Deprecated: Use JavaScriptCore API instead
54 	 *
55 	 * Params:
56 	 *     selector = A #gchar
57 	 *     style = A #gchar
58 	 *     index = A #gulong
59 	 *
60 	 * Returns: A #glong
61 	 *
62 	 * Throws: GException on failure.
63 	 */
64 	public glong addRule(string selector, string style, gulong index)
65 	{
66 		GError* err = null;
67 
68 		auto __p = webkit_dom_css_style_sheet_add_rule(webKitDOMCSSStyleSheet, Str.toStringz(selector), Str.toStringz(style), index, &err);
69 
70 		if (err !is null)
71 		{
72 			throw new GException( new ErrorG(err) );
73 		}
74 
75 		return __p;
76 	}
77 
78 	/**
79 	 *
80 	 *
81 	 * Deprecated: Use JavaScriptCore API instead
82 	 *
83 	 * Params:
84 	 *     index = A #gulong
85 	 *
86 	 * Throws: GException on failure.
87 	 */
88 	public void deleteRule(gulong index)
89 	{
90 		GError* err = null;
91 
92 		webkit_dom_css_style_sheet_delete_rule(webKitDOMCSSStyleSheet, index, &err);
93 
94 		if (err !is null)
95 		{
96 			throw new GException( new ErrorG(err) );
97 		}
98 	}
99 
100 	/**
101 	 *
102 	 *
103 	 * Deprecated: Use JavaScriptCore API instead
104 	 *
105 	 * Returns: A #WebKitDOMCSSRuleList
106 	 */
107 	public DOMCSSRuleList getCssRules()
108 	{
109 		auto __p = webkit_dom_css_style_sheet_get_css_rules(webKitDOMCSSStyleSheet);
110 
111 		if(__p is null)
112 		{
113 			return null;
114 		}
115 
116 		return ObjectG.getDObject!(DOMCSSRuleList)(cast(WebKitDOMCSSRuleList*) __p, true);
117 	}
118 
119 	/**
120 	 *
121 	 *
122 	 * Deprecated: Use JavaScriptCore API instead
123 	 *
124 	 * Returns: A #WebKitDOMCSSRule
125 	 */
126 	public DOMCSSRule getOwnerRule()
127 	{
128 		auto __p = webkit_dom_css_style_sheet_get_owner_rule(webKitDOMCSSStyleSheet);
129 
130 		if(__p is null)
131 		{
132 			return null;
133 		}
134 
135 		return ObjectG.getDObject!(DOMCSSRule)(cast(WebKitDOMCSSRule*) __p, true);
136 	}
137 
138 	/**
139 	 *
140 	 *
141 	 * Deprecated: Use JavaScriptCore API instead
142 	 *
143 	 * Returns: A #WebKitDOMCSSRuleList
144 	 */
145 	public DOMCSSRuleList getRules()
146 	{
147 		auto __p = webkit_dom_css_style_sheet_get_rules(webKitDOMCSSStyleSheet);
148 
149 		if(__p is null)
150 		{
151 			return null;
152 		}
153 
154 		return ObjectG.getDObject!(DOMCSSRuleList)(cast(WebKitDOMCSSRuleList*) __p, true);
155 	}
156 
157 	/**
158 	 *
159 	 *
160 	 * Deprecated: Use JavaScriptCore API instead
161 	 *
162 	 * Params:
163 	 *     rule = A #gchar
164 	 *     index = A #gulong
165 	 *
166 	 * Returns: A #gulong
167 	 *
168 	 * Throws: GException on failure.
169 	 */
170 	public gulong insertRule(string rule, gulong index)
171 	{
172 		GError* err = null;
173 
174 		auto __p = webkit_dom_css_style_sheet_insert_rule(webKitDOMCSSStyleSheet, Str.toStringz(rule), index, &err);
175 
176 		if (err !is null)
177 		{
178 			throw new GException( new ErrorG(err) );
179 		}
180 
181 		return __p;
182 	}
183 
184 	/**
185 	 *
186 	 *
187 	 * Deprecated: Use JavaScriptCore API instead
188 	 *
189 	 * Params:
190 	 *     index = A #gulong
191 	 *
192 	 * Throws: GException on failure.
193 	 */
194 	public void removeRule(gulong index)
195 	{
196 		GError* err = null;
197 
198 		webkit_dom_css_style_sheet_remove_rule(webKitDOMCSSStyleSheet, index, &err);
199 
200 		if (err !is null)
201 		{
202 			throw new GException( new ErrorG(err) );
203 		}
204 	}
205 }