]> git.saurik.com Git - wxWidgets.git/blame - src/motif/popupwin.cpp
really applied Robert's patch (and not the converse of it)
[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
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13#pragma implementation "popup.h"
14#endif
15
16#include "wx/popupwin.h"
17#include "wx/app.h"
18
19#ifdef __VMS__
20#pragma message disable nosimpint
21#endif
22#include <Xm/Xm.h>
23#ifdef __VMS__
24#pragma message enable nosimpint
25#endif
26
27#include "wx/motif/private.h"
28
29IMPLEMENT_DYNAMIC_CLASS( wxPopupWindow, wxWindow );
30
31bool 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
47 SetSize( 100, 100 ); // for child creation to work
48
49 XtSetMappedWhenManaged( popup, False );
50 XtRealizeWidget( popup );
51
52 return true;
53}
54
55bool wxPopupWindow::Show( bool show )
56{
57 if( !wxWindowBase::Show( show ) )
58 return false;
59
60 if( show )
61 {
62 XtPopup( (Widget)GetMainWidget(), XtGrabNone );
63 }
64 else
65 {
66 XtPopdown( (Widget)GetMainWidget() );
67 }
68
69 return true;
70}