From 0e05baef623806eddd3272555c0351dcd535575d Mon Sep 17 00:00:00 2001 From: BDisp Date: Sat, 23 Jul 2022 14:05:27 +0100 Subject: [PATCH] Added a 'Read Only' to the Editor scenario Format menu. (#1882) --- UICatalog/Scenarios/Editor.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/UICatalog/Scenarios/Editor.cs b/UICatalog/Scenarios/Editor.cs index bca03b41f..613624521 100644 --- a/UICatalog/Scenarios/Editor.cs +++ b/UICatalog/Scenarios/Editor.cs @@ -94,7 +94,8 @@ namespace UICatalog.Scenarios { new MenuBarItem ("Forma_t", new MenuItem [] { CreateWrapChecked (), CreateAutocomplete(), - CreateAllowsTabChecked () + CreateAllowsTabChecked (), + CreateReadOnlyChecked () }), new MenuBarItem ("_Responder", new MenuItem [] { CreateCanFocusChecked (), @@ -572,6 +573,18 @@ namespace UICatalog.Scenarios { return item; } + private MenuItem CreateReadOnlyChecked () + { + var item = new MenuItem { + Title = "Read Only" + }; + item.CheckType |= MenuItemCheckStyle.Checked; + item.Checked = _textView.ReadOnly; + item.Action += () => _textView.ReadOnly = item.Checked = !item.Checked; + + return item; + } + private MenuItem CreateCanFocusChecked () { var item = new MenuItem {