From 0c4b203ab72c60a0786b0905797b9128f5ed1e4c Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Sat, 13 Feb 2016 16:25:57 +0100 Subject: [PATCH] clean using, TreeView and TabView empty c# file creation --- Crow.csproj | 6 +- Templates/ListBox.goml | 3 - Templates/TreeView.crow | 7 +++ Templates/TreeViewItem.crow | 31 ++++++++++ Tests/GOLIBTests.cs | 24 +++++++- Tests/Interfaces/1.crow | 8 +-- Tests/Interfaces/testOutOfClipUpdate.crow | 6 ++ Tests/Interfaces/testTreeView.crow | 2 + Tests/Tests.csproj | 6 ++ src/GraphicObjects/CheckBox.cs | 24 ++------ src/GraphicObjects/Expandable.cs | 72 ++++++++++------------- src/GraphicObjects/GraphicObject.cs | 21 ++----- src/GraphicObjects/Group.cs | 12 ++-- src/GraphicObjects/GroupBox.cs | 14 ----- src/GraphicObjects/Popper.cs | 15 +---- src/GraphicObjects/RadioButton.cs | 26 +++----- src/GraphicObjects/ScrollBar.cs | 13 +--- src/GraphicObjects/Scroller.cs | 55 ++++++++--------- src/GraphicObjects/TabView.cs | 32 ++++++++++ src/GraphicObjects/TreeView.cs | 35 +++++++++++ src/OpenTKGameWindow.cs | 24 ++++++-- 21 files changed, 249 insertions(+), 187 deletions(-) create mode 100644 Templates/TreeView.crow create mode 100644 Templates/TreeViewItem.crow create mode 100755 Tests/Interfaces/testOutOfClipUpdate.crow create mode 100755 Tests/Interfaces/testTreeView.crow create mode 100644 src/GraphicObjects/TabView.cs create mode 100644 src/GraphicObjects/TreeView.cs diff --git a/Crow.csproj b/Crow.csproj index 19aee431..9490cde5 100644 --- a/Crow.csproj +++ b/Crow.csproj @@ -134,11 +134,12 @@ + + - glib-sharp-3.0 @@ -149,6 +150,7 @@ + diff --git a/Templates/TreeView.crow b/Templates/TreeView.crow new file mode 100644 index 00000000..132c7eb6 --- /dev/null +++ b/Templates/TreeView.crow @@ -0,0 +1,7 @@ + + + + + diff --git a/Templates/TreeViewItem.crow b/Templates/TreeViewItem.crow new file mode 100644 index 00000000..0cb44176 --- /dev/null +++ b/Templates/TreeViewItem.crow @@ -0,0 +1,31 @@ + + + + + + + diff --git a/Tests/GOLIBTests.cs b/Tests/GOLIBTests.cs index bf0c4b64..832cf151 100644 --- a/Tests/GOLIBTests.cs +++ b/Tests/GOLIBTests.cs @@ -37,6 +37,10 @@ namespace test int frameCpt = 0; int idx = 0; string[] testFiles = { + "testImage.crow", + "testOutOfClipUpdate.crow", + "test_Listbox.goml", + "testTreeView.crow", "0.crow", "1.crow", "testWindow.goml", @@ -57,13 +61,11 @@ namespace test "testScrollbar.goml", "testGroupBox.goml", "testGrid.goml", - "test_Listbox.goml", "testButton.crow", "testBorder.goml", // "testButton2.crow", "test2WayBinding.crow", "fps.goml", - "testImage.crow", "test4.goml", "2.crow", "test1.goml", @@ -149,6 +151,24 @@ namespace test return; NotifyValueChanged ("alignment", Enum.Parse(typeof(Alignment), rb.Caption)); } + public IList List2 = new List(new string[] + { + "string1", + "string2", + "string3", + "string4", + "string5", + "string6", + "string7", + "string8", + "string8", + "string8", + "string8", + "string8", + "string8", + "string9" + } + ); IList testList = Color.ColorDic.ToList(); public IList TestList { set{ diff --git a/Tests/Interfaces/1.crow b/Tests/Interfaces/1.crow index 28523e14..11560723 100755 --- a/Tests/Interfaces/1.crow +++ b/Tests/Interfaces/1.crow @@ -1,7 +1,7 @@  - + @@ -15,18 +15,18 @@ - + - + diff --git a/Tests/Interfaces/testOutOfClipUpdate.crow b/Tests/Interfaces/testOutOfClipUpdate.crow new file mode 100755 index 00000000..b255af7f --- /dev/null +++ b/Tests/Interfaces/testOutOfClipUpdate.crow @@ -0,0 +1,6 @@ + + + + + diff --git a/Tests/Interfaces/testTreeView.crow b/Tests/Interfaces/testTreeView.crow new file mode 100755 index 00000000..86bcae88 --- /dev/null +++ b/Tests/Interfaces/testTreeView.crow @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index e88c1078..1d7bbe18 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -238,6 +238,12 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + diff --git a/src/GraphicObjects/CheckBox.cs b/src/GraphicObjects/CheckBox.cs index fa34522d..05bb0cac 100644 --- a/src/GraphicObjects/CheckBox.cs +++ b/src/GraphicObjects/CheckBox.cs @@ -1,24 +1,13 @@ using System; - - -using System.Collections.Generic; -using System.Linq; -using System.Text; -//using OpenTK.Graphics.OpenGL; - -using Cairo; - -using winColors = System.Drawing.Color; -using System.Diagnostics; -using System.Xml.Serialization; using OpenTK.Input; using System.ComponentModel; +using System.Xml.Serialization; namespace Crow { [DefaultTemplate("#Crow.Templates.CheckBox.goml")] - public class CheckBox : TemplatedControl - { + public class CheckBox : TemplatedControl + { string caption; string image; bool isChecked; @@ -33,12 +22,7 @@ namespace Crow public event EventHandler Unchecked; #region GraphicObject overrides -// [XmlAttributeAttribute()][DefaultValue(-1)] -// public override int Height { -// get { return base.Height; } -// set { base.Height = value; } -// } - [XmlAttributeAttribute()][DefaultValue(true)]//overiden to get default to true + [XmlAttributeAttribute()][DefaultValue(true)] public override bool Focusable { get { return base.Focusable; } diff --git a/src/GraphicObjects/Expandable.cs b/src/GraphicObjects/Expandable.cs index f44e5e27..4214ed93 100644 --- a/src/GraphicObjects/Expandable.cs +++ b/src/GraphicObjects/Expandable.cs @@ -1,33 +1,39 @@ using System; - - -using System.Collections.Generic; -using System.Linq; -using System.Text; -//using OpenTK.Graphics.OpenGL; - -using Cairo; - -using winColors = System.Drawing.Color; -using System.Diagnostics; -using System.Xml.Serialization; using OpenTK.Input; using System.ComponentModel; -using System.Xml; -using System.IO; +using System.Xml.Serialization; namespace Crow { [DefaultTemplate("#Crow.Templates.Expandable.goml")] public class Expandable : TemplatedContainer - { + { + #region CTOR + public Expandable() : base() + { + } + #endregion + + #region Private fields bool _isExpanded; string caption; string image; Container _contentContainer; + #endregion + #region Event Handlers public event EventHandler Expand; public event EventHandler Collapse; + #endregion + + #region GraphicObject overrides + [XmlAttributeAttribute()][DefaultValue(true)] + public override bool Focusable + { + get { return base.Focusable; } + set { base.Focusable = value; } + } + #endregion public override GraphicObject Content { get { @@ -37,30 +43,25 @@ namespace Crow _contentContainer.SetChild(value); } } - - public Expandable() : base() - { - } - protected override void loadTemplate(GraphicObject template = null) { base.loadTemplate (template); _contentContainer = this.child.FindByName ("Content") as Container; } - - [XmlAttributeAttribute()][DefaultValue(true)]//overiden to get default to true - public override bool Focusable + public override void onMouseClick (object sender, MouseButtonEventArgs e) { - get { return base.Focusable; } - set { base.Focusable = value; } + IsExpanded = !IsExpanded; + base.onMouseClick (sender, e); } - [XmlAttributeAttribute()][DefaultValue(-1)] - public override int Height { - get { return base.Height; } - set { base.Height = value; } + public override void ResolveBindings () + { + base.ResolveBindings (); + if (Content != null) + Content.ResolveBindings (); } + #region Public properties [XmlAttributeAttribute()][DefaultValue("Expandable")] public string Caption { get { return caption; } @@ -99,6 +100,7 @@ namespace Crow NotifyValueChanged ("SvgSub", "collapsed"); } } + #endregion public virtual void onExpand(object sender, EventArgs e) { @@ -114,17 +116,5 @@ namespace Crow Collapse.Raise (this, e); } - - public override void onMouseClick (object sender, MouseButtonEventArgs e) - { - IsExpanded = !IsExpanded; - base.onMouseClick (sender, e); - } - public override void ResolveBindings () - { - base.ResolveBindings (); - if (Content != null) - Content.ResolveBindings (); - } } } diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index b6c3a69d..ba11bd77 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -1,23 +1,14 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; - -//using OpenTK.Graphics.OpenGL; -using System.Drawing.Imaging; +using System.ComponentModel; using System.Diagnostics; -using OpenTK.Input; - -using Cairo; - -using System.Xml.Serialization; +using System.Linq; using System.Reflection; -using System.ComponentModel; -using System.IO; -//using System.Xml; -using System.Xml; -using System.Runtime.CompilerServices; using System.Reflection.Emit; +using System.Runtime.CompilerServices; +using System.Xml.Serialization; +using Cairo; +using OpenTK.Input; namespace Crow { diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs index db2107c4..2cf1ed5c 100644 --- a/src/GraphicObjects/Group.cs +++ b/src/GraphicObjects/Group.cs @@ -1,12 +1,10 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; -using System.Diagnostics; -using Cairo; -using System.Xml.Serialization; using System.ComponentModel; +using System.Xml.Serialization; +using Cairo; +using OpenTK.Input; + namespace Crow { @@ -252,7 +250,7 @@ namespace Crow #region Mouse handling - public override void checkHoverWidget (OpenTK.Input.MouseMoveEventArgs e) + public override void checkHoverWidget (MouseMoveEventArgs e) { if (HostContainer.hoverWidget != this) { HostContainer.hoverWidget = this; diff --git a/src/GraphicObjects/GroupBox.cs b/src/GraphicObjects/GroupBox.cs index 9206792a..e3001663 100644 --- a/src/GraphicObjects/GroupBox.cs +++ b/src/GraphicObjects/GroupBox.cs @@ -1,20 +1,6 @@ using System; - - -using System.Collections.Generic; -using System.Linq; -using System.Text; -//using OpenTK.Graphics.OpenGL; - -using Cairo; - -using winColors = System.Drawing.Color; -using System.Diagnostics; using System.Xml.Serialization; -using OpenTK.Input; using System.ComponentModel; -using System.Xml; -using System.IO; namespace Crow { diff --git a/src/GraphicObjects/Popper.cs b/src/GraphicObjects/Popper.cs index 171e54e4..c99b0889 100644 --- a/src/GraphicObjects/Popper.cs +++ b/src/GraphicObjects/Popper.cs @@ -1,20 +1,7 @@ using System; - - -using System.Collections.Generic; -using System.Linq; -using System.Text; -//using OpenTK.Graphics.OpenGL; - -using Cairo; - -using winColors = System.Drawing.Color; -using System.Diagnostics; using System.Xml.Serialization; -using OpenTK.Input; using System.ComponentModel; -using System.Xml; -using System.IO; +using OpenTK.Input; namespace Crow { diff --git a/src/GraphicObjects/RadioButton.cs b/src/GraphicObjects/RadioButton.cs index 297b4c2b..4fd45c58 100644 --- a/src/GraphicObjects/RadioButton.cs +++ b/src/GraphicObjects/RadioButton.cs @@ -1,18 +1,7 @@ using System; - - -using System.Collections.Generic; -using System.Linq; -using System.Text; -//using OpenTK.Graphics.OpenGL; - -using Cairo; - -using winColors = System.Drawing.Color; -using System.Diagnostics; -using System.Xml.Serialization; using OpenTK.Input; using System.ComponentModel; +using System.Xml.Serialization; namespace Crow { @@ -31,17 +20,12 @@ namespace Crow public event EventHandler Unchecked; #region GraphicObject overrides - [XmlAttributeAttribute()][DefaultValue(true)]//overiden to get default to true + [XmlAttributeAttribute()][DefaultValue(true)] public override bool Focusable { get { return base.Focusable; } set { base.Focusable = value; } } - [XmlAttributeAttribute()][DefaultValue(-1)] - public override int Height { - get { return base.Height; } - set { base.Height = value; } - } #endregion [XmlAttributeAttribute()][DefaultValue("RadioButton")] @@ -91,8 +75,12 @@ namespace Crow { Group pg = Parent as Group; if (pg != null) { - foreach (RadioButton c in pg.Children.OfType()) + for (int i = 0; i < pg.Children.Count; i++) { + RadioButton c = pg.Children [i] as RadioButton; + if (c == null) + continue; c.IsChecked = (c == this); + } } else IsChecked = !IsChecked; diff --git a/src/GraphicObjects/ScrollBar.cs b/src/GraphicObjects/ScrollBar.cs index dddd441e..d1ef12a3 100644 --- a/src/GraphicObjects/ScrollBar.cs +++ b/src/GraphicObjects/ScrollBar.cs @@ -1,18 +1,7 @@ using System; - - -using System.Collections.Generic; -using System.Linq; -using System.Text; -//using OpenTK.Graphics.OpenGL; - -using Cairo; - -using winColors = System.Drawing.Color; -using System.Diagnostics; using System.Xml.Serialization; -using OpenTK.Input; using System.ComponentModel; +using OpenTK.Input; namespace Crow { diff --git a/src/GraphicObjects/Scroller.cs b/src/GraphicObjects/Scroller.cs index 1924aac0..459205fe 100644 --- a/src/GraphicObjects/Scroller.cs +++ b/src/GraphicObjects/Scroller.cs @@ -1,13 +1,30 @@ -using System; +// +// Scroller.cs +// +// Author: +// Jean-Philippe Bruyère +// +// Copyright (c) 2016 jp +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +using System; +using System.Xml.Serialization; +using System.ComponentModel; using System.Diagnostics; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; using Cairo; -using System.Xml.Serialization; using OpenTK.Input; -using System.ComponentModel; namespace Crow { @@ -95,7 +112,6 @@ namespace Crow } #endregion - public Scroller() : base(){} @@ -192,14 +208,6 @@ namespace Crow { return base.ScreenCoordinates (r) - new Point((int)ScrollX,(int)ScrollY); } -// protected override void onDraw (Context gr) -// { -// gr.Save (); -// //gr.ResetClip (); -// -// base.onDraw (gr); -// gr.Restore (); -// } protected override void onDraw (Context gr) { Rectangle rBack = new Rectangle (Slot.Size); @@ -218,20 +226,5 @@ namespace Crow child.Paint (ref gr); gr.Restore (); } - -// public override void Paint (ref Context ctx) -// { -// ctx.Save (); -// //ctx.ResetClip (); -// ctx.Translate (-ScrollX, -ScrollY); -// base.Paint (ref ctx); -// ctx.Restore (); -// } -// public override void registerClipRect () -// { -// HostContainer.redrawClip.AddRectangle (base.ScreenCoordinates(Slot)); -// } - - } } diff --git a/src/GraphicObjects/TabView.cs b/src/GraphicObjects/TabView.cs new file mode 100644 index 00000000..f9f44754 --- /dev/null +++ b/src/GraphicObjects/TabView.cs @@ -0,0 +1,32 @@ +// +// TabView.cs +// +// Author: +// Jean-Philippe Bruyère +// +// Copyright (c) 2016 jp +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +using System; + +namespace Crow +{ + public class TabView + { + public TabView () + { + } + } +} + diff --git a/src/GraphicObjects/TreeView.cs b/src/GraphicObjects/TreeView.cs new file mode 100644 index 00000000..64d4afcb --- /dev/null +++ b/src/GraphicObjects/TreeView.cs @@ -0,0 +1,35 @@ +// +// TreeView.cs +// +// Author: +// Jean-Philippe Bruyère +// +// Copyright (c) 2016 jp +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +using System; + +namespace Crow +{ + //treeview expect expandable child (or not) + //if their are expandable, some functions and events are added + [DefaultTemplate("#Crow.Templates.TreeView.crow")] + public class TreeView : ListBox + { + public TreeView () : base() + { + } + } +} + diff --git a/src/OpenTKGameWindow.cs b/src/OpenTKGameWindow.cs index 013f2eea..72d8fb9c 100644 --- a/src/OpenTKGameWindow.cs +++ b/src/OpenTKGameWindow.cs @@ -1,8 +1,26 @@ -// Released to the public domain. Use, modify and relicense at will. +// +// OpenTKGameWindow.cs +// +// Author: +// Jean-Philippe Bruyère +// +// Copyright (c) 2016 jp +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . using System; using System.Collections.Generic; using System.Diagnostics; -using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Threading; @@ -12,8 +30,6 @@ using OpenTK; using OpenTK.Graphics.OpenGL; using OpenTK.Input; - - namespace Crow { public class OpenTKGameWindow : GameWindow, ILayoutable, IGOLibHost -- 2.47.3