public NewValueDialog(string title) { Dialog = Far.Api.CreateDialog(-1, -1, 77, 9); Dialog.AddBox(3, 1, 0, 0, title); int x = 11; // use last history, it is useful Dialog.AddText(5, -1, 0, "&Name"); Name = Dialog.AddEdit(x, 0, 71, string.Empty); Name.History = "PowerPanelNames"; Name.UseLastHistory = true; // do not use last history! Dialog.AddText(5, -1, 0, "&Type"); Type = Dialog.AddEdit(x, 0, 71, string.Empty); Type.History = "PowerPanelTypes"; // do not use last history! Dialog.AddText(5, -1, 0, "&Value"); Value = Dialog.AddEdit(x, 0, 71, string.Empty); Value.History = "PowerPanelValues"; Dialog.AddText(5, -1, 0, string.Empty).Separator = 1; IButton buttonOK = Dialog.AddButton(0, -1, "Ok"); buttonOK.CenterGroup = true; IButton buttonCancel = Dialog.AddButton(0, 0, Res.Cancel); buttonCancel.CenterGroup = true; }
public ConfigDrawerDialog(IModuleDrawer drawer, string helpTopic) { Dialog = Far.Api.CreateDialog(-1, -1, 77, 8); Dialog.HelpTopic = helpTopic; // Box Dialog.AddBox(3, 1, 0, 0, drawer.Name); int x = 14; // Mask Dialog.AddText(5, -1, 0, "&Mask"); Mask = Dialog.AddEdit(x, 0, 71, drawer.Mask); // Priority Dialog.AddText(5, -1, 0, "&Priority"); Priority = Dialog.AddEdit(x, 0, 71, string.Format(null, "{0}", drawer.Priority)); Dialog.AddText(5, -1, 0, string.Empty).Separator = 1; IButton buttonOK = Dialog.AddButton(0, -1, "Ok"); buttonOK.CenterGroup = true; IButton buttonCancel = Dialog.AddButton(0, 0, "Cancel"); buttonCancel.CenterGroup = true; }
public static IEnumerable<IControl> GetControls(IDialog dialog) { for (int i = 0; ; ++i) { IControl control = dialog[i]; if (control == null) break; yield return control; } }
ExportDialog(string title, string filePath, bool useDepth) { int h = 8; if (useDepth) ++h; _Dialog = Far.Api.CreateDialog(-1, -1, 77, h); _Dialog.AddBox(3, 1, 0, 0, title); const int x = 16; int y = 1; _Dialog.AddText(5, ++y, 0, "&File name"); _File = _Dialog.AddEdit(x, y, 71, string.Empty); _File.History = "NewEdit"; _File.IsPath = true; _File.UseLastHistory = true; if (filePath != null) _File.Text = filePath; _Dialog.AddText(5, ++y, 0, "&Encoding"); _Encoding = _Dialog.AddComboBox(x, y, 71, string.Empty); _Encoding.DropDownList = true; _Encoding.Text = "Unicode"; _Encoding.Add("Default"); _Encoding.Add("Unicode"); _Encoding.Add("UTF8"); _Encoding.Add("BigEndianUnicode"); _Encoding.Add("ASCII"); _Encoding.Add("UTF7"); _Encoding.Add("UTF32"); _Encoding.Add("OEM"); if (useDepth) { _Dialog.AddText(5, ++y, 0, "&Depth"); _Depth = _Dialog.AddEdit(x, y, 71, string.Empty); } _Dialog.AddText(5, ++y, 0, string.Empty).Separator = 1; IButton buttonOK = _Dialog.AddButton(0, ++y, "Ok"); buttonOK.CenterGroup = true; _Dialog.Default = buttonOK; IButton buttonCancel = _Dialog.AddButton(0, y, Res.Cancel); buttonCancel.CenterGroup = true; _Dialog.Cancel = buttonCancel; }
public UIWordDialog(string stem1, string stem2) { const int h = 6; const int x = 20; _Dialog = Far.Api.CreateDialog(-1, -1, 77, h); _Dialog.AddBox(3, 1, 0, 0, My.AddToDictionary); int y = 1; _Dialog.AddText(5, ++y, 0, My.NewWord); _Stem1 = _Dialog.AddEdit(x, y, 71, stem1); _Dialog.AddText(5, ++y, 0, My.ExampleStem); _Stem2 = _Dialog.AddEdit(x, y, 71, stem2); _Stem2.History = "RightWordsStem"; }
public bool Show() { string prompt = Prompt ?? ""; var size = Far.Api.UI.WindowSize; _Dialog = Far.Api.CreateDialog(0, size.Y - 2, size.X - 1, size.Y - 1); _Dialog.TypeId = TypeId; _Dialog.NoShadow = true; _Dialog.KeepWindowTitle = true; if (Password) { _Edit = _Dialog.AddEditPassword(prompt.Length, 0, size.X - 1, string.Empty); } else { int right = string.IsNullOrEmpty(History) ? size.X - 1 : size.X - 2; _Edit = _Dialog.AddEdit(prompt.Length, 0, right, string.Empty); _Edit.History = History; } _Edit.Coloring += Coloring.ColorEditAsConsole; if (prompt.Length > 0) { var uiText = _Dialog.AddText(0, 0, prompt.Length - 1, prompt); uiText.Coloring += Coloring.ColorTextAsConsole; } var uiArea = _Dialog.AddText(0, 1, size.X - 1, string.Empty); uiArea.Coloring += Coloring.ColorTextAsConsole; // hotkeys _Edit.KeyPressed += OnKey; // ignore clicks outside _Dialog.MouseClicked += (sender, e) => { if (e.Control == null) e.Ignore = true; }; return _Dialog.Show(); }
public ConnectionDialog(string title) { _Dialog = Far.Api.CreateDialog(-1, -1, 77, 8); _Dialog.AddBox(3, 1, 0, 0, title); _Dialog.AddText(5, -1, 0, "&Computer"); _ComputerName = _Dialog.AddEdit(x, 0, 71, string.Empty); _ComputerName.History = "ComputerName"; _ComputerName.UseLastHistory = true; _Dialog.AddText(5, -1, 0, "&User name"); _UserName = _Dialog.AddEdit(x, 0, 71, string.Empty); _UserName.History = "UserName"; _UserName.UseLastHistory = true; _Dialog.AddText(5, -1, 0, string.Empty).Separator = 1; IButton buttonOK = _Dialog.AddButton(0, -1, "Ok"); buttonOK.CenterGroup = true; _Dialog.Default = buttonOK; _Dialog.Cancel = _Dialog.AddButton(0, 0, Res.Cancel); _Dialog.Cancel.CenterGroup = true; }
static ICheckBox AddOption(IDialog dialog, string text, ModuleToolOptions option, ModuleToolOptions defaultOptions, ModuleToolOptions currentOptions) { ICheckBox result = dialog.AddCheckBox(5, -1, text); if (0 == (option & defaultOptions)) result.Disabled = true; else if (0 != (option & currentOptions)) result.Selected = 1; return result; }
public BreakpointDialog(int type, string script, int line) { Type = type; string typeName = type == 0 ? "Line" : type == 1 ? "Command" : "Variable"; int h = 9; if (Type == 2) ++h; UIDialog = Far.Api.CreateDialog(-1, -1, 77, h); UIDialog.Closing += OnClosing; UIDialog.HelpTopic = Far.Api.GetHelpTopic("BreakpointDialog"); // title UIDialog.AddBox(3, 1, 0, 0, typeName + " breakpoint"); const int x = 14; int y = 1; UIDialog.AddText(5, ++y, 0, "&" + typeName); UIMatter = UIDialog.AddEdit(x, y, 71, string.Empty); switch (type) { case 0: if (line > 0) UIMatter.Text = Kit.ToString(line); break; case 1: UIMatter.History = Res.HistoryCommand; UIMatter.UseLastHistory = true; break; case 2: UIMatter.History = Res.HistoryVariable; UIMatter.UseLastHistory = true; break; } if (Type == 2) { UIDialog.AddText(5, ++y, 0, "&Mode"); UIMode = UIDialog.AddComboBox(x, y, 71, variableAccessMode.ToString()); UIMode.DropDownList = true; UIMode.Add(VariableAccessMode.Read.ToString()); UIMode.Add(VariableAccessMode.Write.ToString()); UIMode.Add(VariableAccessMode.ReadWrite.ToString()); } UIDialog.AddText(5, ++y, 0, "&Script"); UIScript = UIDialog.AddEdit(x, y, 71, string.Empty); UIScript.History = Res.HistoryScript; UIScript.IsPath = true; if (script != null) UIScript.Text = script; UIDialog.AddText(5, ++y, 0, "&Action"); UIAction = UIDialog.AddEdit(x, y, 71, string.Empty); UIAction.History = Res.HistoryAction; UIDialog.AddText(5, ++y, 0, string.Empty).Separator = 1; IButton buttonOK = UIDialog.AddButton(0, ++y, "Ok"); buttonOK.CenterGroup = true; IButton buttonCancel = UIDialog.AddButton(0, y, Res.Cancel); buttonCancel.CenterGroup = true; }