public static UISurface CreateSurface(string title, RECT frame) { UISurface newSurface = new UISurface(title, frame); return newSurface; }
public override void OnMouseUp(MouseEventArgs e) { //Console.WriteLine("MetaSpace.OnMouseUp - {0}", e.ToString()); if (fMouseTracker != null) { MouseEventArgs args = new MouseEventArgs(0, MouseEventType.MouseUp, e.Button, e.Clicks, (e.X-fMouseTracker.Frame.Left), (e.Y-fMouseTracker.Frame.Top), e.Delta, e.Source); fMouseTracker.OnMouseUp(args); fMouseTracker = null; } else { //Console.WriteLine("MetaSpace.OnMouseUp - no tracker found"); } }
public override void OnMouseDown(MouseEventArgs e) { //Console.WriteLine("MetaSpace.OnMouseDown - {0}", e.ToString()); UISurface tracker = GetUISurfaceAt(e.X, e.Y); // If no tracker, then don't do anything // Really, we should let the window handle it, but // for now, just return null if (tracker == null) return; fMouseTracker = tracker; // Create a new mouse event with the point translated into the // coordinate space of the client MouseEventArgs args = new MouseEventArgs(0,MouseEventType.MouseDown,e.Button,e.Clicks, (e.X-tracker.Frame.Left), (e.Y-tracker.Frame.Top), e.Delta, e.Source); tracker.OnMouseDown(args); base.OnMouseDown(e); }
public override void OnMouseMove(MouseEventArgs e) { //Console.WriteLine("MetaSpace.OnMouseMove - {0}", e.ToString()); UISurface tracker = GetUISurfaceAt(e.X, e.Y); // If the current tracker is the same as who we've // already been tracking // then we just send it a mousemove event. if ((tracker != null) && (tracker == fMouseTracker)) { // Create a new mouse event with the point translated into the // coordinate space of the client MouseEventArgs args = new MouseEventArgs(0, MouseEventType.MouseMove, e.Button, e.Clicks, (e.X-tracker.Frame.Left), (e.Y-tracker.Frame.Top), e.Delta, e.Source); fMouseTracker.OnMouseMove(args); return; } // If the tracker is different // Then the current tracker needs to receive the MouseExit event if (fMouseTracker != null) { // Create a new mouse event with the point translated into the // coordinate space of the client MouseEventArgs args = new MouseEventArgs(0, MouseEventType.MouseLeave, e.Button, e.Clicks, e.X - fMouseTracker.Frame.Left, e.Y-fMouseTracker.Frame.Top, e.Delta, e.Source); fMouseTracker.OnMouseLeave(args); } fMouseTracker = tracker; if (fMouseTracker != null) { // Create a new mouse event with the point translated into the // coordinate space of the client MouseEventArgs args = new MouseEventArgs(0, MouseEventType.MouseEnter, e.Button, e.Clicks, e.X-fMouseTracker.Frame.Left, e.Y-fMouseTracker.Frame.Top, e.Delta, e.Source); fMouseTracker.OnMouseEnter(args); } else { // Otherwise, no trackers have been hit, so we're just free floating // in the window. Set the cursor to the generic arrow //Win32Cursor.Current = Win32Cursor.Arrow; } base.OnMouseMove(e); }
public virtual void AddUISurface(UISurface aSurface) { fSurfaces.Add(aSurface); // Register to know when drawing occurs aSurface.DrawEvent += new DrawEventHandler(Surface_DrawEvent); // Register to receive some of the surfaces events aSurface.InvalidateEvent += new InvalidateDelegate(OnInvalidateSurface); aSurface.ValidateEvent += new ValidateDelegate(OnValidateSurface); aSurface.MoveByEvent += new MoveByEventHandler(Surface_MoveByEvent); aSurface.MoveToEvent += new MoveToEventHandler(Surface_MoveToEvent); }