Window class is not part of Unity integration because the system window implementation is already provided by Unity and we don't have control over that part.
In Unity you should implement your own Window/Dialog control and add those window-drag (or even docking) capabilities to your implementation. That is usually done by registering to MouseLeftButtonDown to detect when user clicks over the title border area, capture the mouse and listen to MouseMove events to update window position until MouseLeftButtonUp is fired to release the capture.
To manage the position you can place all the windows inside a Canvas panel and use Canvas.Left and Canvas.Top properties (or use RenderTransform as you did). You can also change ZIndex property to determine the z-order of the windows.
Regarding the
ConnectEvent function, as explained in our
Events tutorial, you don't need to use reflection to attach to the events, just use the input parameters to explicitly add the corresponding handler:
protected override bool ConnectEvent(object source, string eventName, string handlerName)
{
if (eventName == "MouseLeftButtonDown" && handlerName == "ScienceWindowName_MouseLeftButtonDown")
{
((UIElement)source).MouseLeftButtonDown += this.ScienceWindowName_MouseLeftButtonDown;
return true;
}
if (eventName == "MouseLeftButtonUp" && handlerName == "ScienceWindowName_MouseLeftButtonUp")
{
((UIElement)source).MouseLeftButtonUp += this.ScienceWindowName_MouseLeftButtonUp;
return true;
}
if (eventName == "MouseMove" && handlerName == "ScienceWindowName_MouseMove")
{
((UIElement)source).MouseMove += this.ScienceWindowName_MouseMove;
return true;
}
return false;
}
That code is something we want to automatically generate in the future with our plugin, but there is already someone that implemented a Unity script to do it:
viewtopic.php?f=3&t=1670&hilit=ConnectEvent