Ejemplo n.º 1
0
        protected IntPtr DelegateToCallbackPointer(
            HDrawingObject.HDrawingObjectCallbackClass c,
            string evt)
        {
            HDrawingObject.HDrawingObjectCallback hdrawingObjectCallback = (HDrawingObject.HDrawingObjectCallback)((drawid, window, type) =>
            {
                HDrawingObject drawid1 = new HDrawingObject(drawid);
                HWindow window1        = new HWindow(window);
                drawid1.Detach();
                window1.Detach();
                c(drawid1, window1, type);
            });
            GC.KeepAlive((object)hdrawingObjectCallback);
            GC.SuppressFinalize((object)hdrawingObjectCallback);
            switch (evt)
            {
            case "on_resize":
                this.onresize = hdrawingObjectCallback;
                break;

            case "on_attach":
                this.onattach = hdrawingObjectCallback;
                break;

            case "on_detach":
                this.ondetach = hdrawingObjectCallback;
                break;

            case "on_drag":
                this.ondrag = hdrawingObjectCallback;
                break;

            case "on_select":
                this.onselect = hdrawingObjectCallback;
                break;
            }
            return(Marshal.GetFunctionPointerForDelegate(hdrawingObjectCallback));
        }
Ejemplo n.º 2
0
 /// <summary>Adds a callback for the detach event, that is, this callback is
 /// executed when a drawing object is detached from the window.</summary>
 /// <param name="f">Callback function with the signature defined by
 /// HDrawingObjectCallback</param>
 public void OnDetach(HDrawingObject.HDrawingObjectCallbackClass f)
 {
     this.SetDrawingObjectCallback("on_detach", this.DelegateToCallbackPointer(f, "on_detach"));
 }
Ejemplo n.º 3
0
 /// <summary>Adds a callback for the resize event, that is, this callback is
 /// executed whenever the drawing object is selected.</summary>
 /// <param name="f">Callback function with the signature defined by
 /// HDrawingObjectCallback</param>
 public void OnSelect(HDrawingObject.HDrawingObjectCallbackClass f)
 {
     this.SetDrawingObjectCallback("on_select", this.DelegateToCallbackPointer(f, "on_select"));
 }
Ejemplo n.º 4
0
 /// <summary>Adds a callback for the resize event, that is, this callback is
 /// executed whenever the user changes any of the dimensions of the draw
 /// object.</summary>
 /// <param name="f">Callback function with the signature defined by
 /// HDrawingObjectCallback</param>
 public void OnResize(HDrawingObject.HDrawingObjectCallbackClass f)
 {
     this.SetDrawingObjectCallback("on_resize", this.DelegateToCallbackPointer(f, "on_resize"));
 }