From 9c0f19ecc6a85eb2cebaa475adb8d0c10e1d6725 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 28 Nov 2007 07:15:05 +0000 Subject: [PATCH] * Minor naming convention changes in the C# bindings. --- csharp/Caca.cs | 24 ++++++++++++------------ csharp/Cucul.cs | 5 ++--- csharp/test.cs | 12 ++++++------ 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/csharp/Caca.cs b/csharp/Caca.cs index 98f471f..627b860 100644 --- a/csharp/Caca.cs +++ b/csharp/Caca.cs @@ -131,7 +131,7 @@ namespace Caca [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] private static extern int caca_get_event_type(IntPtr ev); - public CacaEventType type + public CacaEventType Type { get { return (CacaEventType)caca_get_event_type(cevent); } } @@ -139,7 +139,7 @@ namespace Caca [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] private static extern int caca_get_event_key_ch(IntPtr ev); - public int keyCh + public int KeyCh { get { return caca_get_event_key_ch(cevent); } } @@ -147,7 +147,7 @@ namespace Caca [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] private static extern int caca_get_event_key_utf32(IntPtr ev); - public int keyUtf32 + public int KeyUtf32 { get { return caca_get_event_key_utf32(cevent); } } @@ -156,7 +156,7 @@ namespace Caca SuppressUnmanagedCodeSecurity] private static extern int caca_get_event_key_utf8(IntPtr ev, IntPtr _utf8); - public string keyUtf8 + public string KeyUtf8 { get { @@ -168,7 +168,7 @@ namespace Caca [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] private static extern int caca_get_event_mouse_button(IntPtr ev); - public int mouseButton + public int MouseButton { get { return caca_get_event_mouse_button(cevent); } } @@ -179,7 +179,7 @@ namespace Caca [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] private static extern int caca_get_event_mouse_y(IntPtr ev); - public Point mousePos + public Point MousePos { get { return new Point(caca_get_event_mouse_x(cevent), caca_get_event_mouse_y(cevent)); } @@ -191,7 +191,7 @@ namespace Caca [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] private static extern int caca_get_event_resize_height(IntPtr ev); - public Size resizeSize + public Size ResizeSize { get { return new Size(caca_get_event_resize_width(cevent), caca_get_event_resize_height(cevent)); } @@ -235,7 +235,7 @@ namespace Caca [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] private static extern int caca_get_display_time(IntPtr dp); - public int displayTime + public int DisplayTime { get { return caca_get_display_time(_dp); } set { caca_set_display_time(_dp, value); } @@ -268,7 +268,7 @@ namespace Caca [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] private static extern int caca_set_display_title(IntPtr dp, string t); - public string title + public string Title { set { caca_set_display_title(_dp, value); } } @@ -276,7 +276,7 @@ namespace Caca [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] private static extern void caca_set_mouse(IntPtr k, bool status); - public bool mouse + public bool Mouse { set { caca_set_mouse(_dp, value); } } @@ -287,7 +287,7 @@ namespace Caca [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] private static extern int caca_get_mouse_y(IntPtr k); - public Point mousePos + public Point MousePos { get { return new Point(caca_get_mouse_x(_dp), caca_get_mouse_y(_dp)); } @@ -296,7 +296,7 @@ namespace Caca [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] private static extern void caca_set_cursor(IntPtr k, bool status); - public bool cursor + public bool Cursor { set { caca_set_cursor(_dp, value); } } diff --git a/csharp/Cucul.cs b/csharp/Cucul.cs index 2de3433..741ca82 100644 --- a/csharp/Cucul.cs +++ b/csharp/Cucul.cs @@ -325,7 +325,6 @@ namespace Cucul } /* primitives drawing */ - /* FIXME: highly incomplete */ [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] @@ -508,7 +507,7 @@ namespace Cucul [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] private static extern int cucul_set_frame_name(IntPtr cv, string n); - public string frameName + public string FrameName { get { return cucul_get_frame_name(_cv); } set { cucul_set_frame_name(_cv, value); } @@ -553,7 +552,7 @@ namespace Cucul public CuculAttr(int attr) { - attr = _attr; + _attr = attr; } [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), diff --git a/csharp/test.cs b/csharp/test.cs index 52c48ba..f34134c 100644 --- a/csharp/test.cs +++ b/csharp/test.cs @@ -91,8 +91,8 @@ class DemoDisplay : CacaDisplay public DemoDisplay(DemoCanvas _cv) : base(_cv) { - displayTime = 20000; // Refresh every 20 ms - title = "libcaca .NET Bindings test suite"; + Title = "libcaca .NET Bindings test suite"; + DisplayTime = 20000; // Refresh every 20 ms cv = _cv; } @@ -100,17 +100,17 @@ class DemoDisplay : CacaDisplay { CacaEvent ev; - while((ev = getEvent(CacaEventType.KEY_RELEASE, 10)).type == 0) + while((ev = getEvent(CacaEventType.KEY_RELEASE, 10)).Type == 0) { cv.Draw(); Refresh(); } - if(ev.keyCh > 0x20 && ev.keyCh < 0x7f) - Console.WriteLine("Key pressed: {0}", ev.keyUtf8); + if(ev.KeyCh > 0x20 && ev.KeyCh < 0x7f) + Console.WriteLine("Key pressed: {0}", ev.KeyUtf8); else - Console.WriteLine("Key pressed: 0x{0:x}", ev.keyCh); + Console.WriteLine("Key pressed: 0x{0:x}", ev.KeyCh); } }