public override void Update(GUIControlContext Context, double Time) { foreach (_Child c in this._Children) { c.Control.Update(Context.CreateChildContext(c.Control, c.Offset), Time); } }
public override void Update(GUIControlContext Context, double Time) { base.Update(Context, Time); if (this._UpdateAction != null) { this._UpdateAction(Context); this._UpdateAction = null; } }
public override void Update(GUIControlContext Context, double Time) { MouseState ms = Context.MouseState; if (ms != null) { // Zoom and stuff double scroll = ms.Scroll; if (scroll != 0.0) { double zoom = Math.Pow(2.0, -scroll / 40.0); Rectangle win = this._Window; Point mousepos = new Rectangle(this.Size).ToRelative(ms.Position); mousepos.Y = 1.0 - mousepos.Y; Point nwinsize = win.Size * zoom; Point nwinpos = win.Location + mousepos.Scale(win.Size) - mousepos.Scale(nwinsize); this._Window = new Rectangle(nwinpos, nwinsize).Intersection(this.Domain); } } }
public override void Update(GUIControlContext Context, double Time) { this._Client.Update(Context.CreateChildContext(this._Client, -this._Offset), Time); }
public override void Update(GUIControlContext Context, double Time) { this._TopLeftButton.Update(Context.CreateChildContext(this._TopLeftButton, new Point(0.0, 0.0)), Time); this._BottomRightButton.Update(Context.CreateChildContext(this._BottomRightButton, this._BottomRightButtonOffset), Time); // Handle mouse MouseState ms = Context.MouseState; if (this._Enabled && ms != null) { bool oldmousedown = this._MouseDown; this._MouseDown = ms.IsButtonDown(MouseButton.Left); double areastart; double areaend; double areasize; double sliderstart; double slidersize; this._GetScrollMeasurements(out areastart, out areaend, out areasize, out sliderstart, out slidersize); double mouse = ms.Position.SwapIf(this._Direction == Axis.Vertical).X; // Dragging if (this._DragOffset != null) { this.Value = (mouse - this._DragOffset.Value - areastart) / (areasize - slidersize); if (!this._MouseDown) { this._DragOffset = null; Context.ReleaseMouse(); } } // Check for press if (!oldmousedown && this._MouseDown) { // See if its in one of the empty regions to either end of the scrollbar. if (mouse > areastart && mouse < sliderstart) { this.Value = this._Value - this._MajorIncrement; } if (mouse < areaend && mouse > sliderstart + slidersize) { this.Value = this._Value + this._MajorIncrement; } // Perhaps the user intends to drag? if (mouse > sliderstart && mouse < sliderstart + slidersize) { Context.CaptureMouse(); this._DragOffset = mouse - sliderstart; } } } }
public override void Update(GUIControlContext Context, double Time) { this._View.Update(Context.CreateChildContext(this._View, new Point(0.0, 0.0)), Time); if (this._VScroll != null) { this._VScroll.Update(Context.CreateChildContext(this._VScroll, new Point(this.Size.X - this._VScroll.Size.X, 0.0)), Time); } if (this._HScroll != null) { this._HScroll.Update(Context.CreateChildContext(this._HScroll, new Point(0.0, this.Size.Y - this._HScroll.Size.Y)), Time); } }
public override void Update(GUIControlContext Context, double Time) { base.Update(Context, Time); MouseState ms = Context.MouseState; // Shown on right click. if (this._ShowOnRightClick && ms != null && ms.HasReleasedButton(MouseButton.Right)) { this._CallAtMouse = true; } // Set up call on mouse if (this._CallAtMouse) { if (ms != null) { this._Callpoint = ms.Position; } this._CallAtMouse = false; } // Call up popup, if needed if (this._Callpoint != null && this._Items != null) { Point cp = this._Callpoint.Value; LayerContainer container; Point layeroffset; if (Context.FindAncestor<LayerContainer>(out container, out layeroffset)) { Popup.Call(container, cp - layeroffset, this._Items, this._Style); } this._Callpoint = null; } }
public override void Update(GUIControlContext Context, double Time) { // Mouse navigation. Rectangle inner = new Rectangle(this.Size).Margin(this._Style.Margin); MouseState ms = Context.MouseState; this._MouseDown = false; if (ms != null) { Point mousepos = ms.Position; foreach (_Item i in this._Items) { Rectangle irect = this._ItemRect(inner, i); if (irect.In(mousepos)) { if (ms.IsButtonDown(MouseButton.Left)) { this._MouseDown = true; } if ((mousepos - this._LastMouse).SquareLength > 1.0 || this._MouseDown) { if (this._Select(i)) { this._UpdateSubmenu(irect); } } if (ms.HasReleasedButton(MouseButton.Left)) { this._Click(); } } } this._LastMouse = mousepos; } // Keyboard navigation KeyboardState ks = Context.KeyboardState; if (ks != null && !this._MouseDown) { foreach (KeyEvent ke in ks.Events) { _Item nitem = this._Active; if (ke.Type == ButtonEventType.Down) { if (ke.Key == Key.Down) { // Navigate down if (this._Active == null) { nitem = this._Items[0]; } else { nitem = this._ItemAtOffsetIndex(this._Active, 1); } } if (ke.Key == Key.Up) { // Navigate up if (this._Active == null) { nitem = this._Items[this._Items.Count - 1]; } else { nitem = this._ItemAtOffsetIndex(this._Active, -1); } } if (ke.Key == Key.Left) { if (this._Parent != null) { this._Parent._Submenu = null; } this.Dismiss(); return; } if (ke.Key == Key.Right) { if (this._Active != null) { this._UpdateSubmenu(_ItemRect(inner, this._Active)); return; } } if (ke.Key == Key.Enter) { this._Click(); return; } } if (nitem != this._Active) { this._Select(nitem); } } // Super quick number navigation foreach (char c in ks.Presses) { int n = (int)c - 49; if (n >= 0 && n < 9) { if (n < this._Items.Count) { _Item item = this._Items[n]; if (this._Select(item)) { this._UpdateSubmenu(this._ItemRect(inner, item)); this._Click(); } } } } } if (this._Submenu == null && !Context.HasKeyboard) { Context.CaptureKeyboard(); } }
public override void Update(GUIControlContext Context, double Time) { MouseState ms = Context.MouseState; if (ms != null) { // Test for click bool primary = false; bool click = false; if (ms.HasPushedButton(OpenTK.Input.MouseButton.Left)) { if (Context.SimpleKeyboardState.IsKeyDown(OpenTK.Input.Key.ControlLeft)) { primary = false; } else { primary = true; } click = true; } if (ms.HasPushedButton(OpenTK.Input.MouseButton.Right)) { primary = false; click = true; } // Click response if (click) { Vector3d mouseraydir = this.UnprojectRay(ms.Position); Vector3d mouseraystart = this.EyePosition; // Test if a piece has been clicked foreach (PieceVisual pv in this._Visuals) { Matrix4d itrans = pv.Transform; itrans.Invert(); Vector3d nmouseraydir = Vector3d.TransformNormal(mouseraydir, itrans); Vector3d nmouseraystart = Vector3d.Transform(mouseraystart, itrans); if (RayBoxIntersect(nmouseraystart, nmouseraydir, Mesh.FloatToDouble(pv.Mesh.BoundsMin) * 0.9f, Mesh.FloatToDouble(pv.Mesh.BoundsMax) * 0.9f)) { // Mouse clicked on piece this.OnSquareClick(pv.Square, primary); click = false; } } // Test if the board has been clicked if (click) { Vector2d boardhit = RayPlaneIntersect( new Vector3d(mouseraystart.Z, mouseraystart.X, mouseraystart.Y), new Vector3d(mouseraydir.Z, mouseraydir.X, mouseraydir.Y)); if (boardhit.X >= 0.0 && boardhit.Y >= 0.0) { int ranks = this._CurrentBoard.Ranks; int files = this._CurrentBoard.Files; int tr = (int)boardhit.Y; int tf = (int)boardhit.X; if (tr < ranks && tf < files) { this.OnSquareClick(new Square(tr, tf), primary); } } } } } }
public override void Update(GUIControlContext Context, double Time) { }
/// <summary> /// Updates the state of the control after the specified amount of time elapses. /// </summary> public virtual void Update(GUIControlContext Context, double Time) { }
public override void Update(GUIControlContext Context, double Time) { this._Client.Update(Context.CreateChildContext(this._Client, new Point(0.0, 0.0)), Time); }
public override void Update(GUIControlContext Context, double Time) { MouseState ms = Context.MouseState; if (ms != null) { this._MouseOver = true; if (ms.IsButtonDown(MouseButton.Left)) { this._MouseDown = true; } else { if (this._MouseDown) { // That would be a click! this._Click(); this._MouseDown = false; } } } else { this._MouseDown = false; this._MouseOver = false; } // Update client, if any if (this._Client != null) { this._Client.Update(Context.CreateChildContext(this._Client, new Point(this._Style.ClientMargin, this._Style.ClientMargin)), Time); } }
public override void Update(GUIControlContext Context, double Time) { MouseState ms = Context.MouseState; if (ms != null) { if (ms.HasReleasedButton(MouseButton.Left)) { this._Click(); } } }
public override void Update(GUIControlContext Context, double Time) { this._Child.Update(Context.CreateChildContext(this._Child, new Point(this._Margin, this._Margin)), Time); }
public override void Update(GUIControlContext Context, double Time) { MouseState ms = Context.MouseState; Point? mousepos = ms != null ? (Point?)ms.Position : null; LinkedList<LayerControl> oldlayercontrols = this._LayerControls; this._LayerControls = new LinkedList<LayerControl>(this._LayerControls); ModalOptions mo = this._ModalOptions; // Go through control in reverse order (since the last control is the top-most). LinkedListNode<LayerControl> cur = oldlayercontrols.Last; while (cur != null) { LayerControl lc = cur.Value; // Standard updating procedure lc.Update(Context.CreateChildContext(lc, lc._Position, mousepos == null), Time); if (mousepos != null) { // If the mouse is over a hover control, do not let it fall through to lower controls. if (new Rectangle(lc._Position, lc.Size).In(mousepos.Value)) { mousepos = null; } } // Handle modal options if (mo != null) { if (mo.LowestModal == lc) { // Background click? if (mousepos != null && (ms.IsButtonDown(MouseButton.Left) || ms.IsButtonDown(MouseButton.Right))) { mo._BackgroundClick(); } // Mouse blocked? if (!mo.MouseFallthrough) { mousepos = null; } } } cur = cur.Previous; } if (this._Background != null) { this._Background.Update(Context.CreateChildContext(this._Background, new Point(), mousepos == null), Time); } // Update lightbox (really low priority). if (this._ModalOptions != null && this._ModalOptions.Lightbox) { this._LightboxTime = Math.Min(this._Style.LightBoxFadeTime, this._LightboxTime + Time); } else { this._LightboxTime = Math.Max(0.0, this._LightboxTime - Time); } }
public override void Update(GUIControlContext Context, double Time) { this._Near.Update(Context.CreateChildContext(this._Near, new Point(0.0, 0.0)), Time); this._Far.Update(Context.CreateChildContext(this._Far, new Point(this._NearSize, 0.0).SwapIf(this._Direction == Axis.Vertical)), Time); }
public override void Update(GUIControlContext Context, double Time) { // Handle mouse selection. MouseState ms = Context.MouseState; if (ms != null) { if (this._MouseDrag) { if(ms.IsButtonDown(MouseButton.Left)) { this._Selection.End = this._SelectedIndex(ms.Position); } else { Context.ReleaseMouse(); this._MouseDrag = false; } } if (ms.HasPushedButton(MouseButton.Left)) { Context.CaptureMouse(); Context.CaptureKeyboard(); this._Selection = new TextSelection(this._SelectedIndex(ms.Position)); this._MouseDrag = true; } } }
public override void Update(GUIControlContext Context, double Time) { double d = 0.0; foreach (_Child c in this._Children) { c.Control.Update(Context.CreateChildContext(c.Control, new Point(d, 0.0).SwapIf(this._Direction == Axis.Vertical)), Time); d += c.Size + this._Seperation; } }
public override void Update(GUIControlContext Context, double Time) { // Handle mouse selection. MouseState ms = Context.MouseState; if (ms != null) { if (this._MouseDrag) { if(ms.IsButtonDown(MouseButton.Left)) { this._Selection.End = this._SelectedIndex(ms.Position); } else { Context.ReleaseMouse(); this._MouseDrag = false; } } if (ms.HasPushedButton(MouseButton.Left)) { Context.CaptureMouse(); Context.CaptureKeyboard(); this._Selection = new TextSelection(this._SelectedIndex(ms.Position)); this._MouseDrag = true; } } TextSelection ts = this._Selection; if (ts != null && !Context.HasKeyboard) { this._Selection = ts = null; if (this.TextEntered != null) { this.TextEntered(this._Text); } } // Flash the cursor this._CursorFlashTime += Time; double cfr = this._Style.CursorFlashRate; while (this._CursorFlashTime > cfr) { this._CursorFlashTime -= cfr * 2.0; } // Update text KeyboardState ks = Context.KeyboardState; if (ks != null && ts != null) { bool changed = false; foreach (char c in ks.Presses) { int starti; int endi; ts.Order(out starti, out endi); if (c == '\b') { if (endi - starti > 0) { if(this._TryChangeText(this._Text.Substring(0, starti) + this._Text.Substring(endi, this._Text.Length - endi))) { this._Selection = new TextSelection(starti); changed = true; } } else { if (starti > 0) { if (this._TryChangeText(this._Text.Substring(0, starti - 1) + this._Text.Substring(starti, this._Text.Length - starti))) { this._Selection = new TextSelection(starti - 1); changed = true; } } } continue; } if (ValidChar(c)) { if (this._TryChangeText(this._Text.Substring(0, starti) + c + this._Text.Substring(endi, this._Text.Length - endi))) { this._Selection = new TextSelection(starti + 1); changed = true; } } } if (changed) { this._CursorFlashTime = 0.0; this._TextSample.Dispose(); this._MakeTextSample(); } // Navigation foreach (KeyEvent ke in ks.Events) { if (ke.Type == ButtonEventType.Down) { int ss = this._Selection.Start; if (ke.Key == Key.Left) { if (ss > 0) { this._Selection = new TextSelection(ss - 1); } } if (ke.Key == Key.Right) { if (ss < this._Text.Length) { this._Selection = new TextSelection(ss + 1); } } } } // Enter? if (ks.IsKeyDown(Key.Enter)) { this._Selection = null; Context.ReleaseKeyboard(); if (this.TextEntered != null) { this.TextEntered(this._Text); } } } }
public override void Update(GUIControlContext Context, double Time) { this._Client.Update(Context.CreateChildContext(this._Client, this.ClientRectangle.Location), Time); this._RightTitleBar.Update(Context.CreateChildContext(this._RightTitleBar, this._RightTitleBarOffset), Time); // Form needs to be dragged? MouseState ms = Context.MouseState; if (ms != null) { Point mousepos = ms.Position; if (this._FormDragOffset == null) { if (new Rectangle( this._Style.TitleBarLeftRightMargin, 0.0, this.Size.X - this._RightTitleBar.Size.X - this._Style.TitleBarLeftRightMargin, this._Style.TitleBarSize).In(mousepos)) { if (ms.HasPushedButton(MouseButton.Left)) { Context.CaptureMouse(); this.Container.BringToTop(this); this._FormDragOffset = mousepos; } } } else { this.Position = this.Position + mousepos - this._FormDragOffset.Value; if (!ms.IsButtonDown(MouseButton.Left)) { Context.ReleaseMouse(); this._FormDragOffset = null; } } } }