]>
Commit | Line | Data |
---|---|---|
833a51f6 | 1 | ///////////////////////////////////////////////////////////////////////////// |
670f9935 | 2 | // Name: src/motif/popupwin.cpp |
833a51f6 MB |
3 | // Purpose: wxPopupWindow implementation |
4 | // Author: Mattia barbon | |
5 | // Modified by: | |
6 | // Created: 28.08.03 | |
833a51f6 | 7 | // Copyright: (c) Mattia barbon |
670f9935 | 8 | // Licence: wxWindows licence |
833a51f6 MB |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
1248b41f MB |
11 | // For compilers that support precompilation, includes "wx.h". |
12 | #include "wx/wxprec.h" | |
13 | ||
833a51f6 | 14 | #include "wx/popupwin.h" |
670f9935 WS |
15 | |
16 | #ifndef WX_PRECOMP | |
17 | #include "wx/app.h" | |
18 | #endif | |
833a51f6 MB |
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 | ||
833a51f6 MB |
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 | ||
105fbe1f MB |
46 | wxAddWindowToTable( (Widget) m_mainWidget, this ); |
47 | ||
48 | DoSetSizeIntr( -1, -1, 100, 100, 0, true ); | |
833a51f6 MB |
49 | |
50 | XtSetMappedWhenManaged( popup, False ); | |
51 | XtRealizeWidget( popup ); | |
105fbe1f MB |
52 | XtManageChild ( popup ); |
53 | /* | |
54 | XtTranslations ptr; | |
55 | XtOverrideTranslations (popup, | |
56 | ptr = XtParseTranslationTable ("<Configure>: resize()")); | |
57 | XtFree ((char *) ptr); | |
58 | */ | |
833a51f6 MB |
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 | { | |
105fbe1f | 69 | XtPopup( (Widget)GetMainWidget(), XtGrabNonexclusive ); |
833a51f6 MB |
70 | } |
71 | else | |
72 | { | |
73 | XtPopdown( (Widget)GetMainWidget() ); | |
74 | } | |
75 | ||
76 | return true; | |
77 | } |