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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
#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.Collections.Generic;
using System.IO;
using System.Linq;
namespace test
{
public class ClsItem
{
// #region IValueChange implementation
//
// public event EventHandler<ValueChangeEventArgs> ValueChanged;
//
// #endregion
public string field;
public string Field {
get {
return field;
}
set {
field = value;
//ValueChanged.Raise(this, new ValueChangeEventArgs ("Field", null, field));
}
}
public ClsItem(){
}
public ClsItem(string str){
Field = str;
}
}
class GOLIBTest_Listbox : OpenTKGameWindow, IValueChange
{
#region IValueChange implementation
public event EventHandler<ValueChangeEventArgs> ValueChanged;
#endregion
public GOLIBTest_Listbox ()
: base(1024, 600,"test")
{}
// public List<ClsItem> TestList = new List<ClsItem>(new ClsItem[]
// {
// new ClsItem("string 1"),
// new ClsItem("string 2"),
// new ClsItem("string 3")
// });
public List<string> TestList;/* = new List<string>( new string[]
{
"string 1",
"string 2",
"string 3"
}); */
public String Hover {
get { return hoverWidget == null ? "None" : hoverWidget.ToString(); }
}
Point mPos;
public string MousePos {
get { return mPos.ToString(); }
}
protected override void OnLoad (EventArgs e)
{
base.OnLoad (e);
//TestList = Directory.GetFileSystemEntries("/home/jp/tmp/mtgdata/a", "*.txt",SearchOption.AllDirectories).ToList();
GraphicObject tlb = LoadInterface("Interfaces/test_Listbox.goml");
tlb.DataSource = this;
// TestList [1].Field = "test string";
// ValueChanged.Raise(this, new ValueChangeEventArgs ("TestList", TestList));
}
void OnClear (object sender, MouseButtonEventArgs e){
TestList = null;
ValueChanged.Raise(this, new ValueChangeEventArgs ("TestList", TestList));
}
void OnLoadList (object sender, MouseButtonEventArgs e){
TestList = Directory.GetFileSystemEntries("/home/jp/tmp/mtgdata/a", "*.txt",SearchOption.AllDirectories).ToList();
ValueChanged.Raise(this, new ValueChangeEventArgs ("TestList", TestList));
}
// protected override void OnMouseMove (MouseMoveEventArgs e)
// {
// base.OnMouseMove (e);
// ValueChanged.Raise (this, new ValueChangeEventArgs ("Hover", Hover));
// ValueChanged.Raise (this, new ValueChangeEventArgs ("MousePos", e.Position.ToString()));
// }
protected override void OnUpdateFrame (FrameEventArgs e)
{
base.OnUpdateFrame (e);
}
// protected override void OnKeyDown (KeyboardKeyEventArgs e)
// {
// TestList = Directory.GetFileSystemEntries("/home/jp/tmp/mtgdata/a", "*.txt",SearchOption.AllDirectories).ToList();
// //TestList.Add ("newly added list item");
// ValueChanged.Raise(this, new ValueChangeEventArgs ("TestList", TestList));
// }
[STAThread]
static void Main ()
{
Console.WriteLine ("starting example");
using (GOLIBTest_Listbox win = new GOLIBTest_Listbox( )) {
win.Run (30.0);
}
}
}
}
|