Win_x86
Debug
-
+packages
/GOLib.suo
/bin/*
/obj/*
/GOLib.userprefs
/Tests/obj/*
/Tests/bin/*
+/UnitTest/obj
+/UnitTest/bin
MonoDevelop.GOLib/bin/
MonoDevelop.GOLib/build/
MonoDevelop.GOLib/obj/
int idx = 0;
string[] testFiles = {
"testColorList.crow",
+ "testGroupBox.goml",
+ "testGrid.goml",
"test_Listbox.goml",
"testButton.crow",
"testBorder.goml",
- "testButton2.crow",
- "testGroupBox.goml",
+// "testButton2.crow",
"test2WayBinding.crow",
"0.crow",
"testSpinner.goml",
"testContainer.goml",
"testRadioButton.goml",
"testMsgBox.goml",
- "testGrid.goml",
"testMeter.goml",
};
<?xml version="1.0"?>
<HorizontalStack Height="-1" Width="200"
- MouseEnter="{Background=SteelBlue}"
- MouseLeave="{Background=Transparent}">
- <GraphicObject Height="10" Width="30" Background="{}"/>
- <TextRun Text="{Name}"/>
+ MouseEnter="{Background=Red}"
+ MouseLeave="{Background=Transparent}">
+ <GraphicObject Height="10" Width="30" Background="{}" Margin="0" CornerRadius="3"/>
+ <TextRun Text="{Name}" Margin="0"/>
</HorizontalStack>
</Scroller>
<ScrollBar Name="scrollbar1" Scroll="{../scroller1.ScrollY}"
MaximumScroll="{../scroller1.MaximumScroll}" Orientation="Vertical"
- Width="10" Height="{../../../TemplatedHeight}" />
+ Width="14" Height="{../../../TemplatedHeight}" />
</HorizontalStack>
</Border>
</Template>
<None Include="Interfaces\test2WayBinding.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\testButton2.crow">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
<None Include="Interfaces\testColorList.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
#region ILayoutable implementation
+ //TODO:uneeded list, should be removed
+ public List<LayoutingQueueItem> RegisteredLQIs { get; } = new List<LayoutingQueueItem>();
public void RegisterForLayouting (int layoutType) { throw new NotImplementedException (); }
public void UpdateLayout (LayoutingType layoutType) { throw new NotImplementedException (); }
public Rectangle ContextCoordinates (Rectangle r)
}
ComputeChildrenPositions ();
//if no layouting remains in queue for item, registre for redraw
- if (Interface.LayoutingQueue.Where (lq => lq.GraphicObject == this).Count () <= 0 && bmp==null)
+ if (RegisteredLQIs.Count () <= 0 && bmp==null)
this.RegisterForRedraw ();
}else
base.UpdateLayout(layoutType);
#endregion
#region ILayoutable
+
+ public List<LayoutingQueueItem> RegisteredLQIs { get; } = new List<LayoutingQueueItem>();
//TODO: it would save the recurent cost of a cast in event bubbling if parent type was GraphicObject
// or we could add to the interface the mouse events
[XmlIgnore]public ILayoutable Parent {
{
return Bounds.Size;
}
+ void deleteLQI(int lt){
+ LayoutingQueueItem[] lqis = this.RegisteredLQIs.Where (lq => (lt & (int)lq.LayoutType) > 0).ToArray ();
+ for (int i = 0; i < lqis.Length; i++) {
+ Interface.LayoutingQueue.Remove (lqis [i]);
+ lqis [i].DeleteLayoutableRef();
+ }
+ }
/// <summary> clear current layoutingQueue items for object and
/// trigger a new layouting pass for a layoutType </summary>
public virtual void RegisterForLayouting(int layoutType)
Debug.WriteLine ("RegisterForLayouting => {1}->{0}", layoutType, this.ToString());
#endif
lock (Interface.LayoutingQueue) {
- Interface.LayoutingQueue.RemoveAll (lq => lq.GraphicObject == this && (layoutType & (int)lq.LayoutType) > 0);
-
+ deleteLQI (layoutType);
if ((layoutType & (int)LayoutingType.Width) > 0) {
if (Bounds.Width == 0) //stretch in parent
Interface.LayoutingQueue.EnqueueAfterParentSizing (LayoutingType.Width, this);
}
lock (Interface.LayoutingQueue) {
//if no layouting remains in queue for item, registre for redraw
- if (Interface.LayoutingQueue.Where (lq => lq.GraphicObject == this).Count () <= 0 && bmp == null)
+ if (this.RegisteredLQIs.Count () <= 0 && bmp == null)
this.RegisterForRedraw ();
}
}
if (layoutType == LayoutingType.PositionChildren) {
ComputeChildrenPositions ();
//if no layouting remains in queue for item, registre for redraw
- if (Interface.LayoutingQueue.Where (lq => lq.GraphicObject == this).Count () <= 0 && bmp==null)
+ if (RegisteredLQIs.Count () <= 0 && bmp==null)
this.RegisterForRedraw ();
}else
base.UpdateLayout(layoutType);
using System;
+using System.Collections.Generic;
namespace Crow
{
IGOLibHost HostContainer { get; }
+ List<LayoutingQueueItem> RegisteredLQIs { get; }
void RegisterForLayouting(int layoutType);
void UpdateLayout(LayoutingType layoutType);
}
public void Enqueue(LayoutingType _lt, ILayoutable _object)
{
- Interface.LayoutingQueue.RemoveAll(lq => lq.GraphicObject == _object && lq.LayoutType == _lt);
- Interface.LayoutingQueue.Add (new LayoutingQueueItem (_lt, _object));
+ this.Add (new LayoutingQueueItem (_lt, _object));
+ }
+ LayoutingQueueItem searchLqi(ILayoutable go, LayoutingType lt){
+ return go.RegisteredLQIs.Where(lq => lq.LayoutType == lt).LastOrDefault();
}
-
public void EnqueueAfterParentSizing (LayoutingType _lt, ILayoutable _object)
{
LayoutingQueueItem lqi = new LayoutingQueueItem (_lt, _object);
- int idxParentSz = Interface.LayoutingQueue.IndexOf
- (Interface.LayoutingQueue.Where(lq => lq.GraphicObject == _object.Parent && lq.LayoutType == _lt).LastOrDefault());
+ LayoutingQueueItem parentLqi = searchLqi (_object.Parent, _lt);
- Interface.LayoutingQueue.Insert (idxParentSz + 1, lqi);
+ if (parentLqi == null)
+ this.Insert (0, lqi);
+ else
+ this.Insert (this.IndexOf (parentLqi) + 1, lqi);
}
public void EnqueueBeforeParentSizing (LayoutingType _lt, ILayoutable _object)
{
LayoutingQueueItem lqi = new LayoutingQueueItem (_lt, _object);
- int idxParentSz = Interface.LayoutingQueue.IndexOf
- (Interface.LayoutingQueue.Where(lq => lq.GraphicObject == _object.Parent && lq.LayoutType == _lt).FirstOrDefault());
+ LayoutingQueueItem parentLqi = searchLqi (_object.Parent, _lt);
- if (idxParentSz < 0)
- Interface.LayoutingQueue.Enqueue (_lt, _object);
+ if (parentLqi == null)
+ this.Add (lqi);
else
- Interface.LayoutingQueue.Insert (idxParentSz, lqi);
+ this.Insert (this.IndexOf (parentLqi), lqi);
}
public void EnqueueAfterThisAndParentSizing (LayoutingType _lt, ILayoutable _object)
{
if (_lt == LayoutingType.Y)
sizing = LayoutingType.Height;
-
- int idxW = Interface.LayoutingQueue.IndexOf (Interface.LayoutingQueue.Where
- (lq => (lq.GraphicObject == _object.Parent || lq.GraphicObject == _object) && lq.LayoutType == sizing).LastOrDefault());
- Interface.LayoutingQueue.Insert (idxW + 1, lqi);
- }
+ LayoutingQueueItem parentLqi = searchLqi (_object.Parent, sizing);
+ LayoutingQueueItem thisLqi = searchLqi (_object, sizing);
+ int idx = -1;
+
+ if (parentLqi == null) {
+ if (thisLqi != null)
+ idx = this.IndexOf (thisLqi);
+ } else {
+ if (thisLqi == null)
+ idx = this.IndexOf (parentLqi);
+ else
+ idx = Math.Max(this.IndexOf (parentLqi), this.IndexOf (thisLqi));
+ }
+ this.Insert (idx + 1, lqi);
+ }
public LayoutingQueueItem Dequeue()
{
LayoutingQueueItem tmp = this [0];
+ tmp.DeleteLayoutableRef ();
this.RemoveAt (0);
return tmp;
}
{
LayoutType = _layoutType;
GraphicObject = _graphicObject;
+ GraphicObject.RegisteredLQIs.Add (this);
+ }
+ public void DeleteLayoutableRef(){
+ GraphicObject.RegisteredLQIs.Remove(this);
}
public void ProcessLayouting()
{
#region ILayoutable implementation
+ //TODO:uneeded list, should be removed
+ public List<LayoutingQueueItem> RegisteredLQIs { get; } = new List<LayoutingQueueItem>();
public void RegisterForLayouting (int layoutType) { throw new NotImplementedException (); }
public void UpdateLayout (LayoutingType layoutType) { throw new NotImplementedException (); }
public Rectangle ContextCoordinates (Rectangle r)