From: Mattia Barbon Date: Tue, 14 Oct 2003 17:05:28 +0000 (+0000) Subject: Implemented wxPopupWindow for wxMotif. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/833a51f67ec2cb68649cf4cd2fe46456fc1752b6?ds=sidebyside Implemented wxPopupWindow for wxMotif. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24175 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/Makefile.in b/Makefile.in index af96be55d8..37b793b168 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1529,6 +1529,7 @@ COND_TOOLKIT_MOTIF_GUI_HDR = \ wx/motif/minifram.h \ wx/motif/msgdlg.h \ wx/motif/palette.h \ + wx/motif/popupwin.h \ wx/motif/print.h \ wx/motif/private.h \ wx/motif/radiobox.h \ @@ -3405,6 +3406,7 @@ COND_TOOLKIT_MOTIF___GUI_SRC_OBJECTS = \ monodll_minifram.o \ monodll_msgdlg.o \ monodll_palette.o \ + monodll_popupwin.o \ monodll_radiobox.o \ monodll_radiobut.o \ monodll_scrolbar.o \ @@ -3800,6 +3802,7 @@ COND_TOOLKIT_MOTIF___GUI_SRC_OBJECTS_1 = \ monolib_minifram.o \ monolib_msgdlg.o \ monolib_palette.o \ + monolib_popupwin.o \ monolib_radiobox.o \ monolib_radiobut.o \ monolib_scrolbar.o \ @@ -4195,6 +4198,7 @@ COND_TOOLKIT_MOTIF___GUI_SRC_OBJECTS_2 = \ coredll_minifram.o \ coredll_msgdlg.o \ coredll_palette.o \ + coredll_popupwin.o \ coredll_radiobox.o \ coredll_radiobut.o \ coredll_scrolbar.o \ @@ -4590,6 +4594,7 @@ COND_TOOLKIT_MOTIF___GUI_SRC_OBJECTS_3 = \ corelib_minifram.o \ corelib_msgdlg.o \ corelib_palette.o \ + corelib_popupwin.o \ corelib_radiobox.o \ corelib_radiobut.o \ corelib_scrolbar.o \ @@ -8508,6 +8513,9 @@ coredll_pnghand.o: $(srcdir)/src/mac/pnghand.cpp @COND_TOOLKIT_MSW_USE_GUI_1@coredll_popupwin.o: $(srcdir)/src/msw/popupwin.cpp @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $< +@COND_TOOLKIT_MOTIF_USE_GUI_1_WXUNIV_0@coredll_popupwin.o: $(srcdir)/src/motif/popupwin.cpp +@COND_TOOLKIT_MOTIF_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $< + coredll_print.o: $(srcdir)/src/os2/print.cpp $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $< @@ -10607,6 +10615,9 @@ corelib_pnghand.o: $(srcdir)/src/mac/pnghand.cpp @COND_TOOLKIT_MSW_USE_GUI_1@corelib_popupwin.o: $(srcdir)/src/msw/popupwin.cpp @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $< +@COND_TOOLKIT_MOTIF_USE_GUI_1_WXUNIV_0@corelib_popupwin.o: $(srcdir)/src/motif/popupwin.cpp +@COND_TOOLKIT_MOTIF_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $< + corelib_print.o: $(srcdir)/src/os2/print.cpp $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $< @@ -13433,6 +13444,9 @@ monodll_pnghand.o: $(srcdir)/src/mac/pnghand.cpp @COND_TOOLKIT_MSW_USE_GUI_1@monodll_popupwin.o: $(srcdir)/src/msw/popupwin.cpp @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $< +@COND_TOOLKIT_MOTIF_USE_GUI_1_WXUNIV_0@monodll_popupwin.o: $(srcdir)/src/motif/popupwin.cpp +@COND_TOOLKIT_MOTIF_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $< + monodll_print.o: $(srcdir)/src/os2/print.cpp $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $< @@ -16033,6 +16047,9 @@ monolib_pnghand.o: $(srcdir)/src/mac/pnghand.cpp @COND_TOOLKIT_MSW_USE_GUI_1@monolib_popupwin.o: $(srcdir)/src/msw/popupwin.cpp @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $< +@COND_TOOLKIT_MOTIF_USE_GUI_1_WXUNIV_0@monolib_popupwin.o: $(srcdir)/src/motif/popupwin.cpp +@COND_TOOLKIT_MOTIF_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $< + monolib_print.o: $(srcdir)/src/os2/print.cpp $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $< diff --git a/autoconf_inc.m4 b/autoconf_inc.m4 index 9dad7712cc..824bc1da33 100644 --- a/autoconf_inc.m4 +++ b/autoconf_inc.m4 @@ -2,9 +2,6 @@ dnl This macro was generated by dnl Bakefile 0.1.1 (http://bakefile.sourceforge.net) dnl Do not modify, all changes will be overwritten! - -dnl Conditions: - dnl ### begin block 0_AC_BAKEFILE_PRECOMP_HEADERS ### AC_BAKEFILE_PRECOMP_HEADERS diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index e238a68d5e..9c4988d62f 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -868,6 +868,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/motif/minifram.cpp src/motif/msgdlg.cpp src/motif/palette.cpp + src/motif/popupwin.cpp src/motif/radiobox.cpp src/motif/radiobut.cpp src/motif/scrolbar.cpp @@ -944,6 +945,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/motif/minifram.h wx/motif/msgdlg.h wx/motif/palette.h + wx/motif/popupwin.h wx/motif/print.h wx/motif/private.h wx/motif/radiobox.h diff --git a/configure b/configure index 91cadeb5ba..ccfbc24e8b 100755 --- a/configure +++ b/configure @@ -33311,21 +33311,16 @@ if test "$wxUSE_POPUPWIN" = "yes"; then { echo "$as_me:$LINENO: WARNING: Popup window not yet supported under Mac OS X... disabled" >&5 echo "$as_me: WARNING: Popup window not yet supported under Mac OS X... disabled" >&2;} else - if test "$wxUSE_MOTIF" = 1; then - { echo "$as_me:$LINENO: WARNING: wxPopupWindow not yet supported under Motif... disabled" >&5 -echo "$as_me: WARNING: wxPopupWindow not yet supported under Motif... disabled" >&2;} - else - if test "$wxUSE_PM" = 1; then - { echo "$as_me:$LINENO: WARNING: wxPopupWindow not yet supported under PM... disabled" >&5 + if test "$wxUSE_PM" = 1; then + { echo "$as_me:$LINENO: WARNING: wxPopupWindow not yet supported under PM... disabled" >&5 echo "$as_me: WARNING: wxPopupWindow not yet supported under PM... disabled" >&2;} - else - cat >>confdefs.h <<\_ACEOF + else + cat >>confdefs.h <<\_ACEOF #define wxUSE_POPUPWIN 1 _ACEOF - USES_CONTROLS=1 - fi + USES_CONTROLS=1 fi fi fi diff --git a/configure.in b/configure.in index 5ae9bb0b85..5da8ebc559 100644 --- a/configure.in +++ b/configure.in @@ -5319,16 +5319,12 @@ if test "$wxUSE_POPUPWIN" = "yes"; then if test "$wxUSE_MAC" = 1 -o "$wxUSE_COCOA" = 1 ; then AC_MSG_WARN([Popup window not yet supported under Mac OS X... disabled]) else - if test "$wxUSE_MOTIF" = 1; then - AC_MSG_WARN([wxPopupWindow not yet supported under Motif... disabled]) + if test "$wxUSE_PM" = 1; then + AC_MSG_WARN([wxPopupWindow not yet supported under PM... disabled]) else - if test "$wxUSE_PM" = 1; then - AC_MSG_WARN([wxPopupWindow not yet supported under PM... disabled]) - else - AC_DEFINE(wxUSE_POPUPWIN) + AC_DEFINE(wxUSE_POPUPWIN) - USES_CONTROLS=1 - fi + USES_CONTROLS=1 fi fi fi diff --git a/include/wx/motif/popupwin.h b/include/wx/motif/popupwin.h new file mode 100644 index 0000000000..e115d68825 --- /dev/null +++ b/include/wx/motif/popupwin.h @@ -0,0 +1,40 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/popupwin.h +// Purpose: wxPopupWindow class for wxMotif +// Author: Mattia Barbon +// Modified by: +// Created: 28.08.03 +// RCS-ID: $Id$ +// Copyright: (c) 2003 Mattia Barbon +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MOTIF_POPUPWIN_H_ +#define _WX_MOTIF_POPUPWIN_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "popup.h" +#endif + +// ---------------------------------------------------------------------------- +// wxPopupWindow +// ---------------------------------------------------------------------------- + +class wxPopupWindow : public wxPopupWindowBase +{ +public: + wxPopupWindow() { Init(); } + + wxPopupWindow( wxWindow *parent, int flags = wxBORDER_NONE ) + { Init(); (void)Create( parent, flags ); } + + bool Create( wxWindow *parent, int flags = wxBORDER_NONE ); + + virtual bool Show( bool show = true ); +private: + void Init() { m_isShown = false; } + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxPopupWindow) +}; + +#endif // _WX_MOTIF_POPUPWIN_H_ diff --git a/include/wx/popupwin.h b/include/wx/popupwin.h index 82979bafa9..6eb26bacb7 100644 --- a/include/wx/popupwin.h +++ b/include/wx/popupwin.h @@ -59,6 +59,8 @@ public: #include "wx/gtk/popupwin.h" #elif __WXX11__ #include "wx/x11/popupwin.h" +#elif __WXMOTIF__ + #include "wx/motif/popupwin.h" #elif __WXMGL__ #include "wx/mgl/popupwin.h" #else diff --git a/src/common/popupcmn.cpp b/src/common/popupcmn.cpp index d0414bce33..6571388a34 100644 --- a/src/common/popupcmn.cpp +++ b/src/common/popupcmn.cpp @@ -28,7 +28,7 @@ #pragma hdrstop #endif -#if wxUSE_POPUPWIN && !defined(__WXMOTIF__) +#if wxUSE_POPUPWIN #include "wx/popupwin.h" diff --git a/src/motif/popupwin.cpp b/src/motif/popupwin.cpp new file mode 100644 index 0000000000..b3ce905e52 --- /dev/null +++ b/src/motif/popupwin.cpp @@ -0,0 +1,70 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: popupwin.cpp +// Purpose: wxPopupWindow implementation +// Author: Mattia barbon +// Modified by: +// Created: 28.08.03 +// RCS-ID: $Id$ +// Copyright: (c) Mattia barbon +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "popup.h" +#endif + +#include "wx/popupwin.h" +#include "wx/app.h" + +#ifdef __VMS__ +#pragma message disable nosimpint +#endif +#include +#ifdef __VMS__ +#pragma message enable nosimpint +#endif + +#include "wx/motif/private.h" + +IMPLEMENT_DYNAMIC_CLASS( wxPopupWindow, wxWindow ); + +bool wxPopupWindow::Create( wxWindow *parent, int flags ) +{ + if( !wxPopupWindowBase::Create( parent, flags ) ) + return false; + + SetParent( parent ); + if( parent ) + parent->AddChild( this ); + + Widget popup = XtVaCreatePopupShell( "shell", + overrideShellWidgetClass, + (Widget)wxTheApp->GetTopLevelWidget(), + NULL ); + + m_mainWidget = (WXWidget)popup; + + SetSize( 100, 100 ); // for child creation to work + + XtSetMappedWhenManaged( popup, False ); + XtRealizeWidget( popup ); + + return true; +} + +bool wxPopupWindow::Show( bool show ) +{ + if( !wxWindowBase::Show( show ) ) + return false; + + if( show ) + { + XtPopup( (Widget)GetMainWidget(), XtGrabNone ); + } + else + { + XtPopdown( (Widget)GetMainWidget() ); + } + + return true; +}