Rename Drop event, remove licenses
This commit is contained in:
parent
77a2a5c8b3
commit
1a20ca5245
11 changed files with 64 additions and 107 deletions
|
@ -285,10 +285,9 @@ namespace OpenTK
|
|||
//event EventHandler<MouseEventArgs> MouseClick;
|
||||
//event EventHandler<MouseEventArgs> MouseDoubleClick;
|
||||
|
||||
event EventHandler<OpenTK.Input.DropEventArgs> Drop;
|
||||
//event EventHandler<DragEventArgs> DragDrop;
|
||||
//event EventHandler<DragEventArgs> DragEnter;
|
||||
//event EventHandler<DragEventArgs> DragOver;
|
||||
//event EventHandler<EventArgs> DragLeave;
|
||||
/// <summary>
|
||||
/// Occurs whenever file dropped on window.
|
||||
/// </summary>
|
||||
event EventHandler<OpenTK.Input.FileDropEventArgs> FileDrop;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
#region License
|
||||
//
|
||||
// ConfigurationType.cs
|
||||
//
|
||||
// Author:
|
||||
// Stefanos A. <stapostol@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2006-2014 Stefanos Apostolopoulos
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenTK.Input
|
||||
{
|
||||
public class DropEventArgs : EventArgs
|
||||
{
|
||||
string drop_string;
|
||||
public DropEventArgs () { }
|
||||
|
||||
public string DropString
|
||||
{
|
||||
get
|
||||
{
|
||||
return drop_string;
|
||||
}
|
||||
set
|
||||
{
|
||||
drop_string = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
30
src/OpenTK/Input/FileDropEventArgs.cs
Normal file
30
src/OpenTK/Input/FileDropEventArgs.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
|
||||
namespace OpenTK.Input
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the event data for <see cref="NativeWindow"/> events.
|
||||
/// </summary>
|
||||
public class FileDropEventArgs : EventArgs
|
||||
{
|
||||
#region Fields
|
||||
|
||||
string fileName;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the file.
|
||||
/// </summary>
|
||||
/// <value>The name of the file.</value>
|
||||
public string FileName
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -710,9 +710,9 @@ namespace OpenTK
|
|||
public event EventHandler<MouseWheelEventArgs> MouseWheel = delegate { };
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever a file dropped in window;
|
||||
/// Occurs whenever a file dropped on window;
|
||||
/// </summary>
|
||||
public event EventHandler<DropEventArgs> Drop = delegate { };
|
||||
public event EventHandler<FileDropEventArgs> FileDrop = delegate { };
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -986,9 +986,16 @@ namespace OpenTK
|
|||
MouseWheel(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnDrop(DropEventArgs e)
|
||||
/// <summary>
|
||||
/// Raises the <see cref="FileDrop"/> event.
|
||||
/// </summary>
|
||||
/// <param name="e">
|
||||
/// A <see cref="FileDropEventArgs"/> instance carrying file name.
|
||||
/// The information carried by this instance is only valid within this method body.
|
||||
/// </param>
|
||||
protected virtual void OnFileDrop(FileDropEventArgs e)
|
||||
{
|
||||
Drop(this, e);
|
||||
FileDrop(this, e);
|
||||
}
|
||||
|
||||
#region OnResize
|
||||
|
@ -1152,7 +1159,11 @@ namespace OpenTK
|
|||
private void OnMouseMoveInternal(object sender, MouseMoveEventArgs e) { OnMouseMove(e); }
|
||||
private void OnMouseWheelInternal(object sender, MouseWheelEventArgs e) { OnMouseWheel(e); }
|
||||
|
||||
private void OnDropInternal(object sender, DropEventArgs e) { OnDrop(e); }
|
||||
#region OnFileDropInternal
|
||||
|
||||
private void OnFileDropInternal(object sender, FileDropEventArgs e) { OnFileDrop(e); }
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnMoveInternal
|
||||
|
||||
|
@ -1226,7 +1237,7 @@ namespace OpenTK
|
|||
implementation.VisibleChanged += OnVisibleChangedInternal;
|
||||
implementation.WindowBorderChanged += OnWindowBorderChangedInternal;
|
||||
implementation.WindowStateChanged += OnWindowStateChangedInternal;
|
||||
implementation.Drop += OnDropInternal;
|
||||
implementation.FileDrop += OnFileDropInternal;
|
||||
events = true;
|
||||
}
|
||||
else if (events)
|
||||
|
@ -1251,7 +1262,7 @@ namespace OpenTK
|
|||
implementation.VisibleChanged -= OnVisibleChangedInternal;
|
||||
implementation.WindowBorderChanged -= OnWindowBorderChangedInternal;
|
||||
implementation.WindowStateChanged -= OnWindowStateChangedInternal;
|
||||
implementation.Drop -= OnDropInternal;
|
||||
implementation.FileDrop -= OnFileDropInternal;
|
||||
events = false;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -795,7 +795,7 @@
|
|||
<Compile Include="Platform\Linux\Bindings\Evdev.cs" />
|
||||
<Compile Include="Platform\Linux\DefaultCursor.cs" />
|
||||
<Compile Include="Platform\Linux\Bindings\Kms.cs" />
|
||||
<Compile Include="Input\DropEventArgs.cs" />
|
||||
<Compile Include="Input\FileDropEventArgs.cs" />
|
||||
<None Include="OpenTK.csproj.paket.template" />
|
||||
<None Include="paket.references" />
|
||||
<Compile Include="Platform\MacOS\Cocoa\NSDragOperation.cs" />
|
||||
|
|
|
@ -1,33 +1,4 @@
|
|||
#region License
|
||||
//
|
||||
// NSEventType.cs
|
||||
//
|
||||
// Author:
|
||||
// Olle Håkansson <ollhak@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2014 Olle Håkansson
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace OpenTK.Platform.MacOS
|
||||
{
|
||||
|
|
|
@ -38,9 +38,6 @@ using System.Threading;
|
|||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
|
||||
//using MonoMac.AppKit;
|
||||
//using MonoMac.Foundation;
|
||||
|
||||
namespace OpenTK.Platform.MacOS
|
||||
{
|
||||
class CocoaNativeWindow : NativeWindowBase
|
||||
|
@ -352,7 +349,7 @@ namespace OpenTK.Platform.MacOS
|
|||
{
|
||||
IntPtr obj = Cocoa.SendIntPtr(files, Selector.Get("objectAtIndex:"), new IntPtr(i));
|
||||
IntPtr str = Cocoa.SendIntPtr(obj, Selector.Get("cStringUsingEncoding:"), new IntPtr(1));
|
||||
OnDrop(Marshal.PtrToStringAnsi(str));
|
||||
OnFileDrop(Marshal.PtrToStringAnsi(str));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace OpenTK.Platform
|
|||
readonly KeyboardKeyEventArgs KeyUpArgs = new KeyboardKeyEventArgs();
|
||||
readonly KeyPressEventArgs KeyPressArgs = new KeyPressEventArgs((char)0);
|
||||
|
||||
readonly DropEventArgs DropArgs = new DropEventArgs();
|
||||
readonly FileDropEventArgs FileDropArgs = new FileDropEventArgs();
|
||||
|
||||
// In order to simplify mouse event implementation,
|
||||
// we can store the current mouse state here.
|
||||
|
@ -158,11 +158,11 @@ namespace OpenTK.Platform
|
|||
KeyUp(this, e);
|
||||
}
|
||||
|
||||
protected void OnDrop(string s)
|
||||
protected void OnFileDrop(string s)
|
||||
{
|
||||
var e = DropArgs;
|
||||
DropArgs.DropString = s;
|
||||
Drop(this, e);
|
||||
var e = FileDropArgs;
|
||||
FileDropArgs.FileName = s;
|
||||
FileDrop(this, e);
|
||||
}
|
||||
|
||||
/// \internal
|
||||
|
@ -327,7 +327,7 @@ namespace OpenTK.Platform
|
|||
public event EventHandler<MouseButtonEventArgs> MouseUp = delegate { };
|
||||
public event EventHandler<MouseMoveEventArgs> MouseMove = delegate { };
|
||||
public event EventHandler<MouseWheelEventArgs> MouseWheel = delegate { };
|
||||
public event EventHandler<DropEventArgs> Drop = delegate { };
|
||||
public event EventHandler<FileDropEventArgs> FileDrop = delegate { };
|
||||
|
||||
public abstract void Close();
|
||||
|
||||
|
|
|
@ -313,7 +313,7 @@ namespace OpenTK.Platform.SDL2
|
|||
byte [] byteArray = new byte[length];
|
||||
Marshal.Copy(ev.File, byteArray, 0, length);
|
||||
string dropString = System.Text.Encoding.UTF8.GetString(byteArray);
|
||||
window.OnDrop(dropString);
|
||||
window.OnFileDrop(dropString);
|
||||
}
|
||||
|
||||
static void ProcessWindowEvent(Sdl2NativeWindow window, WindowEvent e)
|
||||
|
|
|
@ -696,7 +696,7 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
Marshal.Copy(str, byteArray, 0, (int)(fileNameSize - 1));
|
||||
string dropString = System.Text.Encoding.UTF8.GetString(byteArray);
|
||||
OnDrop(dropString);
|
||||
OnFileDrop(dropString);
|
||||
|
||||
Marshal.FreeHGlobal(str);
|
||||
}
|
||||
|
|
|
@ -1197,7 +1197,7 @@ namespace OpenTK.Platform.X11
|
|||
|
||||
for (int i = 0; i < fileNames.Length; i++)
|
||||
{
|
||||
OnDrop(fileNames[i]);
|
||||
OnFileDrop(fileNames[i]);
|
||||
}
|
||||
|
||||
XEvent reply = new XEvent ();
|
||||
|
|
Loading…
Reference in a new issue