]> git.saurik.com Git - wxWidgets.git/blob - src/motif/popupwin.cpp
Cygwin compile fix
[wxWidgets.git] / src / motif / popupwin.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: 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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "popup.h"
14 #endif
15
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
18
19 #include "wx/popupwin.h"
20 #include "wx/app.h"
21
22 #ifdef __VMS__
23 #pragma message disable nosimpint
24 #endif
25 #include <Xm/Xm.h>
26 #ifdef __VMS__
27 #pragma message enable nosimpint
28 #endif
29
30 #include "wx/motif/private.h"
31
32 bool wxPopupWindow::Create( wxWindow *parent, int flags )
33 {
34 if( !wxPopupWindowBase::Create( parent, flags ) )
35 return false;
36
37 SetParent( parent );
38 if( parent )
39 parent->AddChild( this );
40
41 Widget popup = XtVaCreatePopupShell( "shell",
42 overrideShellWidgetClass,
43 (Widget)wxTheApp->GetTopLevelWidget(),
44 NULL );
45
46 m_mainWidget = (WXWidget)popup;
47
48 SetSize( 100, 100 ); // for child creation to work
49
50 XtSetMappedWhenManaged( popup, False );
51 XtRealizeWidget( popup );
52
53 return true;
54 }
55
56 bool wxPopupWindow::Show( bool show )
57 {
58 if( !wxWindowBase::Show( show ) )
59 return false;
60
61 if( show )
62 {
63 XtPopup( (Widget)GetMainWidget(), XtGrabNone );
64 }
65 else
66 {
67 XtPopdown( (Widget)GetMainWidget() );
68 }
69
70 return true;
71 }