public static ICheckBox CreateRadioButton(IObject parent, IGameFactory factory, string id, float x, float y, string text) { var checkbox = createCheckbox(parent, factory, id, x, y, text, FontIcons.RadioUnchecked, FontIcons.RadioChecked); var config = AGSTextConfig.Clone(checkbox.TextLabel.TextConfig); config.Alignment = Alignment.BottomLeft; checkbox.TextLabel.TextConfig = config; return(checkbox); }
public ITreeNodeView CreateNode(ITreeStringNode node, IRenderLayer layer, IObject parent) { var view = _inner.CreateNode(node, layer, parent); int nodeId = Interlocked.Increment(ref _nextNodeId); var folderIcon = _factory.UI.GetLabel($"FolderIcon_{node.Text}_{nodeId}", "", 25f, 25f, 15f, 0f, view.ExpandButton, AGSTextConfig.Clone(FontIcons.IconConfig)); folderIcon.Text = FontIcons.Folder; folderIcon.IsPixelPerfect = false; folderIcon.Enabled = true; folderIcon.MouseEnter.Subscribe(() => { node.Properties.Bools.SetValue(FOLDER_HOVERED, true); view.OnRefreshDisplayNeeded.Invoke(); }); folderIcon.MouseLeave.Subscribe(() => { node.Properties.Bools.SetValue(FOLDER_HOVERED, false); view.OnRefreshDisplayNeeded.Invoke(); }); folderIcon.MouseClicked.Subscribe(async(args) => await view.TreeItem.MouseClicked.InvokeAsync(args)); return(view); }
private static ITextConfig modifyConfig(ITextConfig config, float width) { config = AGSTextConfig.Clone(config); config.LabelMinSize = (width, config.LabelMinSize?.Height ?? 0f); return(config); }