diff --git a/Source/OpenTK/INativeWindow.cs b/Source/OpenTK/INativeWindow.cs
index b46cd069..b5f0915e 100644
--- a/Source/OpenTK/INativeWindow.cs
+++ b/Source/OpenTK/INativeWindow.cs
@@ -39,6 +39,11 @@ namespace OpenTK
///
public interface INativeWindow : IDisposable
{
+ ///
+ /// Gets or sets the of the window.
+ ///
+ Icon Icon { get; set; }
+
///
/// Gets or sets the title of the window.
///
@@ -184,6 +189,11 @@ namespace OpenTK
///
event EventHandler Disposed;
+ ///
+ /// Occurs when the property of the window changes.
+ ///
+ event EventHandler IconChanged;
+
///
/// Occurs when the property of the window changes.
///
diff --git a/Source/OpenTK/NativeWindow.cs b/Source/OpenTK/NativeWindow.cs
index 70c4c51a..edbce7ab 100644
--- a/Source/OpenTK/NativeWindow.cs
+++ b/Source/OpenTK/NativeWindow.cs
@@ -287,6 +287,27 @@ namespace OpenTK
#endregion
+ #region Icon
+
+ ///
+ /// Gets or sets the System.Drawing.Icon for this GameWindow.
+ ///
+ public Icon Icon
+ {
+ get
+ {
+ EnsureUndisposed();
+ return implementation.Icon;
+ }
+ set
+ {
+ EnsureUndisposed();
+ implementation.Icon = value;
+ }
+ }
+
+ #endregion
+
#region InputDriver
///
@@ -529,6 +550,11 @@ namespace OpenTK
///
public event EventHandler FocusedChanged;
+ ///
+ /// Occurs when the property of the window changes.
+ ///
+ public event EventHandler IconChanged;
+
///
/// Occurs whenever a character is typed.
///
@@ -682,6 +708,19 @@ namespace OpenTK
#endregion
+ #region OnIconChanged
+
+ ///
+ /// Called when the property of the NativeWindow has changed.
+ ///
+ /// Not used.
+ protected virtual void OnIconChanged(EventArgs e)
+ {
+ if (IconChanged != null) IconChanged(this, e);
+ }
+
+ #endregion
+
#region OnKeyPress
///
@@ -824,6 +863,12 @@ namespace OpenTK
#endregion
+ #region OnIconChangedInternal
+
+ private void OnIconChangedInternal(object sender, EventArgs e) { OnIconChanged(e); }
+
+ #endregion
+
#region OnKeyPressInternal
private void OnKeyPressInternal(object sender, KeyPressEventArgs e) { OnKeyPress(e); }
@@ -886,6 +931,7 @@ namespace OpenTK
implementation.Closing += OnClosingInternal;
implementation.Disposed += OnDisposedInternal;
implementation.FocusedChanged += OnFocusedChangedInternal;
+ implementation.IconChanged += OnIconChangedInternal;
implementation.KeyPress += OnKeyPressInternal;
implementation.Move += OnMoveInternal;
implementation.Resize += OnResizeInternal;
@@ -901,6 +947,7 @@ namespace OpenTK
implementation.Closing -= OnClosingInternal;
implementation.Disposed -= OnDisposedInternal;
implementation.FocusedChanged -= OnFocusedChangedInternal;
+ implementation.IconChanged -= OnIconChangedInternal;
implementation.KeyPress -= OnKeyPressInternal;
implementation.Move -= OnMoveInternal;
implementation.Resize -= OnResizeInternal;
diff --git a/Source/OpenTK/Platform/MacOS/CarbonGLNative.cs b/Source/OpenTK/Platform/MacOS/CarbonGLNative.cs
index 5e881b6b..b32e130d 100644
--- a/Source/OpenTK/Platform/MacOS/CarbonGLNative.cs
+++ b/Source/OpenTK/Platform/MacOS/CarbonGLNative.cs
@@ -680,6 +680,12 @@ namespace OpenTK.Platform.MacOS
#region INativeWindow Members
+ public System.Drawing.Icon Icon
+ {
+ get { return null; }
+ set { }
+ }
+
public string Title
{
get
diff --git a/Source/OpenTK/Platform/Windows/WinGLNative.cs b/Source/OpenTK/Platform/Windows/WinGLNative.cs
index e73d7623..2cce1834 100644
--- a/Source/OpenTK/Platform/Windows/WinGLNative.cs
+++ b/Source/OpenTK/Platform/Windows/WinGLNative.cs
@@ -130,8 +130,6 @@ namespace OpenTK.Platform.Windows
keyboards.Add(keyboard);
mice.Add(mouse);
-
- Icon = GetApplicationIcon();
}
#endregion
@@ -455,27 +453,6 @@ namespace OpenTK.Platform.Windows
}
break;
- case WindowMessage.GETICON:
- if (icon != null)
- {
- icon.Dispose();
- icon = null;
- }
-
- if (lParam != IntPtr.Zero)
- {
- icon = Icon.FromHandle(lParam);
- }
- else
- {
- IntPtr icon_handle = Functions.DefWindowProc(handle, message, wParam, lParam);
- if (icon_handle != IntPtr.Zero)
- icon = Icon.FromHandle(icon_handle);
- return icon_handle;
- }
-
- break;
-
case WindowMessage.CLOSE:
System.ComponentModel.CancelEventArgs e = new System.ComponentModel.CancelEventArgs();