aboutsummaryrefslogtreecommitdiffstatsci
path: root/Tests/GOLIBTest_TypeViewer.cs
blob: 39e5a527b1253479c1fbda8a5519cb130433a9f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#define MONO_CAIRO_DEBUG_DISPOSE


using System;
using System.Runtime.InteropServices;
using OpenTK;
using OpenTK.Graphics.OpenGL;

using System.Diagnostics;

//using GGL;
using Crow;
using System.Threading;
using System.Reflection;
using System.Linq;


namespace test
{
	class GOLIBTest_TypeViewer : OpenTKGameWindow
	{
		public GOLIBTest_TypeViewer ()
			: base(1024, 600,"test")
		{}

		VerticalStack g;
		TypeContainer type;

		protected override void OnLoad (EventArgs e)
		{
			base.OnLoad (e);
			type = new TypeContainer(typeof (GraphicObject));

			//this.AddWidget(Interface.Load ("Interfaces/testTypeViewer.goml", type));
			GraphicObject go = LoadInterface("Interfaces/testTypeViewer.goml");
			go.DataSource = type;
		}

		protected override void OnRenderFrame (FrameEventArgs e)
		{
			GL.Clear (ClearBufferMask.ColorBufferBit);
			base.OnRenderFrame (e);
			SwapBuffers ();

			MemberInfo mi;


		}

		[STAThread]
		static void Main ()
		{
			Console.WriteLine ("starting example");

			using (GOLIBTest_TypeViewer win = new GOLIBTest_TypeViewer( )) {
				win.Run (30.0);
			}
		}
	}
	public class TypeContainer
	{
		public Type Type;
		public TypeContainer(Type _type){
			Type = _type;
		}
		public string Name {
			get { return Type.Name; }
		}
		public MemberInfo[] Members {
			get {
				MemberInfo[] mi = Properties.Cast<MemberInfo> ().Concat (Methods.Cast<MemberInfo> ()).ToArray(); 
				return mi;
			}
		}
		public MethodInfo[] Methods {
			get { return Type.GetMethods (BindingFlags.Public | BindingFlags.Instance).Where (m => !m.IsSpecialName).ToArray(); }
		}
		public PropertyInfo[] Properties {
			get { return Type.GetProperties (); }
		}
				
	}

}