]>
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 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Mattia barbon | |
670f9935 | 9 | // Licence: wxWindows licence |
833a51f6 MB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
1248b41f MB |
12 | // For compilers that support precompilation, includes "wx.h". |
13 | #include "wx/wxprec.h" | |
14 | ||
833a51f6 | 15 | #include "wx/popupwin.h" |
670f9935 WS |
16 | |
17 | #ifndef WX_PRECOMP | |
18 | #include "wx/app.h" | |
19 | #endif | |
833a51f6 MB |
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 | ||
833a51f6 MB |
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 | ||
105fbe1f MB |
47 | wxAddWindowToTable( (Widget) m_mainWidget, this ); |
48 | ||
49 | DoSetSizeIntr( -1, -1, 100, 100, 0, true ); | |
833a51f6 MB |
50 | |
51 | XtSetMappedWhenManaged( popup, False ); | |
52 | XtRealizeWidget( popup ); | |
105fbe1f MB |
53 | XtManageChild ( popup ); |
54 | /* | |
55 | XtTranslations ptr; | |
56 | XtOverrideTranslations (popup, | |
57 | ptr = XtParseTranslationTable ("<Configure>: resize()")); | |
58 | XtFree ((char *) ptr); | |
59 | */ | |
833a51f6 MB |
60 | return true; |
61 | } | |
62 | ||
63 | bool wxPopupWindow::Show( bool show ) | |
64 | { | |
65 | if( !wxWindowBase::Show( show ) ) | |
66 | return false; | |
67 | ||
68 | if( show ) | |
69 | { | |
105fbe1f | 70 | XtPopup( (Widget)GetMainWidget(), XtGrabNonexclusive ); |
833a51f6 MB |
71 | } |
72 | else | |
73 | { | |
74 | XtPopdown( (Widget)GetMainWidget() ); | |
75 | } | |
76 | ||
77 | return true; | |
78 | } |