public override bool DragAndDrop_HandleDrop(Gwen.DragDrop.Package pPackage, int x, int y) { var pPos = CanvasPosToLocal( new Point( x, y ) ); m_SelectionLayer.Hide(); var pDroppedOn = GetControlAt( pPos.X, pPos.Y ); // pDroppedOn = FindParentControlFactoryControl( pDroppedOn ); m_SelectionLayer.Show(); if ( pDroppedOn == null ) pDroppedOn = this; pPos = pDroppedOn.CanvasPosToLocal( new Point( x, y ) ); if ( pPackage.Name == "ControlSpawn" ) { //ControlFactory::Base* pControlFactory = static_cast<ControlFactory::Base*>(pPackage->userdata); var type = pPackage.data as Type; if (type == null) return false; //TODO LOG var constructor = type.GetConstructor(new Type[] { typeof(Gwen.Control.Base) }); if (constructor == null) return false; //TODO LOG var pControl = (Gwen.Control.Base) constructor.Invoke(new object[] { pDroppedOn }); if (pControl == null) return false; //TODO LOG pControl.SetPosition(pPos.X, pPos.Y); pControl.MouseInputEnabled = true ; if (ChildAdded != null) ChildAdded.Invoke(pControl); return true; } return false; }
public override bool DragAndDrop_CanAcceptPackage( Gwen.DragDrop.Package pPackage ) { return pPackage.Name == "ControlSpawn"; }