protected override void TrackMouseDownHandler(Event e) { if (!Enabled) { return; } MouseEvent me = (MouseEvent)e; // Offset the track-relative coordinates of this event so that // the thumb will end up centered over the mouse down location. float thumbW = (null != Thumb) ? Thumb.Width : 0; float thumbH = (null != Thumb) ? Thumb.Height : 0; float offsetX = me.GlobalPosition.X - (thumbW / 2); float offsetY = me.GlobalPosition.Y - (thumbH / 2); Point p = Track.GlobalToLocal(new Point(offsetX, offsetY)); float newValue = PointToValue(p.X, p.Y); newValue = NearestValidValue(newValue, SnapInterval); if (newValue != PendingValue) { SetValue(newValue); DispatchEvent(new Event(Event.CHANGE)); } }
/// <summary> /// Mouse down handler /// </summary> /// <param name="e"></param> private void MouseDownHandler(Event e) { //Debug.Log(string.Format("Resizable [{0}] -> MouseDownHandler", e.Target)); if (AutoBringToFront) { _component.BringToFront(); } if (AutoExcludeFromLayout) { _component.IncludeInLayout = false; } MouseEvent me = (MouseEvent)e; IsResizing = IsMouseOverBorder(me.GlobalPosition); if (IsResizing) { e.CancelAndStopPropagation(); DoRenderOverlay = true; _origBounds = _component.Bounds; _clickCoords = me.GlobalPosition; // subscribe to mouse moves SystemEventDispatcher.Instance.AddEventListener(MouseEvent.MOUSE_MOVE, MouseMoveHandler, EventPhase.Capture | EventPhase.Target); SystemEventDispatcher.Instance.AddEventListener(MouseEvent.MOUSE_UP, MouseUpHandler); DragManager.IsDragging = true; } }
private void MouseWheelHandler(Event e) { IViewport vp = Viewport; if (e.DefaultPrevented || null == vp || !vp.Visible) { return; } //Debug.Log("HScrollBar MouseWheelHandler"); MouseEvent me = (MouseEvent)e; var delta = me.CurrentEvent.delta.y; int nSteps = (int)Math.Abs(delta); nSteps = 1; // TEMP // Scroll event.delta "steps". //Debug.Log("delta: " + delta); NavigationUnit navigationUnit = (delta > 0) ? NavigationUnit.Right : NavigationUnit.Left; for (int hStep = 0; hStep < nSteps; hStep++) { float hspDelta = vp.GetHorizontalScrollPositionDelta(navigationUnit); //if (null != hspDelta) vp.HorizontalScrollPosition += hspDelta; } e.PreventDefault(); }
/// <summary> /// Mouse up handler: unsubscribe from everything /// </summary> /// <param name="e"></param> private void MouseUpHandler(Event e) { MouseEvent me = (MouseEvent)e; e.CancelAndStopPropagation(); SystemEventDispatcher.Instance.RemoveEventListener(MouseEvent.MOUSE_MOVE, MouseMoveHandler, EventPhase.Capture | EventPhase.Target); SystemEventDispatcher.Instance.RemoveEventListener(MouseEvent.MOUSE_UP, MouseUpHandler); _component.IncludeInLayout = true; IsResizing = false; DragManager.IsDragging = false; DeferManager.Instance.Defer(delegate { //Debug.Log("check"); //Point p = _component.GlobalToLocal(me.GlobalPosition); DoRenderOverlay = IsMouseOverBorder(me.GlobalPosition); if (DoRenderOverlay) { if (!_scanning) { ShowCursor(); } } else { if (_scanning) { HideCursor(); } } }); }
private void SystemMouseUpSomewhereHandler(Event e) { //Debug.Log("SystemMouseUpSomewhereHandler"); //var sm = SystemEventDispatcher.Instance; var dispatcher = MouseEventDispatcher.Instance; dispatcher.RemoveEventListener(MouseEvent.MOUSE_UP, SystemMouseUpSomewhereHandler, EventPhase.CaptureAndTarget); //Debug.Log("e.Target: " + e.Target); var dlm = (DisplayListMember)e.Target; // If we got a mouse down followed by a mouse up on a different target in the skin, // we want to dispatch a click event. if (_mouseDownTarget != e.Target && e is MouseEvent && Contains(dlm)) { MouseEvent mEvent = e as MouseEvent; // Convert the mouse coordinates from the target to the TrackBase Point mousePoint = new Point(mEvent.LocalPosition.X, mEvent.LocalPosition.Y); mousePoint = GlobalToLocal(dlm.LocalToGlobal(mousePoint)); var me2 = new MouseEvent(MouseEvent.CLICK, mEvent.Bubbles, mEvent.Cancelable) { LocalPosition = new Point(mousePoint.X, mousePoint.Y), RelatedObject = null, Control = mEvent.Control, Shift = mEvent.Shift, Alt = mEvent.Alt, ButtonDown = mEvent.ButtonDown, CurrentEvent = mEvent.CurrentEvent }; DispatchEvent(me2); } _mouseDownTarget = null; }
/** * */ protected void CaptureKeyDownHandler(Event e) { if (_isTextInputInFocus) { KeyDownHandlerHelper(e); } }
public void ChangeButtonColor(Event e) { // GUI lookup example Button button = GuiLookup.FindComponent<Button>(gameObject, "button1"); if (null != button) button.Color = Color.green; }
private void OnMouseDown(Event e) { Image comp = e.Target as Image; if (null == comp) { return; } // check if dragged item is child of _pnlSource or _pnlDest if (_pnlSource.ContentContains(comp) || _pnlDest.ContentContains(comp)) { DragSource dataSource = new DragSource(); //dataSource.AddData(comp.Text, "text"); // add text for COPY_TEXT mode //dataSource.AddData(comp.StyleName, "style"); // add text for COPY_STYLE mode //dataSource.AddData(comp, "control"); // add reference to control for Move mode Image proxy = new Image { Texture = comp.Texture, // reference the same texture ScaleMode = ImageScaleMode.ScaleToFit //// TEMP: handles the DragDropManager missing bounds clonning //Bounds = (Rectangle) comp.GlobalBounds.Clone(), //// TEMP: handles the DragDropManager missing MouseEnabled enabled turning off on the proxy //MouseEnabled = false }; DragDropManager.DoDrag(comp, dataSource, (MouseEvent)e, proxy, 0, 0, 0.5f, false); /*new DragOption(DragOptionType.ProxyVisible, false), * new DragOption(DragOptionType.FeedbackVisible, false)*/ } }
private void MouseDownHandler(Event e) { SetFocus(); //Debug.Log("MouseDownHandler: " + e); //TextDisplay.SetFocus(); //e.CancelAndStopPropagation(); ////Debug.Log("MouseDownHandler"); //if (e.Target == TextDisplay) //{ // TextDisplay.SetFocus(); //} //else //{ // SetFocus(); // //if (e.Target == _btnMinus) // //{ // // //Debug.Log("_btnMinus"); // // Value -= Step; // // _valueChangedByEditor = true; // //} // //else if (e.Target == _btnPlus) // //{ // // //Debug.Log("_btnPlus"); // // Value += Step; // // _valueChangedByEditor = true; // //} //} }
/// <summary> /// Fires on mouse out when idle /// </summary> /// <param name="e"></param> private void IdleMouseOutHandler(Event e) { MouseEvent me = (MouseEvent)e; if (_component.Bounds.Contains(_component.GlobalToLocal(me.GlobalPosition))) { return; // still inside } #if DEBUG if (DebugMode) { Debug.Log("IdleMouseOutHandler"); } #endif if (DragManager.IsDragging) { return; } e.Cancel(); DoRenderOverlay = false; HideCursor(); StopScanning(); _previousResizeMode = null; }
public void PaintButtonGreen(Event e) { // GUI lookup example Button button = GuiLookup.GetComponent("button1") as Button; if (null != button) button.Color = Color.green; }
/** * * Called when the systemManager receives a mouseDown event. This closes * the dropDown if the target is outside of the dropDown. */ internal void SystemManagerMouseDownHandler(Event e) { // stop here if mouse was down from being down on the open button if (_mouseIsDown) { _mouseIsDown = false; return; } if (null == DropDown || (DropDown is DisplayObjectContainer && !((DisplayObjectContainer)DropDown).Contains((DisplayListMember)e.Target, true))) { if (HitAreaAdditions != null) { foreach (DisplayObject displayObject in HitAreaAdditions) { if (displayObject == e.Target || ((displayObject is DisplayObjectContainer) && ((DisplayObjectContainer)displayObject).Contains(e.Target as DisplayListMember))) { return; } } } CloseDropDown(true); } }
/** * @private * Mouse rollOver event handler. */ // ReSharper disable MemberCanBePrivate.Global protected void ItemRendererRollOverHandler(Event e) // ReSharper restore MemberCanBePrivate.Global { //Debug.Log("Roll over"); hovered = true; InvalidateDisplayList(); }
private void MoveAreaMouseDownHandler(Event e) { //Debug.Log("Mouse down: " + e.Target); //if (e.Target != MoveArea) // return; //Debug.Log("MoveAreaMouseDownHandler: " + e.Target); // Only allow dragging of pop-upped windows if (Enabled && IsPopUp) { e.CancelAndStopPropagation(); // Calculate the mouse's offset in the window //offsetX = event.stageX - x; //offsetY = event.stageY - y; BringToFront(); MouseEvent me = (MouseEvent) e; _offset = me.GlobalPosition.Subtract(Transform.Position); var sm = SystemEventDispatcher.Instance; sm.AddEventListener(MouseEvent.MOUSE_MOVE, MoveAreaMouseMoveHandler, EventPhase.CaptureAndTarget); sm.AddEventListener(MouseEvent.MOUSE_UP, MoveAreaMouseUpHandler, EventPhase.CaptureAndTarget); _cursorId = CursorManager.Instance.SetCursor(CursorType.Move); } }
private void OnChange(Event e) { HttpServiceProgressEvent inEvent = (HttpServiceProgressEvent)e; _dict[(HttpConnector)e.Target] = inEvent; HttpServiceProgressEvent pe = new HttpServiceProgressEvent(HttpServiceProgressEvent.PROGRESS_CHANGE); foreach (HttpServiceProgressEvent progressEvent in _dict.Values) { if (null == progressEvent) { continue; } pe.Total += progressEvent.Total; pe.Active += progressEvent.Active; pe.Finished += progressEvent.Finished; } #if DEBUG if (DebugMode) { Debug.Log("HttpServiceProgressAggregator: " + pe); } #endif DispatchEvent(pe); }
private void OnMouseMove(Event e) { //MouseEvent me = (MouseEvent)e; //Point position = me.GlobalPosition.Add(_offset); //_cursorImage.Move(position); ShowCurrentTexture(); }
private void RollOverHandler(Event e) { if (e.Target != this) // skin return; /*_tween = new Sequence( Tween.New().SetOptions( new TweenOption(TweenOptionType.Property, "Height"), new TweenOption(TweenOptionType.Duration, 1f), new TweenOption(TweenOptionType.Easer, (Tween.EasingFunction)Expo.EaseInOut), new TweenOption(TweenOptionType.StartValueReader, new PropertyReader("Height")), new TweenOption(TweenOptionType.EndValue, 400f), new TweenOption(TweenOptionType.Target, this) ), Tween.New().SetOptions( new TweenOption(TweenOptionType.Property, "Width"), new TweenOption(TweenOptionType.Duration, 1f), new TweenOption(TweenOptionType.Easer, (Tween.EasingFunction)Expo.EaseInOut), new TweenOption(TweenOptionType.StartValueReader, new PropertyReader("Width")), new TweenOption(TweenOptionType.EndValue, 300f), new TweenOption(TweenOptionType.Target, this) ) ); _tween.Play();*/ }
/** * * Stop the track-scrolling repeat events if the mouse leaves * the track area. */ private void TrackRollOutHandler(Event e) { if (_trackScrolling && null != _trackScrollTimer) { _trackScrollTimer.Stop(); } }
internal override void ViewportHorizontalScrollPositionChangeHandler(Event e) { if (null != Viewport) { Value = Viewport.HorizontalScrollPosition; } }
/** * */ protected void textInput_changeHandler(Event e) { _userTypedIntoText = true; TextFieldEvent tfe = (TextFieldEvent)e; /*var operation:FlowOperation = tfe.operation; * * // Close the dropDown if we press delete or cut the selected text * if (operation is DeleteTextOperation || operation is CutOperation) * { * super.changeHighlightedSelection(CUSTOM_SELECTED_ITEM); * } * else * { * if (openOnInput) * { * if (!isDropDownOpen) * { * // Open the dropDown if it isn't already open * openDropDown(); * addEventListener(DropDownEvent.OPEN, editingOpenHandler); * return; * } * } * * processInputField(); * }*/ }
public void RemoveButtonColor(Event e) { // GUI lookup example Button button = GuiLookup.GetComponent("button1") as Button; if (null != button) button.Color = Color.white; }
/** * * Called synchronously when the space bar is pressed or the mouse is clicked. */ private void ItemClickHandler(Event e) { //MouseEvent me = (MouseEvent) e; var target = e.CurrentTarget as IItemRenderer; var newIndex = target != null ? target.ItemIndex : DataGroup.GetContentChildIndex((DisplayListMember)e.CurrentTarget); var oldSelectedIndex = SelectedIndex; if (newIndex == SelectedIndex) { if (!RequireSelection) { SetSelectedIndex(NO_SELECTION, true); } } else { SetSelectedIndex(newIndex, true); } // Changing the selectedIndex typically causes a call to itemSelected() at // commitProperties() time. We'll update the caretIndex then. If this // method was -not- called as a consequence of a keypress, we will not show // the focus highlight at caretIndex. See itemShowingCaret(). if (_enableFocusHighlight && (SelectedIndex != oldSelectedIndex)) { _enableFocusHighlight = _inKeyUpHandler; } }
private void OnMiddleMouseDown(Event e) { #if DEBUG if (DebugMode) { Debug.Log("MouseEventDispatcher.OnMiddleMouseDown"); } #endif _mouseEvent = (MouseEvent)e; RecalculateMouseTarget(); if (MouseTarget == null) { return; } _middleMouseDownComponent = MouseTarget; #if DEBUG if (DebugMode) { Debug.Log("OnMiddleMouseDown component: " + MouseTarget); } #endif MouseEventHelper.BuildAndDispatchMouseEvent(this, MouseTarget, MouseEvent.MIDDLE_MOUSE_DOWN, _mouseEvent.GlobalPosition, _mouseEvent.CurrentEvent); }
public void TestEvent(Event e) { print(e); // prints event ComboBox combo = (ComboBox)e.Target; print(" SelectedIndex = " + combo.SelectedIndex); }
private void OnMouseDrag(Event e) { #if DEBUG if (DebugMode) { Debug.Log("MouseEventDispatcher.OnMouseDrag"); } #endif _mouseEvent = (MouseEvent)e; RecalculateMouseTarget(); if (null != MouseTarget) { #if DEBUG if (DebugMode) { Debug.Log("OnMouseDrag component: " + MouseTarget); } #endif MouseEventHelper.BuildAndDispatchMouseEvent(this, MouseTarget, MouseEvent.MOUSE_DRAG, _mouseEvent.GlobalPosition, _mouseEvent.CurrentEvent); } }
/** * * Called when the rollOverDelay Timer is up and we should show the drop down. */ private void rollOverDelay_timerCompleteHandler(Event e) { OpenButton.RemoveEventListener(MouseEvent.ROLL_OUT, OpenButtonRollOutHandler); _rollOverOpenDelayTimer = null; OpenDropDownHelper(); }
private void MouseDownHandler(Event e) { MouseEvent me = (MouseEvent)e; Component c = me.Target as Component; if (null == c) { return; } var targetComponent = (DisplayListMember)me.Target; var popup = _popups.Find(delegate(DisplayObject comp) { IChildList list = comp as IChildList; if (null != list) { return(list.Contains(targetComponent, true)); } return(false); }); if (null != popup && _popups.IndexOf(popup) != -1) { var descriptor = _descriptors[popup]; descriptor.Stage.BringChildToFront(descriptor.PopupRoot); //if (descriptor.Stage == _stage) // bring to front only popup manager stage children // _stage.BringToFront(descriptor.PopupRoot); } }
private void OnMouseMove(Event e) { //Debug.Log("OnMouseMove"); MouseEvent me = (MouseEvent)e; if (null == _lastPos) { //Debug.Log("was null"); _lastPos = me.GlobalPosition; } Point delta = me.GlobalPosition.Subtract(_lastPos); //Debug.Log(string.Format("### OnMouseMove ### last: {0}; now: {1}; delta: {2}", _lastPos, me.GlobalPosition, delta)); //Debug.Log(" delta: " + delta); _lastPos = me.GlobalPosition; foreach (Component target in _dragTargets) { //target.Bounds = new Rectangle(target.X + delta.X, target.Y + delta.Y, target.Width, target.Height); target.Move(-100, -100); target.SetActualSize(10, 10); //target.X += delta.X; //target.Y += delta.Y; target.InvalidateTransform(); target.ValidateTransform(); } }
private void MoveAreaMouseDownHandler(Event e) { //Debug.Log("Mouse down: " + e.Target); //if (e.Target != MoveArea) // return; //Debug.Log("MoveAreaMouseDownHandler: " + e.Target); // Only allow dragging of pop-upped windows if (Enabled && IsPopUp) { e.CancelAndStopPropagation(); // Calculate the mouse's offset in the window //offsetX = event.stageX - x; //offsetY = event.stageY - y; BringToFront(); MouseEvent me = (MouseEvent)e; _offset = me.GlobalPosition.Subtract(Transform.Position); var sm = SystemEventDispatcher.Instance; sm.AddEventListener(MouseEvent.MOUSE_MOVE, MoveAreaMouseMoveHandler, EventPhase.CaptureAndTarget); sm.AddEventListener(MouseEvent.MOUSE_UP, MoveAreaMouseUpHandler, EventPhase.CaptureAndTarget); _cursorId = CursorManager.Instance.SetCursor(CursorType.Move); } }
// ReSharper disable RedundantOverridenMember protected override void KeyDownHandler(Event e) { //Debug.Log("TextArea: KeyDownHandler: " + e.Bubbles); //Debug.Log("TextArea: KeyDownHandler"); base.KeyDownHandler(e); //Debug.Log("TextArea: OnKeyDown"); }
/** * */ /*override mx_internal function findKey(eventCode:int):Boolean // TODO * { * return false; * }*/ protected override void KeyDownHandler(Event e) { if (!_isTextInputInFocus) { KeyDownHandlerHelper(e); } }
private void RollOutHandler(Event e) { if (e.Target != this) // skin { return; } /*_tween = new Sequence( * Tween.New().SetOptions( * new TweenOption(TweenOptionType.Property, "Height"), * new TweenOption(TweenOptionType.Duration, 1f), * new TweenOption(TweenOptionType.Easer, (Tween.EasingFunction)Expo.EaseInOut), * new TweenOption(TweenOptionType.StartValueReader, new PropertyReader("Height")), * new TweenOption(TweenOptionType.EndValue, 300f), * new TweenOption(TweenOptionType.Target, this) * ), * Tween.New().SetOptions( * new TweenOption(TweenOptionType.Property, "Width"), * new TweenOption(TweenOptionType.Duration, 1f), * new TweenOption(TweenOptionType.Easer, (Tween.EasingFunction)Expo.EaseInOut), * new TweenOption(TweenOptionType.StartValueReader, new PropertyReader("Width")), * new TweenOption(TweenOptionType.EndValue, 200f), * new TweenOption(TweenOptionType.Target, this) * ) * ); * * _tween.Play();*/ }
private void IdleRollOutHandler(Event e) { if (IsResizing) { return; } if (e.Target != _component) { return; } #if DEBUG if (DebugMode) { Debug.Log("IdleRollOutHandler"); } #endif SystemManager.Instance.MouseMoveSignal.Disconnect(MouseMoveSlot); //SystemManager.Instance.MouseUpSignal.Disconnect(MouseUpSlot); /* Important (the source of the bug of right side cursor not dissapearing on roll out */ HideCursor(); if (_scanning) { StopScanning(); } }
public void ClosingHandler(Event e) { Alert.Show("Combo box closing", string.Format(@"[{0}] received: Type: {1} Target: {2} CurrentTarget: {3}", e.GetType(), e.Type, e.Target, e.CurrentTarget), AlertButtonFlag.Ok); }
private void TimerHandler(Event e) { Callback(Lines[_count]); _count++; if (_count >= Lines.Length) _count = 0; }
internal override void ViewportResizeHandler(Event e) { //Debug.Log("ViewportResizeHandler"); if (null != Viewport) { UpdateMaximumAndPageSize(); } }
internal override void ViewportContentWidthChangeHandler(Event e) { if (null != Viewport) { //var viewportHeight = /*null == Viewport.Height ? 0 : */Viewport.Height; Maximum = Viewport.ContentWidth - Viewport.Width; } }
private void OnPauseChanged(Event e) { bool paused = (bool)((ValueEvent) e).Value; Debug.Log("OnPauseChanged. Paused: " + paused); if (paused) _timer.Stop(); else _timer.Start(); }
public void RemoveDialog(Event e) { Button button = e.Target as Button; if (button != null) { Dialog dialog = GuiLookup.FindParent<Dialog>(button); PopupManager.Instance.RemovePopup(dialog); } }
public void ClickHandler(Event e) { //Debug.Log("ClickHandler: " + e.Target); Alert.Show("Event", string.Format(@"[{0}] received: Type: {1} Target: {2} CurrentTarget: {3}", e.GetType(), e.Type, e.Target, e.CurrentTarget), AlertButtonFlag.Ok); }
public void Info(Event e) { Alert.Show( "Info", "This is the info message. The time is: " + DateTime.Now.ToLongTimeString(), AlertButtonFlag.Ok, new AlertOption(AlertOptionType.HeaderIcon, Resources.Load("Icons/information")), new AlertOption(AlertOptionType.AddedEffect, _alertEffect) ); }
private static void OnReset(Event e) { Debug.Log("OnReset"); GameObject[] gameObjects = GameObject.FindGameObjectsWithTag("Cube"); // destroy all Cubes foreach (GameObject o in gameObjects) { Destroy(o); } }
private void IdleRollOverHandler(Event e) { if (e.Target != _component) return; #if DEBUG if (DebugMode) { Debug.Log("IdleRollOverHandler"); } #endif SystemManager.Instance.MouseMoveSignal.Connect(MouseMoveSlot); //SystemManager.Instance.MouseUpSignal.Connect(MouseUpSlot); }
private void KeyUpHandler(Event e) { KeyboardEvent ke = (KeyboardEvent)e; //Debug.Log("KeyUpHandler: " + ke.KeyCode); if (KeyCode.Escape == ke.KeyCode) { //Debug.Log("DialogCloseOnEsc->Escape"); e.CancelAndStopPropagation(); //PopupManager.Instance.RemovePopup(_dialog); if (Enabled) _dialog.ExecCallback("cancel"); } }
public void ClickHandler(Event e) { //Debug.Log("ClickHandler: " + e.Target); Alert.Show("Event", string.Format(@"[{0}] received: Type: {1} Target: {2} CurrentTarget: {3}", e.GetType(), e.Type, e.Target, e.CurrentTarget), AlertButtonFlag.Ok, new AlertOption(AlertOptionType.HeaderIcon, Resources.Load("Icons/information")), new AlertOption(AlertOptionType.AddedEffect, _alertEffect) ); }
private void RollOverHandler(Event e) { if (e.Target != this) // skin return; //Debug.Log("RollOverHandler"); //RollOverEffect.Target = this; //RollOverEffect.Play(_headerBackground); new Parallel( Tween.New().SetOptions( new TweenOption(TweenOptionType.Property, "BackgroundColor"), new TweenOption(TweenOptionType.Duration, 3f), new TweenOption(TweenOptionType.Easer, (Tween.EasingFunction)Expo.EaseOut), new TweenOption(TweenOptionType.StartValueReader, new PropertyReader("BackgroundColor")), new TweenOption(TweenOptionType.EndValue, GetStyle("headerBackgroundRollOverColor")), new TweenOption(TweenOptionType.Target, _headerBackground) ), Tween.New().SetOptions( new TweenOption(TweenOptionType.Property, "BackgroundColor"), new TweenOption(TweenOptionType.Duration, 3f), new TweenOption(TweenOptionType.Easer, (Tween.EasingFunction)Expo.EaseOut), new TweenOption(TweenOptionType.StartValueReader, new PropertyReader("BackgroundColor")), new TweenOption(TweenOptionType.EndValue, GetStyle("headerBackgroundRollOverColor")), new TweenOption(TweenOptionType.Target, _controlBarBackground) ), Tween.New().SetOptions( new TweenOption(TweenOptionType.Property, "Rotation"), new TweenOption(TweenOptionType.Duration, 2f), new TweenOption(TweenOptionType.Easer, (Tween.EasingFunction)Expo.EaseInOut), new TweenOption(TweenOptionType.StartValueReader, new PropertyReader("Rotation")), new TweenOption(TweenOptionType.EndValue, 720f), new TweenOption(TweenOptionType.Target, _backgroundImage) )/*, Tween.New().SetOptions( new TweenOption(TweenOptionType.Property, "Height"), new TweenOption(TweenOptionType.Duration, 2f), new TweenOption(TweenOptionType.Easer, (Tween.EasingFunction)Expo.EaseOut), new TweenOption(TweenOptionType.StartValueReader, new PropertyReader("Height")), new TweenOption(TweenOptionType.EndValue, 200f), new TweenOption(TweenOptionType.Target, _controlBarBackground) )*/ ).Play(); }
private void StartHandler(Event e) { #if DEBUG if (DebugMode) { Debug.Log("StartHandler " + _component.Width + ", " + _component.Height); } #endif if (null != _maskGraphics) return; // already masking this component _parent = _component.Parent ?? (_component is Stage ? _component : null); if (null == _parent) return; // we are not on the display list, so we have nothing to mask indeed _maskGraphics = new LoadingMaskAnimator { IncludeInLayout = false, X = _component.X, Y = _component.Y, Width = _component.Width, Height = _component.Height, //Bounds = (Rectangle) _component.Bounds.Clone() // BEWARE! This was the reference bug (without Clone())!!!!!!!!! }; _parent.AddChild(_maskGraphics); LoadingEvent le = e as LoadingEvent; if (null != le) _maskGraphics.Message = le.Message; // critical! //_maskGraphics.Transform.Apply(); _maskGraphics.InvalidateTransform(); // subscribe to MOVE and RESIZE events of the component // we shall be levitating just over the component _component.AddEventListener(MoveEvent.MOVE, MoveHandler, EventPhase.Target); _component.AddEventListener(ResizeEvent.RESIZE, ResizeHandler, EventPhase.Target); _maskGraphics.Play(); }
/** * */ private void ResetCollectionChangeHandler(Event e) { //var ce = e as CollectionEvent; //if (ce != null) //{ // if (ce.Kind == CollectionEventKind.ADD || // ce.Kind == CollectionEventKind.REMOVE) // { // //Debug.Log("ResetCollectionChangeHandler"); // // force reset here so first/middle/last skins // // get reassigned // if (null != DataGroup) // { // DataGroup.Layout.UseVirtualLayout = true; // DataGroup.Layout.UseVirtualLayout = false; // } // } //} }
private void IdleRollOutHandler(Event e) { if (IsResizing) return; if (e.Target != _component) return; #if DEBUG if (DebugMode) { Debug.Log("IdleRollOutHandler"); } #endif SystemManager.Instance.MouseMoveSignal.Disconnect(MouseMoveSlot); //SystemManager.Instance.MouseUpSignal.Disconnect(MouseUpSlot); /* Important (the source of the bug of right side cursor not dissapearing on roll out */ HideCursor(); if (_scanning) { StopScanning(); } }
private void OnChange(Event e) { HttpServiceProgressEvent inEvent = (HttpServiceProgressEvent) e; _dict[(HttpConnector) e.Target] = inEvent; HttpServiceProgressEvent pe = new HttpServiceProgressEvent(HttpServiceProgressEvent.PROGRESS_CHANGE); foreach (HttpServiceProgressEvent progressEvent in _dict.Values) { if (null == progressEvent) continue; pe.Total += progressEvent.Total; pe.Active += progressEvent.Active; pe.Finished += progressEvent.Finished; } #if DEBUG if (DebugMode) Debug.Log("HttpServiceProgressAggregator: " + pe); #endif DispatchEvent(pe); }
/** * */ private void DataGroupRendererRemoveHandler(Event e) { RendererExistenceEvent ree = (RendererExistenceEvent) e; IVisualElement renderer = ree.Renderer; if (null != renderer) renderer.RemoveEventListener(MouseEvent.CLICK, ItemClickHandler); }
/// <summary> /// Check if supplied key event passes key up filter /// </summary> /// <param name="e"></param> /// <returns></returns> internal bool PassesKeyUpFilter(Event e) { KeyboardEvent ke = (KeyboardEvent)e; return (KeyUpFilter.Count == 0 || KeyUpFilter.Contains(ke.KeyCode)); }
/// <summary> /// /// </summary> /// <param name="e"></param> protected override void DataProviderCollectionChangeHandler(Event e) { _inCollectionChangeHandler = true; base.DataProviderCollectionChangeHandler(e); _inCollectionChangeHandler = false; }
private static void OnMouseUp(Event e) { SystemEventDispatcher.Instance.RemoveEventListener(MouseEvent.MOUSE_UP, OnMouseUp); SystemEventDispatcher.Instance.RemoveEventListener(MouseEvent.MOUSE_DRAG, OnMouseDrag); ChangeCursorTo(CursorType.Normal); MouseEvent me = (MouseEvent) e; bool dropAccepted = null != _acceptedTarget; //_proxy.Visible = false; _overlay.Visible = false; var newBounds = dropAccepted ? Rectangle.FromPositionAndSize(me.GlobalPosition, new Point(0, 0)) : _dragInitiator.Transform.GlobalBounds; DragProxyTween tween = new DragProxyTween(_proxy, _proxy.Bounds, newBounds) { Callback = delegate(IAnimation anim) { //Debug.Log("*** Finished"); Component proxy = (Component) anim.Target; proxy.Visible = false; DragDropStage.Instance.RemoveChild(proxy); } }; tween.Play(_proxy); RemoveCursor(); if (null != _acceptedTarget) { #if DEBUG if (DebugMode) Debug.Log("DragEvent.DRAG_DROP: " + _acceptedTarget.GetType().Name); #endif DragEvent de = BuildEvent(DragEvent.DRAG_DROP); _acceptedTarget.DispatchEvent(de); } DragEvent dragCompleteEvent = BuildEvent(DragEvent.DRAG_COMPLETE); _dragInitiator.DispatchEvent(dragCompleteEvent); _acceptedTarget = null; _lastDragOverComponent = null; _dragging = false; _dragInitiator = null; _dragOverComponent = null; }
/** * */ private void DataProviderChangeHandler(Event e) { SelectedIndex = ((ISelectableList)DataProvider).SelectedIndex; }
private static void OnMouseDrag(Event e) { #if DEBUG if (DebugMode) Debug.Log("DragDropManager.OnMouseDrag: " + _dragInitiator); #endif MouseEvent input = (MouseEvent)e; DragEvent de; /** * 1) Check for drag start * */ if (!_dragging) // if not yet dragging { _dragOverComponent = null; _dragging = true; // we're dragging now if (null != _dragInitiator) // if dragging something { #if DEBUG if (DebugMode) Debug.Log("DragEvent.DRAG_START: " + _dragInitiator); #endif de = BuildEvent(DragEvent.DRAG_START); _dragInitiator.DispatchEvent(de); } return; } _dragOverComponent = CoordinateProcessor.GetComponentUnderCoordinatesOnAllStages(input.GlobalPosition, delegate(DisplayListMember dlm) { Component component = dlm as Component; return null != component && component.MouseEnabled; // && !(component is Stage); // commented 20130307 }, true, true) as Component; // stopOnDisabled, stopOnInvisible bool isDragEnter = null != _dragOverComponent && _dragOverComponent != _lastDragOverComponent && _dragInitiator != null && _dragInitiator != _dragOverComponent; /** * 2) Check for drag enter * */ if (isDragEnter) { // nullify accepted target, and allow the user to react on DRAG_ENTER event (to call AcceptDragDrop) _acceptedTarget = null; _action = Action.None; //Debug.Log("DragEvent.DRAG_ENTER: " + _dragOverComponent.GetType().Name); #if DEBUG if (DebugMode) Debug.Log("DragEvent.DRAG_ENTER: " + _dragOverComponent.GetType().Name); #endif // dispatch DragEvent.DRAG_EXIT on _lastDragOverComponent if (null != _lastDragOverComponent) { de = BuildEvent(DragEvent.DRAG_EXIT); _lastDragOverComponent.DispatchEvent(de); } // dispatch DragEvent.DRAG_ENTER on _dragOverComponent de = BuildEvent(DragEvent.DRAG_ENTER); _dragOverComponent.DispatchEvent(de); // set _lastDragOverComponent _lastDragOverComponent = _dragOverComponent; } /** * 3) Handle feedback to the user * By this point, if the user was subscribed to DragEvent.DRAG_ENTER, he could have react with AcceptDragDrop() and (optionally) ShowFeedback() * */ // check if the user has accepted drag and drop if (null != _acceptedTarget) { // if drop is accepted, show overlay, and show CursorType.AcceptDrop cursor Overlay.Visible = _overlayShouldBeVisible; //_overlay.SetBounds(_acceptedTarget.GlobalBounds); // fix? .MoveBy(new Point(-1, 0)), //Overlay.Bounds = (Rectangle)_acceptedTarget.Transform.GlobalBounds.Clone(); // consider cloning bounds 20120415 if (_feedbackShouldBeVisible) { if (Action.None == _action) ChangeCursorTo(CursorType.AcceptDrop); else ProcessFeedback(_action); } else ChangeCursorTo(CursorType.Normal); } else { // if drop is rejected (meaning not accepted by developer), hide overlay, and show CursorType.RejectDrop cursor Overlay.Visible = false; if (_feedbackShouldBeVisible) ChangeCursorTo(CursorType.RejectDrop); else ChangeCursorTo(CursorType.Normal); } /** * 4) Move proxy * */ _proxy.X = input.GlobalPosition.X + Offset.X; _proxy.Y = input.GlobalPosition.Y + Offset.Y; _proxy.ValidateNow(); }
protected override void KeyUpHandler(Event e) { if (e.Phase == EventPhase.Bubbling) return; if (!Enabled) return; base.KeyUpHandler(e); KeyboardEvent ke = (KeyboardEvent) e; switch (ke.KeyCode) { case KeyCode.Space: { _inKeyUpHandler = true; // Need to check pressedIndex for NaN for the case when key up // happens on an already selected renderer and under the condition // that requireSelection=true. if (null != _pressedIndex) { // Dispatch key up to the previously pressed item in case focus was lost // through other interaction (e.g. mouse clicks, etc...) IItemRenderer renderer = GetItemRenderer((int) _pressedIndex) as IItemRenderer; if (null != renderer && ((!renderer.Selected && RequireSelection) || !RequireSelection)) { renderer.DispatchEvent(e); _pressedIndex = null; } } _inKeyUpHandler = false; break; } } }
protected override void KeyDownHandler(Event e) { if (e.Phase == EventPhase.Bubbling) return; if (!Enabled || null == DataGroup || e.DefaultPrevented) return; // Block input if space bar is being held down. if (null != _pressedIndex) { e.PreventDefault(); return; } base.KeyDownHandler(e); KeyboardEvent ke = (KeyboardEvent) e; switch (ke.KeyCode) { case KeyCode.UpArrow: case KeyCode.LeftArrow: { AdjustCaretIndex(-1); e.PreventDefault(); break; } case KeyCode.DownArrow: case KeyCode.RightArrow: { AdjustCaretIndex(+1); e.PreventDefault(); break; } case KeyCode.Space: { IItemRenderer renderer = GetItemRenderer(CaretIndex) as IItemRenderer; if (null != renderer && ((!renderer.Selected && RequireSelection) || !RequireSelection)) { renderer.DispatchEvent(e); _pressedIndex = CaretIndex; } break; } } }
/** * * Called synchronously when the space bar is pressed or the mouse is clicked. */ private void ItemClickHandler(Event e) { //MouseEvent me = (MouseEvent) e; var target = e.CurrentTarget as IItemRenderer; var newIndex = target != null ? target.ItemIndex : DataGroup.GetContentChildIndex((DisplayListMember) e.CurrentTarget); var oldSelectedIndex = SelectedIndex; if (newIndex == SelectedIndex) { if (!RequireSelection) SetSelectedIndex(NO_SELECTION, true); } else SetSelectedIndex(newIndex, true); // Changing the selectedIndex typically causes a call to itemSelected() at // commitProperties() time. We'll update the caretIndex then. If this // method was -not- called as a consequence of a keypress, we will not show // the focus highlight at caretIndex. See itemShowingCaret(). if (_enableFocusHighlight && (SelectedIndex != oldSelectedIndex)) _enableFocusHighlight = _inKeyUpHandler; }
/** * */ private void DataGroupRendererAddHandler(Event e) { RendererExistenceEvent ree = (RendererExistenceEvent) e; IVisualElement renderer = ree.Renderer; if (null != renderer) { renderer.AddEventListener(MouseEvent.CLICK, ItemClickHandler); var component = renderer as IFocusManagerComponent; if (component != null) component.FocusEnabled = false; var button = renderer as ButtonBarButton; if (button != null) button.AllowDeselection = !RequireSelection; } }