diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2020-12-07 12:37:23 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2020-12-07 12:37:23 +0100 |
| commit | f4762349a9956bd7ae4fc11f1e165eafb0d2c444 (patch) | |
| tree | f7148e8510b18e4a929e80466696b7b79fba7c1f /Samples/dragNdrop/dragNdrop.cs | |
| parent | a77e1d7b06d860e040097b72cb9244a45e634e62 (diff) | |
stickyMouse, dragNdrop + mdiWins debug and teststemp
Diffstat (limited to 'Samples/dragNdrop/dragNdrop.cs')
| -rw-r--r-- | Samples/dragNdrop/dragNdrop.cs | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/Samples/dragNdrop/dragNdrop.cs b/Samples/dragNdrop/dragNdrop.cs new file mode 100644 index 00000000..0c985747 --- /dev/null +++ b/Samples/dragNdrop/dragNdrop.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Crow; +using Glfw; + +namespace tests +{ + public class BasicTests : SampleBase + { + static void Main () + { + using (BasicTests app = new BasicTests ()) { + app.Run (); + } + } + + protected override void OnInitialized () + { + Load ("#ui.test.crow").DataSource = this; + } + + private void refreshGraphicTree (object sender, MouseButtonEventArgs e) { + NotifyValueChanged ("GraphicTree", (object)null); + NotifyValueChanged ("GraphicTree", GraphicTree); + } + + Group startGroup = null; + + + private void W_StartDrag (object sender, DragDropEventArgs e) { + startGroup = e.DragSource.Parent as Group; + DragImageHeight = e.DragSource.LastPaintedSlot.Height; + DragImageWidth = e.DragSource.LastPaintedSlot.Width; + + Crow.Cairo.Surface dragImg = surf.CreateSimilar (Crow.Cairo.Content.ColorAlpha, DragImageWidth, DragImageHeight); + using (Crow.Cairo.Context gr = new Crow.Cairo.Context(dragImg)) { + gr.SetSource (e.DragSource.bmp, 0, 0); + gr.Paint (); + } + DragImage = dragImg; + lock (UpdateMutex) + startGroup.RemoveChild (e.DragSource); + } + private void W_EndDrag (object sender, DragDropEventArgs e) { + lock (UpdateMutex) + startGroup.AddChild (e.DragSource); + } + + private void W_DragEnter (object sender, DragDropEventArgs e) { + lock (UpdateMutex) + (e.DropTarget as Group).AddChild (e.DragSource); + } + private void W_DragLeave (object sender, DragDropEventArgs e) { + lock (UpdateMutex) + (e.DragSource.Parent as Group).RemoveChild (e.DragSource); + } + private void W_Drop (object sender, DragDropEventArgs e) { + //(e.DropTarget as Group).AddChild (e.DragSource); + } + + + } +} |