]> git.saurik.com Git - wxWidgets.git/blob - src/motif/popupwin.cpp
Make room for the focus ring to be visible on Mac.
[wxWidgets.git] / src / motif / popupwin.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/motif/popupwin.cpp
3 // Purpose: wxPopupWindow implementation
4 // Author: Mattia barbon
5 // Modified by:
6 // Created: 28.08.03
7 // RCS-ID: $Id$
8 // Copyright: (c) Mattia barbon
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14
15 #include "wx/popupwin.h"
16
17 #ifndef WX_PRECOMP
18 #include "wx/app.h"
19 #endif
20
21 #ifdef __VMS__
22 #pragma message disable nosimpint
23 #endif
24 #include <Xm/Xm.h>
25 #ifdef __VMS__
26 #pragma message enable nosimpint
27 #endif
28
29 #include "wx/motif/private.h"
30
31 bool wxPopupWindow::Create( wxWindow *parent, int flags )
32 {
33 if( !wxPopupWindowBase::Create( parent, flags ) )
34 return false;
35
36 SetParent( parent );
37 if( parent )
38 parent->AddChild( this );
39
40 Widget popup = XtVaCreatePopupShell( "shell",
41 overrideShellWidgetClass,
42 (Widget)wxTheApp->GetTopLevelWidget(),
43 NULL );
44
45 m_mainWidget = (WXWidget)popup;
46
47 SetSize( 100, 100 ); // for child creation to work
48
49 XtSetMappedWhenManaged( popup, False );
50 XtRealizeWidget( popup );
51
52 return true;
53 }
54
55 bool wxPopupWindow::Show( bool show )
56 {
57 if( !wxWindowBase::Show( show ) )
58 return false;
59
60 if( show )
61 {
62 XtPopup( (Widget)GetMainWidget(), XtGrabNone );
63 }
64 else
65 {
66 XtPopdown( (Widget)GetMainWidget() );
67 }
68
69 return true;
70 }