public static void TestRender001() { TestXNAGame main = null; GuiControl control = null; TestXNAGame.Start("TestRenderGuiControl001", delegate { main = TestXNAGame.Instance; control = new GuiControl(); control.position = new Vector2(100, 100); control.size = new Vector2(200, 100); control.backgroundColor = Color.RoyalBlue; control.Load(main.GraphicsDevice); }, delegate { DrawEventArgs e = new DrawEventArgs(); e.Device = main.GraphicsDevice; e.SpriteBatch = main.SpriteBatch; control.Draw(e); }); }
public void DoMouseMove(GuiControl control, MouseEventArgs e) { if (control.CheckOnControl(e.CursorPosition)) { e.Handled = true; control.OnMouseMove(e); } }
public void StopDrag() { if (!InDrag) { throw new InvalidOperationException(); } inDrag = false; dragControl.OnDragEnded(null); dragControl = null; }
private void RaiseControlsEvent <T>(GuiControl control, T e, OnEventDelegate <T> del) where T : EventArgs, IHandelable { if (e.Handled) { return; } for (int i = 0; i < control.Controls.Count; i++) { RaiseControlsEvent(control.Controls[i], e, del); } del(control, e); }
public void StartDrag(GuiControl control) { if (inDrag) { throw new InvalidOperationException(); } inDrag = true; dragControl = control; dragStartPoint = game.Mouse.CursorPosition; dragControlStartPosition = control.Position; control.OnDragStarted(null); }
public void Add(GuiControl item) { innerList.Add(item); item.Parent = parent; if (item.TabIndex == -1) { //Get max tabindex int max = 0; for (int i = 0; i < innerList.Count; i++) { if (innerList[i].TabIndex > max) { max = innerList[i].TabIndex; } } item.TabIndex = max + 1; } }
public void Dispose() { if (!disposed) { } if (parent != null) { parent.controls.Remove(this); } parent = null; disposed = true; for (int i = 0; i < controls.Count; i++) { controls[i].Dispose(); } disposed = true; }
public void SetChildIndex(GuiControl item, int targetIndex) { throw new InvalidOperationException("Operation not yet implemented!"); }
public void Remove(GuiControl item) { innerList.Remove(item); item.Parent = null; }
public GuiControlCollection(GuiControl nParent) { parent = nParent; innerList = new List <GuiControl>(); }
public void DoUpdate(GuiControl control, DrawEventArgs e) { control.OnUpdate(e); }
public void DoDraw(GuiControl control, DrawEventArgs e) { control.OnDraw(e); }