wxPopupWindow for wxMGL

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11771 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2001-10-01 22:09:14 +00:00
parent 8c8fb2f6f6
commit 544c782d76
3 changed files with 54 additions and 14 deletions

35
include/wx/mgl/popupwin.h Normal file
View File

@ -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_

View 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

View 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);