+///////////////////////////////////////////////////////////////////////////////
+// Name: msw/popupwin.cpp
+// Purpose: implements wxPopupWindow for MSW
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 08.05.02
+// RCS-ID: $Id$
+// Copyright: (c) 2002 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// License: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "popup.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#endif //WX_PRECOMP
+
+#include "wx/popupwin.h"
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+bool wxPopupWindow::Create(wxWindow *parent, int flags)
+{
+ return wxPopupWindowBase::Create(parent) &&
+ wxWindow::Create(parent, -1,
+ wxDefaultPosition, wxDefaultSize,
+ flags | wxPOPUP_WINDOW);
+}
+
+void wxPopupWindow::DoGetPosition(int *x, int *y) const
+{
+ // the position of a "top level" window such as this should be in
+ // screen coordinates, not in the client ones which MSW gives us
+ // (because we are a child window)
+ wxPopupWindowBase::DoGetPosition(x, y);
+
+ GetParent()->ClientToScreen(x, y);
+}
+
+WXDWORD wxPopupWindow::MSWGetStyle(long flags, WXDWORD *exstyle) const
+{
+ // we only hnour the border flags
+ WXDWORD style = wxWindow::MSWGetStyle(flags & wxBORDER_MASK, exstyle);
+
+ // and we mustn't have WS_CHILD style or we would be limited to the parents
+ // client area
+ style &= ~WS_CHILD;
+ style |= WS_POPUP;
+
+ if ( exstyle )
+ {
+ // a popup window floats on top of everything
+ *exstyle |= WS_EX_TOPMOST | WS_EX_TOOLWINDOW;
+ }
+
+ return style;
+}
+