2009-08-26 Chris Toshok <toshok@ximian.com>
[moon.git] / src / type.h
blob212a87ab069ed09db9590ce8f7d3a94da325a4b6
1 /*
2 * Automatically generated, do not edit this file directly
3 */
5 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
6 /*
7 * type.h: Generated code for the type system.
9 * Contact:
10 * Moonlight List (moonlight-list@lists.ximian.com)
12 * Copyright 2007 Novell, Inc. (http://www.novell.com)
14 * See the LICENSE file included with the distribution for details.
17 #ifndef __TYPE_H__
18 #define __TYPE_H__
20 #include <glib.h>
21 #include "list.h"
23 class Deployment;
24 class DependencyObject;
25 class DependencyProperty;
26 class Surface;
27 class Types;
29 /* @CBindingRequisite */
30 typedef gint64 TimeSpan;
31 typedef DependencyObject *create_inst_func (void);
33 class Type {
34 public:
35 enum Kind {
36 // START_MANAGED_MAPPING
37 INVALID,
38 ACCESSIBILITY,
39 ALSASOURCE,
40 ANIMATION,
41 ANIMATIONCLOCK,
42 APPLICATION,
43 ARCSEGMENT,
44 ASFDEMUXER,
45 ASFMARKERDECODER,
46 ASFPACKET,
47 ASFPARSER,
48 ASSEMBLYPART,
49 ASSEMBLYPART_COLLECTION,
50 ASXDEMUXER,
51 AUDIOSOURCE,
52 AUDIOSTREAM,
53 BACKEASE,
54 BEGINSTORYBOARD,
55 BEZIERSEGMENT,
56 BITMAPIMAGE,
57 BITMAPSOURCE,
58 BOOL,
59 BORDER,
60 BOUNCEEASE,
61 BRUSH,
62 CANVAS,
63 CHAR,
64 CIRCLEEASE,
65 CLOCK,
66 CLOCKGROUP,
67 CODECDOWNLOADER,
68 COLLECTION,
69 COLLECTIONCHANGEDEVENTARGS,
70 COLLECTIONITEMCHANGEDEVENTARGS,
71 COLOR,
72 COLORANIMATION,
73 COLORANIMATIONUSINGKEYFRAMES,
74 COLORKEYFRAME,
75 COLORKEYFRAME_COLLECTION,
76 COLUMNDEFINITION,
77 COLUMNDEFINITION_COLLECTION,
78 CONTENTCHANGEDEVENTARGS,
79 CONTENTCONTROL,
80 CONTROL,
81 CONTROLTEMPLATE,
82 CORNERRADIUS,
83 CUBICEASE,
84 CURSOR,
85 CURSORPOSITIONCHANGEDEVENTARGS,
86 DATATEMPLATE,
87 DEEPZOOMIMAGETILESOURCE,
88 DEPENDENCY_OBJECT,
89 DEPENDENCY_OBJECT_COLLECTION,
90 DEPENDENCYPROPERTY,
91 DEPLOYMENT,
92 DISCRETECOLORKEYFRAME,
93 DISCRETEDOUBLEKEYFRAME,
94 DISCRETEOBJECTKEYFRAME,
95 DISCRETEPOINTKEYFRAME,
96 DISPATCHERTIMER,
97 DOUBLE,
98 DOUBLE_COLLECTION,
99 DOUBLEANIMATION,
100 DOUBLEANIMATIONUSINGKEYFRAMES,
101 DOUBLEKEYFRAME,
102 DOUBLEKEYFRAME_COLLECTION,
103 DOWNLOADER,
104 DOWNLOADPROGRESSEVENTARGS,
105 DRAWINGATTRIBUTES,
106 DURATION,
107 EASINGCOLORKEYFRAME,
108 EASINGDOUBLEKEYFRAME,
109 EASINGFUNCTIONBASE,
110 EASINGPOINTKEYFRAME,
111 ELASTICEASE,
112 ELLIPSE,
113 ELLIPSEGEOMETRY,
114 ERROREVENTARGS,
115 EVENTARGS,
116 EVENTLISTENERPROXY,
117 EVENTOBJECT,
118 EVENTTRIGGER,
119 EXCEPTIONROUTEDEVENTARGS,
120 EXPONENTIALEASE,
121 EXTERNALDECODER,
122 EXTERNALDEMUXER,
123 FFMPEGDECODER,
124 FFMPEGDEMUXER,
125 FILEDOWNLOADER,
126 FILESOURCE,
127 FLOAT,
128 FONTFAMILY,
129 FONTSOURCE,
130 FONTSTRETCH,
131 FONTSTYLE,
132 FONTWEIGHT,
133 FRAMEWORKELEMENT,
134 FRAMEWORKTEMPLATE,
135 GENERALTRANSFORM,
136 GEOMETRY,
137 GEOMETRY_COLLECTION,
138 GEOMETRYGROUP,
139 GLYPHS,
140 GRADIENTBRUSH,
141 GRADIENTSTOP,
142 GRADIENTSTOP_COLLECTION,
143 GRID,
144 GRIDLENGTH,
145 HITTEST_COLLECTION,
146 ICOMPARABLE,
147 ICOMPARABLE_BOOL,
148 ICOMPARABLE_CHAR,
149 ICOMPARABLE_DOUBLE,
150 ICOMPARABLE_FLOAT,
151 ICOMPARABLE_INT,
152 ICOMPARABLE_LONG,
153 ICOMPARABLE_STRING,
154 ICOMPARABLE_TIMESPAN,
155 ICOMPARABLE_UINT,
156 ICOMPARABLE_ULONG,
157 ICONVERTIBLE,
158 IEQUATABLE_BOOL,
159 IEQUATABLE_CHAR,
160 IEQUATABLE_DOUBLE,
161 IEQUATABLE_FLOAT,
162 IEQUATABLE_INT,
163 IEQUATABLE_LONG,
164 IEQUATABLE_STRING,
165 IEQUATABLE_TIMESPAN,
166 IEQUATABLE_UINT,
167 IEQUATABLE_ULONG,
168 IFORMATTABLE,
169 IIMAGECONVERTER,
170 IMAGE,
171 IMAGEBRUSH,
172 IMAGEERROREVENTARGS,
173 IMAGESOURCE,
174 IMEDIADECODER,
175 IMEDIADEMUXER,
176 IMEDIAOBJECT,
177 IMEDIASOURCE,
178 IMEDIASTREAM,
179 INKPRESENTER,
180 INLINE,
181 INLINE_COLLECTION,
182 INPUTMETHOD,
183 INT32,
184 INT64,
185 INTERNALDOWNLOADER,
186 ITEM_COLLECTION,
187 KEYEVENTARGS,
188 KEYFRAME,
189 KEYFRAME_COLLECTION,
190 KEYSPLINE,
191 KEYTIME,
192 LAYOUTINFORMATION,
193 LINE,
194 LINEARCOLORKEYFRAME,
195 LINEARDOUBLEKEYFRAME,
196 LINEARGRADIENTBRUSH,
197 LINEARPOINTKEYFRAME,
198 LINEBREAK,
199 LINEGEOMETRY,
200 LINESEGMENT,
201 MANAGED,// Silverlight 2.0 only
202 MANAGEDSTREAMSOURCE,
203 MANAGEDTYPEINFO,
204 MANUALTIMESOURCE,
205 MARKERREACHEDEVENTARGS,
206 MARKERSTREAM,
207 MATRIX,
208 MATRIXTRANSFORM,
209 MEDIA,
210 MEDIAATTRIBUTE,
211 MEDIAATTRIBUTE_COLLECTION,
212 MEDIABASE,
213 MEDIACLOSURE,
214 MEDIADISPOSEOBJECTCLOSURE,
215 MEDIAELEMENT,
216 MEDIAFRAME,
217 MEDIAGETFRAMECLOSURE,
218 MEDIAMARKER,
219 MEDIAMARKERFOUNDCLOSURE,
220 MEDIAPLAYER,
221 MEDIAREPORTSEEKCOMPLETEDCLOSURE,
222 MEDIASEEKCLOSURE,
223 MEMORYSOURCE,
224 MMSDEMUXER,
225 MMSDOWNLOADER,
226 MMSPLAYLISTENTRY,
227 MMSSECONDDOWNLOADER,
228 MMSSOURCE,
229 MOUSEEVENTARGS,
230 MOUSEWHEELEVENTARGS,
231 MP3DEMUXER,
232 MULTISCALEIMAGE,
233 MULTISCALESUBIMAGE,
234 MULTISCALESUBIMAGE_COLLECTION,
235 MULTISCALETILESOURCE,
236 NAMESCOPE,
237 NPOBJ,
238 NULLDECODER,
239 OBJECT,
240 OBJECTANIMATIONUSINGKEYFRAMES,
241 OBJECTKEYFRAME,
242 OBJECTKEYFRAME_COLLECTION,
243 PANEL,
244 PARALLELTIMELINE,
245 PARSERERROREVENTARGS,
246 PASSTHROUGHDECODER,
247 PASSWORDBOX,
248 PATH,
249 PATHFIGURE,
250 PATHFIGURE_COLLECTION,
251 PATHGEOMETRY,
252 PATHSEGMENT,
253 PATHSEGMENT_COLLECTION,
254 PLAYLIST,
255 PLAYLISTENTRY,
256 PLAYLISTROOT,
257 POINT,
258 POINT_COLLECTION,
259 POINTANIMATION,
260 POINTANIMATIONUSINGKEYFRAMES,
261 POINTKEYFRAME,
262 POINTKEYFRAME_COLLECTION,
263 POLYBEZIERSEGMENT,
264 POLYGON,
265 POLYLINE,
266 POLYLINESEGMENT,
267 POLYQUADRATICBEZIERSEGMENT,
268 POPUP,
269 POWEREASE,
270 PROGRESSEVENTARGS,
271 PROGRESSIVESOURCE,
272 PROPERTYPATH,
273 PULSESOURCE,
274 QUADRATICBEZIERSEGMENT,
275 QUADRATICEASE,
276 QUARTICEASE,
277 QUINTICEASE,
278 RADIALGRADIENTBRUSH,
279 RECT,
280 RECTANGLE,
281 RECTANGLEGEOMETRY,
282 RENDERINGEVENTARGS,
283 REPEATBEHAVIOR,
284 RESOURCE_DICTIONARY,
285 ROTATETRANSFORM,
286 ROUTEDEVENTARGS,
287 ROWDEFINITION,
288 ROWDEFINITION_COLLECTION,
289 RUN,
290 SCALETRANSFORM,
291 SETTER,
292 SETTERBASE,
293 SETTERBASE_COLLECTION,
294 SHAPE,
295 SINEEASE,
296 SIZE,
297 SIZECHANGEDEVENTARGS,
298 SKEWTRANSFORM,
299 SOLIDCOLORBRUSH,
300 SPLINECOLORKEYFRAME,
301 SPLINEDOUBLEKEYFRAME,
302 SPLINEPOINTKEYFRAME,
303 STORYBOARD,
304 STRING,
305 STROKE,
306 STROKE_COLLECTION,
307 STYLE,
308 STYLUSINFO,
309 STYLUSPOINT,
310 STYLUSPOINT_COLLECTION,
311 SURFACE,
312 SYSTEMTIMESOURCE,
313 TEXTBLOCK,
314 TEXTBOX,
315 TEXTBOXBASE,
316 TEXTBOXMODELCHANGEDEVENTARGS,
317 TEXTBOXVIEW,
318 TEXTCHANGEDEVENTARGS,
319 THICKNESS,
320 TILEBRUSH,
321 TIMELINE,
322 TIMELINE_COLLECTION,
323 TIMELINEGROUP,
324 TIMELINEMARKER,
325 TIMELINEMARKER_COLLECTION,
326 TIMEMANAGER,
327 TIMESOURCE,
328 TIMESPAN,
329 TRANSFORM,
330 TRANSFORM_COLLECTION,
331 TRANSFORMGROUP,
332 TRANSLATETRANSFORM,
333 TRIGGER_COLLECTION,
334 TRIGGERACTION,
335 TRIGGERACTION_COLLECTION,
336 TRIGGERBASE,
337 UIELEMENT,
338 UIELEMENT_COLLECTION,
339 UINT32,
340 UINT64,
341 UNMANAGEDMATRIX,
342 URI,
343 USERCONTROL,
344 VIDEOBRUSH,
345 VIDEOSTREAM,
346 VISUALBRUSH,
347 WRITEABLEBITMAP,
348 XMLLANGUAGE,
349 YUVCONVERTER,
351 LASTTYPE,
352 // END_MANAGED_MAPPING
355 static Type *Find (Deployment *deployment, const char *name);
356 static Type *Find (const char *name);
357 static Type *Find (Deployment *deployment, Type::Kind type);
358 static Type *Find (Type::Kind type);
359 static Type *Find (Deployment *deployment, const char *name, bool ignore_case);
360 static Type *Find (const char *name, bool ignore_case);
362 bool IsSubclassOf (Type::Kind super);
363 bool IsSubclassOf (Deployment *deployment, Type::Kind super);
364 static bool IsSubclassOf (Deployment *deployment, Type::Kind type, Type::Kind super);
365 static bool IsSubclassOf (Type::Kind type, Type::Kind super);
367 bool IsAssignableFrom (Type::Kind type);
368 bool IsAssignableFrom (Deployment *deployment, Type::Kind type);
369 static bool IsAssignableFrom (Deployment *deployment, Type::Kind assignable, Type::Kind type);
370 static bool IsAssignableFrom (Type::Kind assignable, Type::Kind type);
372 int LookupEvent (const char *event_name);
373 const char *LookupEventName (int id);
374 DependencyObject *CreateInstance ();
375 const char *GetContentPropertyName ();
377 DependencyProperty *LookupProperty (const char *name);
378 void AddProperty (DependencyProperty *property);
380 GHashTable *CopyProperties (bool inherited);
382 Type::Kind GetKind () { return type; }
383 void SetKind (Type::Kind value) { type = value; }
384 Type::Kind GetParent () { return parent; }
385 bool IsValueType () { return is_value_type; }
386 bool IsInterface () { return is_interface; }
387 bool IsCustomType () { return type > LASTTYPE; }
388 const char *GetName () { return name; }
389 int GetEventCount () { return total_event_count; }
390 int GetInterfaceCount () { return interface_count; }
391 Type::Kind GetInterface (int i) { return i >= 0 && i < interface_count ? interfaces[i] : Type::INVALID; }
393 bool IsCtorVisible () { return ctor_visible; }
395 ~Type ();
396 Type (Type::Kind type, Type::Kind parent, bool is_value_type, bool is_interface,
397 const char *name,
398 int event_count, int total_event_count, const char **events,
399 int interface_count, const Type::Kind *interfaces, bool ctor_visible,
400 create_inst_func *create_inst, const char *content_property);
402 private:
403 Type () {}
405 Type::Kind type; // this type
406 Type::Kind parent; // parent type, INVALID if no parent
407 bool is_value_type; // if this type is a value type
408 bool is_interface; // if this type is a value type
410 const char *name; // The name as it appears in code.
412 int interface_count;
413 Type::Kind *interfaces;
415 int event_count; // number of events in this class
416 int total_event_count; // number of events in this class and all base classes
417 const char **events; // the events this class has
419 bool ctor_visible; // if the type is instantiable in xaml, basically if the managed type has a public default ctor.
420 create_inst_func *create_inst; // a function pointer to create an instance of this type
422 const char *content_property;
424 // The catch here is that SL allows us to register several DPs with the same name,
425 // and when looking up DP on name they seem to return the latest DP registered
426 // with that name.
427 GHashTable *properties; // Registered DependencyProperties for this type
430 class Types {
431 friend class Type;
433 private:
434 ArrayList types;
435 ArrayList properties;
436 bool disposed;
438 void RegisterNativeTypes ();
439 void RegisterNativeProperties ();
441 public:
442 /* @GenerateCBinding,GeneratePInvoke,Version=2.0 */
443 Types ();
444 /* @GenerateCBinding,GeneratePInvoke,Version=2.0 */
445 ~Types ();
447 /* @GenerateCBinding,Version=2.0 */
448 Type::Kind RegisterType (const char *name, void *gc_handle, Type::Kind parent, bool is_interface, bool ctor_visible, Type::Kind *interfaces, int interface_count);
450 void AddProperty (DependencyProperty *property);
451 DependencyProperty *GetProperty (int id);
453 /* @GenerateCBinding,GeneratePInvoke,Version=2.0 */
454 Type *Find (Type::Kind type);
455 Type *Find (const char *name);
456 Type *Find (const char *name, bool ignore_case);
458 bool IsSubclassOf (Type::Kind type, Type::Kind super);
459 bool IsSubclassOrSuperclassOf (Type::Kind unknown, Type::Kind known);
460 static bool IsSubclassOrSuperclassOf (Types *types, Type::Kind unknown, Type::Kind known);
462 bool IsAssignableFrom (Type::Kind destination, Type::Kind type);
464 void Initialize ();
465 void Dispose ();
468 G_BEGIN_DECLS
470 /* @GeneratePInvoke */
471 bool type_get_value_type (Type::Kind type);
472 DependencyObject *type_create_instance (Type *type);
473 DependencyObject *type_create_instance_from_kind (Type::Kind kind);
475 void types_init (void);
476 const char *type_get_name (Type::Kind type);
477 /* @GeneratePInvoke */
478 bool type_is_dependency_object (Type::Kind type);
480 /* @IncludeInKinds */
481 struct ManagedTypeInfo {
482 char *assembly_name;
483 char *full_name;
485 ManagedTypeInfo (const char *assembly_name, const char *full_name)
487 this->assembly_name = g_strdup (assembly_name);
488 this->full_name = g_strdup (full_name);
492 G_END_DECLS
494 #endif