public void NextControl() { if (Count == 0) { return; } var currentControl = _selectedControl; this[_selectedControl].HasFocus = false; do { _selectedControl++; if (_selectedControl == Count) { _selectedControl = 0; } if (this[_selectedControl].TabStop && this[_selectedControl].Enabled) { FocusChanged?.Invoke(this[_selectedControl], EventArgs.Empty); break; } } while (currentControl != _selectedControl); this[_selectedControl].HasFocus = true; }
private void activate(bool active) { if (active != this.activated) { this.activated = active; if (activated) { if (Activated != null) { Activated.Invoke(this); } } else { if (Deactivated != null) { Deactivated.Invoke(this); } } if (FocusChanged != null) { FocusChanged.Invoke(this); } } }
void entryFocused(object sender, FocusEventArgs e) { if (e.IsFocused) { FocusChanged?.Invoke(); } }
static void RaiseFocusChanged(IInputElement oldElement, IInputElement newElement) { if (FocusChanged != null) { FocusChanged.Invoke(null, new ValueChangedEventArgs <IInputElement>(oldElement, newElement)); } }
public void OnAudioFocusChange(AudioFocus focusChange) { print("AUDIOFOCUS CHANGED:::: " + focusChange.ToString() + "|" + (int)focusChange); switch (focusChange) { case AudioFocus.GainTransient: FocusChanged?.Invoke(this, true); break; case AudioFocus.LossTransient: FocusChanged?.Invoke(this, false); break; case AudioFocus.Loss: FocusChanged?.Invoke(this, false); break; case AudioFocus.GainTransientExclusive: FocusChanged?.Invoke(this, true); break; case AudioFocus.Gain: FocusChanged?.Invoke(this, true); break; } }
internal void _fireFocusChanged() { Focused = !Focused; if (FocusChanged != null) { FocusChanged.Invoke(this); } }
private void ButtonPanel_GotFocus(object sender, EventArgs e) { // Unfortunately the event is raised here after the button when the button is focused if (GUIUtilities.CurrentFocus == null || !this.Controls.Contains(GUIUtilities.CurrentFocus)) { GUIUtilities.CurrentFocus = this; } FocusChanged?.Invoke(); }
public SearchReplaceControl() { InitializeComponent(); _initHeight = Height; cbSearchText.GotFocus += (s, e) => FocusChanged?.Invoke(this, true); cbSearchText.LostFocus += (s, e) => FocusChanged?.Invoke(this, false); cbReplaceText.GotFocus += (s, e) => FocusChanged?.Invoke(this, true); cbReplaceText.LostFocus += (s, e) => FocusChanged?.Invoke(this, false); }
private void ColourPanel_LostFocus(object sender, EventArgs e) { if (this.DesignMode) { return; } FocusChanged?.Invoke(); GUIUtilities.CurrentFocus = null; }
protected virtual void OnFocusChanged(FocusEvent focused, GLBaseControl ctrl) // focused elements or parents up to GLForm gets this as well { this.focused = focused == FocusEvent.Focused; if (InvalidateOnFocusChange) { Invalidate(); } FocusChanged?.Invoke(this, focused, ctrl); }
private void OnDownArrowPressed() { if (FocusNumber < 5 && !IsSubPanelActive) { FocusNumber += 2; FocusChanged?.Invoke(this, new FocusChangedEventArgs() { NewFocus = FocusNumber }); } }
private void OnRightArrowPressed() { if (FocusNumber % 2 == 1 && !IsSubPanelActive) { FocusNumber++; FocusChanged?.Invoke(this, new FocusChangedEventArgs() { NewFocus = FocusNumber }); } }
private void OnUpArrowPressed() { FocusNumber--; if (FocusNumber < 1) { FocusNumber = MaxStatTypes; } FocusChanged?.Invoke(this, new FocusChangedEventArgs() { NewFocus = FocusNumber }); }
private void OnDownArrowPressed() { FocusNumber++; if (FocusNumber > MaxStatTypes) { FocusNumber = 1; } FocusChanged?.Invoke(this, new FocusChangedEventArgs() { NewFocus = FocusNumber }); }
private void SampleRefreshIcon_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "TouchPoint") { TouchPoint = (Drawable as SampleDrawable).TouchPoint; PointChanged?.Invoke(this, EventArgs.Empty); } else if (e.PropertyName == "IsFocused") { IsDrawableFocused = (Drawable as SampleDrawable).IsFocused; FocusChanged?.Invoke(this, EventArgs.Empty); } }
private void OnFocusChanged(IInputElement?focus) { var oldFocus = _focus; _focus = focus?.VisualRoot == Owner ? focus as Control : null; if (_focus != oldFocus) { var peer = _focus is object? _focus == Owner ? this : GetOrCreate(_focus) : null; FocusChanged?.Invoke(this, EventArgs.Empty); } }
private void OnElementMouseDown(object sender, MouseEventArgs e) { if (sender != Focus) { var lastFocus = Focus; ChangeFocus(sender as FieldElement); FocusChanged?.Invoke(lastFocus, Focus); } if (e.Button == MouseButtons.Right) { elementMenu.Show(MousePosition); } else if (e.Button == MouseButtons.Left) { StartDrag(); } }
protected virtual void TriggerFocusChanged(Node newFocus) { if (newFocus == null) { return; } if (newFocus == _focusNode) { return; } var oldFocus = _focusNode; _focusNode = newFocus; UpdateFocusTree(); FocusChanged?.Invoke(this, new FocusChangedEventArg(oldFocus, _focusNode)); }
public int HookProc(int code, IntPtr wParam, IntPtr lParam) { if (code == Win32Helper.HcbtSetfocus) { FocusChanged?.Invoke(this, new FocusChangeEventArgs(wParam, lParam)); } else if (code == Win32Helper.HcbtActivate) { if (_insideActivateEvent.CanEnter) { using (_insideActivateEvent.Enter()) { //if (Activate != null) // Activate(this, new WindowActivateEventArgs(wParam)); } } } return(Win32Helper.CallNextHookEx(_windowHook, code, wParam, lParam)); }
public int HookProc(int code, IntPtr wParam, IntPtr lParam) { switch (code) { case 9: FocusChanged?.Invoke(this, new FocusChangeEventArgs(wParam, lParam)); break; case 5: if (_insideActivateEvent.CanEnter) { using (_insideActivateEvent.Enter()) { //if (Activate != null) // Activate(this, new WindowActivateEventArgs(wParam)); } } break; } return(User32.CallNextHookEx(_windowHook, code, wParam, lParam)); }
public Window(string title, int width, int height) { _title = title; Width = width; Height = height; glfw.WindowHint(WindowHintBool.Visible, false); pWindowHandle = glfw.CreateWindow(width, height, _title, (Monitor *)IntPtr.Zero.ToPointer(), null); Load?.Invoke(); _onMove = (window, x, y) => { Move?.Invoke((x, y)); }; _onResize = (window, width, height) => { Resize?.Invoke((width, height)); }; _onFramebufferResize = (window, width, height) => { FramebufferResize?.Invoke((width, height)); }; _onClosing = window => Closing?.Invoke(); _onFocusChanged = (window, isFocused) => FocusChanged?.Invoke(isFocused); _onMinimized = (window, isMinimized) => { WindowState state; // If minimized, we immediately know what value the new WindowState is. if (isMinimized) { state = WindowState.Minimized; } else { // Otherwise, we have to query a few things to figure out out. if (glfw.GetWindowAttrib(pWindowHandle, WindowAttributeGetter.Maximized)) { state = WindowState.Maximized; } else if (glfw.GetWindowMonitor(pWindowHandle) != null) { state = WindowState.Fullscreen; } else { state = WindowState.Normal; } } StateChanged?.Invoke(state); }; _onMaximized = (window, isMaximized) => { // Same here as in onMinimized. WindowState state; if (isMaximized) { state = WindowState.Maximized; } else { if (glfw.GetWindowAttrib(pWindowHandle, WindowAttributeGetter.Iconified)) { state = WindowState.Minimized; } else if (glfw.GetWindowMonitor(pWindowHandle) != null) { state = WindowState.Fullscreen; } else { state = WindowState.Normal; } } StateChanged?.Invoke(state); }; _onFileDrop = (window, count, paths) => { var arrayOfPaths = new string[count]; if (count == 0 || paths == IntPtr.Zero) { return; } for (var i = 0; i < count; i++) { var p = Marshal.ReadIntPtr(paths, i * IntPtr.Size); arrayOfPaths[i] = Marshal.PtrToStringAnsi(p); } FileDrop?.Invoke(arrayOfPaths); }; glfw.SetWindowPosCallback(pWindowHandle, _onMove); glfw.SetWindowSizeCallback(pWindowHandle, _onResize); glfw.SetWindowCloseCallback(pWindowHandle, _onClosing); glfw.SetWindowFocusCallback(pWindowHandle, _onFocusChanged); glfw.SetWindowIconifyCallback(pWindowHandle, _onMinimized); glfw.SetWindowMaximizeCallback(pWindowHandle, _onMaximized); glfw.SetFramebufferSizeCallback(pWindowHandle, _onFramebufferResize); glfw.SetDropCallback(pWindowHandle, _onFileDrop); }
private void DelegateOnFocusChanged(SAPFEWSELib.GuiSession currentSession, GuiVComponent newFocusedControl) { FocusChanged?.Invoke(GetSession(), newFocusedControl); }
/// <summary>Triggers the FocusChanged event</summary> /// <param name="focusedControl">Control that has gotten the input focus</param> private void OnFocusChanged(GuiControl focusedControl) { FocusChanged?.Invoke(this, new ControlEventArgs(focusedControl)); }
private void OnFocusChanged(object sender, EventArgs e) { FocusChanged?.Invoke(); }
private void ButtonPanel_LostFocus(object sender, EventArgs e) { FocusChanged?.Invoke(); }
public EditorState(IWin32Window window, string name, object tag, int tabIndex) { FilePath = null; Name = name; Tag = tag; IsChanged = false; FileEncoding = Encoding.UTF8; _styleNeededState = new StyleNeededState(); _window = window; TabIndex = tabIndex; _editor = new Scintilla(); SetupEditor(_editor); _containerPanel = new Panel(); _containerPanel.Dock = DockStyle.Fill; _containerPanel.Controls.Add(_editor); _searchControl = new SearchReplaceControl(); _searchControl.Dock = DockStyle.Top; _containerPanel.Controls.Add(_searchControl); _searchControl.Search += (s, direction) => { SearchText(_window, _searchControl.SearchText, direction, _searchControl.MatchCase, _searchControl.MatchWords, _searchControl.IsRegex, _searchControl.IsWrap); }; _searchControl.Replace += (s, mode) => { ReplaceText(_window, _searchControl.SearchText, _searchControl.ReplaceText, mode, _searchControl.MatchCase, _searchControl.MatchWords, _searchControl.IsRegex, _searchControl.IsWrap); }; _searchControl.FocusChanged += (s, focused) => { FocusChanged?.Invoke(this, focused); }; _searchControl.Hide(); _maxLineNumberCharLength = 0; _textChangedTimer = new System.Windows.Forms.Timer() { Enabled = false, Interval = 250 }; _textChangedTimer.Tick += (s, e) => { if (!_parseWorker.IsBusy) { _textChangedTimer.Enabled = false; ParseStarting?.Invoke(this); _parseWorker.RunWorkerAsync(_editor.Text); } }; _parseWorker = new BackgroundWorker(); _parseWorker.WorkerSupportsCancellation = true; _parseWorker.DoWork += (s, e) => { // @TODO(final): Support for incremental parsing, so only changes are applied string text = (string)e.Argument; Tokenize(text); Parse(text); }; _parseWorker.RunWorkerCompleted += (s, e) => { // @TODO(final): Dont colorize everything, just re-colorize the changes -> See "Support for continuous tokenization" if (_styleNeededState.Has > 0) { _editor.Colorize(_styleNeededState.StartPos, _styleNeededState.EndPos); } else { int firstLine = _editor.FirstVisibleLine; int lastLine = firstLine + _editor.LinesOnScreen; int start = _editor.Lines[firstLine].Index; int end = _editor.Lines[lastLine].Index; _editor.Colorize(start, end); } ParseComplete?.Invoke(this); }; }
public override void Update() { if (Mouse.ButtonPressed(MouseButtons.Left)) { var isFocused = IsMouseOver(); if (isFocused != IsFocused) { IsFocused = isFocused; FocusChanged?.Invoke(this, new FocusChangedEventArgs(IsFocused)); } if (IsFocused && Font.HitTest(Mouse.Position - Position, Text, ActualWidth, out int i)) { _cursorPos = i; } } if (!IsFocused) { return; } //Toggle cursor every half second _cursorTick += GameTime.UnscaledDeltaTime; if (_cursorTick >= .5f) { _showCursor = !_showCursor; _cursorTick = 0; } //Cursor navigation //Always show cursor when navigating if (_cursorPos > 0 && Keyboard.KeyPressed(Keys.Left)) { _cursorPos--; _cursorTick = 0; _showCursor = true; HandleInputEvent(Keys.Left); } else if (_cursorPos < _text.Length && Keyboard.KeyPressed(Keys.Right)) { _cursorPos++; _cursorTick = 0; _showCursor = true; HandleInputEvent(Keys.Right); } if (Keyboard.KeyPressed(Keys.Enter)) { Enter?.Invoke(this, new EventArgs()); HandleInputEvent(Keys.Enter); } //Text deletion if (Keyboard.KeyPressed(Keys.Backspace) && _cursorPos > 0) { _text = _text.Remove(_cursorPos - 1, 1); _cursorPos--; HandleInputEvent(Keys.Backspace); } if (Keyboard.KeyPressed(Keys.Delete) && _cursorPos < _text.Length) { _text = _text.Remove(_cursorPos, 1); HandleInputEvent(Keys.Delete); } //Text input var keys = Enum.GetValues(typeof(Keys)); for (int i = 0; i < keys.Length; i++) { var k = (Keys)keys.GetValue(i); if (Keyboard.KeyPressed(k)) { var text = Keyboard.ToUnicode(k); if (text != "\b") { _text = _text.Insert(_cursorPos, text); _cursorPos += text.Length; } HandleInputEvent(k); } } }
private void OnInternalFocusChanged(object sender, EventArgs e) { OnFocusChanged(this, e); FocusChanged?.Invoke(this, e); }
void OnFocus(object o, EventArgs args) { NotifyStateChange(StateType.Focused, widget.HasFocus); FocusChanged?.Invoke(this, widget.HasFocus); }
void IOnFocusChangeListener.OnFocusChange(AView view, bool hasFocus) { FocusChanged?.Invoke(hasFocus); }