fixes to focus handling in menus

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11909 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2001-10-09 22:08:45 +00:00
parent 4c7852186d
commit 61bd618fe7
2 changed files with 8 additions and 14 deletions

View File

@@ -82,8 +82,6 @@ bool wxTopLevelWindowMGL::Create(wxWindow *parent,
wxTopLevelWindows.Append(this);
m_title = title;
// FIXME_MGL -- should activate itself when shown!
return TRUE;
}
@@ -139,8 +137,9 @@ bool wxTopLevelWindowMGL::ShowFullScreen(bool show, long style)
bool wxTopLevelWindowMGL::Show(bool show)
{
bool ret = wxTopLevelWindowBase::Show(show);
if ( ret && show )
if ( ret && show && AcceptsFocus() )
SetFocus();
// FIXME_MGL -- don't do this for popup windows?
return ret;
}

View File

@@ -117,6 +117,7 @@ bool wxCreateMGL_WM()
#if wxUSE_SYSTEM_OPTIONS
// FIXME_MGL -- so what is The Proper Way?
width=800, height=600;
if ( wxSystemOptions::HasOption(wxT("mgl.screen-width") )
width = wxSystemOptions::GetOptionInt(wxT("mgl.screen-width"));
if ( wxSystemOptions::HasOption(wxT("mgl.screen-height") )
@@ -180,6 +181,7 @@ static wxWindowMGL* wxGetTopLevelParent(wxWindowMGL *win)
static void wxWindowPainter(window_t *wnd, MGLDC *dc)
{
wxWindowMGL *w = (wxWindow*) wnd->userData;
if ( w && !(w->GetWindowStyle() & wxTRANSPARENT_WINDOW) )
{
MGLDevCtx ctx(dc);
@@ -639,7 +641,7 @@ void wxWindowMGL::SetFocus()
#endif // wxUSE_CARET
wxWindowMGL *active = wxGetTopLevelParent(this);
if ( active != gs_activeFrame )
if ( !(m_windowStyle & wxPOPUP_WINDOW) && active != gs_activeFrame )
{
if ( gs_activeFrame )
{
@@ -656,7 +658,7 @@ void wxWindowMGL::SetFocus()
wxFocusEvent event(wxEVT_SET_FOCUS, GetId());
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
AddPendingEvent(event);
}
void wxWindowMGL::KillFocus()
@@ -675,17 +677,9 @@ void wxWindowMGL::KillFocus()
caret->OnKillFocus();
#endif // wxUSE_CARET
if ( IsTopLevel() )
{
// FIXME_MGL - this is wrong, see wxGTK!
wxActivateEvent event(wxEVT_ACTIVATE, FALSE, GetId());
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
}
wxFocusEvent event(wxEVT_KILL_FOCUS, GetId());
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
AddPendingEvent(event);
}
// ----------------------------------------------------------------------------
@@ -1055,6 +1049,7 @@ void wxWindowMGL::Clear()
dc.Clear();
}
#include "wx/menu.h"
void wxWindowMGL::Refresh(bool eraseBack, const wxRect *rect)
{
if ( m_eraseBackground == -1 )