<EmbeddedResource Include="Templates\ComboListOverlay.goml" />\r
<EmbeddedResource Include="Templates\Expandable.goml" />\r
<EmbeddedResource Include="Images\Icons\expandable.svg" />\r
+ <EmbeddedResource Include="Templates\Checkbox2.goml" />\r
</ItemGroup>\r
</Project>\r
#####GOLib in action
+
+

RoadMap:
-v - Implement Vertical and Horizontal layouting queue instead
- of testing the whole object tree during layout.
- - Implement GL textures backend, as in the c++ version
-v - Validate complete drm rendering stack (OpenTK, and Cairo
- already have experimental support for drm stack)
- - Now the the grobal architecture is ok, develop the common controls existing in every gui lib
+ - TreeView, templated of course...
+ Menu, Popper, Combobox, PangoLayouting controls, Improved editor
+ - Monodevelop addin
+ - improve inline delegates to handle all conversion and graphic tree parsing with directory navigation syntax
+ - Make an easyly compilable example of complete application (3d mesh editor for example)
--- /dev/null
+<?xml version="1.0"?>\r
+<HorizontalStack Margin="0" Spacing="1" Focusable="false">\r
+ <Image Name="Image" Width="16" Height="16" Path="#go.Images.Icons.checkbox.svg"/>\r
+ <Label Name="Caption" Background="Red"/>\r
+</HorizontalStack>
\ No newline at end of file
}\r
frameCpt++;\r
\r
- if (pb.Value == pb.Maximum)\r
- pb.Value = 0;\r
- pb.Value++;\r
+// if (pb.Value == pb.Maximum)\r
+// pb.Value = 0;\r
+// pb.Value++;\r
pb2.Value = pb.Value;\r
- labPb.Text = pb.Value.ToString ();\r
+ //labPb.Text = pb.Value.ToString ();\r
if (FocusedWidget==null)\r
labF.Text = "- none -";\r
else\r
<VerticalStack Width="100">\r
<Checkbox Name="chk1"/>\r
<Checkbox Name="chk2" IsChecked="true"/>\r
- <Checkbox Name="chk3"/>\r
- <Checkbox Name="chk4"/>\r
+ <Checkbox Name="chk3" Template="#go.Templates.Checkbox2.goml"/>\r
+ <Checkbox Name="chk4">\r
+ <Template>\r
+ <HorizontalStack Margin="0" Spacing="1" Focusable="false">\r
+ <Image Name="Image" Width="16" Height="16" Path="#go.Images.Icons.checkbox.svg"/>\r
+ <Label Name="Caption" Foreground="Black" Background="Yellow"/>\r
+ </HorizontalStack>\r
+ </Template>\r
+ </Checkbox>\r
</VerticalStack>\r
<VerticalStack Width="100">\r
<RadioButton IsChecked="true"/>\r
<HorizontalStack Name="hsPbar" Margin="5">\r
<ProgressBar Name="pbBar" \r
Width="100" Height="20"\r
+ Minimum="0"\r
+ Maximum="200"\r
Value="50"\r
Foreground="BlueCrayola" Background="DarkGray"\r
BorderWidth="2" BorderColor="White"/>\r
MemberInfo miDst = dstType.GetMember (binding.MemberName).FirstOrDefault ();
MemberInfo miSrc = srcType.GetMember (binding.Value).FirstOrDefault();
- //initialize target with actual value
+ #region initialize target with actual value
object srcVal = null;
if (miSrc == null)
srcVal = _source;//if no member is provided for binding, source raw value is taken
fiDst.SetValue (binding.Source, srcVal );
}else
throw new Exception("unandled destination member type for binding");
-
+ #endregion
+
#region Retrieve EventHandler parameter type
EventInfo ei = srcType.GetEvent ("ValueChanged");
if (ei == null)
#endregion
+
Type[] args = {typeof(object), handlerArgsType};
DynamicMethod dm = new DynamicMethod("dynHandle_" + dynHandleCpt,
typeof(void),
//Delegate del = dm.CreateDelegate(typeof(System.EventHandler));
addHandler.Invoke(_source, new object[] {del});
}
-
-
+
public static FieldInfo getEventHandlerField(Type type, string eventName)
{
FieldInfo fi;
\r
namespace go\r
{\r
+ [DefaultTemplate("#go.Templates.Checkbox.goml")]\r
public class Checkbox : TemplatedControl\r
{ \r
Label _caption;\r
public Checkbox() : base()\r
{\r
} \r
-\r
+ protected override void loadDefaultValues ()\r
+ {\r
+ base.loadDefaultValues ();\r
+ }\r
protected override void loadTemplate(GraphicObject template = null)\r
{ \r
- if (template == null)\r
- this.SetChild (Interface.Load ("#go.Templates.Checkbox.goml", this));\r
- else\r
- this.SetChild (template);\r
+ base.loadTemplate (template);\r
\r
_caption = this.child.FindByName ("Caption") as Label;\r
_image = this.child.FindByName ("Image") as Image;\r
\r
namespace go\r
{\r
+ [DefaultTemplate("#go.Templates.Expandable.goml")]\r
public class Expandable : TemplatedControl\r
{ \r
bool _isExpanded;\r
\r
protected override void loadTemplate(GraphicObject template = null)\r
{\r
- if (template == null)\r
- this.SetChild (Interface.Load ("#go.Templates.Expandable.goml",this));\r
- else\r
- this.SetChild (template);\r
+ base.loadTemplate (template);\r
\r
_caption = this.child.FindByName ("Caption") as Label;\r
Content = this.child.FindByName ("Content") as Container;\r
if (_image == null)\r
return;\r
_image.SvgSub = "collapsed";\r
+\r
this.Expand += (object sender, EventArgs e) => {_image.SvgSub = "expanded";};\r
this.Collapse += (object sender, EventArgs e) => {_image.SvgSub = "collapsed";};\r
\r
namespace go
{
+ [DefaultTemplate("#go.Templates.Listbox.goml")]
public class ListBox : TemplatedControl
{
Group _list;
#region implemented abstract members of TemplatedControl
protected override void loadTemplate (GraphicObject template = null)
{
- if (template == null)
- this.SetChild (Interface.Load ("#go.Templates.Listbox.goml"));
- else
- this.SetChild (template);
-
+ base.loadTemplate (template);
_list = this.child.FindByName ("List") as Group;
}
#endregion
\r
namespace go\r
{\r
+ [DefaultTemplate("#go.Templates.RadioButton.goml")]\r
public class RadioButton : TemplatedControl\r
{ \r
Label _caption;\r
\r
protected override void loadTemplate(GraphicObject template = null)\r
{\r
- if (template == null)\r
- this.SetChild (Interface.Load ("#go.Templates.RadioButton.goml"));\r
- else\r
- this.SetChild (template);\r
+ base.loadTemplate (template);\r
\r
_caption = this.child.FindByName ("Caption") as Label;\r
_image = this.child.FindByName ("Image") as Image;\r
}\r
\r
\r
- [XmlAttributeAttribute()][DefaultValue("RadioButton")]\r
+ [XmlAttributeAttribute][DefaultValue("RadioButton")]\r
public string Caption {\r
get { return _caption.Text; } \r
set { \r
namespace go
{
+ [DefaultTemplate("#go.Templates.Spinner.goml")]
public class Spinner : NumericControl
{
-// Button butUp;
-// Button butDown;
Label labCpt;
public Spinner (double minimum, double maximum, double step) :
protected override void loadTemplate (GraphicObject template = null)
{
- if (template == null)
- this.SetChild (Interface.Load ("#go.Templates.Spinner.goml", this));
- else
- this.SetChild (template);
-
+ base.loadTemplate (template);
labCpt = this.child.FindByName ("labCpt") as Label;
}
using System.ComponentModel;
using System.IO;
using System.Xml;
+using System.Linq;
+using System.Diagnostics;
namespace go
{
+ [AttributeUsage(AttributeTargets.Class)]
+ public class DefaultTemplate : Attribute
+ {
+ public string Path = "";
+ public DefaultTemplate(string path)
+ {
+ Path = path;
+ }
+ }
+
public abstract class TemplatedControl : PrivateContainer, IXmlSerializable
{
public TemplatedControl () : base()
// }
- protected abstract void loadTemplate(GraphicObject template = null);
+ protected virtual void loadTemplate(GraphicObject template = null)
+ {
+ if (template == null) {
+ DefaultTemplate dt = (DefaultTemplate)this.GetType ().GetCustomAttributes (typeof(DefaultTemplate), true).FirstOrDefault();
+ this.SetChild (Interface.Load (dt.Path, this));
+ }else
+ this.SetChild (template);
+ }
protected override void loadDefaultValues ()
{
}
public override void ReadXml(System.Xml.XmlReader reader)
{
+ //Template could be either an attribute containing path or expressed inlined
+ //as a Template Element
using (System.Xml.XmlReader subTree = reader.ReadSubtree())
{
subTree.Read ();
+
+ string template = reader.GetAttribute ("Template");
string tmp = subTree.ReadOuterXml ();
+ //Load template from path set as attribute in templated control
+ if (string.IsNullOrEmpty (template)) {
//seek for template tag first
- using (XmlReader xr = new XmlTextReader (tmp, XmlNodeType.Element, null)) {
- //load template first if inlined
+ using (XmlReader xr = new XmlTextReader (tmp, XmlNodeType.Element, null)) {
+ //load template first if inlined
- xr.Read (); //skip current node
+ xr.Read (); //skip current node
- while (!xr.EOF) {
- xr.Read (); //read first child
- if (!xr.IsStartElement ())
- continue;
- if (xr.Name == "Template") {
- xr.Read ();
+ while (!xr.EOF) {
+ xr.Read (); //read first child
+ if (!xr.IsStartElement ())
+ continue;
+ if (xr.Name == "Template") {
+ xr.Read ();
- Type t = Type.GetType ("go." + xr.Name);
- GraphicObject go = (GraphicObject)Activator.CreateInstance (t);
- (go as IXmlSerializable).ReadXml (xr);
+ Type t = Type.GetType ("go." + xr.Name);
+ GraphicObject go = (GraphicObject)Activator.CreateInstance (t);
+ (go as IXmlSerializable).ReadXml (xr);
- loadTemplate (go);
+ loadTemplate (go);
- xr.Read ();//go close tag
- xr.Read ();//Template close tag
- } else {
- xr.ReadInnerXml ();
+ xr.Read ();//go close tag
+ xr.Read ();//Template close tag
+ } else {
+ xr.ReadInnerXml ();
+ }
}
- }
- }
+ }
+ } else
+ loadTemplate (Interface.Load (template, this));
+
+
+ //normal xml read
using (XmlReader xr = new XmlTextReader (tmp, XmlNodeType.Element, null)) {
xr.Read ();
base.ReadXml(xr);