]> git.saurik.com Git - wxWidgets.git/blob - src/motif/popupwin.cpp
Applied #15375 to stop event-sending in generic wxSpinCtrl ctor (eco)
[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 // Copyright: (c) Mattia barbon
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
13
14 #include "wx/popupwin.h"
15
16 #ifndef WX_PRECOMP
17 #include "wx/app.h"
18 #endif
19
20 #ifdef __VMS__
21 #pragma message disable nosimpint
22 #endif
23 #include <Xm/Xm.h>
24 #ifdef __VMS__
25 #pragma message enable nosimpint
26 #endif
27
28 #include "wx/motif/private.h"
29
30 bool wxPopupWindow::Create( wxWindow *parent, int flags )
31 {
32 if( !wxPopupWindowBase::Create( parent, flags ) )
33 return false;
34
35 SetParent( parent );
36 if( parent )
37 parent->AddChild( this );
38
39 Widget popup = XtVaCreatePopupShell( "shell",
40 overrideShellWidgetClass,
41 (Widget)wxTheApp->GetTopLevelWidget(),
42 NULL );
43
44 m_mainWidget = (WXWidget)popup;
45
46 wxAddWindowToTable( (Widget) m_mainWidget, this );
47
48 DoSetSizeIntr( -1, -1, 100, 100, 0, true );
49
50 XtSetMappedWhenManaged( popup, False );
51 XtRealizeWidget( popup );
52 XtManageChild ( popup );
53 /*
54 XtTranslations ptr;
55 XtOverrideTranslations (popup,
56 ptr = XtParseTranslationTable ("<Configure>: resize()"));
57 XtFree ((char *) ptr);
58 */
59 return true;
60 }
61
62 bool wxPopupWindow::Show( bool show )
63 {
64 if( !wxWindowBase::Show( show ) )
65 return false;
66
67 if( show )
68 {
69 XtPopup( (Widget)GetMainWidget(), XtGrabNonexclusive );
70 }
71 else
72 {
73 XtPopdown( (Widget)GetMainWidget() );
74 }
75
76 return true;
77 }