ソースを参照

Expose some Curses APIs to the public

Miguel de Icaza 6 年 前
コミット
82398758e2

+ 10 - 3
Terminal.Gui/Drivers/CursesDriver.cs

@@ -16,7 +16,7 @@ namespace Terminal.Gui {
 	/// <summary>
 	/// This is the Curses driver for the gui.cs/Terminal framework.
 	/// </summary>
-	internal class CursesDriver : ConsoleDriver {
+	public class CursesDriver : ConsoleDriver {
 		Action terminalResized;
 
 		public override int Cols => Curses.Cols;
@@ -70,9 +70,16 @@ namespace Terminal.Gui {
 		public Curses.Window window;
 
 		static short last_color_pair = 16;
-		static Attribute MakeColor (short f, short b)
+
+		/// <summary>
+		/// Creates a curses color from the provided foreground and background colors
+		/// </summary>
+		/// <param name="foreground">Contains the curses attributes for the foreground (color, plus any attributes)</param>
+		/// <param name="background">Contains the curses attributes for the background (color, plus any attributes)</param>
+		/// <returns></returns>
+		public static Attribute MakeColor (short foreground, short background)
 		{
-			Curses.InitColorPair (++last_color_pair, f, b);
+			Curses.InitColorPair (++last_color_pair, foreground, background);
 			return new Attribute () { value = Curses.ColorPair (last_color_pair) };
 		}
 

+ 2 - 2
Terminal.Gui/MonoCurses/binding.cs

@@ -48,9 +48,9 @@ using Mono.Terminal.Internal;
 
 namespace Unix.Terminal {
 
-	internal partial class Curses {
+	public partial class Curses {
 		[StructLayout (LayoutKind.Sequential)]
-		internal struct MouseEvent {
+		public struct MouseEvent {
 			public short ID;
 			public int X, Y, Z;
 			public Event ButtonState;

+ 2 - 2
Terminal.Gui/MonoCurses/constants.cs

@@ -5,7 +5,7 @@
 using System;
 
 namespace Unix.Terminal {
-	internal partial class Curses {
+	public partial class Curses {
 		public const int A_NORMAL = unchecked((int)0x0);
 		public const int A_STANDOUT = unchecked((int)0x10000);
 		public const int A_UNDERLINE = unchecked((int)0x20000);
@@ -49,7 +49,7 @@ namespace Unix.Terminal {
 		public const int COLOR_CYAN = unchecked((int)0x6);
 		public const int COLOR_WHITE = unchecked((int)0x7);
 		public const int KEY_CODE_YES = unchecked((int)0x100);
-		internal enum Event : long {
+		public enum Event : long {
 			Button1Pressed = unchecked((int)0x2),
 			Button1Released = unchecked((int)0x1),
 			Button1Clicked = unchecked((int)0x4),

+ 2 - 2
Terminal.Gui/MonoCurses/handles.cs

@@ -30,8 +30,8 @@ using System.Runtime.InteropServices;
 
 namespace Unix.Terminal {
 
-	internal partial class Curses {
-		internal class Window {
+	public partial class Curses {
+		public class Window {
 			public readonly IntPtr Handle;
 			static Window curscr;
 			static Window stdscr;