}
#endregion
- internal IBackend backend;
-
#region CTOR
static Interface(){
- /*if (Type.GetType ("Mono.Runtime") == null) {
- throw new Exception (@"C.R.O.W. run only on Mono, download latest version at: http://www.mono-project.com/download/stable/");
- }*/
-
CrowConfigRoot =
System.IO.Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
Init ();
- InitBackend ();
+ ProcessResize (clientRectangle);
}
#endregion
protected bool running;
- protected virtual void InitBackend () {
- if (Environment.OSVersion.Platform == PlatformID.Unix)
- backend = new XLib.XLibBackend();
- //backend = new Crow.XCB.XCBBackend();
- else
- backend = new Crow.Win32.Win32Backend();
- backend.Init (this);
- }
public void Run () {
//load default main.crow if present
try {
// TODO: dispose managed state (managed objects).
}
- backend.CleanUp ();
disposedValue = true;
}
Widget w = _hoverWidget; //previous hover widget
+
+ //if (!FocusOnHover || (w == _hoverWidget))
+ // return;
- backend.ProcessEvents ();
-
- if (!FocusOnHover || (w == _hoverWidget))
- return;
-
- w = _hoverWidget;
+ //w = _hoverWidget;
while (w != null) {
if (w.Focusable) {
FocusedWidget = _hoverWidget;
_hoverWidget = value;
+ if (FocusOnHover) {
+ Widget w = _hoverWidget; //previous hover widget
+ while (w != null) {
+ if (w.Focusable) {
+ FocusedWidget = w;
+ break;
+ }
+ w = w.focusParent;
+ }
+ }
+
#if DEBUG_FOCUS
- NotifyValueChanged("HoverWidget", _hoverWidget);
+ NotifyValueChanged ("HoverWidget", _hoverWidget);
#endif
/*
if (_hoverWidget != null)
#endif
if (DragImage != null)
clipping.UnionRectangle(new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight));
- //using (surf = new ImageSurface (bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height, ClientRectangle.Width * 4)) {
- using (ctx = new Context (surf)){
- if (!clipping.IsEmpty) {
- IsDirty = true;
+ using (surf = new ImageSurface (bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height, ClientRectangle.Width * 4)) {
+ using (ctx = new Context (surf)) {
+ if (!clipping.IsEmpty) {
+ IsDirty = true;
+
+ for (int i = 0; i < clipping.NumRectangles; i++)
+ ctx.Rectangle (clipping.GetRectangle (i));
+
+ ctx.ClipPreserve ();
+ ctx.Operator = Operator.Clear;
+ ctx.Fill ();
+ ctx.Operator = Operator.Over;
+
+ for (int i = GraphicTree.Count - 1; i >= 0; i--) {
+ Widget p = GraphicTree[i];
+ if (!p.Visible)
+ continue;
+ if (clipping.Contains (p.Slot) == RegionOverlap.Out)
+ continue;
- for (int i = 0; i < clipping.NumRectangles; i++)
- ctx.Rectangle(clipping.GetRectangle(i));
-
- ctx.ClipPreserve();
- ctx.Operator = Operator.Clear;
- ctx.Fill();
- ctx.Operator = Operator.Over;
-
- for (int i = GraphicTree.Count -1; i >= 0 ; i--){
- Widget p = GraphicTree[i];
- if (!p.Visible)
- continue;
- if (clipping.Contains (p.Slot) == RegionOverlap.Out)
- continue;
-
- ctx.Save ();
- p.Paint (ref ctx);
- ctx.Restore ();
- }
-
- if (DragAndDropOperation != null) {
- if (DragImage != null) {
- DirtyRect += new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight);
- DragImageX = Mouse.X - DragImageWidth / 2;
- DragImageY = Mouse.Y - DragImageHeight / 2;
ctx.Save ();
- ctx.ResetClip ();
- ctx.SetSourceSurface (DragImage, DragImageX, DragImageY);
- ctx.PaintWithAlpha (0.8);
+ p.Paint (ref ctx);
ctx.Restore ();
- DirtyRect += new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight);
- IsDirty = true;
- //Console.WriteLine ("dragimage drawn: {0},{1}", DragImageX, DragImageY);
}
- }
- #if DEBUG_CLIP_RECTANGLE
- ctx.LineWidth = 1;
- ctx.SetSourceColor(Color.Magenta.AdjustAlpha (0.5));
- for (int i = 0; i < clipping.NumRectangles; i++)
- ctx.Rectangle(clipping.GetRectangle(i));
- ctx.Stroke ();
- #endif
+ if (DragAndDropOperation != null) {
+ if (DragImage != null) {
+ DirtyRect += new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight);
+ DragImageX = Mouse.X - DragImageWidth / 2;
+ DragImageY = Mouse.Y - DragImageHeight / 2;
+ ctx.Save ();
+ ctx.ResetClip ();
+ ctx.SetSourceSurface (DragImage, DragImageX, DragImageY);
+ ctx.PaintWithAlpha (0.8);
+ ctx.Restore ();
+ DirtyRect += new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight);
+ IsDirty = true;
+ //Console.WriteLine ("dragimage drawn: {0},{1}", DragImageX, DragImageY);
+ }
+ }
- clipping.Dispose ();
- clipping = new Region ();
- //}
- //surf.WriteToPng (@"/mnt/data/test.png");
+#if DEBUG_CLIP_RECTANGLE
+ ctx.LineWidth = 1;
+ ctx.SetSourceColor(Color.Magenta.AdjustAlpha (0.5));
+ for (int i = 0; i < clipping.NumRectangles; i++)
+ ctx.Rectangle(clipping.GetRectangle(i));
+ ctx.Stroke ();
+#endif
- backend?.Flush ();
+ clipping.Dispose ();
+ clipping = new Region ();
+ //}
+ //surf.WriteToPng (@"/mnt/data/test.png");
+
+ }
}
}
/*#if DEBUG_LOG
lock (UpdateMutex) {
clientRectangle = bounds;
- if (surf is XlibSurface)
- (surf as XlibSurface).SetSize (clientRectangle.Width, clientRectangle.Height);
- else if (surf is XcbSurface)
- (surf as XcbSurface).SetSize (clientRectangle.Width, clientRectangle.Height);
+ int stride = 4 * ClientRectangle.Width;
+ int bmpSize = Math.Abs (stride) * ClientRectangle.Height;
+ bmp = new byte[bmpSize];
foreach (Widget g in GraphicTree)
g.RegisterForLayouting (LayoutingType.All);
public MouseCursors MouseCursor {
set {
- backend.SetCursor (value);
+ //backend.SetCursor (value);
}
}
/// <summary>Processes mouse move events from the root container, this function
_hoverWidget.onMouseDown (_hoverWidget, lastMouseDownEvent);
+ if (!FocusOnHover) {
+ Widget w = _hoverWidget; //previous hover widget
+ while (w != null) {
+ if (w.Focusable) {
+ FocusedWidget = w;
+ break;
+ }
+ w = w.focusParent;
+ }
+ }
+
ActiveWidget = _hoverWidget;
return true;
}
}
public bool Shift {
- get { return backend.Shift; }
+ get { return false; }
}
public bool Ctrl {
- get { return backend.Ctrl; }
+ get { return false; }
}
public bool Alt {
- get { return backend.Alt; }
+ get { return false; }
}
public bool IsKeyDown (Key key) {
return false;