]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/motif/popupwin.cpp
cleanup - reformatting; simplified OnPaint
[wxWidgets.git] / src / motif / popupwin.cpp
... / ...
CommitLineData
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// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
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
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}