/// <summary> /// Creates a function that displays the selection to the user. /// </summary> public Action<GUIControlContext> Display(GameBoardView BoardView) { return delegate(GUIControlContext Context) { LayerContainer lc; Point offset; if (Context.FindAncestor<LayerContainer>(out lc, out offset)) { FlowContainer options = new FlowContainer(20.0, Axis.Horizontal); Pane pane = new Pane(new SunkenContainer(options.WithMargin(20.0)).WithBorder(1.0)); ModalOptions mo = new ModalOptions() { Lightbox = false, LowestModal = pane, MouseFallthrough = false }; foreach (_Possible p in this._Items) { _Possible ip = p; Button button = new Button(ButtonStyle.CreateSolid(Skin.Default), new _PieceIcon(p.Move.NewState).CreateControl()); options.AddChild(button, 150.0); button.Click += delegate { lc.Modal = null; pane.Dismiss(); BoardView.MakeMove(ip.Move, ip.Board); }; } pane.ClientSize = new Point(options.SuggestLength + 42.0, 190.0); Rectangle merect = new Rectangle(offset, Context.Control.Size); lc.AddControl(pane, merect.Location + merect.Size * 0.5 - pane.Size * 0.5); lc.Modal = mo; } }; }