public ShortcutPropertyEditor(IPropertyEditorParams editorParams) : base(editorParams) { editor = editorParams.EditBoxFactory(); editor.Updating += Updating; editor.Updated += Updated; editor.LayoutCell = new LayoutCell(Alignment.Center); editor.AddChangeLateWatcher(CoalescedPropertyValue(), v => { var text = v.Value.ToString(); editor.Text = v.IsDefined ? v.Value.Main != Key.Unknown ? text : text.Replace("Unknown", "") : ManyValuesText; }); editor.IsReadOnly = true; editor.TextWidget.Tasks.Clear(); editor.TextWidget.Position = new Vector2(0, editor.MinHeight / 2); editor.TextWidget.Padding = new Thickness(5, 0); editor.Gestures.Add(new ClickGesture(() => editor.SetFocus())); editor.Gestures.Add(new ClickGesture(1, () => { main = Key.Unknown; modifiers = Modifiers.None; SetValue(new Shortcut(modifiers, main)); })); editor.AddToNode(EditorContainer); PropertyLabel.Tasks.Clear(); PropertyLabel.Tasks.Add(ManageLabelFocus()); ContainerWidget.Tasks.Add(ManageFocusTask()); var value = CoalescedPropertyValue().GetValue(); main = value.Value.Main; modifiers = value.Value.Modifiers; flatFillPresenter = new WidgetFlatFillPresenter(Theme.Colors.GrayBackground); ContainerWidget.CompoundPresenter.Add(flatFillPresenter); }
public Exposition(Widget container, WidgetInput input) { blackBackgroundPresenter = new WidgetFlatFillPresenter(Color4.Transparent); canvas = CreateCanvas(container); var cellSize = CalcCellSize(container.Size, GetWidgets().Count()); int itemCount = GetWidgets().Count(); items = GetWidgets().Select((w, i) => new Item(w, CreateItemFrame(i, canvas, cellSize), input, showLabel: itemCount <= 50)).ToList(); }