//using GGL;\r
using go;\r
using System.Threading;\r
+using System.Reflection;\r
\r
\r
namespace test\r
: base(1024, 600,"test")\r
{}\r
\r
- Border g;\r
- Type type;\r
+ VerticalStack g;\r
+ TypeContainer type;\r
\r
protected override void OnLoad (EventArgs e)\r
{\r
base.OnLoad (e);\r
- type = typeof (GraphicObject);\r
+ type = new TypeContainer(typeof (GraphicObject));\r
\r
this.AddWidget(Interface.Load ("Interfaces/testTypeViewer.goml", type));\r
//LoadInterface("Interfaces/testTypeViewer.goml", out g);\r
GL.Clear (ClearBufferMask.ColorBufferBit);\r
base.OnRenderFrame (e);\r
SwapBuffers ();\r
+\r
+ MemberInfo mi;\r
+\r
}\r
\r
[STAThread]\r
}\r
}\r
}\r
+ public class TypeContainer\r
+ {\r
+ public Type Type;\r
+ public TypeContainer(Type _type){\r
+ Type = _type;\r
+ }\r
+ public string Name {\r
+ get { return Type.Name; }\r
+ }\r
+ public MemberInfo[] Members {\r
+ get { return Type.GetProperties (BindingFlags.Public | BindingFlags.Instance); }\r
+ }\r
+ }\r
}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0"?>\r
+<Border BorderWidth="3">\r
+ <Label Text="{Name}" Focusable="true" Width="0" Height="-1" Margin="0"\r
+ MouseEnter="{Background=Red}"\r
+ MouseLeave="{Background=Transparent}"\r
+ />\r
+</Border>\r
+\r
<?xml version="1.0"?>
-<Border Background="SteelBlue"
- Width="150" Height="250" BorderWidth="2">
- <VerticalStack Height="0" Width="0" Name="hstack" Margin="0" Spacing="5">
- <Border Height="-1" Width="0" >
+ <VerticalStack Height="-1" Width="200" Name="hstack" Margin="0" Spacing="0">
+ <Border Height="-1" Width="0" BorderWidth="2" CornerRadius="10">
<Label Name="labName" Text="{Name}" Width="0" Height="-1"/>
</Border>
- <ListBox Data="{GetMembers ()}" Width="0" Height="-1">
+ <ListBox Data="{Members}" Width="0" Height="0" ItemTemplate="Interfaces/tmpMembers.goml">
+ <Template>
+ <Border Width="0" Height="0" BorderWidth="1" Margin="1" MinimumSize="0;100" >
+ <Scroller Name="scroller1" Height="0" Width="0"
+ Margin="5" VerticalScrolling="true" >
+ <VerticalStack Width="0" Height="-1" Name="List" Margin="1" VerticalAlignment="Top"/>
+ </Scroller>
+ </Border>
+ </Template>
</ListBox>
</VerticalStack>
-</Border>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0"?>\r
+ <HorizontalStack Width="0" Height="-1" Focusable="true" \r
+ MouseEnter="{Background=Red}"\r
+ MouseLeave="{Background=Transparent}">\r
+ <Label Text="{Name}" Width="0" Height="-1" Margin="2"/>\r
+ <Label Text="{MemberType}" Width="-1" Height="-1" Margin="2"/>\r
+ </HorizontalStack>\r
+\r
<OutputType>Exe</OutputType>
<RootNamespace>Tests</RootNamespace>
<AssemblyName>Tests</AssemblyName>
- <StartupObject>test.GOLIBTest_TypeViewer</StartupObject>
+ <StartupObject>test.GOLIBTest_4</StartupObject>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<OutputPath>..\bin\$(configuration)</OutputPath>
<IntermediateOutputPath>obj\$(configuration)</IntermediateOutputPath>
<None Include="Interfaces\testTypeViewer.goml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+ <None Include="Interfaces\tmpMembers.goml">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="Interfaces\itemTmp.goml">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
</ItemGroup>
<ItemGroup>
<Folder Include="Interfaces\" />
namespace go
{
[DefaultTemplate("#go.Templates.Listbox.goml")]
+ //[DefaultTemplate("#go.Templates.ItemTemplate.goml")]
public class ListBox : TemplatedControl
{
Group _list;
ICollection data;
int _selectedIndex;
+ string _itemTemplate;
+ [XmlAttributeAttribute][DefaultValue("#go.Templates.ItemTemplate.goml")]
+ public string ItemTemplate {
+ get { return _itemTemplate; }
+ set { _itemTemplate = value; }
+ }
public int SelectedIndex{
get { return _selectedIndex; }
set { _selectedIndex = value; }
}
- [XmlAttributeAttribute()][DefaultValue(null)]
+ [XmlAttributeAttribute][DefaultValue(null)]
public ICollection Data {
get {
return data;
if (data == null)
return;
foreach (var item in data) {
- GraphicObject g = Interface.Load ("#go.Templates.ItemTemplate.goml", item);
+ GraphicObject g = Interface.Load (ItemTemplate, item);
+ //GraphicObject g = Interface.Load ("#go.Templates.Listbox.goml", item);
// g.Tag = item;
// g.MouseClick += (object sender, OpenTK.Input.MouseButtonEventArgs e) => {
//
Path = path;
}
}
+ [AttributeUsage(AttributeTargets.Class)]
+ public class DefaultItemTemplate : Attribute
+ {
+ public string Path = "";
+ public DefaultItemTemplate(string path)
+ {
+ Path = path;
+ }
+ }
public abstract class TemplatedControl : PrivateContainer, IXmlSerializable
{
#region IXmlSerializable
- public override System.Xml.Schema.XmlSchema GetSchema()
- {
- return null;
- }
+ public override System.Xml.Schema.XmlSchema GetSchema(){ return null; }
public override void ReadXml(System.Xml.XmlReader reader)
{
//Template could be either an attribute containing path or expressed inlined