diff --git a/Core.cs b/Core.cs index 43ce879e6..2bbf06be0 100644 --- a/Core.cs +++ b/Core.cs @@ -801,12 +801,14 @@ namespace Terminal { /// static public event EventHandler Iteration; - public static void MakeFirstResponder (Responder newResponder) + /// + /// Returns a rectangle that is centered in the screen for the provided size. + /// + /// The centered rect. + /// Size for the rectangle. + public static Rect MakeCenteredRect (Size size) { - if (newResponder == null) - throw new ArgumentNullException (); - - throw new NotImplementedException (); + return new Rect (new Point ((Driver.Cols - size.Width) / 2, (Driver.Rows - size.Height) / 2), size); } class MainLoopSyncContext : SynchronizationContext { diff --git a/TODO.md b/TODO.md index ad9af42e5..ceca82360 100644 --- a/TODO.md +++ b/TODO.md @@ -44,6 +44,11 @@ Wanted: - Popup menus - Make windows draggable +High-level widgets: +- Time selector +- Date selector +- File selector +- Masked input ## Layout manager @@ -64,21 +69,10 @@ characters everywhere For now it is split, in case we want to introduce formal view controllers. But the design becomes very ugly. -# Bugs - -There is a problem with the high-intensity colors, they are not showing up - -Add resizing support (still needs layout as well) - -# Mouse support - -It is still pending. - -Should allow for views to be dragged, in particular Window should allow this - # Mono-Curses The only missing feature in Mono-Curses that still relies on a native library is to fetch the OS SIGTSTP signal, we could hardcode this value if we had a way of detecting the host operating system and architecture, and just hardcode -the value based on this. \ No newline at end of file +the value based on this. + diff --git a/Terminal.csproj b/Terminal.csproj index be83e0b9f..f0965ea1e 100644 --- a/Terminal.csproj +++ b/Terminal.csproj @@ -45,6 +45,7 @@ + diff --git a/Views/Dialog.cs b/Views/Dialog.cs new file mode 100644 index 000000000..90a431ba2 --- /dev/null +++ b/Views/Dialog.cs @@ -0,0 +1,51 @@ +// +// Dialog.cs: Dialog box +// +// Authors: +// Miguel de Icaza (miguel@gnome.org) +// + +using System; +using System.Collections.Generic; + +namespace Terminal { + /// + /// The dialog box is a window that by default is centered and contains one + /// or more buttons. + /// + public class Dialog : Window { + List