From 544c782d7609ed592a9d718c952bd3b043a86e90 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Mon, 1 Oct 2001 22:09:14 +0000 Subject: [PATCH] wxPopupWindow for wxMGL git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11771 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/mgl/popupwin.h | 35 +++++++++++++++++++++++++++++++++++ include/wx/popupwin.h | 2 ++ src/mgl/window.cpp | 31 +++++++++++++++++-------------- 3 files changed, 54 insertions(+), 14 deletions(-) create mode 100644 include/wx/mgl/popupwin.h diff --git a/include/wx/mgl/popupwin.h b/include/wx/mgl/popupwin.h new file mode 100644 index 0000000000..8ce1965614 --- /dev/null +++ b/include/wx/mgl/popupwin.h @@ -0,0 +1,35 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/mgl/popupwin.h +// Purpose: wxPopupWindow class for wxMGL +// Author: Vadim Zeitlin +// Created: 06.01.01 +// RCS-ID: $Id$ +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_POPUPWIN_H_ +#define _WX_POPUPWIN_H_ + +// ---------------------------------------------------------------------------- +// wxPopupWindow +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxPopupWindow : public wxPopupWindowBase +{ +public: + wxPopupWindow() { } + + wxPopupWindow(wxWindow *parent) { (void)Create(parent); } + + bool Create(wxWindow *parent, int flags = wxBORDER_NONE) + { + return wxPopupWindowBase::Create(parent) && + wxWindow::Create(parent, -1, + wxDefaultPosition, wxDefaultSize, + flags & wxBORDER_MASK); + } +}; + +#endif // _WX_POPUPWIN_H_ + diff --git a/include/wx/popupwin.h b/include/wx/popupwin.h index bd9524c08f..7a666aaf7d 100644 --- a/include/wx/popupwin.h +++ b/include/wx/popupwin.h @@ -55,6 +55,8 @@ public: #include "wx/msw/popupwin.h" #elif __WXGTK__ #include "wx/gtk/popupwin.h" +#elif __WXMGL__ + #include "wx/mgl/popupwin.h" #else #error "wxPopupWindow is not supported under this platform." #endif diff --git a/src/mgl/window.cpp b/src/mgl/window.cpp index 8f3bb0905a..5cba0b51d0 100644 --- a/src/mgl/window.cpp +++ b/src/mgl/window.cpp @@ -166,7 +166,7 @@ void wxDestroyMGL_WM() static void wxWindowPainter(window_t *wnd, MGLDC *dc) { wxWindowMGL *w = (wxWindow*) wnd->userData; - if (w && !(w->GetStyle() & wxTRANSPARENT_WINDOW)) + if ( w && !(w->GetWindowStyle() & wxTRANSPARENT_WINDOW) ) { MGLDevCtx ctx(dc); w->HandlePaint(&ctx); @@ -377,6 +377,8 @@ static long wxScanToKeyCode(event_t *event) break; } + #undef KEY + return key; } @@ -387,7 +389,6 @@ static long wxAsciiToKeyCode(event_t *event) static ibool wxWindowKeybHandler(window_t *wnd, event_t *e) { - wxEventType type = wxEVT_NULL; wxWindowMGL *win = (wxWindowMGL*)MGL_wmGetWindowUserData(wnd); if ( !win->IsEnabled() ) return FALSE; @@ -516,22 +517,11 @@ bool wxWindowMGL::Create(wxWindow *parent, long style, const wxString& name) { - // FIXME_MGL -- temporary! - //wxCHECK_MSG( parent, FALSE, wxT("can't create wxWindow without parent") ); - if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) ) return FALSE; - if ( parent ) // FIXME_MGL temporary + if ( parent ) parent->AddChild(this); - else - m_isShown=FALSE;// FIXME_MGL -- temporary, simulates wxTLW/wxFrame - - if ( style & wxPOPUP_WINDOW ) - { - // it is created hidden as other top level windows - m_isShown = FALSE; - } int x, y, w, h; x = pos.x, y = pos.y; @@ -543,10 +533,21 @@ bool wxWindowMGL::Create(wxWindow *parent, h = HeightDefault(size.y); long mgl_style = 0; + if ( !(style & wxNO_FULL_REPAINT_ON_RESIZE) ) + { mgl_style |= MGL_WM_FULL_REPAINT_ON_RESIZE; + } if ( style & wxSTAY_ON_TOP ) + { mgl_style |= MGL_WM_ALWAYS_ON_TOP; + } + if ( style & wxPOPUP_WINDOW ) + { + mgl_style |= MGL_WM_ALWAYS_ON_TOP; + // it is created hidden as other top level windows + m_isShown = FALSE; + } m_wnd = MGL_wmCreateWindow(g_winMng, parent ? parent->GetHandle() : NULL, @@ -586,6 +587,7 @@ void wxWindowMGL::SetFocus() if ( IsTopLevel() ) { + // FIXME_MGL - this is wrong, see wxGTK! wxActivateEvent event(wxEVT_ACTIVATE, TRUE, GetId()); event.SetEventObject(this); GetEventHandler()->ProcessEvent(event); @@ -614,6 +616,7 @@ void wxWindowMGL::KillFocus() if ( IsTopLevel() ) { + // FIXME_MGL - this is wrong, see wxGTK! wxActivateEvent event(wxEVT_ACTIVATE, FALSE, GetId()); event.SetEventObject(this); GetEventHandler()->ProcessEvent(event); -- 2.45.2