A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

68 lines
2.3 KiB

// -----------------------------------------------------------------------
// <copyright file="PopupImpl.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Win32
{
using System;
using Perspex.Platform;
using Perspex.Win32.Interop;
public class PopupImpl : WindowImpl, IPopupImpl
{
public void SetPosition(Point p)
{
UnmanagedMethods.SetWindowPos(
this.Handle.Handle,
IntPtr.Zero,
(int)p.X,
(int)p.Y,
0,
0,
UnmanagedMethods.SetWindowPosFlags.SWP_NOSIZE | UnmanagedMethods.SetWindowPosFlags.SWP_NOACTIVATE);
}
public override void Show()
{
UnmanagedMethods.ShowWindow(this.Handle.Handle, UnmanagedMethods.ShowWindowCommand.ShowNoActivate);
}
protected override IntPtr CreateWindowOverride(ushort atom)
{
UnmanagedMethods.WindowStyles style =
UnmanagedMethods.WindowStyles.WS_POPUP |
UnmanagedMethods.WindowStyles.WS_CLIPSIBLINGS;
UnmanagedMethods.WindowStyles exStyle =
UnmanagedMethods.WindowStyles.WS_EX_TOOLWINDOW |
UnmanagedMethods.WindowStyles.WS_EX_TOPMOST;
return UnmanagedMethods.CreateWindowEx(
(int)exStyle,
atom,
null,
(uint)style,
UnmanagedMethods.CW_USEDEFAULT,
UnmanagedMethods.CW_USEDEFAULT,
UnmanagedMethods.CW_USEDEFAULT,
UnmanagedMethods.CW_USEDEFAULT,
IntPtr.Zero,
IntPtr.Zero,
IntPtr.Zero,
IntPtr.Zero);
}
protected override IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
{
switch ((UnmanagedMethods.WindowsMessage)msg)
{
case UnmanagedMethods.WindowsMessage.WM_MOUSEACTIVATE:
return (IntPtr)UnmanagedMethods.MouseActivate.MA_NOACTIVATE;
default:
return base.WndProc(hWnd, msg, wParam, lParam);
}
}
}
}