void item_MouseUp(object sender, MouseEventArgs e) { ToolStripItem item = sender as ToolStripItem; Floaty floaty = item.Tag as Floaty; floaty.Show(); }
void ShowVisual() { if (my_visual == null) { GameObject popup = Peripheral.Instance.zoo.getObject(visual, true); //RectTransform rt = popup.GetComponent<RectTransform>(); my_visual = popup.GetComponent <Floaty>(); } my_visual.Init(castle_position); }
/// ------------------------------------------------------------------------------------ /// <summary> /// finds the potential dockhost control at the specified location /// </summary> /// ------------------------------------------------------------------------------------ internal Control FindDockHost(Floaty floaty, Point pt) { Control c = null; if (FormIsHit(floaty.DockState.OrgDockHost, pt)) c = floaty.DockState.OrgDockHost; //assume toplevel control if (((IFloaty)floaty).DockOnHostOnly) return c; foreach (Floaty f in Floaties) { if (f.DockState.Container.Visible && FormIsHit(f.DockState.Container, pt)) { // add this line to dissallow docking inside floaties //if (f.Visible) continue; c = f.DockState.Container; // found suitable floating form break; } } return c; }
/// ------------------------------------------------------------------------------------ /// <summary> /// attach this class to any dockable type of container control to make it dockable. /// Attach a container control and use it as a grip hande. The handle must support mouse /// move events. Supply a splitter control to allow resizing of the docked container /// </summary> /// <param name="container">control to be dockable</param> /// <param name="handle">handle to be used to track the mouse movement (e.g. caption of /// the container)</param> /// <param name="splitter">splitter to resize the docked container (optional)</param> /// <returns></returns> /// ------------------------------------------------------------------------------------ public IFloaty Attach(ScrollableControl container, Control handle, Splitter splitter) { if (container == null) throw new ArgumentException("container cannot be null"); if (handle == null) throw new ArgumentException("handle cannot be null"); DockState dockState = new DockState(); dockState.Container = container; dockState.Handle = handle; dockState.OrgDockHost = _dockHost; dockState.Splitter = splitter; dockState.OrgFloatingBounds = container.Bounds; Floaty floaty = new Floaty(this); floaty.Persistence = m_persistence; floaty.Attach(dockState); _floaties.Add(floaty); return floaty; }
/// <summary> /// attach this class to any dockable type of container control /// to make it dockable. /// Attach a container control and use it as a grip hande. The handle must support mouse move events. /// Supply a splitter control to allow resizing of the docked container /// </summary> /// <param name="container">control to be dockable</param> /// <param name="handle">handle to be used to track the mouse movement (e.g. caption of the container)</param> /// <param name="splitter">splitter to resize the docked container (optional)</param> public IFloaty Attach(Control container, Control handle, Splitter splitter) { if (container == null) throw new ArgumentException("container cannot be null"); if (handle == null) throw new ArgumentException("handle cannot be null"); DockState _dockState = new DockState(); _dockState.Container = container; _dockState.Handle = handle; _dockState.OrgDockHost = _dockHost; _dockState.Splitter = splitter; Floaty floaty = new Floaty(this); floaty.Attach(_dockState); _floaties.Add(floaty); return floaty; }
// Use this for initialization void Start() { floaty = GetComponentInParent <Floaty>(); }