public override bool HandleEvent(Application.EventType aType, object aData) { ModalWindow popup; lock (mModalWindows) popup = mModalWindows.FirstOrDefault(w => w.IsVisible); if (popup != null) { return(popup.HandleEvent(aType, aData)); } for (var i = 0; i < mChilds.Count; i++) { var child = mChilds[mChilds.Count - 1 - i]; if (child.IsVisible) { if (!(child is ModalWindow)) { if (child.HandleEvent(aType, aData)) { return(true); } } } } return(false); }
public override bool HandleEvent(Application.EventType aType, object aData) { for (var i = 0; i < mChilds.Count; i++) { mChilds[i].HandleEvent(aType, aData); } return(true); }
public override bool HandleEvent(Application.EventType aType, object aData) { foreach (var widget in mChilds) { widget.HandleEvent(aType, aData); } return(true); }
public override bool HandleEvent(Application.EventType aType, object aData) { var mouseData = (MouseData)aData; //Console.WriteLine("{0},{1}", mouseData.X, mouseData.Y); switch (aType) { case Application.EventType.MouseDown: { if (State != ButtonState.Pressed) { if ((mouseData.X >= X && mouseData.X <= X + Width) && (mouseData.Y >= Y && mouseData.Y <= Y + Height)) { // меняем внутреннее состояние State = ButtonState.Pressed; SelectItemByMousePosition(mouseData.Y); // оповещаем всех о смене состояния if (OnPress != null) { OnPress(); } // перерисовываем в ApplyStateChange } } } return(true); case Application.EventType.MouseUp: { if (State == ButtonState.Pressed) { State = ButtonState.Released; // оповещаем всех о смене состояния if (OnRelease != null) { OnRelease(); } // перерисовываем в ApplyStateChange } } return(true); } return(false); }
public override bool HandleEvent(Application.EventType aType, object aData) { var mouseData = (MouseData)aData; switch (aType) { case Application.EventType.MouseDown: { if (State != ButtonState.Pressed) { if ((mouseData.X >= X && mouseData.X <= X + Width) && (mouseData.Y >= Y && mouseData.Y <= Y + Height)) { // меняем внутреннее состояние State = ButtonState.Pressed; // оповещаем всех о смене состояния if (OnPress != null) { OnPress(); } // перерисовываем ChangeZLevel(); Invalidate(); } } } return(true); case Application.EventType.MouseUp: { if (State == ButtonState.Pressed) { State = ButtonState.Released; // оповещаем всех о смене состояния if (OnRelease != null) { OnRelease(); } // перерисовываем Invalidate(); } } return(true); } return(false); }
public virtual bool HandleEvent(Application.EventType aType, object aData) { var point = ScreenPosition; switch (aType) { case Application.EventType.MouseDown: { if (IsVisible && IsActive) { if (State != ButtonState.Pressed) { var mouseData = (MouseData)aData; //Console.WriteLine("{0},{1}", mouseData.X, mouseData.Y); if ((mouseData.X >= point.X && mouseData.X <= point.X + Width) && (mouseData.Y >= point.Y && mouseData.Y <= point.Y + Height)) { // меняем внутреннее состояние State = ButtonState.Pressed; mCheckHoldKey.Start(); // оповещаем всех о смене состояния if (OnPress != null) { OnPress(this); return(true); } } } } } break; case Application.EventType.MouseUp: { if (IsVisible && IsActive) { if (State == ButtonState.Pressed) { State = ButtonState.Released; mCheckHoldKey.Stop(); var isHandled = false; // оповещаем всех о смене состояния if (DateTime.Now.Subtract(mPreviousReleaseEvent).TotalMilliseconds < kDoubleClickTimeout) { if (OnDoubleClick != null) { OnDoubleClick(this); isHandled = true; } } // оповещаем всех о смене состояния if (OnRelease != null) { OnRelease(this); isHandled = true; } mPreviousReleaseEvent = DateTime.Now; return(isHandled); } } } break; case Application.EventType.KeyboardPress: { if (IsVisible && IsActive) { if (HotKeycode == ((KeyboardData)aData).Keycode) { if (State != ButtonState.Pressed) { // меняем внутреннее состояние State = ButtonState.Pressed; mCheckHoldKey.Start(); // оповещаем всех о смене состояния if (OnPress != null) { OnPress(this); return(true); } } } } } break; case Application.EventType.KeyboardRelease: { if (IsVisible && IsActive) { if (HotKeycode == ((KeyboardData)aData).Keycode) { if (State == ButtonState.Pressed) { State = ButtonState.Released; mCheckHoldKey.Stop(); var isHandled = false; // оповещаем всех о смене состояния if (DateTime.Now.Subtract(mPreviousReleaseEvent).TotalMilliseconds < kDoubleClickTimeout) { if (OnDoubleClick != null) { OnDoubleClick(this); isHandled = true; } } // оповещаем всех о смене состояния if (OnRelease != null) { OnRelease(this); isHandled = true; } mPreviousReleaseEvent = DateTime.Now; return(isHandled); } } } } break; case Application.EventType.KeyHold: { if (IsVisible && IsActive) { if (ReferenceEquals(this, aData)) { mCheckHoldKey.Stop(); // оповещаем всех о смене состояния if (OnHold != null) { OnHold(this); return(true); } return(false); } } } break; } return(false); }