2009-10-05 Chris Toshok <toshok@ximian.com>
[moon.git] / plugin / plugin-class.h
blobfe6e181c2aa438d4030c3aeac9b6a38932c047c3
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 * plugin-class.h: MoonLight browser plugin - autogenerated header classes
9 * Contact:
10 * Moonlight List (moonlight-list@lists.ximian.com)
12 * Copyright 2007-2009 Novell, Inc. (http://www.novell.com)
14 * See the LICENSE file included with the distribution for details.
18 #ifndef __PLUGIN_CLASS_H__
19 #define __PLUGIN_CLASS_H__
21 #include "moonlight.h"
22 #include "error.h"
23 #include "plugin.h"
25 // debug javascript
26 #define DEBUG_JAVASCRIPT 1
28 #define DEPENDENCY_OBJECT_FROM_VARIANT(obj) (((MoonlightDependencyObjectObject*) NPVARIANT_TO_OBJECT (obj))->GetDependencyObject ())
30 #define THROW_JS_EXCEPTION(meth) \
31 do { \
32 char *message = g_strdup_printf ("Error calling method: %s", meth); \
33 NPN_SetException (this, message); \
34 g_free (message); \
35 return true; \
36 } while (0); \
38 #define THROW_JS_EXCEPTION2(obj, meth) \
39 do { \
40 char *message = g_strdup_printf ("Error calling method: %s", meth); \
41 NPN_SetException (obj, message); \
42 g_free (message); \
43 } while (0); \
46 enum PluginPropertyId {
47 NoMapping = 0,
49 // property names
50 MoonId_ErrorCode = 0x4000,
51 MoonId_ErrorType,
52 MoonId_ErrorMessage,
53 MoonId_LineNumber,
54 MoonId_CharPosition,
55 MoonId_XamlFile,
56 MoonId_MethodName,
57 MoonId_X,
58 MoonId_Y,
59 MoonId_Left,
60 MoonId_Right,
61 MoonId_Top,
62 MoonId_Bottom,
63 MoonId_TopLeft,
64 MoonId_TopRight,
65 MoonId_BottomLeft,
66 MoonId_BottomRight,
67 MoonId_Width,
68 MoonId_Height,
69 MoonId_Seconds,
70 MoonId_Name,
71 MoonId_Shift,
72 MoonId_Ctrl,
73 MoonId_Marker,
74 MoonId_Key,
75 MoonId_PlatformKeyCode,
76 MoonId_Progress,
77 MoonId_Settings,
78 MoonId_Content,
79 MoonId_InitParams,
80 MoonId_Id,
81 MoonId_IsLoaded,
82 MoonId_Source,
83 MoonId_Background,
84 MoonId_EnableFramerateCounter,
85 MoonId_EnableRedrawRegions,
86 MoonId_EnableHtmlAccess,
87 MoonId_MaxFrameRate,
88 MoonId_Version,
89 MoonId_Windowless,
90 MoonId_ActualHeight,
91 MoonId_ActualWidth,
92 MoonId_FullScreen,
93 MoonId_Root,
94 MoonId_Count,
95 MoonId_ResponseText,
96 MoonId_DeviceType,
97 MoonId_IsInverted,
98 MoonId_Handled,
99 MoonId_GridUnitType,
100 MoonId_Value,
101 MoonId_Accessibility,
102 MoonId_MultiScaleImage_Source,
104 // event names (handled by the property setters)
105 MoonId_BufferingProgressChanged,
106 MoonId_Completed,
107 MoonId_CurrentStateChanged,
108 MoonId_DownloadProgressChanged,
109 MoonId_GotFocus,
110 MoonId_ImageFailed,
111 MoonId_KeyDown,
112 MoonId_KeyUp,
113 MoonId_LostFocus,
114 MoonId_Loaded,
115 MoonId_MarkerReached,
116 MoonId_MediaEnded,
117 MoonId_MediaFailed,
118 MoonId_MediaOpened,
119 MoonId_MouseEnter,
120 MoonId_MouseLeave,
121 MoonId_MouseMove,
122 MoonId_MouseLeftButtonDown,
123 MoonId_MouseLeftButtonUp,
124 MoonId_OnResize,
125 MoonId_OnFullScreenChange,
126 MoonId_OnError,
127 MoonId_OnLoad,
128 MoonId_OnSourceDownloadProgressChanged,
129 MoonId_OnSourceDownloadComplete,
131 // method names
132 MoonId_GetPosition = 0x8000,
133 MoonId_CreateObject,
134 MoonId_IsVersionSupported,
135 MoonId_FindName,
136 MoonId_CreateFromXaml,
137 MoonId_CreateFromXamlDownloader,
138 MoonId_Equals,
139 MoonId_GetHost,
140 MoonId_GetParent,
141 MoonId_GetStylusInfo,
142 MoonId_GetStylusPoints,
143 MoonId_CaptureMouse,
144 MoonId_ReleaseMouseCapture,
145 MoonId_AddEventListener,
146 MoonId_RemoveEventListener,
147 MoonId_SetValue,
148 MoonId_GetValue,
149 MoonId_ToString,
150 #if DEBUG_JAVASCRIPT
151 MoonId_Printf,
152 MoonId_DumpNameScope,
153 #endif
154 MoonId_Add,
155 MoonId_Remove,
156 MoonId_RemoveAt,
157 MoonId_Insert,
158 MoonId_Clear,
159 MoonId_GetItem,
160 MoonId_GetItemByName,
161 MoonId_Begin,
162 MoonId_Pause,
163 MoonId_Resume,
164 MoonId_Seek,
165 MoonId_Stop,
166 MoonId_Play,
167 MoonId_SetSource,
168 MoonId_SetFontSource,
169 MoonId_Abort,
170 MoonId_Open,
171 MoonId_GetResponseText,
172 MoonId_Send,
173 MoonId_AddStylusPoints,
174 MoonId_GetBounds,
175 MoonId_HitTest,
176 MoonId_UpdateLayout,
178 MoonId_StopPropagation,
179 MoonId_PreventDefault,
180 MoonId_Detail,
182 MoonId_Focus,
184 MoonId_Select,
185 MoonId_SelectAll,
187 MoonId_MultiScaleImage_GetIthSubImage,
188 MoonId_MultiScaleImage_GetSubImageCount,
189 MoonId_MultiScaleImage_LogicalToElementX,
190 MoonId_MultiScaleImage_LogicalToElementY,
191 MoonId_MultiScaleImage_ZoomAboutLogicalPoint,
192 MoonId_UIElement_CaptureMouse,
193 MoonId_UIElement_TransformToVisual,
194 MoonId_UIElement_ReleaseMouseCapture,
195 MoonId_UIElement_UpdateLayout,
200 #define MAPPING_FLAG_SL1 0x01
201 #define MAPPING_FLAG_SL2 0x02
203 struct MoonNameIdMapping {
204 const char *name;
205 int id;
208 #define IS_METHOD(id) (((id) & 0x8000) != 0)
209 #define IS_PROPERTY(id) (((id) & 0x4000) != 0)
212 G_BEGIN_DECLS
213 G_GNUC_INTERNAL bool npobject_is_dependency_object (NPObject *obj);
215 G_GNUC_INTERNAL bool check_arg_list (const char *arglist, guint32 argc, const NPVariant *argv);
217 G_GNUC_INTERNAL void plugin_init_classes (void);
218 G_GNUC_INTERNAL void plugin_destroy_classes (void);
220 G_GNUC_INTERNAL void event_object_add_xaml_listener (EventObject *obj, PluginInstance *instance, const char *event_name, const char *cb_name);
222 void string_to_npvariant (const char *value, NPVariant *result);
223 G_GNUC_INTERNAL void variant_to_value (const NPVariant *v, Value **result);
224 G_END_DECLS
227 class MoonlightObject;
229 /*** EventListenerProxy */
230 typedef void (*EventArgsWrapper)(NPP instance, EventArgs *calldata, NPVariant *value);
232 class EventListenerProxy : public EventObject {
233 static void on_handler_removed (gpointer closure);
235 EventObject *target_object;
236 MoonlightObject *owner;
238 NPP instance;
239 bool is_func;
241 /* if @is_func == true, callback is an NPObject (the function object)
242 if @is_func == false, callback is a char* (the function name)
244 gpointer callback;
246 char *event_name;
247 int event_id;
248 int token;
250 bool one_shot;
252 public:
253 EventListenerProxy (NPP instance, const char *event_name, const char *cb_name);
254 EventListenerProxy (NPP instance, const char *event_name, const NPVariant *cb);
255 virtual ~EventListenerProxy ();
257 void SetOwner (MoonlightObject *owner);
259 int AddXamlHandler (EventObject *obj);
260 int AddHandler (EventObject *obj);
261 void RemoveHandler ();
262 const char *GetCallbackAsString ();
264 int GetEventId () { return event_id; }
265 int GetEventToken () { return token; }
267 void SetOneShot () { one_shot = true; }
269 static void proxy_listener_to_javascript (EventObject *sender, EventArgs *calldata, gpointer closure);
273 /*** MoonlightObjectClass **************************************************************/
275 struct MoonlightObjectType : NPClass {
276 MoonlightObjectType ();
278 ~MoonlightObjectType() { g_free (mapping); }
280 void AddMapping (const MoonNameIdMapping *mapping, int count);
282 bool Enumerate (NPIdentifier **value, guint32 *count);
284 int LookupName (NPIdentifier name);
286 MoonNameIdMapping *mapping;
287 int mapping_count;
289 NPIdentifier last_lookup;
290 int last_id;
293 extern MoonlightObjectType *MoonlightObjectClass;
295 struct MoonlightObject : NPObject {
296 MoonlightObject (NPP instance)
298 this->instance = instance;
299 this->moonlight_type = Type::INVALID;
300 this->event_listener_proxies = g_hash_table_new (g_direct_hash, g_direct_equal);
303 virtual void Invalidate () { }
304 virtual ~MoonlightObject ();
306 virtual bool HasProperty (NPIdentifier name);
307 virtual bool GetProperty (int id, NPIdentifier name, NPVariant *result);
308 virtual bool SetProperty (int id, NPIdentifier name, const NPVariant *value);
310 virtual bool HasMethod (NPIdentifier unmapped);
311 virtual bool Invoke (int id, NPIdentifier name,
312 const NPVariant *args, guint32 argCount, NPVariant *result);
313 int LookupName (NPIdentifier name) { return ((MoonlightObjectType *)_class)->LookupName (name); }
315 EventListenerProxy *LookupEventProxy (int event_id);
316 void SetEventProxy (EventListenerProxy* proxy);
317 void ClearEventProxy (EventListenerProxy *proxy);
319 static void destroy_proxy (gpointer data);
320 static void invalidate_proxy (gpointer key, gpointer value, gpointer data);
322 NPP instance;
323 Type::Kind moonlight_type;
324 GHashTable *event_listener_proxies;
328 /*** MoonlightEventObjectClass ***************************************************/
329 struct MoonlightEventObjectType : MoonlightObjectType {
330 MoonlightEventObjectType ();
333 extern MoonlightEventObjectType *MoonlightEventObjectClass;
335 struct MoonlightEventObjectObject : MoonlightObject {
336 MoonlightEventObjectObject (NPP instance) : MoonlightObject (instance)
338 moonlight_type = Type::EVENTOBJECT;
339 eo = NULL;
342 virtual ~MoonlightEventObjectObject ();
344 EventObject *eo;
347 extern MoonlightEventObjectObject *EventObjectCreateWrapper (NPP instance, EventObject *obj);
349 /*** MoonlightDependencyObjectClass ***************************************************/
350 struct MoonlightDependencyObjectType : MoonlightEventObjectType {
351 MoonlightDependencyObjectType ();
355 struct MoonlightDependencyObjectObject : MoonlightEventObjectObject {
356 MoonlightDependencyObjectObject (NPP instance) : MoonlightEventObjectObject (instance)
358 moonlight_type = Type::DEPENDENCY_OBJECT;
361 DependencyObject *GetDependencyObject ()
363 if (eo == NULL || !eo->Is (Type::DEPENDENCY_OBJECT)) {
364 g_warning ("MoonlightDependencyObjectObject::GetDependencyObject (): Not a dependency object!");
365 return NULL;
368 return (DependencyObject*) eo;
371 virtual bool HasProperty (NPIdentifier unmapped);
372 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
373 virtual bool SetProperty (int id, NPIdentifier unmapped, const NPVariant *value);
375 virtual bool Invoke (int id, NPIdentifier name,
376 const NPVariant *args, guint32 argCount, NPVariant *result);
380 extern MoonlightDependencyObjectObject *DependencyObjectCreateWrapper (NPP instance, DependencyObject *obj);
383 /*************** AUTO GENERATED CLASSES ****************************/
385 /*** MoonlightUIElementClass *********/
386 struct MoonlightUIElementType : MoonlightDependencyObjectType {
387 MoonlightUIElementType ();
390 extern MoonlightUIElementType *MoonlightUIElementClass;
392 struct MoonlightUIElementObject : MoonlightDependencyObjectObject {
393 MoonlightUIElementObject (NPP instance) : MoonlightDependencyObjectObject (instance)
395 moonlight_type = Type::UIELEMENT;
398 virtual bool Invoke (int id, NPIdentifier name,
399 const NPVariant *args, guint32 argCount, NPVariant *result);
404 /*************** END OF AUTO GENERATED CLASSES *********************/
406 /*** MoonlightPointClass **************************************************************/
407 struct MoonlightPointType : MoonlightObjectType {
408 MoonlightPointType ();
411 extern MoonlightPointType *MoonlightPointClass;
413 struct MoonlightPoint : MoonlightObject {
414 MoonlightPoint (NPP instance) : MoonlightObject(instance), point (Point())
416 moonlight_type = Type::POINT;
419 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
420 virtual bool SetProperty (int id, NPIdentifier unmapped, const NPVariant *value);
422 Point point;
425 /*** MoonlightRectClass **************************************************************/
426 struct MoonlightRectType : MoonlightObjectType {
427 MoonlightRectType ();
430 extern MoonlightRectType *MoonlightRectClass;
432 struct MoonlightRect : MoonlightObject {
433 MoonlightRect (NPP instance) : MoonlightObject(instance), rect (Rect())
435 moonlight_type = Type::RECT;
438 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
439 virtual bool SetProperty (int id, NPIdentifier unmapped, const NPVariant *value);
441 Rect rect;
445 /*** MoonlightDurationClass **************************************************************/
446 struct MoonlightDurationType : MoonlightObjectType {
447 MoonlightDurationType ();
450 extern MoonlightDurationType *MoonlightDurationClass;
452 struct MoonlightDuration : MoonlightObject {
453 MoonlightDuration (NPP instance) : MoonlightObject (instance)
455 moonlight_type = Type::DURATION;
456 parent_property = NULL;
457 parent_obj = NULL;
460 virtual ~MoonlightDuration ();
462 void SetParentInfo (DependencyObject *parent_obj, DependencyProperty *parent_property);
464 double GetValue ();
466 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
467 virtual bool SetProperty (int id, NPIdentifier unmapped, const NPVariant *value);
469 DependencyProperty *parent_property;
470 DependencyObject *parent_obj;
473 /*** MoonlightTimeSpanClass **************************************************************/
474 struct MoonlightTimeSpanType : MoonlightObjectType {
475 MoonlightTimeSpanType ();
478 extern MoonlightTimeSpanType *MoonlightTimeSpanClass;
480 struct MoonlightTimeSpan : MoonlightObject {
481 MoonlightTimeSpan (NPP instance) : MoonlightObject (instance)
483 moonlight_type = Type::TIMESPAN;
484 parent_property = NULL;
485 parent_obj = NULL;
488 virtual ~MoonlightTimeSpan ();
490 void SetParentInfo (DependencyObject *parent_obj, DependencyProperty *parent_property);
492 TimeSpan GetValue ();
494 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
495 virtual bool SetProperty (int id, NPIdentifier unmapped, const NPVariant *value);
497 DependencyProperty *parent_property;
498 DependencyObject *parent_obj;
501 /*** MoonlightKeyTimeClass ****************************************************************/
502 struct MoonlightKeyTimeType : MoonlightObjectType {
503 MoonlightKeyTimeType ();
506 extern MoonlightKeyTimeType *MoonlightKeyTimeClass;
508 struct MoonlightKeyTime : MoonlightObject {
509 MoonlightKeyTime (NPP instance) : MoonlightObject (instance)
511 moonlight_type = Type::KEYTIME;
512 parent_property = NULL;
513 parent_obj = NULL;
516 virtual ~MoonlightKeyTime ();
518 void SetParentInfo (DependencyObject *parent_obj, DependencyProperty *parent_property);
520 KeyTime* GetValue ();
522 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
523 virtual bool SetProperty (int id, NPIdentifier unmapped, const NPVariant *value);
525 DependencyProperty *parent_property;
526 DependencyObject *parent_obj;
529 /*** MoonlightThicknessClass ****************************************************************/
530 struct MoonlightThicknessType : MoonlightObjectType {
531 MoonlightThicknessType ();
534 extern MoonlightThicknessType *MoonlightThicknessClass;
536 struct MoonlightThickness : MoonlightObject {
537 MoonlightThickness (NPP instance) : MoonlightObject (instance)
539 moonlight_type = Type::THICKNESS;
540 parent_property = NULL;
541 parent_obj = NULL;
544 virtual ~MoonlightThickness ();
546 void SetParentInfo (DependencyObject *parent_obj, DependencyProperty *parent_property);
548 Thickness* GetValue ();
550 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
551 virtual bool SetProperty (int id, NPIdentifier unmapped, const NPVariant *value);
553 DependencyProperty *parent_property;
554 DependencyObject *parent_obj;
557 /*** MoonlightCornerRadiusClass ****************************************************************/
558 struct MoonlightCornerRadiusType : MoonlightObjectType {
559 MoonlightCornerRadiusType ();
562 extern MoonlightCornerRadiusType *MoonlightCornerRadiusClass;
564 struct MoonlightCornerRadius : MoonlightObject {
565 MoonlightCornerRadius (NPP instance) : MoonlightObject (instance)
567 moonlight_type = Type::CORNERRADIUS;
568 parent_property = NULL;
569 parent_obj = NULL;
572 virtual ~MoonlightCornerRadius ();
574 void SetParentInfo (DependencyObject *parent_obj, DependencyProperty *parent_property);
576 CornerRadius* GetValue ();
578 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
579 virtual bool SetProperty (int id, NPIdentifier unmapped, const NPVariant *value);
581 DependencyProperty *parent_property;
582 DependencyObject *parent_obj;
585 /*** MoonlightGridLengthClass ****************************************************************/
586 struct MoonlightGridLengthType : MoonlightObjectType {
587 MoonlightGridLengthType ();
590 extern MoonlightGridLengthType *MoonlightGridLengthClass;
592 struct MoonlightGridLength : MoonlightObject {
593 MoonlightGridLength (NPP instance) : MoonlightObject (instance)
595 moonlight_type = Type::GRIDLENGTH;
596 parent_property = NULL;
597 parent_obj = NULL;
600 virtual ~MoonlightGridLength ();
602 void SetParentInfo (DependencyObject *parent_obj, DependencyProperty *parent_property);
604 GridLength* GetValue ();
606 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
607 virtual bool SetProperty (int id, NPIdentifier unmapped, const NPVariant *value);
609 DependencyProperty *parent_property;
610 DependencyObject *parent_obj;
613 /*** MoonlightSettingsClass ***********************************************************/
615 struct MoonlightSettingsType : MoonlightObjectType {
616 MoonlightSettingsType ();
619 extern MoonlightSettingsType *MoonlightSettingsClass;
621 struct MoonlightSettingsObject : MoonlightObject {
622 MoonlightSettingsObject (NPP instance) : MoonlightObject (instance)
626 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
627 virtual bool SetProperty (int id, NPIdentifier unmapped, const NPVariant *value);
629 virtual bool Invoke (int id, NPIdentifier name,
630 const NPVariant *args, guint32 argCount, NPVariant *result);
634 /*** MoonlightContentClass ************************************************************/
636 struct MoonlightContentType : MoonlightObjectType {
637 MoonlightContentType ();
640 extern MoonlightContentType *MoonlightContentClass;
642 struct MoonlightContentObject : MoonlightObject {
643 MoonlightContentObject (NPP instance) : MoonlightObject (instance)
645 registered_scriptable_objects = g_hash_table_new (g_direct_hash, g_direct_equal);
646 accessibility = NULL;
649 virtual ~MoonlightContentObject ();
651 virtual bool HasProperty (NPIdentifier unmapped);
652 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
653 virtual bool SetProperty (int id, NPIdentifier unmapped, const NPVariant *value);
655 virtual bool Invoke (int id, NPIdentifier name,
656 const NPVariant *args, guint32 argCount, NPVariant *result);
658 DependencyObject *accessibility;
659 GHashTable *registered_scriptable_objects;
662 /*** MoonlightScriptControlClass **********************************************************/
664 struct MoonlightScriptControlType : MoonlightObjectType {
665 MoonlightScriptControlType ();
668 extern MoonlightScriptControlType *MoonlightScriptControlClass;
670 struct MoonlightScriptControlObject : MoonlightObject {
671 MoonlightScriptControlObject (NPP instance) : MoonlightObject (instance)
673 settings = NPN_CreateObject (instance, MoonlightSettingsClass);
674 content = NPN_CreateObject (instance, MoonlightContentClass);
677 virtual ~MoonlightScriptControlObject ();
679 virtual void Invalidate ();
681 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
682 virtual bool SetProperty (int id, NPIdentifier unmapped, const NPVariant *value);
684 virtual bool Invoke (int id, NPIdentifier name,
685 const NPVariant *args, guint32 argCount, NPVariant *result);
687 NPObject *settings;
688 NPObject *content;
692 /*** MoonlightEventArgsClass ******************************************************/
693 struct MoonlightEventArgsType : MoonlightDependencyObjectType {
694 MoonlightEventArgsType ();
697 struct MoonlightEventArgs : MoonlightDependencyObjectObject {
698 MoonlightEventArgs (NPP instance) : MoonlightDependencyObjectObject (instance)
700 moonlight_type = Type::EVENTARGS;
704 /*** MoonlightEventArgsClass ******************************************************/
705 struct MoonlightRoutedEventArgsType : MoonlightEventArgsType {
706 MoonlightRoutedEventArgsType ();
709 struct MoonlightRoutedEventArgs : MoonlightEventArgs {
710 MoonlightRoutedEventArgs (NPP instance) : MoonlightEventArgs (instance)
712 moonlight_type = Type::ROUTEDEVENTARGS;
715 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
717 RoutedEventArgs *GetRoutedEventArgs () { return (RoutedEventArgs *) eo; }
720 /*** MoonlightMouseEventArgsClass **************************************************************/
721 struct MoonlightMouseEventArgsType : MoonlightRoutedEventArgsType {
722 MoonlightMouseEventArgsType ();
725 struct MoonlightMouseEventArgsObject : MoonlightRoutedEventArgs {
726 MoonlightMouseEventArgsObject (NPP instance) : MoonlightRoutedEventArgs (instance)
728 moonlight_type = Type::MOUSEEVENTARGS;
731 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
732 virtual bool SetProperty (int id, NPIdentifier unmapped, const NPVariant *value);
733 virtual bool Invoke (int id, NPIdentifier name,
734 const NPVariant *args, guint32 argCount, NPVariant *result);
736 MouseEventArgs *GetMouseEventArgs () { return (MouseEventArgs *) eo; };
739 /*** MoonlightMarkerReachedEventArgsClass ******************************************/
740 struct MoonlightMarkerReachedEventArgsType : MoonlightRoutedEventArgsType {
741 MoonlightMarkerReachedEventArgsType ();
744 extern MoonlightMarkerReachedEventArgsType *MoonlightMarkerReachedEventArgsClass;
746 struct MoonlightMarkerReachedEventArgsObject : MoonlightRoutedEventArgs {
747 MoonlightMarkerReachedEventArgsObject (NPP instance) : MoonlightRoutedEventArgs (instance)
749 moonlight_type = Type::MARKERREACHEDEVENTARGS;
752 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
754 MarkerReachedEventArgs *GetMarkerReachedEventArgs () { return (MarkerReachedEventArgs *) eo; }
757 /*** MoonlightKeyEventArgsClass **************************************************************/
758 struct MoonlightKeyEventArgsType : MoonlightEventArgsType {
759 MoonlightKeyEventArgsType ();
762 struct MoonlightKeyEventArgsObject : MoonlightEventArgs {
763 MoonlightKeyEventArgsObject (NPP instance) : MoonlightEventArgs (instance)
765 moonlight_type = Type::KEYEVENTARGS;
768 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
769 KeyEventArgs *GetKeyEventArgs () { return (KeyEventArgs *) eo; }
772 /*** MoonlightDownloadProgressEventArgsClass ******************************************************/
773 struct MoonlightDownloadProgressEventArgsType : MoonlightEventArgsType {
774 MoonlightDownloadProgressEventArgsType ();
777 struct MoonlightDownloadProgressEventArgs : MoonlightEventArgs {
778 MoonlightDownloadProgressEventArgs (NPP instance) : MoonlightEventArgs (instance)
780 moonlight_type = Type::DOWNLOADPROGRESSEVENTARGS;
783 DownloadProgressEventArgs *GetDownloadProgressEventArgs () { return (DownloadProgressEventArgs *) eo; }
784 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
787 /*** MoonlightErrorEventArgsClass ******************************************************/
788 struct MoonlightErrorEventArgsType : MoonlightEventArgsType {
789 MoonlightErrorEventArgsType ();
792 struct MoonlightErrorEventArgs : MoonlightEventArgs {
793 MoonlightErrorEventArgs (NPP instance) : MoonlightEventArgs (instance)
795 moonlight_type = Type::ERROREVENTARGS;
798 ErrorEventArgs *GetErrorEventArgs () { return (ErrorEventArgs *) eo; }
799 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
802 /*** MoonlightCollectionClass ***************************************************/
804 struct MoonlightCollectionType : MoonlightDependencyObjectType {
805 MoonlightCollectionType ();
808 struct MoonlightCollectionObject : MoonlightDependencyObjectObject {
809 MoonlightCollectionObject (NPP instance) : MoonlightDependencyObjectObject (instance)
811 moonlight_type = Type::COLLECTION;
814 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
816 virtual bool Invoke (int id, NPIdentifier name,
817 const NPVariant *args, guint32 argCount, NPVariant *result);
820 /*** MoonlightStoryboardClass ***************************************************/
822 struct MoonlightStoryboardType : MoonlightDependencyObjectType {
823 MoonlightStoryboardType ();
826 struct MoonlightStoryboardObject : MoonlightDependencyObjectObject {
827 MoonlightStoryboardObject (NPP instance) : MoonlightDependencyObjectObject (instance)
829 moonlight_type = Type::STORYBOARD;
832 virtual bool Invoke (int id, NPIdentifier name,
833 const NPVariant *args, guint32 argCount, NPVariant *result);
836 /*** MoonlightMediaElement ***************************************************/
838 struct MoonlightMediaElementType : MoonlightUIElementType {
839 MoonlightMediaElementType ();
843 struct MoonlightMediaElementObject : MoonlightUIElementObject {
844 MoonlightMediaElementObject (NPP instance) : MoonlightUIElementObject (instance)
846 moonlight_type = Type::MEDIAELEMENT;
849 virtual bool Invoke (int id, NPIdentifier name,
850 const NPVariant *args, guint32 argCount, NPVariant *result);
853 /*** MoonlightMultiScaleImage ***************************************************/
855 struct MoonlightMultiScaleImageType : MoonlightDependencyObjectType {
856 MoonlightMultiScaleImageType ();
859 struct MoonlightMultiScaleImageObject : MoonlightDependencyObjectObject {
860 MoonlightMultiScaleImageObject (NPP instance) : MoonlightDependencyObjectObject (instance)
862 moonlight_type = Type::MULTISCALEIMAGE;
865 virtual bool Invoke (int id, NPIdentifier name,
866 const NPVariant *args, guint32 argCount, NPVariant *result);
868 virtual bool SetProperty (int id, NPIdentifier name, const NPVariant *value);
871 /*** MoonlightImage ***************************************************/
873 struct MoonlightImageType : MoonlightUIElementType {
874 MoonlightImageType ();
878 struct MoonlightImageObject : MoonlightUIElementObject {
879 MoonlightImageObject (NPP instance) : MoonlightUIElementObject (instance)
881 moonlight_type = Type::IMAGE;
884 virtual bool Invoke (int id, NPIdentifier name,
885 const NPVariant *args, guint32 argCount, NPVariant *result);
886 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
889 /*** MoonlightImageBrush ***************************************************/
891 struct MoonlightImageBrushType : MoonlightDependencyObjectType {
892 MoonlightImageBrushType ();
896 struct MoonlightImageBrushObject : MoonlightDependencyObjectObject {
897 MoonlightImageBrushObject (NPP instance) : MoonlightDependencyObjectObject (instance)
899 moonlight_type = Type::IMAGEBRUSH;
902 virtual bool Invoke (int id, NPIdentifier name,
903 const NPVariant *args, guint32 argCount, NPVariant *result);
904 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
907 /*** MoonlightDownloader ***************************************************/
909 struct MoonlightDownloaderType : MoonlightDependencyObjectType {
910 MoonlightDownloaderType ();
914 struct MoonlightDownloaderObject : MoonlightDependencyObjectObject {
915 MoonlightDownloaderObject (NPP instance) : MoonlightDependencyObjectObject (instance)
917 moonlight_type = Type::DOWNLOADER;
920 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
921 virtual bool Invoke (int id, NPIdentifier name,
922 const NPVariant *args, guint32 argCount, NPVariant *result);
925 /*** MoonlightTextBlock ***************************************************/
927 struct MoonlightTextBlockType : MoonlightUIElementType {
928 MoonlightTextBlockType ();
932 struct MoonlightTextBlockObject : MoonlightUIElementObject {
933 MoonlightTextBlockObject (NPP instance) : MoonlightUIElementObject (instance)
935 moonlight_type = Type::TEXTBLOCK;
938 virtual bool Invoke (int id, NPIdentifier name,
939 const NPVariant *args, guint32 argCount, NPVariant *result);
942 /*** MoonlightControl ***************************************************/
944 struct MoonlightControlType : MoonlightUIElementType {
945 MoonlightControlType ();
948 extern MoonlightControlType *MoonlightControlClass;
950 struct MoonlightControlObject : MoonlightUIElementObject {
951 MoonlightControlObject (NPP instance) : MoonlightUIElementObject (instance)
953 moonlight_type = Type::CONTROL;
956 virtual bool Invoke (int id, NPIdentifier name, const NPVariant *args, guint32 argCount, NPVariant *result);
959 /*** MoonlightTextBox ***************************************************/
961 struct MoonlightTextBoxType : MoonlightControlType {
962 MoonlightTextBoxType ();
966 struct MoonlightTextBoxObject : MoonlightControlObject {
967 MoonlightTextBoxObject (NPP instance) : MoonlightControlObject (instance)
969 moonlight_type = Type::TEXTBOX;
972 virtual bool Invoke (int id, NPIdentifier name,
973 const NPVariant *args, guint32 argCount, NPVariant *result);
977 /*** MoonlightPasswordBox ***************************************************/
979 struct MoonlightPasswordBoxType : MoonlightControlType {
980 MoonlightPasswordBoxType ();
984 struct MoonlightPasswordBoxObject : MoonlightControlObject {
985 MoonlightPasswordBoxObject (NPP instance) : MoonlightControlObject (instance)
987 moonlight_type = Type::PASSWORDBOX;
990 virtual bool Invoke (int id, NPIdentifier name,
991 const NPVariant *args, guint32 argCount, NPVariant *result);
994 /*** MoonlightStylusInfoType ***************************************************/
996 struct MoonlightStylusInfoType : MoonlightDependencyObjectType {
997 MoonlightStylusInfoType ();
1001 struct MoonlightStylusInfoObject : MoonlightDependencyObjectObject {
1002 MoonlightStylusInfoObject (NPP instance) : MoonlightDependencyObjectObject (instance)
1004 moonlight_type = Type::STYLUSINFO;
1007 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
1010 /*** MoonlightStylusPointCollectionType *************************************/
1012 struct MoonlightStylusPointCollectionType : MoonlightCollectionType {
1013 MoonlightStylusPointCollectionType ();
1017 struct MoonlightStylusPointCollectionObject : MoonlightCollectionObject {
1018 MoonlightStylusPointCollectionObject (NPP instance) : MoonlightCollectionObject (instance)
1020 moonlight_type = Type::STYLUSPOINT_COLLECTION;
1023 virtual bool Invoke (int id, NPIdentifier name,
1024 const NPVariant *args, guint32 argCount, NPVariant *result);
1028 /*** MoonlightStrokeCollectionType *************************************/
1030 struct MoonlightStrokeCollectionType : MoonlightCollectionType {
1031 MoonlightStrokeCollectionType ();
1035 struct MoonlightStrokeCollectionObject : MoonlightCollectionObject {
1037 MoonlightStrokeCollectionObject (NPP instance)
1038 : MoonlightCollectionObject (instance)
1040 moonlight_type = Type::STROKE_COLLECTION;
1043 virtual bool Invoke (int id, NPIdentifier name,
1044 const NPVariant *args, guint32 argCount, NPVariant *result);
1048 /*** MoonlightStrokeType *************************************/
1050 struct MoonlightStrokeType : MoonlightDependencyObjectType {
1051 MoonlightStrokeType ();
1055 struct MoonlightStrokeObject : MoonlightDependencyObjectObject {
1057 MoonlightStrokeObject (NPP instance)
1058 : MoonlightDependencyObjectObject (instance)
1060 moonlight_type = Type::STROKE;
1063 virtual bool Invoke (int id, NPIdentifier name,
1064 const NPVariant *args, guint32 argCount, NPVariant *result);
1067 /*** MoonlightScriptableObject ***************************************************/
1069 struct MoonlightScriptableObjectObject;
1071 typedef void (*InvokeDelegate) (gpointer managed_obj_handle, gpointer method_handle, char* name, Value** args, int arg_count, Value* return_value);
1072 typedef void (*SetPropertyDelegate) (gpointer managed_obj_handle, char* name, Value *value);
1073 typedef void (*GetPropertyDelegate) (gpointer managed_obj_handle, char* name, Value *value);
1074 typedef void (*EventHandlerDelegate) (gpointer managed_obj_handle, gpointer event_handle, MoonlightScriptableObjectObject* scriptable_obj, gpointer closure);
1076 struct MoonlightScriptableObjectType : MoonlightObjectType {
1077 MoonlightScriptableObjectType ();
1080 extern MoonlightScriptableObjectType *MoonlightScriptableObjectClass;
1082 struct MoonlightScriptableObjectObject : MoonlightObject {
1083 MoonlightScriptableObjectObject (NPP instance) : MoonlightObject (instance)
1085 managed_scriptable = NULL;
1086 properties = g_hash_table_new (g_direct_hash, g_direct_equal);
1087 methods = g_hash_table_new (g_direct_hash, g_direct_equal);
1088 events = g_hash_table_new (g_direct_hash, g_direct_equal);
1091 virtual ~MoonlightScriptableObjectObject ();
1093 virtual bool HasProperty (NPIdentifier name);
1094 virtual bool GetProperty (int id, NPIdentifier unmapped, NPVariant *result);
1095 virtual bool SetProperty (int id, NPIdentifier unmapped, const NPVariant *value);
1097 virtual bool HasMethod (NPIdentifier name);
1098 virtual bool Invoke (int id, NPIdentifier name,
1099 const NPVariant *args, guint32 argCount, NPVariant *result);
1101 gpointer managed_scriptable;
1102 GHashTable *properties;
1103 GHashTable *methods;
1104 GHashTable *events;
1106 InvokeDelegate invoke;
1107 SetPropertyDelegate setprop;
1108 GetPropertyDelegate getprop;
1109 EventHandlerDelegate addevent;
1110 EventHandlerDelegate removeevent;
1114 G_BEGIN_DECLS
1116 // These are meant to be called by System.Silverlight.dll
1117 /* @GeneratePInvoke */
1118 NPObject * moonlight_object_to_npobject (MoonlightObject *obj);
1119 MoonlightObject * npobject_to_moonlight_object (NPObject *npobj);
1121 /* @GeneratePInvoke */
1122 MoonlightScriptableObjectObject *moonlight_scriptable_object_wrapper_create_root (PluginInstance *plugin, gpointer scriptable,
1123 InvokeDelegate invoke,
1124 SetPropertyDelegate setprop,
1125 GetPropertyDelegate getprop,
1126 EventHandlerDelegate addevent,
1127 EventHandlerDelegate removeevent);
1129 /* @GeneratePInvoke */
1130 MoonlightScriptableObjectObject *moonlight_scriptable_object_wrapper_create (NPObject *parent, gpointer scriptable,
1131 InvokeDelegate invoke,
1132 SetPropertyDelegate setprop,
1133 GetPropertyDelegate getprop,
1134 EventHandlerDelegate addevent,
1135 EventHandlerDelegate removeevent);
1137 /* @GeneratePInvoke */
1138 void moonlight_scriptable_object_add_property (PluginInstance *plugin,
1139 MoonlightScriptableObjectObject *obj,
1140 gpointer property_handle,
1141 char *property_name,
1142 /* @MarshalAs=TypeCode */ int property_type,
1143 bool can_read,
1144 bool can_write);
1146 /* @GeneratePInvoke */
1147 void moonlight_scriptable_object_add_event (PluginInstance *plugin,
1148 MoonlightScriptableObjectObject *obj,
1149 gpointer event_handle,
1150 char *event_name);
1152 /* @GeneratePInvoke */
1153 void moonlight_scriptable_object_add_method (PluginInstance *plugin,
1154 MoonlightScriptableObjectObject *obj,
1155 gpointer method_handle,
1156 char *method_name,
1157 /* @MarshalAs=TypeCode */ int method_return_type,
1158 /* @MarshalAs=TypeCode[] */ int *method_parameter_types,
1159 int parameter_count);
1161 /* @GeneratePInvoke */
1162 void moonlight_scriptable_object_register (PluginInstance *plugin,
1163 char *name,
1164 MoonlightScriptableObjectObject *obj);
1166 /* @GeneratePInvoke */
1167 void moonlight_scriptable_object_emit_event (PluginInstance *plugin,
1168 MoonlightScriptableObjectObject *obj,
1169 MoonlightScriptableObjectObject *event_args,
1170 NPObject *cb_obj);
1172 /*** HtmlObject ***************************************************/
1174 // int clientX, int clientY,
1176 typedef void callback_dom_event (gpointer context, char *name, int client_x, int client_y, int offset_x, int offset_y, gboolean alt_key,
1177 gboolean ctrl_key, gboolean shift_key, int mouse_button,
1178 int key_code, int char_code,
1179 gpointer domEvent);
1181 const char *html_get_element_text (PluginInstance *plugin, const char *element_id);
1183 // These are meant to be called by System.Silverlight.dll
1184 /* @GeneratePInvoke */
1185 bool html_object_has_property (PluginInstance *plugin, NPObject *npobj, char *name);
1186 /* @GeneratePInvoke */
1187 void html_object_get_property (PluginInstance *plugin, NPObject *npobj, char *name, /* @MarshalAs=Mono.Value,IsOut */ Value *result);
1188 /* @GeneratePInvoke */
1189 void html_object_set_property (PluginInstance *plugin, NPObject *npobj, char *name, Value *value);
1190 /* @GeneratePInvoke */
1191 bool html_object_invoke (PluginInstance *plugin, NPObject *npobj, char *name, /* @MarshalAs=Mono.Value[] */ Value *args, guint32 arg_count, /* @MarshalAs=Mono.Value,IsOut */ Value *result);
1192 /* @GeneratePInvoke */
1193 bool html_object_invoke_self (PluginInstance *plugin, NPObject *npobj, /* @MarshalAs=Mono.Value[] */ Value *args, guint32 arg_count, /* @MarshalAs=Mono.Value,IsOut */ Value *result);
1194 /* @GeneratePInvoke */
1195 gpointer html_object_attach_event (PluginInstance *plugin, NPObject *npobj, char *name, callback_dom_event *cb, gpointer context);
1196 /* @GeneratePInvoke */
1197 void html_object_detach_event (PluginInstance *plugin, const char *name, gpointer listener);
1198 /* @GeneratePInvoke */
1199 void html_object_release (PluginInstance *plugin, NPObject *npobj);
1200 /* @GeneratePInvoke */
1201 void html_object_retain (PluginInstance *plugin, NPObject *npobj);
1203 /*** Browser interaction utility classes ***/
1204 void browser_do_alert (PluginInstance *plugin, char *msg);
1207 G_END_DECLS
1209 #endif /* __PLUGIN_CLASS_H__ */