]> git.saurik.com Git - wxWidgets.git/blame - src/motif/popupwin.cpp
Crash fix under VC++
[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
12#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13#pragma implementation "popup.h"
14#endif
15
1248b41f
MB
16// For compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
18
833a51f6
MB
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
32IMPLEMENT_DYNAMIC_CLASS( wxPopupWindow, wxWindow );
33
34bool wxPopupWindow::Create( wxWindow *parent, int flags )
35{
36 if( !wxPopupWindowBase::Create( parent, flags ) )
37 return false;
38
39 SetParent( parent );
40 if( parent )
41 parent->AddChild( this );
42
43 Widget popup = XtVaCreatePopupShell( "shell",
44 overrideShellWidgetClass,
45 (Widget)wxTheApp->GetTopLevelWidget(),
46 NULL );
47
48 m_mainWidget = (WXWidget)popup;
49
50 SetSize( 100, 100 ); // for child creation to work
51
52 XtSetMappedWhenManaged( popup, False );
53 XtRealizeWidget( popup );
54
55 return true;
56}
57
58bool wxPopupWindow::Show( bool show )
59{
60 if( !wxWindowBase::Show( show ) )
61 return false;
62
63 if( show )
64 {
65 XtPopup( (Widget)GetMainWidget(), XtGrabNone );
66 }
67 else
68 {
69 XtPopdown( (Widget)GetMainWidget() );
70 }
71
72 return true;
73}