<package >
<metadata>
<id>Crow.OpenTK</id>
- <version>0.5.4</version>
+ <version>0.5.6</version>
<title>C# Rapid Open Widget Toolkit</title>
<authors>JP Bruyere</authors>
<owners>Grand Tetras Software</owners>
isDirty = imlVE.IsDirty;
if (isDirty) {
- lock (CurrentInterface.UpdateMutex)
+ lock (currentInterface.UpdateMutex)
RegisterForRedraw ();
}
public List<InterfaceControler> ifaceControl = new List<InterfaceControler>();
int focusedIdx = -1, activeIdx = -2;
+ // TODO:We should be able to set the current interface programmaticaly
+ /// <summary>
+ /// Gets the currently focused interface, focus could have been given by creation of new iface controler and
+ /// not only by the mouse
+ /// </summary>
+ public Interface CurrentInterface {
+ get {
+ if (ifaceControl.Count == 0) {//create default orthogonal interface
+ addInterfaceControler (new InterfaceControler (
+ new Rectangle (0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height)));
+ focusedIdx = 0;
+ }
+ return ifaceControl [focusedIdx].CrowInterface;
+ }
+ }
+
void addInterfaceControler(InterfaceControler ifaceControler)
{
ifaceControler.CrowInterface.Quit += Quit;
ifaceControler.CrowInterface.MouseCursorChanged += CrowInterface_MouseCursorChanged;
ifaceControl.Add (ifaceControler);
+ focusedIdx = ifaceControl.Count - 1;
}
void openGLDraw(){
//save GL states
ifaceControl [interfaceIdx].CrowInterface.AddWidget (g);
return g;
}
+
public void DeleteWidget (GraphicObject g, int interfaceIdx = 0){
ifaceControl [interfaceIdx].CrowInterface.DeleteWidget (g);
}
{
base.OnLoad (e);
- AddWidget(new Label("Hello World"));
+
+ AddWidget(Instantiator.CreateFromImlFragment (@"<Border Fit='true' BorderWidth='2' BorderStyle='Normal' MouseDown='{BorderStyle=Sunken}' MouseUp='{BorderStyle=Raised}' MouseEnter='{BorderStyle=Raised}' MouseLeave='{BorderStyle=Normal}'><Label Margin='50'/></Border>").CreateInstance (CurrentInterface));
+ //Load(@"Interfaces/GraphicObject/0.crow");
}
[STAThread]
while (true) {
CrowInterface.Update ();
- Thread.Sleep (1);
+ Thread.Sleep (2);
}
}
return;
if (fi is DirectoryInfo)
return;
- lock (this.ifaceControl [0].CrowInterface.UpdateMutex) {
- GraphicObject g = this.ifaceControl [0].CrowInterface.Load (fi.FullName);
+ lock (this.CurrentInterface.UpdateMutex) {
+ GraphicObject g = this.CurrentInterface.Load (fi.FullName);
crowContainer.SetChild (g);
g.DataSource = this;
}
}
return false;
}
+ /// <summary>
+ /// Gets the default value of the widget's property from either the style, or from xml default
+ /// </summary>
+ /// <returns><c>true</c>, if default value is defined, <c>false</c> otherwise.</returns>
+ /// <param name="pi">PropertyInfo</param>
+ /// <param name="styling">Styling informations</param>
+ /// <param name="defaultValue">output of Default value, null if not found</param>
bool getDefaultValue(PropertyInfo pi, List<Style> styling,
out object defaultValue){
defaultValue = null;
public void RegisterForGraphicUpdate ()
{
#if DEBUG_UPDATE
- Debug.WriteLine (string.Format("RegisterForGraphicUpdate -> {0}", this.ToString ()));
+ Debug.WriteLine (string.Format("RegisterForGraphicUpdate (IsDirty set)-> {0}", this.ToString ()));
#endif
IsDirty = true;
if (Width.IsFit || Height.IsFit)
public void RegisterForRedraw ()
{
#if DEBUG_UPDATE
- Debug.WriteLine (string.Format("RegisterForRedraw -> {0}", this.ToString ()));
+ Debug.WriteLine (string.Format("RegisterForRedraw (IsDirty set)-> {0}", this.ToString ()));
#endif
IsDirty = true;
if (RegisteredLayoutings == LayoutingType.None)
/// met and LQI has to be re-queued</returns>
public virtual bool UpdateLayout (LayoutingType layoutType)
{
+ #if DEBUG_UPDATE
+ Debug.WriteLine (string.Format("UpdateLayout ({1})-> {0}", this.ToString (), layoutType));
+ #endif
//unset bit, it would be reset if LQI is re-queued
registeredLayoutings &= (~layoutType);
/// <summary> This is the common overridable drawing routine to create new widget </summary>
protected virtual void onDraw(Context gr)
{
+ #if DEBUG_UPDATE
+ Debug.WriteLine (string.Format("OnDraw -> {0}", this.ToString ()));
+ #endif
+
Rectangle rBack = new Rectangle (Slot.Size);
Background.SetAsSource (gr, rBack);
protected virtual void RecreateCache ()
{
#if DEBUG_UPDATE
- Debug.WriteLine ("RecreateCache -> {0}", this.ToString ());
+ Debug.WriteLine (string.Format("RecreateCache -> {0}", this.ToString ()));
#endif
IsDirty = false;
if (bmp != null)
}
protected virtual void UpdateCache(Context ctx){
#if DEBUG_UPDATE
- Debug.WriteLine ("UpdateCache -> {0}", this.ToString ());
+ Debug.WriteLine (string.Format("UpdateCache -> {0}", this.ToString ()));
#endif
Rectangle rb = Slot + Parent.ClientRectangle.Position;
if (clearBackground) {
#region UPDATE Loops
/// <summary>Enqueue Graphic object for Repaint, DrawingQueue is locked because
- /// GraphObj's property Set methods could trigger an update from another thread</summary>
+ /// GraphObj's property Set methods could trigger an update from another thread
+ /// Once in that queue, the layouting of obj and childs is ok, the next step
+ /// when dequeued is clipping registration</summary>
public void EnqueueForRepaint(GraphicObject g)
{
+ #if DEBUG_UPDATE
+ Debug.WriteLine (string.Format("\tEnqueueForRepaint -> {0}", g?.ToString ()));
+ #endif
lock (DrawingQueue) {
if (g.IsQueueForRedraw)
return;
if (Layoutable.Parent == null) {//TODO:improve this
//cancel layouting for object without parent, maybe some were in queue when
//removed from a listbox
- #if DEBUG_LAYOUTING
+ #if DEBUG_UPDATE || DEBUG_LAYOUTING
Debug.WriteLine ("ERROR: processLayouting, no parent for: " + this.ToString ());
#endif
return;