<?xml version="1.0"?>\r
<Border BorderWidth="1" Margin="1" MinimumSize="20;20" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" >\r
- <Scroller Name="scroller1" Margin="1" VerticalScrolling="true"\r
- Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">\r
+<!-- <Scroller Name="scroller1" Margin="1" VerticalScrolling="true"\r
+ Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">-->\r
<VerticalStack Height="-1" Width="{../../../TemplatedWidth}" Name="List" Margin="0" VerticalAlignment="Top"/>\r
- </Scroller>\r
+<!-- </Scroller>-->\r
</Border>
\ No newline at end of file
<Border BorderWidth="1" BorderColor="LightGray">\r
<GenericStack Orientation="{../../Orientation}" Width="0" Height="0">\r
<Button Width="12" Height="12" MouseClick="../../../onScrollBack">\r
- <Image Margin="1" Path="#go.Images.Icons.updown.svg" SvgSub="../../../../up"/>\r
+ <Image Margin="1" Path="#go.Images.Icons.updown.svg" SvgSub="up"/>\r
</Button>\r
<Slider Name="Slider" Value="{../../../Scroll}" Maximum="{../../../MaximumScroll}" \r
Width="{../../../Width}" Height="{../../../Height}" Orientation="{../../../Orientation}"\r
ValueChanged="../../../onSliderValueChange"/>\r
<Button Width="12" Height="12" MouseClick="../../../onScrollForth">\r
- <Image Margin="1" Path="#go.Images.Icons.updown.svg" SvgSub="../../../../down"/>\r
+ <Image Margin="1" Path="#go.Images.Icons.updown.svg" SvgSub="down"/>\r
</Button>\r
</GenericStack>\r
</Border>
\ No newline at end of file
class GOLIBTests : OpenTKGameWindow, IValueChange\r
{\r
#region IValueChange implementation\r
-\r
public event EventHandler<ValueChangeEventArgs> ValueChanged;\r
-\r
+ public virtual void NotifyValueChanged(string MemberName, object _value)\r
+ {\r
+ ValueChanged.Raise(this, new ValueChangeEventArgs(MemberName, _value)); \r
+ }\r
#endregion\r
\r
public GOLIBTests ()\r
- : base(600, 400,"test: press spacebar to toogle test files")\r
+ : base(600, 500,"test: press spacebar to toogle test files")\r
{\r
VSync = VSyncMode.Off;\r
}\r
base.OnKeyDown (e);\r
if (e.Key == Key.Escape) {\r
this.Quit ();\r
+ return;\r
+ }else if (e.Key == Key.L) {\r
+ TestList.Add ("new string");\r
+ NotifyValueChanged ("TestList", TestList);\r
+ return;\r
}\r
ClearInterface ();\r
idx++;\r
<?xml version="1.0"?>\r
-<Combobox Height="-1" Data="{TestList}"/>
\ No newline at end of file
+<Combobox Height="-1" Data="{TestList}" SelectedIndex="0"/>
\ No newline at end of file
{\r
[DefaultTemplate("#go.Templates.Combobox.goml")]\r
[DefaultOverlayTemplate("#go.Templates.ComboboxOverlay.goml")]\r
- public class Combobox : TemplatedControl\r
+ public class Combobox : TemplatedContainer\r
{ \r
#region CTOR\r
public Combobox() : base(){ } \r
base.loadTemplate (template);\r
loadOverlayTemplate (null);\r
}\r
-// public override GraphicObject Content {\r
-// get {\r
-// throw new NotImplementedException ();\r
-// }\r
-// set {\r
-// throw new NotImplementedException ();\r
-// }\r
-// }\r
+ public override GraphicObject Content {\r
+ get {\r
+ throw new NotImplementedException ();\r
+ }\r
+ set {\r
+ throw new NotImplementedException ();\r
+ }\r
+ }\r
#endregion\r
\r
protected virtual void loadOverlayTemplate(GraphicObject overlayTemplate)\r
//TODO:reload list with new template?\r
_overlayTemplate = value; \r
\r
- Overlay = Interface.Load (_overlayTemplate, this, !Interface.DontResoveGOML);\r
+ Overlay = Interface.Load (_overlayTemplate);\r
+ Overlay.ResolveBindings ();\r
_list = Overlay.FindByName ("List") as Group;\r
}\r
}\r
Text = "";\r
else\r
Text = _selectedItem.ToString ();\r
- }\r
+ }\r
}\r
public object SelectedItem{\r
set {\r
\r
Thread t = new Thread (loadingThread);\r
t.Start ();\r
+ t.Join ();\r
\r
}\r
}\r
if (_overlay != null) {\r
_overlay.LayoutChanged -= _overlay_LayoutChanged;\r
_overlay.MouseLeave -= _overlay_MouseLeave;\r
+ _overlay.LogicalParent = null;\r
}\r
\r
_overlay = value; \r
if (_overlay == null)\r
return;\r
\r
+ _overlay.LogicalParent = this;\r
_overlay.Focusable = true;\r
_overlay.LayoutChanged += _overlay_LayoutChanged;\r
_overlay.MouseLeave += _overlay_MouseLeave;\r
base.ClearBinding ();\r
\r
}\r
-\r
+ public override void ResolveBindings ()\r
+ {\r
+ base.ResolveBindings ();\r
+ if (Overlay != null)\r
+ Overlay.ResolveBindings ();\r
+ }\r
}\r
}\r
Children.Remove(child);\r
this.RegisterForLayouting ((int)LayoutingType.Sizing);\r
}\r
-\r
+ public virtual void ClearChildren()\r
+ {\r
+ int lim = children.Count;\r
+ for (int i = 0; i < lim; i++) {\r
+ GraphicObject g = Children [0];\r
+ g.ClearBinding ();\r
+ g.Parent = null;\r
+ Children.Remove(g); \r
+ }\r
+ this.RegisterForLayouting ((int)LayoutingType.Sizing);\r
+ }\r
public void putWidgetOnTop(GraphicObject w)\r
{\r
if (Children.Contains(w))\r
get {
return data;
}
- set {
+ set {
+ if (loadingInProgress) {
+ thread.Join ();
+ Interface.LoadingLists.Remove (this);
+ pendingChildrenAddition = null;
+ loadingInProgress = false;
+ }
+
data = value;
- foreach (GraphicObject c in _list.Children) {
- c.ClearBinding ();
- }
- _list.Children.Clear ();
- _list.registerForGraphicUpdate ();
+ _list.ClearChildren ();
+
if (data == null)
return;
pendingChildrenAddition = new Queue<GraphicObject> ();
threadedLoadingFinished = false;
+ Interface.LoadingLists.Add (this);
- Thread t = new Thread (loadingThread);
- t.Start ();
- t.Join ();
-
+ thread = new Thread(loadingThread);
+ loadingInProgress = true;
+ thread.Start ();
}
}
- public override void UpdateLayout (LayoutingType layoutType)
- {
- CheckPendingChildrenAddition ();
- base.UpdateLayout (layoutType);
- }
+// public override void UpdateLayout (LayoutingType layoutType)
+// {
+// CheckPendingChildrenAddition ();
+// base.UpdateLayout (layoutType);
+// }
internal void CheckPendingChildrenAddition()
{
- if (pendingChildrenAddition == null)
+ if (!loadingInProgress)
return;
lock (pendingChildrenAddition) {
if (!threadedLoadingFinished && pendingChildrenAddition.Count < 50)
return;
- while (pendingChildrenAddition.Count > 0)
- _list.addChild (pendingChildrenAddition.Dequeue ());
+ while (pendingChildrenAddition.Count > 0) {
+ GraphicObject tmp = pendingChildrenAddition.Dequeue ();
+ tmp.DataSource = tmp.Tag;
+ tmp.Tag = null;
+ _list.addChild (tmp);
+ }
+ if (threadedLoadingFinished) {
+ Interface.LoadingLists.Remove (this);
+ pendingChildrenAddition = null;
+ loadingInProgress = false;
+ }
}
}
- volatile Queue<GraphicObject> pendingChildrenAddition;
+ Queue<GraphicObject> pendingChildrenAddition;
volatile bool threadedLoadingFinished = false;
+ volatile bool loadingInProgress = false;
+ Thread thread;
void loadingThread()
{
foreach (var item in data) {
ms.Seek(0,SeekOrigin.Begin);
GraphicObject g = Interface.Load (ms, t);
- g.DataSource = item;
+ g.Tag = item;
g.MouseClick += itemClick;
-
lock (pendingChildrenAddition) {
pendingChildrenAddition.Enqueue (g);
}
if (template == null) {
DefaultTemplate dt = (DefaultTemplate)this.GetType ().GetCustomAttributes (typeof(DefaultTemplate), true).FirstOrDefault();
this.SetChild (Interface.Load (dt.Path, this));
- this.child.ResolveBindings ();
}else
this.SetChild (template);
+
+ this.child.ResolveBindings ();
}
#region IXmlSerializable
TopContainer.DeleteWidget (parent as GraphicObject);
}
-
+ public override void ResolveBindings ()
+ {
+ base.ResolveBindings ();
+ if (Content != null)
+ Content.ResolveBindings ();
+ }
}
}
/// </summary>
public static List<object> References = new List<object> ();
public static Queue<int> FreeRefIndices = new Queue<int> ();
+ public static List<ListBox> LoadingLists= new List<ListBox>();
public static void Unreference (Object o)
{
surf = new ImageSurface(bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height,ClientRectangle.Width*4);\r
ctx = new Context(surf);\r
\r
+ if (Interface.LoadingLists.Count > 0) {\r
+ ListBox[] loadings = new ListBox[Interface.LoadingLists.Count];\r
+ Interface.LoadingLists.CopyTo (loadings, 0);\r
+ for (int i = 0; i < loadings.Length; i++)\r
+ loadings [i].CheckPendingChildrenAddition (); \r
+ }\r
\r
GraphicObject[] invGOList = new GraphicObject[GraphicObjects.Count];\r
GraphicObjects.CopyTo (invGOList,0);\r