1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * plugin-class.h: MoonLight browser plugin - autogenerated header classes
6 * Moonlight List (moonlight-list@lists.ximian.com)
8 * Copyright 2007-2009 Novell, Inc. (http://www.novell.com)
10 * See the LICENSE file included with the distribution for details.
14 #ifndef __PLUGIN_CLASS_H__
15 #define __PLUGIN_CLASS_H__
17 #include "moonlight.h"
22 #define DEBUG_JAVASCRIPT 1
24 #define DEPENDENCY_OBJECT_FROM_VARIANT(obj) (((MoonlightDependencyObjectObject*) NPVARIANT_TO_OBJECT (obj))->GetDependencyObject ())
26 #define THROW_JS_EXCEPTION(meth) \
28 char *message = g_strdup_printf ("Error calling method: %s", meth); \
29 NPN_SetException (this, message); \
34 #define THROW_JS_EXCEPTION2(obj, meth) \
36 char *message = g_strdup_printf ("Error calling method: %s", meth); \
37 NPN_SetException (obj, message); \
42 enum PluginPropertyId {
46 MoonId_ErrorCode
= 0x4000,
71 MoonId_PlatformKeyCode
,
80 MoonId_EnableFramerateCounter
,
81 MoonId_EnableRedrawRegions
,
82 MoonId_EnableHtmlAccess
,
98 MoonId_MultiScaleImage_Source
,
100 // event names (handled by the property setters)
101 MoonId_BufferingProgressChanged
,
103 MoonId_CurrentStateChanged
,
104 MoonId_DownloadProgressChanged
,
111 MoonId_MarkerReached
,
118 MoonId_MouseLeftButtonDown
,
119 MoonId_MouseLeftButtonUp
,
121 MoonId_OnFullScreenChange
,
124 MoonId_OnSourceDownloadProgressChanged
,
125 MoonId_OnSourceDownloadComplete
,
128 MoonId_GetPosition
= 0x8000,
130 MoonId_IsVersionSupported
,
132 MoonId_CreateFromXaml
,
133 MoonId_CreateFromXamlDownloader
,
137 MoonId_GetStylusInfo
,
138 MoonId_GetStylusPoints
,
140 MoonId_ReleaseMouseCapture
,
141 MoonId_AddEventListener
,
142 MoonId_RemoveEventListener
,
148 MoonId_DumpNameScope
,
156 MoonId_GetItemByName
,
164 MoonId_SetFontSource
,
167 MoonId_GetResponseText
,
169 MoonId_AddStylusPoints
,
174 MoonId_StopPropagation
,
175 MoonId_PreventDefault
,
183 MoonId_MultiScaleImage_GetIthSubImage
,
184 MoonId_MultiScaleImage_GetSubImageCount
,
185 MoonId_MultiScaleImage_LogicalToElementX
,
186 MoonId_MultiScaleImage_LogicalToElementY
,
187 MoonId_MultiScaleImage_ZoomAboutLogicalPoint
,
192 #define MAPPING_FLAG_SL1 0x01
193 #define MAPPING_FLAG_SL2 0x02
195 struct MoonNameIdMapping
{
200 #define IS_METHOD(id) (((id) & 0x8000) != 0)
201 #define IS_PROPERTY(id) (((id) & 0x4000) != 0)
205 G_GNUC_INTERNAL
bool npobject_is_dependency_object (NPObject
*obj
);
207 G_GNUC_INTERNAL
bool check_arg_list (const char *arglist
, guint32 argc
, const NPVariant
*argv
);
209 G_GNUC_INTERNAL
void plugin_init_classes (void);
210 G_GNUC_INTERNAL
void plugin_destroy_classes (void);
212 G_GNUC_INTERNAL
void event_object_add_xaml_listener (EventObject
*obj
, PluginInstance
*instance
, const char *event_name
, const char *cb_name
);
214 void string_to_npvariant (const char *value
, NPVariant
*result
);
215 G_GNUC_INTERNAL
void variant_to_value (const NPVariant
*v
, Value
**result
);
219 class MoonlightObject
;
221 /*** EventListenerProxy */
222 typedef void (*EventArgsWrapper
)(NPP instance
, EventArgs
*calldata
, NPVariant
*value
);
224 class EventListenerProxy
: public EventObject
{
225 static void on_handler_removed (gpointer closure
);
227 EventObject
*target_object
;
228 MoonlightObject
*owner
;
233 /* if @is_func == true, callback is an NPObject (the function object)
234 if @is_func == false, callback is a char* (the function name)
245 EventListenerProxy (NPP instance
, const char *event_name
, const char *cb_name
);
246 EventListenerProxy (NPP instance
, const char *event_name
, const NPVariant
*cb
);
247 virtual ~EventListenerProxy ();
249 void SetOwner (MoonlightObject
*owner
);
251 int AddXamlHandler (EventObject
*obj
);
252 int AddHandler (EventObject
*obj
);
253 void RemoveHandler ();
254 const char *GetCallbackAsString ();
256 int GetEventId () { return event_id
; }
257 int GetEventToken () { return token
; }
259 void SetOneShot () { one_shot
= true; }
261 static void proxy_listener_to_javascript (EventObject
*sender
, EventArgs
*calldata
, gpointer closure
);
265 /*** MoonlightObjectClass **************************************************************/
267 struct MoonlightObjectType
: NPClass
{
268 MoonlightObjectType ();
270 ~MoonlightObjectType() { g_free (mapping
); }
272 void AddMapping (const MoonNameIdMapping
*mapping
, int count
);
274 bool Enumerate (NPIdentifier
**value
, guint32
*count
);
276 int LookupName (NPIdentifier name
);
278 MoonNameIdMapping
*mapping
;
281 NPIdentifier last_lookup
;
285 extern MoonlightObjectType
*MoonlightObjectClass
;
287 struct MoonlightObject
: NPObject
{
288 MoonlightObject (NPP instance
)
290 this->instance
= instance
;
291 this->moonlight_type
= Type::INVALID
;
292 this->event_listener_proxies
= g_hash_table_new (g_direct_hash
, g_direct_equal
);
295 virtual void Invalidate () { }
296 virtual ~MoonlightObject ();
298 virtual bool HasProperty (NPIdentifier name
);
299 virtual bool GetProperty (int id
, NPIdentifier name
, NPVariant
*result
);
300 virtual bool SetProperty (int id
, NPIdentifier name
, const NPVariant
*value
);
302 virtual bool HasMethod (NPIdentifier unmapped
);
303 virtual bool Invoke (int id
, NPIdentifier name
,
304 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
305 int LookupName (NPIdentifier name
) { return ((MoonlightObjectType
*)_class
)->LookupName (name
); }
307 EventListenerProxy
*LookupEventProxy (int event_id
);
308 void SetEventProxy (EventListenerProxy
* proxy
);
309 void ClearEventProxy (EventListenerProxy
*proxy
);
311 static void destroy_proxy (gpointer data
);
312 static void invalidate_proxy (gpointer key
, gpointer value
, gpointer data
);
315 Type::Kind moonlight_type
;
316 GHashTable
*event_listener_proxies
;
320 /*** MoonlightEventObjectClass ***************************************************/
321 struct MoonlightEventObjectType
: MoonlightObjectType
{
322 MoonlightEventObjectType ();
325 extern MoonlightEventObjectType
*MoonlightEventObjectClass
;
327 struct MoonlightEventObjectObject
: MoonlightObject
{
328 MoonlightEventObjectObject (NPP instance
) : MoonlightObject (instance
)
330 moonlight_type
= Type::EVENTOBJECT
;
334 virtual ~MoonlightEventObjectObject ();
339 extern MoonlightEventObjectObject
*EventObjectCreateWrapper (NPP instance
, EventObject
*obj
);
341 /*** MoonlightDependencyObjectClass ***************************************************/
342 struct MoonlightDependencyObjectType
: MoonlightEventObjectType
{
343 MoonlightDependencyObjectType ();
347 struct MoonlightDependencyObjectObject
: MoonlightEventObjectObject
{
348 MoonlightDependencyObjectObject (NPP instance
) : MoonlightEventObjectObject (instance
)
350 moonlight_type
= Type::DEPENDENCY_OBJECT
;
353 DependencyObject
*GetDependencyObject ()
355 if (eo
== NULL
|| !eo
->Is (Type::DEPENDENCY_OBJECT
)) {
356 g_warning ("MoonlightDependencyObjectObject::GetDependencyObject (): Not a dependency object!");
360 return (DependencyObject
*) eo
;
363 virtual bool HasProperty (NPIdentifier unmapped
);
364 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
365 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
367 virtual bool Invoke (int id
, NPIdentifier name
,
368 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
372 extern MoonlightDependencyObjectObject
*DependencyObjectCreateWrapper (NPP instance
, DependencyObject
*obj
);
375 /*************** AUTO GENERATED CLASSES ****************************/
379 /*************** END OF AUTO GENERATED CLASSES *********************/
381 /*** MoonlightPointClass **************************************************************/
382 struct MoonlightPointType
: MoonlightObjectType
{
383 MoonlightPointType ();
386 extern MoonlightPointType
*MoonlightPointClass
;
388 struct MoonlightPoint
: MoonlightObject
{
389 MoonlightPoint (NPP instance
) : MoonlightObject(instance
), point (Point())
391 moonlight_type
= Type::POINT
;
394 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
395 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
400 /*** MoonlightRectClass **************************************************************/
401 struct MoonlightRectType
: MoonlightObjectType
{
402 MoonlightRectType ();
405 extern MoonlightRectType
*MoonlightRectClass
;
407 struct MoonlightRect
: MoonlightObject
{
408 MoonlightRect (NPP instance
) : MoonlightObject(instance
), rect (Rect())
410 moonlight_type
= Type::RECT
;
413 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
414 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
420 /*** MoonlightDurationClass **************************************************************/
421 struct MoonlightDurationType
: MoonlightObjectType
{
422 MoonlightDurationType ();
425 extern MoonlightDurationType
*MoonlightDurationClass
;
427 struct MoonlightDuration
: MoonlightObject
{
428 MoonlightDuration (NPP instance
) : MoonlightObject (instance
)
430 moonlight_type
= Type::DURATION
;
431 parent_property
= NULL
;
435 virtual ~MoonlightDuration ();
437 void SetParentInfo (DependencyObject
*parent_obj
, DependencyProperty
*parent_property
);
441 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
442 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
444 DependencyProperty
*parent_property
;
445 DependencyObject
*parent_obj
;
448 /*** MoonlightTimeSpanClass **************************************************************/
449 struct MoonlightTimeSpanType
: MoonlightObjectType
{
450 MoonlightTimeSpanType ();
453 extern MoonlightTimeSpanType
*MoonlightTimeSpanClass
;
455 struct MoonlightTimeSpan
: MoonlightObject
{
456 MoonlightTimeSpan (NPP instance
) : MoonlightObject (instance
)
458 moonlight_type
= Type::TIMESPAN
;
459 parent_property
= NULL
;
463 virtual ~MoonlightTimeSpan ();
465 void SetParentInfo (DependencyObject
*parent_obj
, DependencyProperty
*parent_property
);
467 TimeSpan
GetValue ();
469 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
470 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
472 DependencyProperty
*parent_property
;
473 DependencyObject
*parent_obj
;
476 /*** MoonlightKeyTimeClass ****************************************************************/
477 struct MoonlightKeyTimeType
: MoonlightObjectType
{
478 MoonlightKeyTimeType ();
481 extern MoonlightKeyTimeType
*MoonlightKeyTimeClass
;
483 struct MoonlightKeyTime
: MoonlightObject
{
484 MoonlightKeyTime (NPP instance
) : MoonlightObject (instance
)
486 moonlight_type
= Type::KEYTIME
;
487 parent_property
= NULL
;
491 virtual ~MoonlightKeyTime ();
493 void SetParentInfo (DependencyObject
*parent_obj
, DependencyProperty
*parent_property
);
495 KeyTime
* GetValue ();
497 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
498 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
500 DependencyProperty
*parent_property
;
501 DependencyObject
*parent_obj
;
504 /*** MoonlightThicknessClass ****************************************************************/
505 struct MoonlightThicknessType
: MoonlightObjectType
{
506 MoonlightThicknessType ();
509 extern MoonlightThicknessType
*MoonlightThicknessClass
;
511 struct MoonlightThickness
: MoonlightObject
{
512 MoonlightThickness (NPP instance
) : MoonlightObject (instance
)
514 moonlight_type
= Type::THICKNESS
;
515 parent_property
= NULL
;
519 virtual ~MoonlightThickness ();
521 void SetParentInfo (DependencyObject
*parent_obj
, DependencyProperty
*parent_property
);
523 Thickness
* GetValue ();
525 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
526 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
528 DependencyProperty
*parent_property
;
529 DependencyObject
*parent_obj
;
532 /*** MoonlightCornerRadiusClass ****************************************************************/
533 struct MoonlightCornerRadiusType
: MoonlightObjectType
{
534 MoonlightCornerRadiusType ();
537 extern MoonlightCornerRadiusType
*MoonlightCornerRadiusClass
;
539 struct MoonlightCornerRadius
: MoonlightObject
{
540 MoonlightCornerRadius (NPP instance
) : MoonlightObject (instance
)
542 moonlight_type
= Type::CORNERRADIUS
;
543 parent_property
= NULL
;
547 virtual ~MoonlightCornerRadius ();
549 void SetParentInfo (DependencyObject
*parent_obj
, DependencyProperty
*parent_property
);
551 CornerRadius
* GetValue ();
553 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
554 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
556 DependencyProperty
*parent_property
;
557 DependencyObject
*parent_obj
;
560 /*** MoonlightGridLengthClass ****************************************************************/
561 struct MoonlightGridLengthType
: MoonlightObjectType
{
562 MoonlightGridLengthType ();
565 extern MoonlightGridLengthType
*MoonlightGridLengthClass
;
567 struct MoonlightGridLength
: MoonlightObject
{
568 MoonlightGridLength (NPP instance
) : MoonlightObject (instance
)
570 moonlight_type
= Type::GRIDLENGTH
;
571 parent_property
= NULL
;
575 virtual ~MoonlightGridLength ();
577 void SetParentInfo (DependencyObject
*parent_obj
, DependencyProperty
*parent_property
);
579 GridLength
* GetValue ();
581 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
582 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
584 DependencyProperty
*parent_property
;
585 DependencyObject
*parent_obj
;
588 /*** MoonlightSettingsClass ***********************************************************/
590 struct MoonlightSettingsType
: MoonlightObjectType
{
591 MoonlightSettingsType ();
594 extern MoonlightSettingsType
*MoonlightSettingsClass
;
596 struct MoonlightSettingsObject
: MoonlightObject
{
597 MoonlightSettingsObject (NPP instance
) : MoonlightObject (instance
)
601 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
602 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
604 virtual bool Invoke (int id
, NPIdentifier name
,
605 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
609 /*** MoonlightContentClass ************************************************************/
611 struct MoonlightContentType
: MoonlightObjectType
{
612 MoonlightContentType ();
615 extern MoonlightContentType
*MoonlightContentClass
;
617 struct MoonlightContentObject
: MoonlightObject
{
618 MoonlightContentObject (NPP instance
) : MoonlightObject (instance
)
620 registered_scriptable_objects
= g_hash_table_new (g_direct_hash
, g_direct_equal
);
621 accessibility
= NULL
;
624 virtual ~MoonlightContentObject ();
626 virtual bool HasProperty (NPIdentifier unmapped
);
627 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
628 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
630 virtual bool Invoke (int id
, NPIdentifier name
,
631 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
633 DependencyObject
*accessibility
;
634 GHashTable
*registered_scriptable_objects
;
637 /*** MoonlightScriptControlClass **********************************************************/
639 struct MoonlightScriptControlType
: MoonlightObjectType
{
640 MoonlightScriptControlType ();
643 extern MoonlightScriptControlType
*MoonlightScriptControlClass
;
645 struct MoonlightScriptControlObject
: MoonlightObject
{
646 MoonlightScriptControlObject (NPP instance
) : MoonlightObject (instance
)
648 settings
= NPN_CreateObject (instance
, MoonlightSettingsClass
);
649 content
= NPN_CreateObject (instance
, MoonlightContentClass
);
652 virtual ~MoonlightScriptControlObject ();
654 virtual void Invalidate ();
656 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
657 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
659 virtual bool Invoke (int id
, NPIdentifier name
,
660 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
667 /*** MoonlightEventArgsClass ******************************************************/
668 struct MoonlightEventArgsType
: MoonlightDependencyObjectType
{
669 MoonlightEventArgsType ();
672 struct MoonlightEventArgs
: MoonlightDependencyObjectObject
{
673 MoonlightEventArgs (NPP instance
) : MoonlightDependencyObjectObject (instance
)
675 moonlight_type
= Type::EVENTARGS
;
679 /*** MoonlightEventArgsClass ******************************************************/
680 struct MoonlightRoutedEventArgsType
: MoonlightEventArgsType
{
681 MoonlightRoutedEventArgsType ();
684 struct MoonlightRoutedEventArgs
: MoonlightEventArgs
{
685 MoonlightRoutedEventArgs (NPP instance
) : MoonlightEventArgs (instance
)
687 moonlight_type
= Type::ROUTEDEVENTARGS
;
690 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
692 RoutedEventArgs
*GetRoutedEventArgs () { return (RoutedEventArgs
*) eo
; }
695 /*** MoonlightMouseEventArgsClass **************************************************************/
696 struct MoonlightMouseEventArgsType
: MoonlightRoutedEventArgsType
{
697 MoonlightMouseEventArgsType ();
700 struct MoonlightMouseEventArgsObject
: MoonlightRoutedEventArgs
{
701 MoonlightMouseEventArgsObject (NPP instance
) : MoonlightRoutedEventArgs (instance
)
703 moonlight_type
= Type::MOUSEEVENTARGS
;
706 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
707 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
708 virtual bool Invoke (int id
, NPIdentifier name
,
709 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
711 MouseEventArgs
*GetMouseEventArgs () { return (MouseEventArgs
*) eo
; };
714 /*** MoonlightMarkerReachedEventArgsClass ******************************************/
715 struct MoonlightMarkerReachedEventArgsType
: MoonlightRoutedEventArgsType
{
716 MoonlightMarkerReachedEventArgsType ();
719 extern MoonlightMarkerReachedEventArgsType
*MoonlightMarkerReachedEventArgsClass
;
721 struct MoonlightMarkerReachedEventArgsObject
: MoonlightRoutedEventArgs
{
722 MoonlightMarkerReachedEventArgsObject (NPP instance
) : MoonlightRoutedEventArgs (instance
)
724 moonlight_type
= Type::MARKERREACHEDEVENTARGS
;
727 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
729 MarkerReachedEventArgs
*GetMarkerReachedEventArgs () { return (MarkerReachedEventArgs
*) eo
; }
732 /*** MoonlightKeyEventArgsClass **************************************************************/
733 struct MoonlightKeyEventArgsType
: MoonlightEventArgsType
{
734 MoonlightKeyEventArgsType ();
737 struct MoonlightKeyEventArgsObject
: MoonlightEventArgs
{
738 MoonlightKeyEventArgsObject (NPP instance
) : MoonlightEventArgs (instance
)
740 moonlight_type
= Type::KEYEVENTARGS
;
743 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
744 KeyEventArgs
*GetKeyEventArgs () { return (KeyEventArgs
*) eo
; }
747 /*** MoonlightDownloadProgressEventArgsClass ******************************************************/
748 struct MoonlightDownloadProgressEventArgsType
: MoonlightEventArgsType
{
749 MoonlightDownloadProgressEventArgsType ();
752 struct MoonlightDownloadProgressEventArgs
: MoonlightEventArgs
{
753 MoonlightDownloadProgressEventArgs (NPP instance
) : MoonlightEventArgs (instance
)
755 moonlight_type
= Type::DOWNLOADPROGRESSEVENTARGS
;
758 DownloadProgressEventArgs
*GetDownloadProgressEventArgs () { return (DownloadProgressEventArgs
*) eo
; }
759 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
762 /*** MoonlightErrorEventArgsClass ******************************************************/
763 struct MoonlightErrorEventArgsType
: MoonlightEventArgsType
{
764 MoonlightErrorEventArgsType ();
767 struct MoonlightErrorEventArgs
: MoonlightEventArgs
{
768 MoonlightErrorEventArgs (NPP instance
) : MoonlightEventArgs (instance
)
770 moonlight_type
= Type::ERROREVENTARGS
;
773 ErrorEventArgs
*GetErrorEventArgs () { return (ErrorEventArgs
*) eo
; }
774 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
777 /*** MoonlightCollectionClass ***************************************************/
779 struct MoonlightCollectionType
: MoonlightDependencyObjectType
{
780 MoonlightCollectionType ();
783 struct MoonlightCollectionObject
: MoonlightDependencyObjectObject
{
784 MoonlightCollectionObject (NPP instance
) : MoonlightDependencyObjectObject (instance
)
786 moonlight_type
= Type::COLLECTION
;
789 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
791 virtual bool Invoke (int id
, NPIdentifier name
,
792 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
795 /*** MoonlightStoryboardClass ***************************************************/
797 struct MoonlightStoryboardType
: MoonlightDependencyObjectType
{
798 MoonlightStoryboardType ();
801 struct MoonlightStoryboardObject
: MoonlightDependencyObjectObject
{
802 MoonlightStoryboardObject (NPP instance
) : MoonlightDependencyObjectObject (instance
)
804 moonlight_type
= Type::STORYBOARD
;
807 virtual bool Invoke (int id
, NPIdentifier name
,
808 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
811 /*** MoonlightMediaElement ***************************************************/
813 struct MoonlightMediaElementType
: MoonlightUIElementType
{
814 MoonlightMediaElementType ();
818 struct MoonlightMediaElementObject
: MoonlightUIElementObject
{
819 MoonlightMediaElementObject (NPP instance
) : MoonlightUIElementObject (instance
)
821 moonlight_type
= Type::MEDIAELEMENT
;
824 virtual bool Invoke (int id
, NPIdentifier name
,
825 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
828 /*** MoonlightMultiScaleImage ***************************************************/
830 struct MoonlightMultiScaleImageType
: MoonlightDependencyObjectType
{
831 MoonlightMultiScaleImageType ();
834 struct MoonlightMultiScaleImageObject
: MoonlightDependencyObjectObject
{
835 MoonlightMultiScaleImageObject (NPP instance
) : MoonlightDependencyObjectObject (instance
)
837 moonlight_type
= Type::MULTISCALEIMAGE
;
840 virtual bool Invoke (int id
, NPIdentifier name
,
841 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
843 virtual bool SetProperty (int id
, NPIdentifier name
, const NPVariant
*value
);
846 /*** MoonlightImage ***************************************************/
848 struct MoonlightImageType
: MoonlightUIElementType
{
849 MoonlightImageType ();
853 struct MoonlightImageObject
: MoonlightUIElementObject
{
854 MoonlightImageObject (NPP instance
) : MoonlightUIElementObject (instance
)
856 moonlight_type
= Type::IMAGE
;
859 virtual bool Invoke (int id
, NPIdentifier name
,
860 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
861 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
864 /*** MoonlightImageBrush ***************************************************/
866 struct MoonlightImageBrushType
: MoonlightDependencyObjectType
{
867 MoonlightImageBrushType ();
871 struct MoonlightImageBrushObject
: MoonlightDependencyObjectObject
{
872 MoonlightImageBrushObject (NPP instance
) : MoonlightDependencyObjectObject (instance
)
874 moonlight_type
= Type::IMAGEBRUSH
;
877 virtual bool Invoke (int id
, NPIdentifier name
,
878 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
879 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
882 /*** MoonlightDownloader ***************************************************/
884 struct MoonlightDownloaderType
: MoonlightDependencyObjectType
{
885 MoonlightDownloaderType ();
889 struct MoonlightDownloaderObject
: MoonlightDependencyObjectObject
{
890 MoonlightDownloaderObject (NPP instance
) : MoonlightDependencyObjectObject (instance
)
892 moonlight_type
= Type::DOWNLOADER
;
895 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
896 virtual bool Invoke (int id
, NPIdentifier name
,
897 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
900 /*** MoonlightTextBlock ***************************************************/
902 struct MoonlightTextBlockType
: MoonlightUIElementType
{
903 MoonlightTextBlockType ();
907 struct MoonlightTextBlockObject
: MoonlightUIElementObject
{
908 MoonlightTextBlockObject (NPP instance
) : MoonlightUIElementObject (instance
)
910 moonlight_type
= Type::TEXTBLOCK
;
913 virtual bool Invoke (int id
, NPIdentifier name
,
914 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
917 /*** MoonlightControl ***************************************************/
919 struct MoonlightControlType
: MoonlightUIElementType
{
920 MoonlightControlType ();
923 extern MoonlightControlType
*MoonlightControlClass
;
925 struct MoonlightControlObject
: MoonlightUIElementObject
{
926 MoonlightControlObject (NPP instance
) : MoonlightUIElementObject (instance
)
928 moonlight_type
= Type::CONTROL
;
931 virtual bool Invoke (int id
, NPIdentifier name
, const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
934 /*** MoonlightTextBox ***************************************************/
936 struct MoonlightTextBoxType
: MoonlightControlType
{
937 MoonlightTextBoxType ();
941 struct MoonlightTextBoxObject
: MoonlightControlObject
{
942 MoonlightTextBoxObject (NPP instance
) : MoonlightControlObject (instance
)
944 moonlight_type
= Type::TEXTBOX
;
947 virtual bool Invoke (int id
, NPIdentifier name
,
948 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
952 /*** MoonlightPasswordBox ***************************************************/
954 struct MoonlightPasswordBoxType
: MoonlightControlType
{
955 MoonlightPasswordBoxType ();
959 struct MoonlightPasswordBoxObject
: MoonlightControlObject
{
960 MoonlightPasswordBoxObject (NPP instance
) : MoonlightControlObject (instance
)
962 moonlight_type
= Type::PASSWORDBOX
;
965 virtual bool Invoke (int id
, NPIdentifier name
,
966 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
969 /*** MoonlightStylusInfoType ***************************************************/
971 struct MoonlightStylusInfoType
: MoonlightDependencyObjectType
{
972 MoonlightStylusInfoType ();
976 struct MoonlightStylusInfoObject
: MoonlightDependencyObjectObject
{
977 MoonlightStylusInfoObject (NPP instance
) : MoonlightDependencyObjectObject (instance
)
979 moonlight_type
= Type::STYLUSINFO
;
982 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
985 /*** MoonlightStylusPointCollectionType *************************************/
987 struct MoonlightStylusPointCollectionType
: MoonlightCollectionType
{
988 MoonlightStylusPointCollectionType ();
992 struct MoonlightStylusPointCollectionObject
: MoonlightCollectionObject
{
993 MoonlightStylusPointCollectionObject (NPP instance
) : MoonlightCollectionObject (instance
)
995 moonlight_type
= Type::STYLUSPOINT_COLLECTION
;
998 virtual bool Invoke (int id
, NPIdentifier name
,
999 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
1003 /*** MoonlightStrokeCollectionType *************************************/
1005 struct MoonlightStrokeCollectionType
: MoonlightCollectionType
{
1006 MoonlightStrokeCollectionType ();
1010 struct MoonlightStrokeCollectionObject
: MoonlightCollectionObject
{
1012 MoonlightStrokeCollectionObject (NPP instance
)
1013 : MoonlightCollectionObject (instance
)
1015 moonlight_type
= Type::STROKE_COLLECTION
;
1018 virtual bool Invoke (int id
, NPIdentifier name
,
1019 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
1023 /*** MoonlightStrokeType *************************************/
1025 struct MoonlightStrokeType
: MoonlightDependencyObjectType
{
1026 MoonlightStrokeType ();
1030 struct MoonlightStrokeObject
: MoonlightDependencyObjectObject
{
1032 MoonlightStrokeObject (NPP instance
)
1033 : MoonlightDependencyObjectObject (instance
)
1035 moonlight_type
= Type::STROKE
;
1038 virtual bool Invoke (int id
, NPIdentifier name
,
1039 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
1042 /*** MoonlightScriptableObject ***************************************************/
1044 struct MoonlightScriptableObjectObject
;
1046 typedef void (*InvokeDelegate
) (gpointer managed_obj_handle
, gpointer method_handle
, char* name
, Value
** args
, int arg_count
, Value
* return_value
);
1047 typedef void (*SetPropertyDelegate
) (gpointer managed_obj_handle
, char* name
, Value
*value
);
1048 typedef void (*GetPropertyDelegate
) (gpointer managed_obj_handle
, char* name
, Value
*value
);
1049 typedef void (*EventHandlerDelegate
) (gpointer managed_obj_handle
, gpointer event_handle
, MoonlightScriptableObjectObject
* scriptable_obj
, gpointer closure
);
1051 struct MoonlightScriptableObjectType
: MoonlightObjectType
{
1052 MoonlightScriptableObjectType ();
1055 extern MoonlightScriptableObjectType
*MoonlightScriptableObjectClass
;
1057 struct MoonlightScriptableObjectObject
: MoonlightObject
{
1058 MoonlightScriptableObjectObject (NPP instance
) : MoonlightObject (instance
)
1060 managed_scriptable
= NULL
;
1061 properties
= g_hash_table_new (g_direct_hash
, g_direct_equal
);
1062 methods
= g_hash_table_new (g_direct_hash
, g_direct_equal
);
1063 events
= g_hash_table_new (g_direct_hash
, g_direct_equal
);
1066 virtual ~MoonlightScriptableObjectObject ();
1068 virtual bool HasProperty (NPIdentifier name
);
1069 virtual bool GetProperty (int id
, NPIdentifier unmapped
, NPVariant
*result
);
1070 virtual bool SetProperty (int id
, NPIdentifier unmapped
, const NPVariant
*value
);
1072 virtual bool HasMethod (NPIdentifier name
);
1073 virtual bool Invoke (int id
, NPIdentifier name
,
1074 const NPVariant
*args
, guint32 argCount
, NPVariant
*result
);
1076 gpointer managed_scriptable
;
1077 GHashTable
*properties
;
1078 GHashTable
*methods
;
1081 InvokeDelegate invoke
;
1082 SetPropertyDelegate setprop
;
1083 GetPropertyDelegate getprop
;
1084 EventHandlerDelegate addevent
;
1085 EventHandlerDelegate removeevent
;
1091 // These are meant to be called by System.Silverlight.dll
1092 /* @GeneratePInvoke */
1093 NPObject
* moonlight_object_to_npobject (MoonlightObject
*obj
);
1094 MoonlightObject
* npobject_to_moonlight_object (NPObject
*npobj
);
1096 /* @GeneratePInvoke */
1097 MoonlightScriptableObjectObject
*moonlight_scriptable_object_wrapper_create_root (PluginInstance
*plugin
, gpointer scriptable
,
1098 InvokeDelegate invoke
,
1099 SetPropertyDelegate setprop
,
1100 GetPropertyDelegate getprop
,
1101 EventHandlerDelegate addevent
,
1102 EventHandlerDelegate removeevent
);
1104 /* @GeneratePInvoke */
1105 MoonlightScriptableObjectObject
*moonlight_scriptable_object_wrapper_create (NPObject
*parent
, gpointer scriptable
,
1106 InvokeDelegate invoke
,
1107 SetPropertyDelegate setprop
,
1108 GetPropertyDelegate getprop
,
1109 EventHandlerDelegate addevent
,
1110 EventHandlerDelegate removeevent
);
1112 /* @GeneratePInvoke */
1113 void moonlight_scriptable_object_add_property (PluginInstance
*plugin
,
1114 MoonlightScriptableObjectObject
*obj
,
1115 gpointer property_handle
,
1116 char *property_name
,
1117 /* @MarshalAs=TypeCode */ int property_type
,
1121 /* @GeneratePInvoke */
1122 void moonlight_scriptable_object_add_event (PluginInstance
*plugin
,
1123 MoonlightScriptableObjectObject
*obj
,
1124 gpointer event_handle
,
1127 /* @GeneratePInvoke */
1128 void moonlight_scriptable_object_add_method (PluginInstance
*plugin
,
1129 MoonlightScriptableObjectObject
*obj
,
1130 gpointer method_handle
,
1132 /* @MarshalAs=TypeCode */ int method_return_type
,
1133 /* @MarshalAs=TypeCode[] */ int *method_parameter_types
,
1134 int parameter_count
);
1136 /* @GeneratePInvoke */
1137 void moonlight_scriptable_object_register (PluginInstance
*plugin
,
1139 MoonlightScriptableObjectObject
*obj
);
1141 /* @GeneratePInvoke */
1142 void moonlight_scriptable_object_emit_event (PluginInstance
*plugin
,
1143 MoonlightScriptableObjectObject
*obj
,
1144 MoonlightScriptableObjectObject
*event_args
,
1147 /*** HtmlObject ***************************************************/
1149 // int clientX, int clientY,
1151 typedef void callback_dom_event (gpointer context
, char *name
, int client_x
, int client_y
, int offset_x
, int offset_y
, gboolean alt_key
,
1152 gboolean ctrl_key
, gboolean shift_key
, int mouse_button
,
1153 int key_code
, int char_code
,
1156 const char *html_get_element_text (PluginInstance
*plugin
, const char *element_id
);
1158 // These are meant to be called by System.Silverlight.dll
1159 /* @GeneratePInvoke */
1160 bool html_object_has_property (PluginInstance
*plugin
, NPObject
*npobj
, char *name
);
1161 /* @GeneratePInvoke */
1162 void html_object_get_property (PluginInstance
*plugin
, NPObject
*npobj
, char *name
, /* @MarshalAs=Mono.Value,IsOut */ Value
*result
);
1163 /* @GeneratePInvoke */
1164 void html_object_set_property (PluginInstance
*plugin
, NPObject
*npobj
, char *name
, Value
*value
);
1165 /* @GeneratePInvoke */
1166 bool html_object_invoke (PluginInstance
*plugin
, NPObject
*npobj
, char *name
, /* @MarshalAs=Mono.Value[] */ Value
*args
, guint32 arg_count
, /* @MarshalAs=Mono.Value,IsOut */ Value
*result
);
1167 /* @GeneratePInvoke */
1168 bool html_object_invoke_self (PluginInstance
*plugin
, NPObject
*npobj
, /* @MarshalAs=Mono.Value[] */ Value
*args
, guint32 arg_count
, /* @MarshalAs=Mono.Value,IsOut */ Value
*result
);
1169 /* @GeneratePInvoke */
1170 gpointer
html_object_attach_event (PluginInstance
*plugin
, NPObject
*npobj
, char *name
, callback_dom_event
*cb
, gpointer context
);
1171 /* @GeneratePInvoke */
1172 void html_object_detach_event (PluginInstance
*plugin
, const char *name
, gpointer listener
);
1173 /* @GeneratePInvoke */
1174 void html_object_release (PluginInstance
*plugin
, NPObject
*npobj
);
1175 /* @GeneratePInvoke */
1176 void html_object_retain (PluginInstance
*plugin
, NPObject
*npobj
);
1178 /*** Browser interaction utility classes ***/
1179 void browser_do_alert (PluginInstance
*plugin
, char *msg
);
1184 #endif /* __PLUGIN_CLASS_H__ */