/// <summary> /// Handles load data notification /// </summary> unsafe static partial void Host_HandleLoadData(ISciterNotifications host, IntPtr pns) { var datantf = (SCN_LOAD_DATA *)pns; var e = new LoadDataEventArgs(datantf->GetUri(), () => datantf->GetData()) { IsCached = datantf->outData != IntPtr.Zero, //TODO: Htmlayout do not have such property //RequestId = datantf->request_id, ResourceType = (ResourceType)datantf->dataType }; host.ProcessLoadData(e); byte[] bytes = null; if (e.IsDataAvailable) { bytes = e.GetData(); } else { bytes = SciterFactory.ResolveBinResource(e.Uri, e.ResourceType); } SciterDataReady(datantf->hwnd, e.Uri, bytes); }
/// <summary> /// Handles data loaded notification /// </summary> unsafe static partial void Host_HandleDataLoaded(ISciterNotifications host, IntPtr pns) { var datantf = (SCN_DATA_LOADED *)pns; var e = new DataLoadedEventArgs(datantf->GetUri(), () => datantf->GetData()); host.ProcessDataLoaded(e); }
/// <summary> /// Handles host callback notification /// </summary> private unsafe static void Host_HandleCallbackHost(ISciterNotifications host, IntPtr pns) { var datantf = (SCN_CALLBACK_HOST *)pns; var e = new CallbackHostEventArgs((CallbackHostEventArgs.HostChannelType)datantf->channel, datantf->p1.GetValue(), datantf->p2.GetValue()); host.ProcessCallbackHost(e); if (e.ReturnValue != null) { datantf->r.SetValue(e.ReturnValue); } }
/// <summary> /// Handles behavior attach /// </summary> unsafe static partial void Host_HandleAttachBehavior(ISciterNotifications host, IntPtr pns) { var datantf = (SCN_ATTACH_BEHAVIOR *)pns; var e = new AttachBehaviorEventArgs(Element.Create(datantf->element), datantf->GetBehaviorName()); host.ProcessAttachBehavior(e); e.Behavior = e.Behavior ?? SciterFactory.ResolveBehavior(e.BehaviorName); if (e.Behavior != null) { datantf->elementProc = ElementEventProcEntryPoint; datantf->elementTag = InstanceProtector.Protect(e.Behavior); datantf->elementEvents = (EVENT_GROUPS)e.EventGroups; } }
unsafe static partial void Host_HandleDocumentComplete(ISciterNotifications host, IntPtr pns);
unsafe static partial void Host_HandleLoadData(ISciterNotifications host, IntPtr pns);
unsafe static partial void Host_HandleAttachBehavior(ISciterNotifications host, IntPtr pns);
/// <summary> /// Assings host callback to the sciter window /// </summary> /// <param name="hWndSciter"></param> /// <param name="ntf"></param> public static void SciterSetCallback(IntPtr hWndSciter, ISciterNotifications ntf) { Debug.Assert(ntf != null, "Notification callback cannot be null"); HTMLayoutSetCallback(hWndSciter, _nativeCallback, InstanceProtector.Protect(ntf)); }
/// <summary> /// Handles document complete event /// </summary> static unsafe partial void Host_HandleDocumentComplete(ISciterNotifications host, IntPtr pns) { host.ProcessDocumentComplete(DocumentCompleteEventArgs.Empty); }
/// <summary> /// Handles host callback notification /// </summary> private unsafe static void Host_HandleCallbackHost(ISciterNotifications host, IntPtr pns) { var datantf = (SCN_CALLBACK_HOST*)pns; var e = new CallbackHostEventArgs((CallbackHostEventArgs.HostChannelType)datantf->channel, datantf->p1.GetValue(), datantf->p2.GetValue()); host.ProcessCallbackHost(e); if (e.ReturnValue != null) datantf->r.SetValue(e.ReturnValue); }
/// <summary> /// Assings host callback to the sciter window /// </summary> /// <param name="hWndSciter"></param> /// <param name="ntf"></param> public static void SciterSetCallback(IntPtr hWndSciter, ISciterNotifications ntf) { SciterSetCallback(hWndSciter, _nativeCallback, InstanceProtector.Protect(ntf)); }