Skip to content

Commit ffdaf95

Browse files
author
tznind
committed
Showcase checkboxes
Restore 'save changes' exit prompt Set Runnable to render with dotted line for border Don't show Arrangement options unless its a container view Make CheckBox radio style a designable property
1 parent a2f0c13 commit ffdaf95

5 files changed

Lines changed: 166 additions & 7 deletions

File tree

Showcase/Checkboxes.Designer.cs

Lines changed: 134 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Showcase/Checkboxes.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
//------------------------------------------------------------------------------
3+
4+
// <auto-generated>
5+
// This code was generated by:
6+
// TerminalGuiDesigner v2.0.2.0
7+
// You can make changes to this file and they will not be overwritten when saving.
8+
// </auto-generated>
9+
// -----------------------------------------------------------------------------
10+
namespace Showcase {
11+
using Terminal.Gui;
12+
13+
14+
public partial class Checkboxes {
15+
16+
public Checkboxes() {
17+
InitializeComponent();
18+
}
19+
}
20+
}

Showcase/Program.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ internal class Program
99
{
1010
static void Main(string[] args)
1111
{
12-
Type[] types = [typeof(Menus), typeof(Buttons)];
12+
Type[] types = [
13+
typeof(Menus),
14+
typeof(Buttons),
15+
typeof(Checkboxes)
16+
];
1317

1418
using (var app = Application.Create())
1519
{

src/Design.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,11 @@ private IEnumerable<Property> LoadDesignableProperties()
610610

611611
yield return this.CreateSuppressedProperty(nameof(this.View.Visible), true);
612612

613-
yield return this.CreateSuppressedProperty(nameof(this.View.Arrangement), ViewArrangement.Fixed);
613+
if (this.View.IsContainerView())
614+
{
615+
// Don't offer to make checkboxes etc Resizeable/Overlapped etc
616+
yield return this.CreateSuppressedProperty(nameof(this.View.Arrangement), ViewArrangement.Fixed);
617+
}
614618

615619
yield return this.CreateSuppressedProperty(nameof(View.CanFocus), true);
616620

@@ -715,6 +719,7 @@ private IEnumerable<Property> LoadDesignableProperties()
715719
if (this.View is CheckBox)
716720
{
717721
yield return this.CreateProperty(nameof(CheckBox.Value));
722+
yield return this.CreateProperty(nameof(CheckBox.RadioStyle));
718723
}
719724
if (this.View is ColorPicker cp)
720725
{

src/ViewExtensions.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ public static bool IsContainerView(this View v)
200200

201201
// TODO: are there any others?
202202
return
203+
v.GetType() == typeof(Runnable) ||
203204
v is FrameView ||
204205
v is Window ||
205206
type == typeof(View) || type.Name.Equals("ContentView");
@@ -213,11 +214,6 @@ v is Window ||
213214
/// <returns>True if no visible border and <see cref="ViewExtensions.IsContainerView(View)"/>.</returns>
214215
public static bool IsBorderlessContainerView(this View v)
215216
{
216-
if (v is Runnable)
217-
{
218-
return false;
219-
}
220-
221217
if (v.IsContainerView() && v.HasNoBorderProperty())
222218
{
223219
return true;

0 commit comments

Comments
 (0)