Example #1
0
		public override void OnKeyPress(KeyEvent evt)
		{
			base.OnKeyPress(evt);
			
			evt.Handle(this);
			MakeDirty();
			
			// look for special keys
			switch (evt.SpecialKey)
			{
			case SpecialKey.Right:
				CursorRight(evt.Modifier);
				return;
			case SpecialKey.Left:
				CursorLeft(evt.Modifier);
				return;
			case SpecialKey.Up:
				CursorUp(evt.Modifier);
				return;
			case SpecialKey.Down:
				CursorDown(evt.Modifier);
				return;
			case SpecialKey.Backspace:
				CursorBackspace(evt.Modifier);
				return;
			case SpecialKey.Delete:
				CursorDelete(evt.Modifier);
				return;
			case SpecialKey.Home:
				CursorHome();
				return;
			case SpecialKey.End:
				CursorEnd();
				return;
			}
			
			var charVal = (char)evt.Value;
			if (Char.IsLetterOrDigit(charVal) || Char.IsPunctuation(charVal) || charVal == ' ')
			{
				Insert(charVal.ToString());
			}
		}
Example #2
0
		public virtual void OnKeyRelease(KeyEvent evt)
		{
			evt.Scene = this;
			
			OverlayInteractor.OnKeyRelease(evt);
			
			if (PrimaryInteractor != null)
				PrimaryInteractor.OnKeyRelease(evt);
			
			if (EnableViewInteractor)
				ViewInteractor.OnKeyRelease(evt);
		}
Example #3
0
		public override void OnKeyPress(KeyEvent evt)
		{
			base.OnKeyPress(evt);
			
			if (!IsEnabled)
				return;
			
			if (evt.SpecialKey == SpecialKey.Enter || evt.SpecialKey == SpecialKey.Space)
			{
				evt.Handle(this);
				_justKeyActivated = true;
				IsSelected = true;
				IsFocused = true;
				QueuePaneRender();
				Click();
			}
		}
Example #4
0
		public override void OnKeyPress(KeyEvent evt)
		{
			base.OnKeyPress(evt);
			
			if (Root != null)
				Root.OnKeyPress(evt);
		}
Example #5
0
		public void OnKeyRelease(KeyEvent evt)
		{
			RootScene.OnKeyRelease(evt);
		}
Example #6
0
		public void OnKeyPress(KeyEvent evt)
		{
			RootScene.OnKeyPress(evt);
		}
Example #7
0
		/// <summary>
		/// Handles a keyboard event.
		/// </summary>
		public override void OnKeyPress(KeyEvent evt)
		{
		
Example #8
0
		public virtual void OnKeyRelease(KeyEvent evt) {}
Example #9
0
		public virtual void OnKeyPress(KeyEvent evt) {}
Example #10
0
		public override void OnKeyPress(KeyEvent evt)
		{
			base.OnKeyPress(evt);
			
			if (IsFocused)
			{
				if (evt.SpecialKey == SpecialKey.Right || evt.SpecialKey == SpecialKey.Up)
				{
					StepUp();
				}
				else if (evt.SpecialKey == SpecialKey.Left || evt.SpecialKey == SpecialKey.Down)
				{
					StepDown();
				}
			}
		}
Example #11
0
		protected override void OnKeyDown(KeyEventArgs e)
		{
			base.OnKeyDown(e);
			
			// get the modifier
			int mod = 0;
			if (e.Shift)
				mod += (int)InteractionModifier.Shift;
			if (e.Control)
				mod += (int)InteractionModifier.Control;
			if (e.Alt)
				mod += (int)InteractionModifier.Alt;
			if (mod == 0)
				mod = (int)InteractionModifier.None;

			int val = e.KeyValue;

			var evt = new KeyEvent(Viewport.RootScene, val, (InteractionModifier)mod);
			//Console.WriteLine("viewport key press {0} ({1}, {2})", evt.Value, evt.SpecialKey, evt.Modifier);

			Viewport.OnKeyPress(evt);

			e.Handled = evt.IsHandled;

			PaintGL();
		}
Example #12
0
		/// <summary>
		/// Converts a QKeyEvent to a KeyEvent.
		/// </summary>
		private KeyEvent ConvertEvent(QKeyEvent qevt)
		{
			var keyVal = qevt.Key();
			var mod = GetModifier(qevt);
			if (keyVal >= 65 && keyVal <= 90 && // letter
				(mod & InteractionModifier.Shift) != InteractionModifier.Shift)
				keyVal += 32;
			if (keyVal == (int)Key.Key_Left)
				keyVal = (int)SpecialKey.Left;
			if (keyVal == (int)Key.Key_Right)
				keyVal = (int)SpecialKey.Right;
			if (keyVal == (int)Key.Key_Up)
				keyVal = (int)SpecialKey.Up;
			if (keyVal == (int)Key.Key_Down)
				keyVal = (int)SpecialKey.Down;
			if (keyVal == (int)Key.Key_Backspace)
				keyVal = (int)SpecialKey.Backspace;
			if (keyVal == (int)Key.Key_Enter)
				keyVal = (int)SpecialKey.Enter;
			if (keyVal == (int)Key.Key_Home)
				keyVal = (int)SpecialKey.Home;
			if (keyVal == (int)Key.Key_End)
				keyVal = (int)SpecialKey.End;
			if (keyVal == (int)Key.Key_Delete)
				keyVal = (int)SpecialKey.Delete;
			var evt = new KeyEvent(Viewport.RootScene, keyVal, mod);
			return evt;
		}
Example #13
0
		public override void OnKeyRelease(KeyEvent evt)
		{
			base.OnKeyRelease(evt);
			
			_textBox.OnKeyRelease(evt);
		}
Example #14
0
		public override void OnKeyPress(KeyEvent evt)
		{
			base.OnKeyPress(evt);
			
			_textBox.OnKeyPress(evt);
		}
Example #15
0
		public override void OnKeyPress(KeyEvent evt)
		{
			base.OnKeyPress(evt);
			
			if (Control == null)
				return;
			
			if (evt.SpecialKey == SpecialKey.Tab)
			{
				MakeDirty();
				if (evt.Modifier == InteractionModifier.Shift)
				{
					if (InFocus != null)
						InFocus = InFocus.GetPreviousFocus();
					else
						InFocus = Control.GetLastFocus();
				}
				else
				{
					if (InFocus != null)
						InFocus = InFocus.GetNextFocus();
					else
						InFocus = Control.GetFirstFocus();
				}
			}			
			else if (InFocus != null)
			{
				
				InFocus.OnKeyPress(evt);
			}
		}
Example #16
0
		public override void OnKeyPress(KeyEvent evt)
		{
			base.OnKeyPress(evt);
			
			if (InFocus != null)
			{
				InFocus.OnKeyPress(evt);
			}
		}