Browse Source

added ExtendedPopup

pull/1/head
Siegfried Pammer 15 years ago
parent
commit
0aabda8caf
  1. 54
      src/Main/ICSharpCode.Core.Presentation/ExtendedPopup.cs
  2. 1
      src/Main/ICSharpCode.Core.Presentation/ICSharpCode.Core.Presentation.csproj

54
src/Main/ICSharpCode.Core.Presentation/ExtendedPopup.cs

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Interop;
namespace ICSharpCode.Core.Presentation
{
/// <summary>
/// Description of ExtendedPopup.
/// </summary>
public class ExtendedPopup : Popup
{
RoutedEventHandler lostFocus;
RoutedEventHandler gotFocus;
// protected override void OnOpened(EventArgs e)
// {
// IntPtr hwnd = ((HwndSource)PresentationSource.FromVisual(Child)).Handle;
// SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
// lostFocus = new RoutedEventHandler(MainWindowLostFocus);
// gotFocus = new RoutedEventHandler(MainWindowGotFocus);
// AddHandler(Window., lostFocus);
// AddHandler(Window.GotFocusEvent, gotFocus);
//
// }
//
// protected override void OnClosed(EventArgs e)
// {
// RemoveHandler(Window.LostFocusEvent, lostFocus);
// RemoveHandler(Window.GotFocusEvent, gotFocus);
// }
//
// void MainWindowLostFocus(object sender, RoutedEventArgs e)
// {
// Visibility = Visibility.Collapsed;
// }
//
// void MainWindowGotFocus(object sender, RoutedEventArgs e)
// {
// Visibility = Visibility.Visible;
// }
const int SWP_NOMOVE = 0x002;
const int SWP_NOSIZE = 0x001;
static readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2);
[DllImport("user32", EntryPoint="SetWindowPos")]
static extern int SetWindowPos(IntPtr hWnd, IntPtr hwndInsertAfter, int x, int y, int cx, int cy, uint uFlags);
}
}

1
src/Main/ICSharpCode.Core.Presentation/ICSharpCode.Core.Presentation.csproj

@ -69,6 +69,7 @@ @@ -69,6 +69,7 @@
<Compile Include="..\GlobalAssemblyInfo.cs">
<Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="ExtendedPopup.cs" />
<Compile Include="GlobalStyles.cs" />
<Compile Include="RestrictDesiredSize.cs" />
<Compile Include="SortableGridViewColumn.cs" />

Loading…
Cancel
Save