]> git.saurik.com Git - wxWidgets.git/blame - src/motif/popupwin.cpp
fix for bug 1371386, with some minor mods and cleanup
[wxWidgets.git] / src / motif / popupwin.cpp
CommitLineData
833a51f6
MB
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
65571936 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
MB
15#include "wx/popupwin.h"
16#include "wx/app.h"
17
18#ifdef __VMS__
19#pragma message disable nosimpint
20#endif
21#include <Xm/Xm.h>
22#ifdef __VMS__
23#pragma message enable nosimpint
24#endif
25
26#include "wx/motif/private.h"
27
833a51f6
MB
28bool wxPopupWindow::Create( wxWindow *parent, int flags )
29{
30 if( !wxPopupWindowBase::Create( parent, flags ) )
31 return false;
32
33 SetParent( parent );
34 if( parent )
35 parent->AddChild( this );
36
37 Widget popup = XtVaCreatePopupShell( "shell",
38 overrideShellWidgetClass,
39 (Widget)wxTheApp->GetTopLevelWidget(),
40 NULL );
41
42 m_mainWidget = (WXWidget)popup;
43
44 SetSize( 100, 100 ); // for child creation to work
45
46 XtSetMappedWhenManaged( popup, False );
47 XtRealizeWidget( popup );
48
49 return true;
50}
51
52bool wxPopupWindow::Show( bool show )
53{
54 if( !wxWindowBase::Show( show ) )
55 return false;
56
57 if( show )
58 {
59 XtPopup( (Widget)GetMainWidget(), XtGrabNone );
60 }
61 else
62 {
63 XtPopdown( (Widget)GetMainWidget() );
64 }
65
66 return true;
67}