]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/popupwin.cpp
   1 /////////////////////////////////////////////////////////////////////////////// 
   2 // Name:        src/mac/popupwin.cpp 
   3 // Purpose:     implements wxPopupWindow for wxMac 
   4 // Author:      Stefan Csomor 
   8 // Copyright:   (c) 2006 Stefan Csomor 
   9 // License:     wxWindows licence 
  10 /////////////////////////////////////////////////////////////////////////////// 
  12 // ============================================================================ 
  14 // ============================================================================ 
  16 // CAUTION : This is not functional yet 
  18 // ---------------------------------------------------------------------------- 
  20 // ---------------------------------------------------------------------------- 
  22 // For compilers that support precompilation, includes "wx.h". 
  23 #include "wx/wxprec.h" 
  34 #include "wx/popupwin.h" 
  36 #include "wx/mac/private.h"     
  38 // ============================================================================ 
  40 // ============================================================================ 
  42 bool wxPopupWindow::Create(wxWindow 
*parent
, int flags
) 
  44     // popup windows are created hidden by default 
  47     return wxPopupWindowBase::Create(parent
) && 
  48                wxWindow::Create(parent
, wxID_ANY
, 
  49                                 wxDefaultPosition
, wxDefaultSize
, 
  50                                 flags 
| wxPOPUP_WINDOW
); 
  53 void wxPopupWindow::DoGetPosition(int *x
, int *y
) const 
  55     // the position of a "top level" window such as this should be in 
  56     // screen coordinates, not in the client ones which MSW gives us 
  57     // (because we are a child window) 
  58     wxPopupWindowBase::DoGetPosition(x
, y
); 
  60     GetParent()->ClientToScreen(x
, y
); 
  64 WXDWORD wxPopupWindow::MSWGetStyle(long flags, WXDWORD *exstyle) const 
  66     // we only honour the border flags, the others don't make sense for us 
  67     WXDWORD style = wxWindow::MSWGetStyle(flags & wxBORDER_MASK, exstyle); 
  71         // a popup window floats on top of everything 
  72         *exstyle |= WS_EX_TOPMOST | WS_EX_TOOLWINDOW; 
  78 WXHWND wxPopupWindow::MSWGetParent() const 
  80     // we must be a child of the desktop to be able to extend beyond the parent 
  81     // window client area (like the comboboxes drop downs do) 
  83     // NB: alternative implementation would be to use WS_POPUP instead of 
  84     //     WS_CHILD but then showing a popup would deactivate the parent which 
  85     //     is ugly and working around this, although possible, is even more 
  87     // GetDesktopWindow() is not always supported on WinCE, and if 
  88     // it is, it often returns NULL. 
  92     return (WXHWND)::GetDesktopWindow(); 
  97 bool wxPopupWindow::Show(bool show
) 
  99     if ( !wxWindowMac::Show(show
) ) 
 104         // raise to top of z order 
 105         if (!::SetWindowPos(GetHwnd(), HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE)) 
 107             wxLogLastError(_T("SetWindowPos")); 
 110         // and set it as the foreground window so the mouse can be captured 
 111         ::SetForegroundWindow(GetHwnd()); 
 117 #endif // #if wxUSE_POPUPWIN