Catching up
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15869 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
f52640f373
commit
47df2b8c54
@ -62,7 +62,6 @@ public:
|
||||
virtual void Raise(void);
|
||||
|
||||
// event handlers
|
||||
void OnActivate(wxActivateEvent& rEvent);
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& rEvent);
|
||||
|
||||
// Toolbar
|
||||
@ -122,12 +121,6 @@ public:
|
||||
void SetToolTipCtrl(WXHWND hHwndTT) { m_hWndToolTip = hHwndTT; }
|
||||
#endif // tooltips
|
||||
|
||||
//
|
||||
// Called by wxWindow whenever it gets focus
|
||||
//
|
||||
void SetLastFocus(wxWindow* pWin) { m_pWinLastFocused = pWin; }
|
||||
wxWindow *GetLastFocus(void) const { return m_pWinLastFocused; }
|
||||
|
||||
void SetClient(WXHWND c_Hwnd);
|
||||
void SetClient(wxWindow* c_Window);
|
||||
wxWindow *GetClient();
|
||||
@ -188,7 +181,6 @@ protected:
|
||||
bool m_bFsIsShowing;
|
||||
bool m_bWasMinimized;
|
||||
bool m_bIsShown;
|
||||
wxWindow* m_pWinLastFocused;
|
||||
|
||||
private:
|
||||
#if wxUSE_TOOLTIPS
|
||||
|
@ -21,7 +21,10 @@ class WXDLLEXPORT wxPopupWindow : public wxPopupWindowBase
|
||||
public:
|
||||
wxPopupWindow() { }
|
||||
|
||||
wxPopupWindow(wxWindow* pParent) { (void)Create(pParent); }
|
||||
wxPopupWindow( wxWindow* pParent
|
||||
,int nFlags
|
||||
)
|
||||
{ (void)Create(pParent, nFlags); }
|
||||
|
||||
bool Create( wxWindow* pParent
|
||||
,int nFlags = wxBORDER_NONE
|
||||
@ -30,19 +33,8 @@ public:
|
||||
// Implementation only from now on
|
||||
// -------------------------------
|
||||
//
|
||||
|
||||
//
|
||||
// Override Show() to prevent wxPopupWindow from being activated
|
||||
//
|
||||
virtual bool Show(bool show = TRUE);
|
||||
|
||||
//
|
||||
// Find a shown popup window with the given window as parent, return NULL
|
||||
// if none
|
||||
//
|
||||
static wxPopupWindow *FindPopupFor(wxWindow* pWin);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void DoGetPosition( int* pnX
|
||||
,int* pny
|
||||
) const;
|
||||
@ -50,6 +42,11 @@ protected:
|
||||
virtual WXDWORD OS2GetStyle( long lFlags
|
||||
,WXDWORD* dwExstyle
|
||||
) const;
|
||||
//
|
||||
// Get the HWND to be used as parent of this window with CreateWindow()
|
||||
//
|
||||
virtual WXHWND OS2GetParent(void) const;
|
||||
|
||||
//
|
||||
// The list of all currently shown popup windows used by FindPopupFor()
|
||||
//
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
|
||||
void Command(wxCommandEvent& rEvent);
|
||||
bool ContainsHWND(WXHWND hWnd) const;
|
||||
bool Enable(bool bEnable);
|
||||
virtual bool Enable(bool bEnable = TRUE);
|
||||
void Enable( int nItem
|
||||
,bool bEnable
|
||||
);
|
||||
@ -87,7 +87,7 @@ public:
|
||||
,WXWORD wId
|
||||
);
|
||||
void SendNotificationEvent(void);
|
||||
void Show( int nItem
|
||||
virtual void Show( int nItem
|
||||
,bool bShow = TRUE
|
||||
) ;
|
||||
bool Show(bool bShow);
|
||||
|
@ -86,6 +86,11 @@ public:
|
||||
// --------------------------
|
||||
//
|
||||
PSWP GetSwpClient(void) { return &m_vSwpClient; }
|
||||
|
||||
void OnActivate(wxActivateEvent& rEvent);
|
||||
|
||||
void SetLastFocus(wxWindow *pWin) { m_pWinLastFocused = pWin; }
|
||||
wxWindow* GetLastFocus(void) const { return m_pWinLastFocused; }
|
||||
protected:
|
||||
//
|
||||
// Common part of all ctors
|
||||
@ -157,11 +162,15 @@ protected:
|
||||
bool m_bFsIsMaximized;
|
||||
bool m_bFsIsShowing;
|
||||
|
||||
wxWindow* m_pWinLastFocused;
|
||||
|
||||
WXHWND m_hFrame;
|
||||
SWP m_vSwp;
|
||||
SWP m_vSwpClient;
|
||||
static bool m_sbInitialized;
|
||||
static wxWindow* m_spHiddenParent;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
}; // end of CLASS wxTopLevelWindowOS2
|
||||
|
||||
//
|
||||
|
@ -237,6 +237,10 @@ public:
|
||||
|
||||
WXFARPROC OS2GetOldWndProc(void) const { return m_fnOldWndProc; }
|
||||
void OS2SetOldWndProc(WXFARPROC fnProc) { m_fnOldWndProc = fnProc; }
|
||||
//
|
||||
// Return TRUE if the window is of a standard (i.e. not wxWindows') class
|
||||
//
|
||||
bool IsOfStandardClass(void) const { return m_fnOldWndProc != NULL; }
|
||||
|
||||
wxWindow* FindItem(long lId) const;
|
||||
wxWindow* FindItemByHWND( WXHWND hWnd
|
||||
@ -503,7 +507,6 @@ protected:
|
||||
bool m_bUseCtl3D:1; // Using CTL3D for this control
|
||||
bool m_bBackgroundTransparent:1;
|
||||
bool m_bMouseInWindow:1;
|
||||
bool m_bDoubleClickAllowed:1;
|
||||
bool m_bLastKeydownProcessed:1;
|
||||
bool m_bWinCaptured:1;
|
||||
WXDWORD m_dwExStyle;
|
||||
|
@ -1117,5 +1117,5 @@ void wxFont::SetPS(
|
||||
M_FONTDATA->SetPS(hPS);
|
||||
|
||||
RealizeResource();
|
||||
} // end of wxFont::SetUnderlined
|
||||
} // end of wxFont::SetPS
|
||||
|
||||
|
@ -323,27 +323,12 @@ void wxFillLogFont(
|
||||
,(int)lNumFonts
|
||||
);
|
||||
|
||||
wxString sVals;
|
||||
|
||||
//
|
||||
// For debugging, delete later
|
||||
//
|
||||
for (int i = 0; i < lNumFonts; i++)
|
||||
{
|
||||
sVals << "Face: " << pFM[i].szFacename
|
||||
<< "Family: " << pFM[i].szFamilyname
|
||||
<< " PointSize: " << pFM[i].lEmHeight
|
||||
<< " Height: " << pFM[i].lXHeight
|
||||
;
|
||||
sVals = "";
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize FATTR and FACENAMEDESC
|
||||
//
|
||||
pFattrs->usRecordLength = sizeof(FATTRS);
|
||||
pFattrs->fsFontUse = FATTR_FONTUSE_OUTLINE | // only outline fonts allowed
|
||||
FATTR_FONTUSE_TRANSFORMABLE; // may be transformed
|
||||
FATTR_FONTUSE_TRANSFORMABLE; // may be transformed
|
||||
pFattrs->fsType = 0;
|
||||
pFattrs->lMaxBaselineExt = pFattrs->lAveCharWidth = 0;
|
||||
pFattrs->idRegistry = 0;
|
||||
@ -639,110 +624,12 @@ wxFont wxCreateFontFromLogFont(
|
||||
, PFACENAMEDESC pFaceName
|
||||
)
|
||||
{
|
||||
//
|
||||
// Extract family from facename
|
||||
//
|
||||
int nFontFamily;
|
||||
wxNativeFontInfo vInfo;
|
||||
|
||||
if (strcmp(pLogFont->szFacename, "Times New Roman") == 0)
|
||||
nFontFamily = wxROMAN;
|
||||
else if (strcmp(pLogFont->szFacename, "WarpSans") == 0)
|
||||
nFontFamily = wxSWISS;
|
||||
else if (strcmp(pLogFont->szFacename, "Script") == 0)
|
||||
nFontFamily = wxSCRIPT;
|
||||
else if (strcmp(pLogFont->szFacename, "Courier New") == 0)
|
||||
nFontFamily = wxMODERN;
|
||||
else
|
||||
nFontFamily = wxSWISS;
|
||||
|
||||
//
|
||||
// Weight and Style
|
||||
//
|
||||
int nFontWeight = wxNORMAL;
|
||||
|
||||
switch (pFaceName->usWeightClass)
|
||||
{
|
||||
case FWEIGHT_LIGHT:
|
||||
nFontWeight = wxLIGHT;
|
||||
break;
|
||||
|
||||
default:
|
||||
case FWEIGHT_NORMAL:
|
||||
nFontWeight = wxNORMAL;
|
||||
break;
|
||||
|
||||
case FWEIGHT_BOLD:
|
||||
nFontWeight = wxBOLD;
|
||||
break;
|
||||
}
|
||||
|
||||
int nFontStyle;
|
||||
|
||||
if(pLogFont->fsSelection & FATTR_SEL_ITALIC)
|
||||
nFontStyle = wxITALIC;
|
||||
else
|
||||
nFontStyle = wxNORMAL;
|
||||
|
||||
bool bFontUnderline = (pLogFont->fsSelection & FATTR_SEL_UNDERSCORE);
|
||||
wxString sFontFace = pLogFont->szFacename;
|
||||
int nFontPoints = pFM->lEmHeight;
|
||||
wxFontEncoding vFontEncoding;
|
||||
|
||||
switch (pLogFont->usCodePage)
|
||||
{
|
||||
default:
|
||||
wxFAIL_MSG(wxT("unsupported charset"));
|
||||
// fall through
|
||||
|
||||
case 850:
|
||||
vFontEncoding = wxFONTENCODING_CP1252;
|
||||
break;
|
||||
|
||||
case 1250:
|
||||
vFontEncoding = wxFONTENCODING_CP1250;
|
||||
break;
|
||||
|
||||
case 921:
|
||||
vFontEncoding = wxFONTENCODING_CP1257;
|
||||
break;
|
||||
|
||||
case 866:
|
||||
vFontEncoding = wxFONTENCODING_CP1251;
|
||||
break;
|
||||
|
||||
case 864:
|
||||
vFontEncoding = wxFONTENCODING_CP1256;
|
||||
break;
|
||||
|
||||
case 869:
|
||||
vFontEncoding = wxFONTENCODING_CP1253;
|
||||
break;
|
||||
|
||||
case 862:
|
||||
vFontEncoding = wxFONTENCODING_CP1255;
|
||||
break;
|
||||
|
||||
case 857:
|
||||
vFontEncoding = wxFONTENCODING_CP1254;
|
||||
break;
|
||||
|
||||
case 874:
|
||||
vFontEncoding = wxFONTENCODING_CP437;
|
||||
break;
|
||||
|
||||
case 437:
|
||||
vFontEncoding = wxFONTENCODING_CP437;
|
||||
break;
|
||||
}
|
||||
|
||||
return wxFont( nFontPoints
|
||||
,nFontFamily
|
||||
,nFontStyle
|
||||
,nFontWeight
|
||||
,bFontUnderline
|
||||
,sFontFace
|
||||
,vFontEncoding
|
||||
);
|
||||
vInfo.fa = *pLogFont;
|
||||
vInfo.fm = *pFM;
|
||||
vInfo.fn = *pFaceName;
|
||||
return wxFont(vInfo);
|
||||
} // end of wxCreateFontFromLogFont
|
||||
|
||||
int wxGpiStrcmp(
|
||||
|
@ -67,7 +67,6 @@ extern void wxAssociateWinWithHandle( HWND hWnd
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
|
||||
EVT_ACTIVATE(wxFrame::OnActivate)
|
||||
EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
@ -101,7 +100,6 @@ void wxFrame::Init()
|
||||
m_nFsToolBarHeight = 0;
|
||||
m_hWndToolTip = 0L;
|
||||
m_bWasMinimized = FALSE;
|
||||
m_pWinLastFocused = NULL;
|
||||
|
||||
|
||||
m_frameMenuBar = NULL;
|
||||
@ -658,70 +656,13 @@ bool wxFrame::ShowFullScreen(
|
||||
,m_vFsOldSize.height
|
||||
,SWP_SIZE | SWP_SHOW
|
||||
);
|
||||
return TRUE;
|
||||
}
|
||||
return wxFrameBase::ShowFullScreen(bShow, lStyle);
|
||||
} // end of wxFrame::ShowFullScreen
|
||||
|
||||
//
|
||||
// Frame window
|
||||
//
|
||||
//
|
||||
// Default activation behaviour - set the focus for the first child
|
||||
// subwindow found.
|
||||
//
|
||||
void wxFrame::OnActivate(
|
||||
wxActivateEvent& rEvent
|
||||
)
|
||||
{
|
||||
if ( rEvent.GetActive() )
|
||||
{
|
||||
// restore focus to the child which was last focused
|
||||
wxLogTrace(_T("focus"), _T("wxFrame %08x activated."), m_hWnd);
|
||||
|
||||
wxWindow* pParent = m_pWinLastFocused ? m_pWinLastFocused->GetParent()
|
||||
: NULL;
|
||||
if (!pParent)
|
||||
{
|
||||
pParent = this;
|
||||
}
|
||||
|
||||
wxSetFocusToChild( pParent
|
||||
,&m_pWinLastFocused
|
||||
);
|
||||
}
|
||||
else // deactivating
|
||||
{
|
||||
//
|
||||
// Remember the last focused child if it is our child
|
||||
//
|
||||
m_pWinLastFocused = FindFocus();
|
||||
|
||||
for (wxWindowList::Node* pNode = GetChildren().GetFirst();
|
||||
pNode;
|
||||
pNode = pNode->GetNext())
|
||||
{
|
||||
// FIXME all this is totally bogus - we need to do the same as wxPanel,
|
||||
// but how to do it without duplicating the code?
|
||||
|
||||
// restore focus
|
||||
wxWindow* pChild = pNode->GetData();
|
||||
|
||||
if (!pChild->IsTopLevel()
|
||||
#if wxUSE_TOOLBAR
|
||||
&& !wxDynamicCast(pChild, wxToolBar)
|
||||
#endif // wxUSE_TOOLBAR
|
||||
#if wxUSE_STATUSBAR
|
||||
&& !wxDynamicCast(pChild, wxStatusBar)
|
||||
#endif // wxUSE_STATUSBAR
|
||||
)
|
||||
{
|
||||
pChild->SetFocus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end of wxFrame::OnActivate
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFrame size management: we exclude the areas taken by menu/status/toolbars
|
||||
// from the client area, so the client area is what's really available for the
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include "wx/popupwin.h"
|
||||
|
||||
wxWindowList wxPopupWindow::m_svShownPopups;
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPopupWindow, wxWindow)
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
@ -64,6 +64,14 @@ void wxPopupWindow::DoGetPosition(
|
||||
GetParent()->ClientToScreen(pnX, pnY);
|
||||
} // end of wxPopupWindow::DoGetPosition
|
||||
|
||||
WXHWND wxPopupWindow::OS2GetParent() const
|
||||
{
|
||||
// we must be a child of the desktop to be able to extend beyond the parent
|
||||
// window client area (like the comboboxes drop downs do)
|
||||
//
|
||||
return (WXHWND)HWND_DESKTOP;
|
||||
} // end of wxPopupWindow::OS2GetParent
|
||||
|
||||
WXDWORD wxPopupWindow::OS2GetStyle(
|
||||
long lFlags
|
||||
, WXDWORD* dwExstyle
|
||||
@ -76,73 +84,4 @@ WXDWORD wxPopupWindow::OS2GetStyle(
|
||||
return dwStyle;
|
||||
} // end of wxPopupWindow::OS2GetStyle
|
||||
|
||||
bool wxPopupWindow::Show(
|
||||
bool bShow
|
||||
)
|
||||
{
|
||||
SWP vSwp;
|
||||
//
|
||||
// Skip wxWindow::Show() which calls wxBringWindowToTop(): this results in
|
||||
// activating the popup window and stealing the atcivation from our parent
|
||||
// which means that the parent frame becomes deactivated when opening a
|
||||
// combobox, for example -- definitely not what we want
|
||||
//
|
||||
if (!wxWindowBase::Show(bShow))
|
||||
return FALSE;
|
||||
|
||||
if (bShow)
|
||||
{
|
||||
m_svShownPopups.Append(this);
|
||||
}
|
||||
else // remove from the shown list
|
||||
{
|
||||
m_svShownPopups.DeleteObject(this);
|
||||
}
|
||||
::WinQueryWindowPos(GetHwnd(), &vSwp);
|
||||
|
||||
if (bShow)
|
||||
{
|
||||
::WinSetWindowPos( GetHwnd()
|
||||
,HWND_TOP
|
||||
,vSwp.x
|
||||
,vSwp.y
|
||||
,vSwp.cx
|
||||
,vSwp.cy
|
||||
,SWP_DEACTIVATE | SWP_SHOW | SWP_ZORDER
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
::WinSetWindowPos( GetHwnd()
|
||||
,HWND_BOTTOM
|
||||
,vSwp.x
|
||||
,vSwp.y
|
||||
,vSwp.cx
|
||||
,vSwp.cy
|
||||
,SWP_HIDE | SWP_ZORDER
|
||||
);
|
||||
}
|
||||
return TRUE;
|
||||
} // end of wxPopupWindow::Show
|
||||
|
||||
/* static */
|
||||
wxPopupWindow* wxPopupWindow::FindPopupFor(
|
||||
wxWindow* pWinParent
|
||||
)
|
||||
{
|
||||
//
|
||||
// Find a popup with the given parent in the linked list of all shown
|
||||
// popups
|
||||
//
|
||||
for ( wxWindowList::Node *node = m_svShownPopups.GetFirst();
|
||||
node;
|
||||
node = node->GetNext() )
|
||||
{
|
||||
wxWindow* pWin = node->GetData();
|
||||
|
||||
if (pWin->GetParent() == pWinParent )
|
||||
return (wxPopupWindow *)pWin;
|
||||
}
|
||||
return NULL;
|
||||
} // end of wxPopupWindow::FindPopupFor
|
||||
|
||||
|
@ -85,7 +85,9 @@ public:
|
||||
HMTX m_vMutex;
|
||||
};
|
||||
|
||||
wxMutex::wxMutex()
|
||||
wxMutex::wxMutex(
|
||||
wxMutexType eMutexType
|
||||
)
|
||||
{
|
||||
APIRET ulrc;
|
||||
|
||||
@ -95,13 +97,10 @@ wxMutex::wxMutex()
|
||||
{
|
||||
wxLogSysError(_("Can not create mutex."));
|
||||
}
|
||||
m_locked = 0;
|
||||
}
|
||||
|
||||
wxMutex::~wxMutex()
|
||||
{
|
||||
if (m_locked > 0)
|
||||
wxLogDebug(wxT("Warning: freeing a locked mutex (%d locks)."), m_locked);
|
||||
::DosCloseMutexSem(m_internal->m_vMutex);
|
||||
m_internal->m_vMutex = NULL;
|
||||
}
|
||||
@ -131,7 +130,6 @@ wxMutexError wxMutex::Lock()
|
||||
default:
|
||||
wxFAIL_MSG(wxT("impossible return value in wxMutex::Lock"));
|
||||
}
|
||||
m_locked++;
|
||||
return wxMUTEX_NO_ERROR;
|
||||
}
|
||||
|
||||
@ -143,7 +141,6 @@ wxMutexError wxMutex::TryLock()
|
||||
if (ulrc == ERROR_TIMEOUT || ulrc == ERROR_TOO_MANY_SEM_REQUESTS)
|
||||
return wxMUTEX_BUSY;
|
||||
|
||||
m_locked++;
|
||||
return wxMUTEX_NO_ERROR;
|
||||
}
|
||||
|
||||
@ -151,9 +148,6 @@ wxMutexError wxMutex::Unlock()
|
||||
{
|
||||
APIRET ulrc;
|
||||
|
||||
if (m_locked > 0)
|
||||
m_locked--;
|
||||
|
||||
ulrc = ::DosReleaseMutexSem(m_internal->m_vMutex);
|
||||
if (ulrc != 0)
|
||||
{
|
||||
@ -180,7 +174,7 @@ public:
|
||||
m_nWaiters = 0;
|
||||
}
|
||||
|
||||
inline bool Wait(
|
||||
inline APIRET Wait(
|
||||
unsigned long ulTimeout
|
||||
)
|
||||
{
|
||||
@ -189,7 +183,7 @@ public:
|
||||
m_nWaiters++;
|
||||
ulrc = ::DosWaitEventSem(m_vEvent, ulTimeout);
|
||||
m_nWaiters--;
|
||||
return (ulrc != ERROR_TIMEOUT);
|
||||
return (ulrc);
|
||||
}
|
||||
|
||||
inline ~wxConditionInternal ()
|
||||
@ -234,34 +228,80 @@ wxCondition::~wxCondition()
|
||||
m_internal = NULL;
|
||||
}
|
||||
|
||||
void wxCondition::Wait()
|
||||
wxCondError wxCondition::Wait()
|
||||
{
|
||||
(void)m_internal->Wait(SEM_INDEFINITE_WAIT);
|
||||
APIRET rc = m_internal->Wait(SEM_INDEFINITE_WAIT);
|
||||
|
||||
switch(rc)
|
||||
{
|
||||
case NO_ERROR:
|
||||
return wxCOND_NO_ERROR;
|
||||
case ERROR_INVALID_HANDLE:
|
||||
return wxCOND_INVALID;
|
||||
case ERROR_TIMEOUT:
|
||||
return wxCOND_TIMEOUT;
|
||||
default:
|
||||
return wxCOND_MISC_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
bool wxCondition::Wait(
|
||||
wxCondError wxCondition::WaitTimeout(
|
||||
unsigned long lMilliSec
|
||||
)
|
||||
{
|
||||
return m_internal->Wait(lMilliSec);
|
||||
APIRET rc = m_internal->Wait(lMilliSec);
|
||||
|
||||
switch(rc)
|
||||
{
|
||||
case NO_ERROR:
|
||||
return wxCOND_NO_ERROR;
|
||||
case ERROR_INVALID_HANDLE:
|
||||
return wxCOND_INVALID;
|
||||
case ERROR_TIMEOUT:
|
||||
return wxCOND_TIMEOUT;
|
||||
default:
|
||||
return wxCOND_MISC_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
void wxCondition::Signal()
|
||||
wxCondError wxCondition::Signal()
|
||||
{
|
||||
::DosPostEventSem(m_internal->m_vEvent);
|
||||
APIRET rc = ::DosPostEventSem(m_internal->m_vEvent);
|
||||
|
||||
switch(rc)
|
||||
{
|
||||
case NO_ERROR:
|
||||
return wxCOND_NO_ERROR;
|
||||
case ERROR_INVALID_HANDLE:
|
||||
return wxCOND_INVALID;
|
||||
default:
|
||||
return wxCOND_MISC_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
void wxCondition::Broadcast()
|
||||
wxCondError wxCondition::Broadcast()
|
||||
{
|
||||
int i;
|
||||
APIRET rc = NO_ERROR;
|
||||
|
||||
for (i = 0; i < m_internal->m_nWaiters; i++)
|
||||
{
|
||||
if (::DosPostEventSem(m_internal->m_vEvent) != 0)
|
||||
if ((rc = ::DosPostEventSem(m_internal->m_vEvent)) != NO_ERROR)
|
||||
{
|
||||
wxLogSysError(_("Couldn't change the state of event object."));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch(rc)
|
||||
{
|
||||
case NO_ERROR:
|
||||
return wxCOND_NO_ERROR;
|
||||
case ERROR_INVALID_HANDLE:
|
||||
return wxCOND_INVALID;
|
||||
default:
|
||||
return wxCOND_MISC_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -59,6 +59,14 @@ extern void wxAssociateWinWithHandle( HWND hWnd
|
||||
bool wxTopLevelWindowOS2::m_sbInitialized = FALSE;
|
||||
wxWindow* wxTopLevelWindowOS2::m_spHiddenParent = NULL;
|
||||
|
||||
// ============================================================================
|
||||
// wxTopLevelWindowOS2 implementation
|
||||
// ============================================================================
|
||||
|
||||
BEGIN_EVENT_TABLE(wxTopLevelWindowOS2, wxTopLevelWindowBase)
|
||||
EVT_ACTIVATE(wxTopLevelWindowOS2::OnActivate)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// wxTopLevelWindowMSW implementation
|
||||
// ============================================================================
|
||||
@ -70,21 +78,20 @@ MRESULT EXPENTRY wxDlgProc( HWND WXUNUSED(hWnd)
|
||||
,MPARAM WXUNUSED(lParam)
|
||||
)
|
||||
{
|
||||
if (uMessage == WM_INITDLG)
|
||||
switch(uMessage)
|
||||
{
|
||||
//
|
||||
// For this message, returning TRUE tells system to set focus to the
|
||||
// first control in the dialog box.
|
||||
//
|
||||
return (MRESULT)TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// For all the other ones, FALSE means that we didn't process the
|
||||
// message
|
||||
//
|
||||
return (MRESULT)FALSE;
|
||||
case WM_INITDLG:
|
||||
//
|
||||
// For this message, returning TRUE tells system to set focus to
|
||||
// the first control in the dialog box, but as we set the focus
|
||||
// ourselves, we return FALSE from here as well, so fall through
|
||||
//
|
||||
default:
|
||||
//
|
||||
// For all the other ones, FALSE means that we didn't process the
|
||||
// message
|
||||
//
|
||||
return (MRESULT)FALSE;
|
||||
}
|
||||
} // end of wxDlgProc
|
||||
|
||||
@ -111,8 +118,65 @@ void wxTopLevelWindowOS2::Init()
|
||||
m_hFrame = NULLHANDLE;
|
||||
memset(&m_vSwp, 0, sizeof(SWP));
|
||||
memset(&m_vSwpClient, 0, sizeof(SWP));
|
||||
m_pWinLastFocused = (wxWindow *)NULL;
|
||||
} // end of wxTopLevelWindowIOS2::Init
|
||||
|
||||
void wxTopLevelWindowOS2::OnActivate(
|
||||
wxActivateEvent& rEvent
|
||||
)
|
||||
{
|
||||
if (rEvent.GetActive())
|
||||
{
|
||||
//
|
||||
// Restore focus to the child which was last focused
|
||||
//
|
||||
wxLogTrace(_T("focus"), _T("wxTLW %08x activated."), m_hWnd);
|
||||
|
||||
wxWindow* pParent = m_pWinLastFocused ? m_pWinLastFocused->GetParent()
|
||||
: NULL;
|
||||
if (!pParent)
|
||||
{
|
||||
pParent = this;
|
||||
}
|
||||
|
||||
wxSetFocusToChild( pParent
|
||||
,&m_pWinLastFocused
|
||||
);
|
||||
}
|
||||
else // deactivating
|
||||
{
|
||||
//
|
||||
// Remember the last focused child if it is our child
|
||||
//
|
||||
m_pWinLastFocused = FindFocus();
|
||||
|
||||
//
|
||||
// So we NULL it out if it's a child from some other frame
|
||||
//
|
||||
wxWindow* pWin = m_pWinLastFocused;
|
||||
|
||||
while (pWin)
|
||||
{
|
||||
if (pWin->IsTopLevel())
|
||||
{
|
||||
if (pWin != this)
|
||||
{
|
||||
m_pWinLastFocused = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
pWin = pWin->GetParent();
|
||||
}
|
||||
|
||||
wxLogTrace(_T("focus"),
|
||||
_T("wxTLW %08x deactivated, last focused: %08x."),
|
||||
m_hWnd,
|
||||
m_pWinLastFocused ? GetHwndOf(m_pWinLastFocused)
|
||||
: NULL);
|
||||
rEvent.Skip();
|
||||
}
|
||||
} // end of wxTopLevelWindowOS2::OnActivate
|
||||
|
||||
WXDWORD wxTopLevelWindowOS2::OS2GetStyle(
|
||||
long lStyle
|
||||
, WXDWORD* pdwExflags
|
||||
|
@ -293,11 +293,10 @@ void wxWindowOS2::Init()
|
||||
//
|
||||
// PM specific
|
||||
//
|
||||
m_bDoubleClickAllowed = 0;
|
||||
m_bWinCaptured = FALSE;
|
||||
|
||||
m_isBeingDeleted = FALSE;
|
||||
m_fnOldWndProc = 0;
|
||||
m_fnOldWndProc = NULL;
|
||||
m_bUseCtl3D = FALSE;
|
||||
m_bMouseInWindow = FALSE;
|
||||
m_bLastKeydownProcessed = FALSE;
|
||||
@ -342,12 +341,12 @@ wxWindowOS2::~wxWindowOS2()
|
||||
|
||||
for (wxWindow* pWin = GetParent(); pWin; pWin = pWin->GetParent())
|
||||
{
|
||||
wxFrame* pFrame = wxDynamicCast(pWin, wxFrame);
|
||||
wxTopLevelWindow* pFrame = wxDynamicCast(pWin, wxTopLevelWindow);
|
||||
|
||||
if (pFrame)
|
||||
{
|
||||
if (pFrame->GetLastFocus() == this)
|
||||
pFrame->SetLastFocus((wxWindow*)NULL);
|
||||
pFrame->SetLastFocus(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2732,10 +2731,13 @@ MRESULT wxWindowOS2::OS2WindowProc(
|
||||
break;
|
||||
|
||||
case WM_QUERYDLGCODE:
|
||||
if ( m_lDlgCode )
|
||||
if (!IsOfStandardClass())
|
||||
{
|
||||
mResult = (MRESULT)m_lDlgCode;
|
||||
bProcessed = TRUE;
|
||||
if ( m_lDlgCode )
|
||||
{
|
||||
mResult = (MRESULT)m_lDlgCode;
|
||||
bProcessed = TRUE;
|
||||
}
|
||||
}
|
||||
//
|
||||
//else: get the dlg code from the DefWindowProc()
|
||||
|
Loading…
Reference in New Issue
Block a user