]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/popupwin.cpp
Added missing URL attribute testing
[wxWidgets.git] / src / mac / carbon / popupwin.cpp
CommitLineData
14cd0443
SC
1///////////////////////////////////////////////////////////////////////////////
2// Name: src/mac/popupwin.cpp
3// Purpose: implements wxPopupWindow for wxMac
4// Author: Stefan Csomor
5// Modified by:
6// Created:
7// RCS-ID: $Id$
8// Copyright: (c) 2006 Stefan Csomor
9// License: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// CAUTION : This is not functional yet
17
18// ----------------------------------------------------------------------------
19// headers
20// ----------------------------------------------------------------------------
21
22// For compilers that support precompilation, includes "wx.h".
23#include "wx/wxprec.h"
24
25#ifdef __BORLANDC__
26 #pragma hdrstop
27#endif
28
29#if wxUSE_POPUPWIN
30
31#ifndef WX_PRECOMP
32#endif //WX_PRECOMP
33
34#include "wx/popupwin.h"
35
36#include "wx/mac/private.h"
37
38// ============================================================================
39// implementation
40// ============================================================================
41
42bool wxPopupWindow::Create(wxWindow *parent, int flags)
43{
44 // popup windows are created hidden by default
45 Hide();
46
47 return wxPopupWindowBase::Create(parent) &&
48 wxWindow::Create(parent, wxID_ANY,
49 wxDefaultPosition, wxDefaultSize,
50 flags | wxPOPUP_WINDOW);
51}
52
53void wxPopupWindow::DoGetPosition(int *x, int *y) const
54{
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);
59
60 GetParent()->ClientToScreen(x, y);
61}
62
63/*
64WXDWORD wxPopupWindow::MSWGetStyle(long flags, WXDWORD *exstyle) const
65{
66 // we only honour the border flags, the others don't make sense for us
67 WXDWORD style = wxWindow::MSWGetStyle(flags & wxBORDER_MASK, exstyle);
68
69 if ( exstyle )
70 {
71 // a popup window floats on top of everything
72 *exstyle |= WS_EX_TOPMOST | WS_EX_TOOLWINDOW;
73 }
74
75 return style;
76}
77
78WXHWND wxPopupWindow::MSWGetParent() const
79{
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)
82 //
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
86 // ugly
87 // GetDesktopWindow() is not always supported on WinCE, and if
88 // it is, it often returns NULL.
89#ifdef __WXWINCE__
90 return 0;
91#else
92 return (WXHWND)::GetDesktopWindow();
93#endif
94}
95*/
96
97bool wxPopupWindow::Show(bool show)
98{
99 if ( !wxWindowMac::Show(show) )
100 return false;
101/*
102 if ( show )
103 {
104 // raise to top of z order
105 if (!::SetWindowPos(GetHwnd(), HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE))
106 {
107 wxLogLastError(_T("SetWindowPos"));
108 }
109
110 // and set it as the foreground window so the mouse can be captured
111 ::SetForegroundWindow(GetHwnd());
112 }
113*/
114 return true;
115}
116
117#endif // #if wxUSE_POPUPWIN