]> git.saurik.com Git - wxWidgets.git/commitdiff
wxPopupWindow for wxMGL
authorVáclav Slavík <vslavik@fastmail.fm>
Mon, 1 Oct 2001 22:09:14 +0000 (22:09 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Mon, 1 Oct 2001 22:09:14 +0000 (22:09 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11771 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/mgl/popupwin.h [new file with mode: 0644]
include/wx/popupwin.h
src/mgl/window.cpp

diff --git a/include/wx/mgl/popupwin.h b/include/wx/mgl/popupwin.h
new file mode 100644 (file)
index 0000000..8ce1965
--- /dev/null
@@ -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_
+
index bd9524c08f15121b0d8f22f6e721432d89027963..7a666aaf7d6e6f834805581c3cadd2bdfcc0da9f 100644 (file)
@@ -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
index 8f3bb0905a71900b8554ddb47a3d1325fabbf3a4..5cba0b51d0d3b1eb8243783713d526a4f3221235 100644 (file)
@@ -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);