]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/motif/popupwin.cpp
Better fix
[wxWidgets.git] / src / motif / popupwin.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/motif/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
17#ifndef WX_PRECOMP
18 #include "wx/app.h"
19#endif
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
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 wxAddWindowToTable( (Widget) m_mainWidget, this );
48
49 DoSetSizeIntr( -1, -1, 100, 100, 0, true );
50
51 XtSetMappedWhenManaged( popup, False );
52 XtRealizeWidget( popup );
53 XtManageChild ( popup );
54/*
55 XtTranslations ptr;
56 XtOverrideTranslations (popup,
57 ptr = XtParseTranslationTable ("<Configure>: resize()"));
58 XtFree ((char *) ptr);
59*/
60 return true;
61}
62
63bool wxPopupWindow::Show( bool show )
64{
65 if( !wxWindowBase::Show( show ) )
66 return false;
67
68 if( show )
69 {
70 XtPopup( (Widget)GetMainWidget(), XtGrabNonexclusive );
71 }
72 else
73 {
74 XtPopdown( (Widget)GetMainWidget() );
75 }
76
77 return true;
78}