2 * Automatically generated, do not edit this file directly
5 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
7 * plugin-class.h: MoonLight browser plugin - autogenerated header classes
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"
26 #define DEBUG_JAVASCRIPT 1
28 #define DEPENDENCY_OBJECT_FROM_VARIANT(obj) (((MoonlightDependencyObjectObject*) NPVARIANT_TO_OBJECT (obj))->GetDependencyObject ())
30 #define THROW_JS_EXCEPTION(meth) \
32 char *message = g_strdup_printf ("Error calling method: %s", meth); \
33 NPN_SetException (this, message); \
38 #define THROW_JS_EXCEPTION2(obj, meth) \
40 char *message = g_strdup_printf ("Error calling method: %s", meth); \
41 NPN_SetException (obj, message); \
46 enum PluginPropertyId {
50 MoonId_ErrorCode
= 0x4000,
75 MoonId_PlatformKeyCode
,
84 MoonId_EnableFramerateCounter
,
85 MoonId_EnableRedrawRegions
,
86 MoonId_EnableHtmlAccess
,
101 MoonId_Accessibility
,
102 MoonId_MultiScaleImage_Source
,
104 // event names (handled by the property setters)
105 MoonId_BufferingProgressChanged
,
107 MoonId_CurrentStateChanged
,
108 MoonId_DownloadProgressChanged
,
115 MoonId_MarkerReached
,
122 MoonId_MouseLeftButtonDown
,
123 MoonId_MouseLeftButtonUp
,
125 MoonId_OnFullScreenChange
,
128 MoonId_OnSourceDownloadProgressChanged
,
129 MoonId_OnSourceDownloadComplete
,
132 MoonId_GetPosition
= 0x8000,
134 MoonId_IsVersionSupported
,
136 MoonId_CreateFromXaml
,
137 MoonId_CreateFromXamlDownloader
,
141 MoonId_GetStylusInfo
,
142 MoonId_GetStylusPoints
,
144 MoonId_ReleaseMouseCapture
,
145 MoonId_AddEventListener
,
146 MoonId_RemoveEventListener
,
152 MoonId_DumpNameScope
,
160 MoonId_GetItemByName
,
168 MoonId_SetFontSource
,
171 MoonId_GetResponseText
,
173 MoonId_AddStylusPoints
,
178 MoonId_StopPropagation
,
179 MoonId_PreventDefault
,
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
{
208 #define IS_METHOD(id) (((id) & 0x8000) != 0)
209 #define IS_PROPERTY(id) (((id) & 0x4000) != 0)
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
);
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 PluginInstance
*plugin
;
241 /* if @is_func == true, callback is an NPObject (the function object)
242 if @is_func == false, callback is a char* (the function name)
253 EventListenerProxy (PluginInstance
*plugin
, const char *event_name
, const char *cb_name
);
254 EventListenerProxy (PluginInstance
*plugin
, 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; }
268 gpointer
GetCallback () { return callback
; }
269 bool IsFunc () { return is_func
; }
271 PluginInstance
*GetPlugin () { return plugin
; }
272 NPP
GetInstance () { return plugin
->GetInstance (); }
274 static void proxy_listener_to_javascript (EventObject
*sender
, EventArgs
*calldata
, gpointer closure
);
278 /*** MoonlightObjectClass **************************************************************/
280 struct MoonlightObjectType
: NPClass
{
281 MoonlightObjectType ();
283 ~MoonlightObjectType() { g_free (mapping
); }
285 void AddMapping (const MoonNameIdMapping
*mapping
, int count
);
287 bool Enumerate (NPIdentifier
**value
, guint32
*count
);
289 int LookupName (NPIdentifier name
);
291 MoonNameIdMapping
*mapping
;
294 NPIdentifier last_lookup
;
298 extern MoonlightObjectType
*MoonlightObjectClass
;
300 struct MoonlightObject
: NPObject
{
301 MoonlightObject (NPP instance
)
304 g_assert (instance
->pdata
!= NULL
); /* #if SANITY */
306 this->plugin
= (PluginInstance
*) instance
->pdata
;
308 this->plugin
->ref ();
309 this->moonlight_type
= Type::INVALID
;
310 this->event_listener_proxies
= g_hash_table_new (g_direct_hash
, g_direct_equal
);
313 virtual void Invalidate () { }
314 virtual ~MoonlightObject ();
316 virtual bool HasProperty (NPIdentifier name
);
317 virtual bool GetProperty (int id
, NPIdentifier name
, NPVariant
*result
);
318 virtual bool SetProperty (int id
, NPIdentifier name
, const NPVariant
*value
);
320 virtual bool HasMethod (NPIdentifier unmapped
);
321 virtual bool Invoke (int id
, NPIdentifier name
,
322 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
323 int LookupName (NPIdentifier name
) { return ((MoonlightObjectType
*)_class
)->LookupName (name
); }
325 void SetPlugin (PluginInstance
*plugin
)
328 this->plugin
->unref ();
329 this->plugin
= plugin
;
330 this->plugin
->ref ();
333 EventListenerProxy
*LookupEventProxy (int event_id
);
334 void SetEventProxy (EventListenerProxy
* proxy
);
335 void ClearEventProxy (EventListenerProxy
*proxy
);
336 void ClearEventProxies ();
337 NPP
GetInstance () { return plugin
->GetInstance (); }
338 PluginInstance
*GetPlugin () { return plugin
; }
340 static void destroy_proxy (gpointer data
);
341 static void invalidate_proxy (gpointer key
, gpointer value
, gpointer data
);
343 PluginInstance
*plugin
;
344 Type::Kind moonlight_type
;
345 GHashTable
*event_listener_proxies
;
349 /*** MoonlightEventObjectClass ***************************************************/
350 struct MoonlightEventObjectType
: MoonlightObjectType
{
351 MoonlightEventObjectType ();
354 extern MoonlightEventObjectType
*MoonlightEventObjectClass
;
356 struct MoonlightEventObjectObject
: MoonlightObject
{
357 MoonlightEventObjectObject (NPP instance
) : MoonlightObject (instance
)
359 moonlight_type
= Type::EVENTOBJECT
;
363 virtual ~MoonlightEventObjectObject ();
368 extern MoonlightEventObjectObject
*EventObjectCreateWrapper (PluginInstance
*plugin
, EventObject
*obj
);
370 /*** MoonlightDependencyObjectClass ***************************************************/
371 struct MoonlightDependencyObjectType
: MoonlightEventObjectType
{
372 MoonlightDependencyObjectType ();
376 struct MoonlightDependencyObjectObject
: MoonlightEventObjectObject
{
377 MoonlightDependencyObjectObject (NPP instance
) : MoonlightEventObjectObject (instance
)
379 moonlight_type
= Type::DEPENDENCY_OBJECT
;
382 DependencyObject
*GetDependencyObject ()
384 if (eo
== NULL
|| !eo
->Is (Type::DEPENDENCY_OBJECT
)) {
385 g_warning ("MoonlightDependencyObjectObject::GetDependencyObject (): Not a dependency object!");
389 return (DependencyObject
*) eo
;
392 virtual bool HasProperty (NPIdentifier unmapped
);
393 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
394 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
396 virtual bool Invoke (int id
, NPIdentifier name
,
397 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
401 extern MoonlightDependencyObjectObject
*DependencyObjectCreateWrapper (NPP instance
, DependencyObject
*obj
);
404 /*************** AUTO GENERATED CLASSES ****************************/
406 /*** MoonlightUIElementClass *********/
407 struct MoonlightUIElementType
: MoonlightDependencyObjectType
{
408 MoonlightUIElementType ();
411 extern MoonlightUIElementType
*MoonlightUIElementClass
;
413 struct MoonlightUIElementObject
: MoonlightDependencyObjectObject
{
414 MoonlightUIElementObject (NPP instance
) : MoonlightDependencyObjectObject (instance
)
416 moonlight_type
= Type::UIELEMENT
;
419 virtual bool Invoke (int id
, NPIdentifier name
,
420 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
425 /*************** END OF AUTO GENERATED CLASSES *********************/
427 /*** MoonlightPointClass **************************************************************/
428 struct MoonlightPointType
: MoonlightObjectType
{
429 MoonlightPointType ();
432 extern MoonlightPointType
*MoonlightPointClass
;
434 struct MoonlightPoint
: MoonlightObject
{
435 MoonlightPoint (NPP instance
) : MoonlightObject(instance
), point (Point())
437 moonlight_type
= Type::POINT
;
440 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
441 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
446 /*** MoonlightRectClass **************************************************************/
447 struct MoonlightRectType
: MoonlightObjectType
{
448 MoonlightRectType ();
451 extern MoonlightRectType
*MoonlightRectClass
;
453 struct MoonlightRect
: MoonlightObject
{
454 MoonlightRect (NPP instance
) : MoonlightObject(instance
), rect (Rect())
456 moonlight_type
= Type::RECT
;
459 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
460 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
466 /*** MoonlightDurationClass **************************************************************/
467 struct MoonlightDurationType
: MoonlightObjectType
{
468 MoonlightDurationType ();
471 extern MoonlightDurationType
*MoonlightDurationClass
;
473 struct MoonlightDuration
: MoonlightObject
{
474 MoonlightDuration (NPP instance
) : MoonlightObject (instance
)
476 moonlight_type
= Type::DURATION
;
477 parent_property
= NULL
;
481 virtual ~MoonlightDuration ();
483 void SetParentInfo (DependencyObject
*parent_obj
, DependencyProperty
*parent_property
);
487 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
488 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
490 DependencyProperty
*parent_property
;
491 DependencyObject
*parent_obj
;
494 /*** MoonlightTimeSpanClass **************************************************************/
495 struct MoonlightTimeSpanType
: MoonlightObjectType
{
496 MoonlightTimeSpanType ();
499 extern MoonlightTimeSpanType
*MoonlightTimeSpanClass
;
501 struct MoonlightTimeSpan
: MoonlightObject
{
502 MoonlightTimeSpan (NPP instance
) : MoonlightObject (instance
)
504 moonlight_type
= Type::TIMESPAN
;
505 parent_property
= NULL
;
509 virtual ~MoonlightTimeSpan ();
511 void SetParentInfo (DependencyObject
*parent_obj
, DependencyProperty
*parent_property
);
513 TimeSpan
GetValue ();
515 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
516 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
518 DependencyProperty
*parent_property
;
519 DependencyObject
*parent_obj
;
522 /*** MoonlightKeyTimeClass ****************************************************************/
523 struct MoonlightKeyTimeType
: MoonlightObjectType
{
524 MoonlightKeyTimeType ();
527 extern MoonlightKeyTimeType
*MoonlightKeyTimeClass
;
529 struct MoonlightKeyTime
: MoonlightObject
{
530 MoonlightKeyTime (NPP instance
) : MoonlightObject (instance
)
532 moonlight_type
= Type::KEYTIME
;
533 parent_property
= NULL
;
537 virtual ~MoonlightKeyTime ();
539 void SetParentInfo (DependencyObject
*parent_obj
, DependencyProperty
*parent_property
);
541 KeyTime
* GetValue ();
543 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
544 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
546 DependencyProperty
*parent_property
;
547 DependencyObject
*parent_obj
;
550 /*** MoonlightThicknessClass ****************************************************************/
551 struct MoonlightThicknessType
: MoonlightObjectType
{
552 MoonlightThicknessType ();
555 extern MoonlightThicknessType
*MoonlightThicknessClass
;
557 struct MoonlightThickness
: MoonlightObject
{
558 MoonlightThickness (NPP instance
) : MoonlightObject (instance
)
560 moonlight_type
= Type::THICKNESS
;
561 parent_property
= NULL
;
565 virtual ~MoonlightThickness ();
567 void SetParentInfo (DependencyObject
*parent_obj
, DependencyProperty
*parent_property
);
569 Thickness
* GetValue ();
571 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
572 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
574 DependencyProperty
*parent_property
;
575 DependencyObject
*parent_obj
;
578 /*** MoonlightCornerRadiusClass ****************************************************************/
579 struct MoonlightCornerRadiusType
: MoonlightObjectType
{
580 MoonlightCornerRadiusType ();
583 extern MoonlightCornerRadiusType
*MoonlightCornerRadiusClass
;
585 struct MoonlightCornerRadius
: MoonlightObject
{
586 MoonlightCornerRadius (NPP instance
) : MoonlightObject (instance
)
588 moonlight_type
= Type::CORNERRADIUS
;
589 parent_property
= NULL
;
593 virtual ~MoonlightCornerRadius ();
595 void SetParentInfo (DependencyObject
*parent_obj
, DependencyProperty
*parent_property
);
597 CornerRadius
* GetValue ();
599 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
600 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
602 DependencyProperty
*parent_property
;
603 DependencyObject
*parent_obj
;
606 /*** MoonlightGridLengthClass ****************************************************************/
607 struct MoonlightGridLengthType
: MoonlightObjectType
{
608 MoonlightGridLengthType ();
611 extern MoonlightGridLengthType
*MoonlightGridLengthClass
;
613 struct MoonlightGridLength
: MoonlightObject
{
614 MoonlightGridLength (NPP instance
) : MoonlightObject (instance
)
616 moonlight_type
= Type::GRIDLENGTH
;
617 parent_property
= NULL
;
621 virtual ~MoonlightGridLength ();
623 void SetParentInfo (DependencyObject
*parent_obj
, DependencyProperty
*parent_property
);
625 GridLength
* GetValue ();
627 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
628 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
630 DependencyProperty
*parent_property
;
631 DependencyObject
*parent_obj
;
634 /*** MoonlightSettingsClass ***********************************************************/
636 struct MoonlightSettingsType
: MoonlightObjectType
{
637 MoonlightSettingsType ();
640 extern MoonlightSettingsType
*MoonlightSettingsClass
;
642 struct MoonlightSettingsObject
: MoonlightObject
{
643 MoonlightSettingsObject (NPP instance
) : MoonlightObject (instance
)
647 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
648 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
650 virtual bool Invoke (int id
, NPIdentifier name
,
651 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
655 /*** MoonlightContentClass ************************************************************/
657 struct MoonlightContentType
: MoonlightObjectType
{
658 MoonlightContentType ();
661 extern MoonlightContentType
*MoonlightContentClass
;
663 struct MoonlightContentObject
: MoonlightObject
{
664 MoonlightContentObject (NPP instance
) : MoonlightObject (instance
)
666 registered_scriptable_objects
= g_hash_table_new (g_direct_hash
, g_direct_equal
);
667 accessibility
= NULL
;
670 virtual ~MoonlightContentObject ();
672 virtual bool HasProperty (NPIdentifier unmapped
);
673 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
674 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
676 virtual bool Invoke (int id
, NPIdentifier name
,
677 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
679 DependencyObject
*accessibility
;
680 GHashTable
*registered_scriptable_objects
;
683 /*** MoonlightScriptControlClass **********************************************************/
685 struct MoonlightScriptControlType
: MoonlightObjectType
{
686 MoonlightScriptControlType ();
689 extern MoonlightScriptControlType
*MoonlightScriptControlClass
;
691 struct MoonlightScriptControlObject
: MoonlightObject
{
692 MoonlightScriptControlObject (NPP instance
) : MoonlightObject (instance
)
694 settings
= (MoonlightSettingsObject
*) NPN_CreateObject (instance
, MoonlightSettingsClass
);
695 content
= (MoonlightContentObject
*) NPN_CreateObject (instance
, MoonlightContentClass
);
698 virtual ~MoonlightScriptControlObject ();
700 virtual void Invalidate ();
702 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
703 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
705 virtual bool Invoke (int id
, NPIdentifier name
,
706 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
708 MoonlightSettingsObject
*settings
;
709 MoonlightContentObject
*content
;
711 /* store the current event handlers so that they survive PluginInstance destruction */
712 void PreSwitchPlugin (PluginInstance
*old_plugin
, PluginInstance
*new_plugin
);
713 /* restore the stored event handlers into the new PluginInstance */
714 void PostSwitchPlugin (PluginInstance
*old_plugin
, PluginInstance
*new_plugin
);
717 /* fields for storing the data in PreSwitchPlugin */
719 int *events_to_switch
;
720 MoonlightObject
**events_object
;
721 gpointer
*events_callbacks
;
722 bool *events_is_func
;
726 /*** MoonlightEventArgsClass ******************************************************/
727 struct MoonlightEventArgsType
: MoonlightDependencyObjectType
{
728 MoonlightEventArgsType ();
731 struct MoonlightEventArgs
: MoonlightDependencyObjectObject
{
732 MoonlightEventArgs (NPP instance
) : MoonlightDependencyObjectObject (instance
)
734 moonlight_type
= Type::EVENTARGS
;
738 /*** MoonlightEventArgsClass ******************************************************/
739 struct MoonlightRoutedEventArgsType
: MoonlightEventArgsType
{
740 MoonlightRoutedEventArgsType ();
743 struct MoonlightRoutedEventArgs
: MoonlightEventArgs
{
744 MoonlightRoutedEventArgs (NPP instance
) : MoonlightEventArgs (instance
)
746 moonlight_type
= Type::ROUTEDEVENTARGS
;
749 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
751 RoutedEventArgs
*GetRoutedEventArgs () { return (RoutedEventArgs
*) eo
; }
754 /*** MoonlightMouseEventArgsClass **************************************************************/
755 struct MoonlightMouseEventArgsType
: MoonlightRoutedEventArgsType
{
756 MoonlightMouseEventArgsType ();
759 struct MoonlightMouseEventArgsObject
: MoonlightRoutedEventArgs
{
760 MoonlightMouseEventArgsObject (NPP instance
) : MoonlightRoutedEventArgs (instance
)
762 moonlight_type
= Type::MOUSEEVENTARGS
;
765 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
766 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
767 virtual bool Invoke (int id
, NPIdentifier name
,
768 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
770 MouseEventArgs
*GetMouseEventArgs () { return (MouseEventArgs
*) eo
; };
773 /*** MoonlightMarkerReachedEventArgsClass ******************************************/
774 struct MoonlightTimelineMarkerRoutedEventArgsType
: MoonlightRoutedEventArgsType
{
775 MoonlightTimelineMarkerRoutedEventArgsType ();
778 extern MoonlightTimelineMarkerRoutedEventArgsType
*MoonlightTimelineMarkerRoutedEventArgsClass
;
780 struct MoonlightTimelineMarkerRoutedEventArgsObject
: MoonlightRoutedEventArgs
{
781 MoonlightTimelineMarkerRoutedEventArgsObject (NPP instance
) : MoonlightRoutedEventArgs (instance
)
783 moonlight_type
= Type::TIMELINEMARKERROUTEDEVENTARGS
;
786 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
788 TimelineMarkerRoutedEventArgs
*GetTimelineMarkerRoutedEventArgs () { return (TimelineMarkerRoutedEventArgs
*) eo
; }
791 /*** MoonlightKeyEventArgsClass **************************************************************/
792 struct MoonlightKeyEventArgsType
: MoonlightEventArgsType
{
793 MoonlightKeyEventArgsType ();
796 struct MoonlightKeyEventArgsObject
: MoonlightEventArgs
{
797 MoonlightKeyEventArgsObject (NPP instance
) : MoonlightEventArgs (instance
)
799 moonlight_type
= Type::KEYEVENTARGS
;
802 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
803 KeyEventArgs
*GetKeyEventArgs () { return (KeyEventArgs
*) eo
; }
806 /*** MoonlightDownloadProgressEventArgsClass ******************************************************/
807 struct MoonlightDownloadProgressEventArgsType
: MoonlightEventArgsType
{
808 MoonlightDownloadProgressEventArgsType ();
811 struct MoonlightDownloadProgressEventArgs
: MoonlightEventArgs
{
812 MoonlightDownloadProgressEventArgs (NPP instance
) : MoonlightEventArgs (instance
)
814 moonlight_type
= Type::DOWNLOADPROGRESSEVENTARGS
;
817 DownloadProgressEventArgs
*GetDownloadProgressEventArgs () { return (DownloadProgressEventArgs
*) eo
; }
818 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
821 /*** MoonlightErrorEventArgsClass ******************************************************/
822 struct MoonlightErrorEventArgsType
: MoonlightEventArgsType
{
823 MoonlightErrorEventArgsType ();
826 struct MoonlightErrorEventArgs
: MoonlightEventArgs
{
827 MoonlightErrorEventArgs (NPP instance
) : MoonlightEventArgs (instance
)
829 moonlight_type
= Type::ERROREVENTARGS
;
832 ErrorEventArgs
*GetErrorEventArgs () { return (ErrorEventArgs
*) eo
; }
833 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
836 /*** MoonlightCollectionClass ***************************************************/
838 struct MoonlightCollectionType
: MoonlightDependencyObjectType
{
839 MoonlightCollectionType ();
842 struct MoonlightCollectionObject
: MoonlightDependencyObjectObject
{
843 MoonlightCollectionObject (NPP instance
) : MoonlightDependencyObjectObject (instance
)
845 moonlight_type
= Type::COLLECTION
;
848 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
850 virtual bool Invoke (int id
, NPIdentifier name
,
851 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
854 /*** MoonlightStoryboardClass ***************************************************/
856 struct MoonlightStoryboardType
: MoonlightDependencyObjectType
{
857 MoonlightStoryboardType ();
860 struct MoonlightStoryboardObject
: MoonlightDependencyObjectObject
{
861 MoonlightStoryboardObject (NPP instance
) : MoonlightDependencyObjectObject (instance
)
863 moonlight_type
= Type::STORYBOARD
;
866 virtual bool Invoke (int id
, NPIdentifier name
,
867 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
870 /*** MoonlightMediaElement ***************************************************/
872 struct MoonlightMediaElementType
: MoonlightUIElementType
{
873 MoonlightMediaElementType ();
877 struct MoonlightMediaElementObject
: MoonlightUIElementObject
{
878 MoonlightMediaElementObject (NPP instance
) : MoonlightUIElementObject (instance
)
880 moonlight_type
= Type::MEDIAELEMENT
;
883 virtual bool Invoke (int id
, NPIdentifier name
,
884 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
887 /*** MoonlightMultiScaleImage ***************************************************/
889 struct MoonlightMultiScaleImageType
: MoonlightDependencyObjectType
{
890 MoonlightMultiScaleImageType ();
893 struct MoonlightMultiScaleImageObject
: MoonlightDependencyObjectObject
{
894 MoonlightMultiScaleImageObject (NPP instance
) : MoonlightDependencyObjectObject (instance
)
896 moonlight_type
= Type::MULTISCALEIMAGE
;
899 virtual bool Invoke (int id
, NPIdentifier name
,
900 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
902 virtual bool SetProperty (int id
, NPIdentifier name
, const NPVariant
*value
);
905 /*** MoonlightImage ***************************************************/
907 struct MoonlightImageType
: MoonlightUIElementType
{
908 MoonlightImageType ();
912 struct MoonlightImageObject
: MoonlightUIElementObject
{
913 MoonlightImageObject (NPP instance
) : MoonlightUIElementObject (instance
)
915 moonlight_type
= Type::IMAGE
;
918 virtual bool Invoke (int id
, NPIdentifier name
,
919 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
920 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
923 /*** MoonlightImageBrush ***************************************************/
925 struct MoonlightImageBrushType
: MoonlightDependencyObjectType
{
926 MoonlightImageBrushType ();
930 struct MoonlightImageBrushObject
: MoonlightDependencyObjectObject
{
931 MoonlightImageBrushObject (NPP instance
) : MoonlightDependencyObjectObject (instance
)
933 moonlight_type
= Type::IMAGEBRUSH
;
936 virtual bool Invoke (int id
, NPIdentifier name
,
937 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
938 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
941 /*** MoonlightDownloader ***************************************************/
943 struct MoonlightDownloaderType
: MoonlightDependencyObjectType
{
944 MoonlightDownloaderType ();
948 struct MoonlightDownloaderObject
: MoonlightDependencyObjectObject
{
949 MoonlightDownloaderObject (NPP instance
) : MoonlightDependencyObjectObject (instance
)
951 moonlight_type
= Type::DOWNLOADER
;
954 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
955 virtual bool Invoke (int id
, NPIdentifier name
,
956 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
959 /*** MoonlightTextBlock ***************************************************/
961 struct MoonlightTextBlockType
: MoonlightUIElementType
{
962 MoonlightTextBlockType ();
966 struct MoonlightTextBlockObject
: MoonlightUIElementObject
{
967 MoonlightTextBlockObject (NPP instance
) : MoonlightUIElementObject (instance
)
969 moonlight_type
= Type::TEXTBLOCK
;
972 virtual bool Invoke (int id
, NPIdentifier name
,
973 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
976 /*** MoonlightControl ***************************************************/
978 struct MoonlightControlType
: MoonlightUIElementType
{
979 MoonlightControlType ();
982 extern MoonlightControlType
*MoonlightControlClass
;
984 struct MoonlightControlObject
: MoonlightUIElementObject
{
985 MoonlightControlObject (NPP instance
) : MoonlightUIElementObject (instance
)
987 moonlight_type
= Type::CONTROL
;
990 virtual bool Invoke (int id
, NPIdentifier name
, const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
993 /*** MoonlightTextBox ***************************************************/
995 struct MoonlightTextBoxType
: MoonlightControlType
{
996 MoonlightTextBoxType ();
1000 struct MoonlightTextBoxObject
: MoonlightControlObject
{
1001 MoonlightTextBoxObject (NPP instance
) : MoonlightControlObject (instance
)
1003 moonlight_type
= Type::TEXTBOX
;
1006 virtual bool Invoke (int id
, NPIdentifier name
,
1007 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
1011 /*** MoonlightPasswordBox ***************************************************/
1013 struct MoonlightPasswordBoxType
: MoonlightControlType
{
1014 MoonlightPasswordBoxType ();
1018 struct MoonlightPasswordBoxObject
: MoonlightControlObject
{
1019 MoonlightPasswordBoxObject (NPP instance
) : MoonlightControlObject (instance
)
1021 moonlight_type
= Type::PASSWORDBOX
;
1024 virtual bool Invoke (int id
, NPIdentifier name
,
1025 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
1028 /*** MoonlightStylusInfoType ***************************************************/
1030 struct MoonlightStylusInfoType
: MoonlightDependencyObjectType
{
1031 MoonlightStylusInfoType ();
1035 struct MoonlightStylusInfoObject
: MoonlightDependencyObjectObject
{
1036 MoonlightStylusInfoObject (NPP instance
) : MoonlightDependencyObjectObject (instance
)
1038 moonlight_type
= Type::STYLUSINFO
;
1041 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
1044 /*** MoonlightStylusPointCollectionType *************************************/
1046 struct MoonlightStylusPointCollectionType
: MoonlightCollectionType
{
1047 MoonlightStylusPointCollectionType ();
1051 struct MoonlightStylusPointCollectionObject
: MoonlightCollectionObject
{
1052 MoonlightStylusPointCollectionObject (NPP instance
) : MoonlightCollectionObject (instance
)
1054 moonlight_type
= Type::STYLUSPOINT_COLLECTION
;
1057 virtual bool Invoke (int id
, NPIdentifier name
,
1058 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
1062 /*** MoonlightStrokeCollectionType *************************************/
1064 struct MoonlightStrokeCollectionType
: MoonlightCollectionType
{
1065 MoonlightStrokeCollectionType ();
1069 struct MoonlightStrokeCollectionObject
: MoonlightCollectionObject
{
1071 MoonlightStrokeCollectionObject (NPP instance
)
1072 : MoonlightCollectionObject (instance
)
1074 moonlight_type
= Type::STROKE_COLLECTION
;
1077 virtual bool Invoke (int id
, NPIdentifier name
,
1078 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
1082 /*** MoonlightStrokeType *************************************/
1084 struct MoonlightStrokeType
: MoonlightDependencyObjectType
{
1085 MoonlightStrokeType ();
1089 struct MoonlightStrokeObject
: MoonlightDependencyObjectObject
{
1091 MoonlightStrokeObject (NPP instance
)
1092 : MoonlightDependencyObjectObject (instance
)
1094 moonlight_type
= Type::STROKE
;
1097 virtual bool Invoke (int id
, NPIdentifier name
,
1098 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
1101 /*** MoonlightScriptableObject ***************************************************/
1103 struct MoonlightScriptableObjectObject
;
1105 typedef void (*InvokeDelegate
) (gpointer managed_obj_handle
, gpointer method_handle
, char* name
, Value
** args
, int arg_count
, Value
* return_value
);
1106 typedef void (*SetPropertyDelegate
) (gpointer managed_obj_handle
, char* name
, Value
*value
);
1107 typedef void (*GetPropertyDelegate
) (gpointer managed_obj_handle
, char* name
, Value
*value
);
1108 typedef void (*EventHandlerDelegate
) (gpointer managed_obj_handle
, gpointer event_handle
, MoonlightScriptableObjectObject
* scriptable_obj
, gpointer closure
);
1110 struct MoonlightScriptableObjectType
: MoonlightObjectType
{
1111 MoonlightScriptableObjectType ();
1114 extern MoonlightScriptableObjectType
*MoonlightScriptableObjectClass
;
1116 struct MoonlightScriptableObjectObject
: MoonlightObject
{
1117 MoonlightScriptableObjectObject (NPP instance
) : MoonlightObject (instance
)
1119 managed_scriptable
= NULL
;
1120 properties
= g_hash_table_new (g_direct_hash
, g_direct_equal
);
1121 methods
= g_hash_table_new (g_direct_hash
, g_direct_equal
);
1122 events
= g_hash_table_new (g_direct_hash
, g_direct_equal
);
1125 virtual ~MoonlightScriptableObjectObject ();
1127 virtual bool HasProperty (NPIdentifier name
);
1128 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
1129 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
1131 virtual bool HasMethod (NPIdentifier name
);
1132 virtual bool Invoke (int id
, NPIdentifier name
,
1133 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
1135 gpointer managed_scriptable
;
1136 GHashTable
*properties
;
1137 GHashTable
*methods
;
1140 InvokeDelegate invoke
;
1141 SetPropertyDelegate setprop
;
1142 GetPropertyDelegate getprop
;
1143 EventHandlerDelegate addevent
;
1144 EventHandlerDelegate removeevent
;
1150 // These are meant to be called by System.Silverlight.dll
1151 /* @GeneratePInvoke */
1152 NPObject
* moonlight_object_to_npobject (MoonlightObject
*obj
);
1153 MoonlightObject
* npobject_to_moonlight_object (NPObject
*npobj
);
1155 /* @GeneratePInvoke */
1156 MoonlightScriptableObjectObject
*moonlight_scriptable_object_wrapper_create_root (PluginInstance
*plugin
, gpointer scriptable
,
1157 InvokeDelegate invoke
,
1158 SetPropertyDelegate setprop
,
1159 GetPropertyDelegate getprop
,
1160 EventHandlerDelegate addevent
,
1161 EventHandlerDelegate removeevent
);
1163 /* @GeneratePInvoke */
1164 MoonlightScriptableObjectObject
*moonlight_scriptable_object_wrapper_create (NPObject
*parent
, gpointer scriptable
,
1165 InvokeDelegate invoke
,
1166 SetPropertyDelegate setprop
,
1167 GetPropertyDelegate getprop
,
1168 EventHandlerDelegate addevent
,
1169 EventHandlerDelegate removeevent
);
1171 /* @GeneratePInvoke */
1172 void moonlight_scriptable_object_add_property (PluginInstance
*plugin
,
1173 MoonlightScriptableObjectObject
*obj
,
1174 gpointer property_handle
,
1175 char *property_name
,
1176 /* @MarshalAs=TypeCode */ int property_type
,
1180 /* @GeneratePInvoke */
1181 void moonlight_scriptable_object_add_event (PluginInstance
*plugin
,
1182 MoonlightScriptableObjectObject
*obj
,
1183 gpointer event_handle
,
1186 /* @GeneratePInvoke */
1187 void moonlight_scriptable_object_add_method (PluginInstance
*plugin
,
1188 MoonlightScriptableObjectObject
*obj
,
1189 gpointer method_handle
,
1191 /* @MarshalAs=TypeCode */ int method_return_type
,
1192 /* @MarshalAs=TypeCode[] */ int *method_parameter_types
,
1193 int parameter_count
);
1195 /* @GeneratePInvoke */
1196 void moonlight_scriptable_object_register (PluginInstance
*plugin
,
1198 MoonlightScriptableObjectObject
*obj
);
1200 /* @GeneratePInvoke */
1201 void moonlight_scriptable_object_emit_event (PluginInstance
*plugin
,
1202 MoonlightScriptableObjectObject
*obj
,
1203 MoonlightScriptableObjectObject
*event_args
,
1206 /*** HtmlObject ***************************************************/
1208 // int clientX, int clientY,
1210 typedef void callback_dom_event (gpointer context
, char *name
, int client_x
, int client_y
, int offset_x
, int offset_y
, gboolean alt_key
,
1211 gboolean ctrl_key
, gboolean shift_key
, int mouse_button
,
1212 int key_code
, int char_code
,
1215 const char *html_get_element_text (PluginInstance
*plugin
, const char *element_id
);
1217 // These are meant to be called by System.Silverlight.dll
1218 /* @GeneratePInvoke */
1219 bool html_object_has_property (PluginInstance
*plugin
, NPObject
*npobj
, char *name
);
1220 /* @GeneratePInvoke */
1221 void html_object_get_property (PluginInstance
*plugin
, NPObject
*npobj
, char *name
, /* @MarshalAs=Mono.Value,IsOut */ Value
*result
);
1222 /* @GeneratePInvoke */
1223 void html_object_set_property (PluginInstance
*plugin
, NPObject
*npobj
, char *name
, Value
*value
);
1224 /* @GeneratePInvoke */
1225 bool html_object_invoke (PluginInstance
*plugin
, NPObject
*npobj
, char *name
, /* @MarshalAs=Mono.Value[] */ Value
*args
, guint32 arg_count
, /* @MarshalAs=Mono.Value,IsOut */ Value
*result
);
1226 /* @GeneratePInvoke */
1227 bool html_object_invoke_self (PluginInstance
*plugin
, NPObject
*npobj
, /* @MarshalAs=Mono.Value[] */ Value
*args
, guint32 arg_count
, /* @MarshalAs=Mono.Value,IsOut */ Value
*result
);
1228 /* @GeneratePInvoke */
1229 gpointer
html_object_attach_event (PluginInstance
*plugin
, NPObject
*npobj
, char *name
, callback_dom_event
*cb
, gpointer context
);
1230 /* @GeneratePInvoke */
1231 void html_object_detach_event (PluginInstance
*plugin
, const char *name
, gpointer listener
);
1232 /* @GeneratePInvoke */
1233 void html_object_release (PluginInstance
*plugin
, NPObject
*npobj
);
1234 /* @GeneratePInvoke */
1235 void html_object_retain (PluginInstance
*plugin
, NPObject
*npobj
);
1237 /*** Browser interaction utility classes ***/
1238 void browser_do_alert (PluginInstance
*plugin
, char *msg
);
1243 #endif /* __PLUGIN_CLASS_H__ */