示例#1
0
		public MouseEvent(Scene scene, Coord viewportPos, InteractionModifier modifier)
			: base(scene)
		{
			ViewportPos = viewportPos;
			Pos = viewportPos.Copy();
			Modifier = modifier;
		}
示例#2
0
		/// <summary>
		/// Default constructor.
		/// </summary>
		public KeyEvent(Scene scene, int keyVal, InteractionModifier modifier) : base(scene)
		{
			Value = keyVal;
			Modifier = modifier;
		}
示例#3
0
		public MouseButtonEvent(Scene scene, Coord viewportPos, int button, InteractionModifier modifier, ClickMultiplicity multiplicity)
			: base(scene, viewportPos, modifier)
		{
			Button = button;
			Multiplicity = multiplicity;
		}
示例#4
0
		public MouseButtonEvent(Scene scene, Coord viewportPos, int button, InteractionModifier modifier)
			: this(scene, viewportPos, button, modifier, ClickMultiplicity.Single)
		{
		}
示例#5
0
		public MouseWheelEvent(Scene scene, WheelDirection direction, InteractionModifier modifier) : base(scene)
		{
			Direction = direction;
			Modifier = modifier;
		}
示例#6
0
		/// <summary>
		/// Moves the cursor down or more lines up, depending on the modifier.
		/// </summary>
		public virtual void CursorDown(InteractionModifier modifier)
		{
			if (Anchor != null)
				Anchor = null;
			
			if (Cursor == null)
			{
				Cursor = new TextCursor() {
					Column = 0,
					Row = NumLines - 1,
					IsDirty = true
				};
			}
			else if (Cursor.Row < NumLines - 1 )
			{
				Cursor.Row++;
				Cursor.IsDirty = true;
			}
		}
示例#7
0
		/// <summary>
		/// Moves the cursor one or more lines up, depending on the modifier.
		/// </summary>
		public virtual void CursorUp(InteractionModifier modifier)
		{
			if (Anchor != null)
				Anchor = null;
			
			if (Cursor == null)
			{
				Cursor = new TextCursor() {
					Column = 0,
					Row = 0,
					IsDirty = true
				};
			}
			else if (Cursor.Row > 0 )
			{
				Cursor.Row--;
				Cursor.IsDirty = true;
			}
		}
示例#8
0
		/// <summary>
		/// Moves the cursor one or more characters to the right, depending on the modifier.
		/// </summary>
		public virtual void CursorRight(InteractionModifier modifier)
		{
			if (Anchor != null && modifier != InteractionModifier.Shift)
				Anchor = null;
			else if (Anchor == null && modifier == InteractionModifier.Shift)
				Anchor = Cursor.Copy();
			
			if (Cursor == null)
			{
				Cursor = new TextCursor() {
					Column = 0,
					Row = 0,
					IsDirty = true
				};
			}
			else
			{
				if (Cursor.Column < CurrentLine.Length )
				{
					Cursor.Column++;
					Cursor.IsDirty = true;
				}
				else if (Cursor.Row < Lines.Length - 1)
				{
					Cursor.Row++;
					Cursor.Column = 0;
					Cursor.IsDirty = true;
				}
			}
		}
示例#9
0
		/// <summary>
		/// Moves the cursor one or more characters to the left, depending on the modifier.
		/// </summary>
		public virtual void CursorLeft(InteractionModifier modifier)
		{
			if (Anchor != null && modifier != InteractionModifier.Shift)
				Anchor = null;
			else if (Anchor == null && modifier == InteractionModifier.Shift)
				Anchor = Cursor.Copy();
			
			// make sure there is a cursor
			if (Cursor == null)
			{
				Cursor = new TextCursor() {
					Column = 0,
					Row = 0,
					IsDirty = true
				};
			}
			else
			{
				if (Cursor.Column > 0)
				{
					Cursor.Column--;
					Cursor.IsDirty = true;
				}
				else if (Cursor.Row > 0)
				{
					Cursor.Row--;
					Cursor.Column = CurrentLine.Length;
					Cursor.IsDirty = true;
				}
			}
		}
示例#10
0
		/// <summary>
		/// Deletes one or more characters to the right depending on the modifier.
		/// </summary>
		public virtual void CursorDelete(InteractionModifier modifier)
		{
			if (Cursor == null)
				return;
			
			if (Anchor != null)
			{
				DeleteSelection();
				return;
			}
			
			if (modifier == InteractionModifier.None)
			{
				if (Cursor.Column == CurrentLine.Length)
				{
					if (Cursor.Row < NumLines - 1) // there's a line break to delete
					{
						throw new NotImplementedException();
					}
				}
				else
				{
					CurrentLine = CurrentLine.Remove(Cursor.Column, 1);
					SetBodyFromLines();
				}
			}
			else // another modifier
			{
				throw new NotImplementedException();
			}
		}