Catching up
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15869 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -62,7 +62,6 @@ public:
|
|||||||
virtual void Raise(void);
|
virtual void Raise(void);
|
||||||
|
|
||||||
// event handlers
|
// event handlers
|
||||||
void OnActivate(wxActivateEvent& rEvent);
|
|
||||||
void OnSysColourChanged(wxSysColourChangedEvent& rEvent);
|
void OnSysColourChanged(wxSysColourChangedEvent& rEvent);
|
||||||
|
|
||||||
// Toolbar
|
// Toolbar
|
||||||
@@ -122,12 +121,6 @@ public:
|
|||||||
void SetToolTipCtrl(WXHWND hHwndTT) { m_hWndToolTip = hHwndTT; }
|
void SetToolTipCtrl(WXHWND hHwndTT) { m_hWndToolTip = hHwndTT; }
|
||||||
#endif // tooltips
|
#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(WXHWND c_Hwnd);
|
||||||
void SetClient(wxWindow* c_Window);
|
void SetClient(wxWindow* c_Window);
|
||||||
wxWindow *GetClient();
|
wxWindow *GetClient();
|
||||||
@@ -188,7 +181,6 @@ protected:
|
|||||||
bool m_bFsIsShowing;
|
bool m_bFsIsShowing;
|
||||||
bool m_bWasMinimized;
|
bool m_bWasMinimized;
|
||||||
bool m_bIsShown;
|
bool m_bIsShown;
|
||||||
wxWindow* m_pWinLastFocused;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
|
@@ -21,7 +21,10 @@ class WXDLLEXPORT wxPopupWindow : public wxPopupWindowBase
|
|||||||
public:
|
public:
|
||||||
wxPopupWindow() { }
|
wxPopupWindow() { }
|
||||||
|
|
||||||
wxPopupWindow(wxWindow* pParent) { (void)Create(pParent); }
|
wxPopupWindow( wxWindow* pParent
|
||||||
|
,int nFlags
|
||||||
|
)
|
||||||
|
{ (void)Create(pParent, nFlags); }
|
||||||
|
|
||||||
bool Create( wxWindow* pParent
|
bool Create( wxWindow* pParent
|
||||||
,int nFlags = wxBORDER_NONE
|
,int nFlags = wxBORDER_NONE
|
||||||
@@ -30,19 +33,8 @@ public:
|
|||||||
// Implementation only from now on
|
// 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:
|
protected:
|
||||||
|
|
||||||
virtual void DoGetPosition( int* pnX
|
virtual void DoGetPosition( int* pnX
|
||||||
,int* pny
|
,int* pny
|
||||||
) const;
|
) const;
|
||||||
@@ -50,6 +42,11 @@ protected:
|
|||||||
virtual WXDWORD OS2GetStyle( long lFlags
|
virtual WXDWORD OS2GetStyle( long lFlags
|
||||||
,WXDWORD* dwExstyle
|
,WXDWORD* dwExstyle
|
||||||
) const;
|
) 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()
|
// The list of all currently shown popup windows used by FindPopupFor()
|
||||||
//
|
//
|
||||||
|
@@ -70,7 +70,7 @@ public:
|
|||||||
|
|
||||||
void Command(wxCommandEvent& rEvent);
|
void Command(wxCommandEvent& rEvent);
|
||||||
bool ContainsHWND(WXHWND hWnd) const;
|
bool ContainsHWND(WXHWND hWnd) const;
|
||||||
bool Enable(bool bEnable);
|
virtual bool Enable(bool bEnable = TRUE);
|
||||||
void Enable( int nItem
|
void Enable( int nItem
|
||||||
,bool bEnable
|
,bool bEnable
|
||||||
);
|
);
|
||||||
@@ -87,7 +87,7 @@ public:
|
|||||||
,WXWORD wId
|
,WXWORD wId
|
||||||
);
|
);
|
||||||
void SendNotificationEvent(void);
|
void SendNotificationEvent(void);
|
||||||
void Show( int nItem
|
virtual void Show( int nItem
|
||||||
,bool bShow = TRUE
|
,bool bShow = TRUE
|
||||||
) ;
|
) ;
|
||||||
bool Show(bool bShow);
|
bool Show(bool bShow);
|
||||||
|
@@ -86,6 +86,11 @@ public:
|
|||||||
// --------------------------
|
// --------------------------
|
||||||
//
|
//
|
||||||
PSWP GetSwpClient(void) { return &m_vSwpClient; }
|
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:
|
protected:
|
||||||
//
|
//
|
||||||
// Common part of all ctors
|
// Common part of all ctors
|
||||||
@@ -157,11 +162,15 @@ protected:
|
|||||||
bool m_bFsIsMaximized;
|
bool m_bFsIsMaximized;
|
||||||
bool m_bFsIsShowing;
|
bool m_bFsIsShowing;
|
||||||
|
|
||||||
|
wxWindow* m_pWinLastFocused;
|
||||||
|
|
||||||
WXHWND m_hFrame;
|
WXHWND m_hFrame;
|
||||||
SWP m_vSwp;
|
SWP m_vSwp;
|
||||||
SWP m_vSwpClient;
|
SWP m_vSwpClient;
|
||||||
static bool m_sbInitialized;
|
static bool m_sbInitialized;
|
||||||
static wxWindow* m_spHiddenParent;
|
static wxWindow* m_spHiddenParent;
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
}; // end of CLASS wxTopLevelWindowOS2
|
}; // end of CLASS wxTopLevelWindowOS2
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@@ -237,6 +237,10 @@ public:
|
|||||||
|
|
||||||
WXFARPROC OS2GetOldWndProc(void) const { return m_fnOldWndProc; }
|
WXFARPROC OS2GetOldWndProc(void) const { return m_fnOldWndProc; }
|
||||||
void OS2SetOldWndProc(WXFARPROC fnProc) { m_fnOldWndProc = fnProc; }
|
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* FindItem(long lId) const;
|
||||||
wxWindow* FindItemByHWND( WXHWND hWnd
|
wxWindow* FindItemByHWND( WXHWND hWnd
|
||||||
@@ -503,7 +507,6 @@ protected:
|
|||||||
bool m_bUseCtl3D:1; // Using CTL3D for this control
|
bool m_bUseCtl3D:1; // Using CTL3D for this control
|
||||||
bool m_bBackgroundTransparent:1;
|
bool m_bBackgroundTransparent:1;
|
||||||
bool m_bMouseInWindow:1;
|
bool m_bMouseInWindow:1;
|
||||||
bool m_bDoubleClickAllowed:1;
|
|
||||||
bool m_bLastKeydownProcessed:1;
|
bool m_bLastKeydownProcessed:1;
|
||||||
bool m_bWinCaptured:1;
|
bool m_bWinCaptured:1;
|
||||||
WXDWORD m_dwExStyle;
|
WXDWORD m_dwExStyle;
|
||||||
|
@@ -1117,5 +1117,5 @@ void wxFont::SetPS(
|
|||||||
M_FONTDATA->SetPS(hPS);
|
M_FONTDATA->SetPS(hPS);
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
} // end of wxFont::SetUnderlined
|
} // end of wxFont::SetPS
|
||||||
|
|
||||||
|
@@ -323,21 +323,6 @@ void wxFillLogFont(
|
|||||||
,(int)lNumFonts
|
,(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
|
// Initialize FATTR and FACENAMEDESC
|
||||||
//
|
//
|
||||||
@@ -639,110 +624,12 @@ wxFont wxCreateFontFromLogFont(
|
|||||||
, PFACENAMEDESC pFaceName
|
, PFACENAMEDESC pFaceName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
wxNativeFontInfo vInfo;
|
||||||
// Extract family from facename
|
|
||||||
//
|
|
||||||
int nFontFamily;
|
|
||||||
|
|
||||||
if (strcmp(pLogFont->szFacename, "Times New Roman") == 0)
|
vInfo.fa = *pLogFont;
|
||||||
nFontFamily = wxROMAN;
|
vInfo.fm = *pFM;
|
||||||
else if (strcmp(pLogFont->szFacename, "WarpSans") == 0)
|
vInfo.fn = *pFaceName;
|
||||||
nFontFamily = wxSWISS;
|
return wxFont(vInfo);
|
||||||
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
|
|
||||||
);
|
|
||||||
} // end of wxCreateFontFromLogFont
|
} // end of wxCreateFontFromLogFont
|
||||||
|
|
||||||
int wxGpiStrcmp(
|
int wxGpiStrcmp(
|
||||||
|
@@ -67,7 +67,6 @@ extern void wxAssociateWinWithHandle( HWND hWnd
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
|
BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
|
||||||
EVT_ACTIVATE(wxFrame::OnActivate)
|
|
||||||
EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
|
EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
@@ -101,7 +100,6 @@ void wxFrame::Init()
|
|||||||
m_nFsToolBarHeight = 0;
|
m_nFsToolBarHeight = 0;
|
||||||
m_hWndToolTip = 0L;
|
m_hWndToolTip = 0L;
|
||||||
m_bWasMinimized = FALSE;
|
m_bWasMinimized = FALSE;
|
||||||
m_pWinLastFocused = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
m_frameMenuBar = NULL;
|
m_frameMenuBar = NULL;
|
||||||
@@ -658,70 +656,13 @@ bool wxFrame::ShowFullScreen(
|
|||||||
,m_vFsOldSize.height
|
,m_vFsOldSize.height
|
||||||
,SWP_SIZE | SWP_SHOW
|
,SWP_SIZE | SWP_SHOW
|
||||||
);
|
);
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
return wxFrameBase::ShowFullScreen(bShow, lStyle);
|
||||||
} // end of wxFrame::ShowFullScreen
|
} // end of wxFrame::ShowFullScreen
|
||||||
|
|
||||||
//
|
//
|
||||||
// Frame window
|
// 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
|
// 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
|
// from the client area, so the client area is what's really available for the
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#include "wx/popupwin.h"
|
#include "wx/popupwin.h"
|
||||||
|
|
||||||
wxWindowList wxPopupWindow::m_svShownPopups;
|
IMPLEMENT_DYNAMIC_CLASS(wxPopupWindow, wxWindow)
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// implementation
|
// implementation
|
||||||
@@ -64,6 +64,14 @@ void wxPopupWindow::DoGetPosition(
|
|||||||
GetParent()->ClientToScreen(pnX, pnY);
|
GetParent()->ClientToScreen(pnX, pnY);
|
||||||
} // end of wxPopupWindow::DoGetPosition
|
} // 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(
|
WXDWORD wxPopupWindow::OS2GetStyle(
|
||||||
long lFlags
|
long lFlags
|
||||||
, WXDWORD* dwExstyle
|
, WXDWORD* dwExstyle
|
||||||
@@ -76,73 +84,4 @@ WXDWORD wxPopupWindow::OS2GetStyle(
|
|||||||
return dwStyle;
|
return dwStyle;
|
||||||
} // end of wxPopupWindow::OS2GetStyle
|
} // 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;
|
HMTX m_vMutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
wxMutex::wxMutex()
|
wxMutex::wxMutex(
|
||||||
|
wxMutexType eMutexType
|
||||||
|
)
|
||||||
{
|
{
|
||||||
APIRET ulrc;
|
APIRET ulrc;
|
||||||
|
|
||||||
@@ -95,13 +97,10 @@ wxMutex::wxMutex()
|
|||||||
{
|
{
|
||||||
wxLogSysError(_("Can not create mutex."));
|
wxLogSysError(_("Can not create mutex."));
|
||||||
}
|
}
|
||||||
m_locked = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMutex::~wxMutex()
|
wxMutex::~wxMutex()
|
||||||
{
|
{
|
||||||
if (m_locked > 0)
|
|
||||||
wxLogDebug(wxT("Warning: freeing a locked mutex (%d locks)."), m_locked);
|
|
||||||
::DosCloseMutexSem(m_internal->m_vMutex);
|
::DosCloseMutexSem(m_internal->m_vMutex);
|
||||||
m_internal->m_vMutex = NULL;
|
m_internal->m_vMutex = NULL;
|
||||||
}
|
}
|
||||||
@@ -131,7 +130,6 @@ wxMutexError wxMutex::Lock()
|
|||||||
default:
|
default:
|
||||||
wxFAIL_MSG(wxT("impossible return value in wxMutex::Lock"));
|
wxFAIL_MSG(wxT("impossible return value in wxMutex::Lock"));
|
||||||
}
|
}
|
||||||
m_locked++;
|
|
||||||
return wxMUTEX_NO_ERROR;
|
return wxMUTEX_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +141,6 @@ wxMutexError wxMutex::TryLock()
|
|||||||
if (ulrc == ERROR_TIMEOUT || ulrc == ERROR_TOO_MANY_SEM_REQUESTS)
|
if (ulrc == ERROR_TIMEOUT || ulrc == ERROR_TOO_MANY_SEM_REQUESTS)
|
||||||
return wxMUTEX_BUSY;
|
return wxMUTEX_BUSY;
|
||||||
|
|
||||||
m_locked++;
|
|
||||||
return wxMUTEX_NO_ERROR;
|
return wxMUTEX_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,9 +148,6 @@ wxMutexError wxMutex::Unlock()
|
|||||||
{
|
{
|
||||||
APIRET ulrc;
|
APIRET ulrc;
|
||||||
|
|
||||||
if (m_locked > 0)
|
|
||||||
m_locked--;
|
|
||||||
|
|
||||||
ulrc = ::DosReleaseMutexSem(m_internal->m_vMutex);
|
ulrc = ::DosReleaseMutexSem(m_internal->m_vMutex);
|
||||||
if (ulrc != 0)
|
if (ulrc != 0)
|
||||||
{
|
{
|
||||||
@@ -180,7 +174,7 @@ public:
|
|||||||
m_nWaiters = 0;
|
m_nWaiters = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool Wait(
|
inline APIRET Wait(
|
||||||
unsigned long ulTimeout
|
unsigned long ulTimeout
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -189,7 +183,7 @@ public:
|
|||||||
m_nWaiters++;
|
m_nWaiters++;
|
||||||
ulrc = ::DosWaitEventSem(m_vEvent, ulTimeout);
|
ulrc = ::DosWaitEventSem(m_vEvent, ulTimeout);
|
||||||
m_nWaiters--;
|
m_nWaiters--;
|
||||||
return (ulrc != ERROR_TIMEOUT);
|
return (ulrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ~wxConditionInternal ()
|
inline ~wxConditionInternal ()
|
||||||
@@ -234,34 +228,80 @@ wxCondition::~wxCondition()
|
|||||||
m_internal = NULL;
|
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
|
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;
|
int i;
|
||||||
|
APIRET rc = NO_ERROR;
|
||||||
|
|
||||||
for (i = 0; i < m_internal->m_nWaiters; i++)
|
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."));
|
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;
|
bool wxTopLevelWindowOS2::m_sbInitialized = FALSE;
|
||||||
wxWindow* wxTopLevelWindowOS2::m_spHiddenParent = NULL;
|
wxWindow* wxTopLevelWindowOS2::m_spHiddenParent = NULL;
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// wxTopLevelWindowOS2 implementation
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(wxTopLevelWindowOS2, wxTopLevelWindowBase)
|
||||||
|
EVT_ACTIVATE(wxTopLevelWindowOS2::OnActivate)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// wxTopLevelWindowMSW implementation
|
// wxTopLevelWindowMSW implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -70,16 +78,15 @@ MRESULT EXPENTRY wxDlgProc( HWND WXUNUSED(hWnd)
|
|||||||
,MPARAM WXUNUSED(lParam)
|
,MPARAM WXUNUSED(lParam)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (uMessage == WM_INITDLG)
|
switch(uMessage)
|
||||||
{
|
{
|
||||||
|
case WM_INITDLG:
|
||||||
//
|
//
|
||||||
// For this message, returning TRUE tells system to set focus to the
|
// For this message, returning TRUE tells system to set focus to
|
||||||
// first control in the dialog box.
|
// the first control in the dialog box, but as we set the focus
|
||||||
|
// ourselves, we return FALSE from here as well, so fall through
|
||||||
//
|
//
|
||||||
return (MRESULT)TRUE;
|
default:
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
//
|
||||||
// For all the other ones, FALSE means that we didn't process the
|
// For all the other ones, FALSE means that we didn't process the
|
||||||
// message
|
// message
|
||||||
@@ -111,8 +118,65 @@ void wxTopLevelWindowOS2::Init()
|
|||||||
m_hFrame = NULLHANDLE;
|
m_hFrame = NULLHANDLE;
|
||||||
memset(&m_vSwp, 0, sizeof(SWP));
|
memset(&m_vSwp, 0, sizeof(SWP));
|
||||||
memset(&m_vSwpClient, 0, sizeof(SWP));
|
memset(&m_vSwpClient, 0, sizeof(SWP));
|
||||||
|
m_pWinLastFocused = (wxWindow *)NULL;
|
||||||
} // end of wxTopLevelWindowIOS2::Init
|
} // 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(
|
WXDWORD wxTopLevelWindowOS2::OS2GetStyle(
|
||||||
long lStyle
|
long lStyle
|
||||||
, WXDWORD* pdwExflags
|
, WXDWORD* pdwExflags
|
||||||
|
@@ -293,11 +293,10 @@ void wxWindowOS2::Init()
|
|||||||
//
|
//
|
||||||
// PM specific
|
// PM specific
|
||||||
//
|
//
|
||||||
m_bDoubleClickAllowed = 0;
|
|
||||||
m_bWinCaptured = FALSE;
|
m_bWinCaptured = FALSE;
|
||||||
|
|
||||||
m_isBeingDeleted = FALSE;
|
m_isBeingDeleted = FALSE;
|
||||||
m_fnOldWndProc = 0;
|
m_fnOldWndProc = NULL;
|
||||||
m_bUseCtl3D = FALSE;
|
m_bUseCtl3D = FALSE;
|
||||||
m_bMouseInWindow = FALSE;
|
m_bMouseInWindow = FALSE;
|
||||||
m_bLastKeydownProcessed = FALSE;
|
m_bLastKeydownProcessed = FALSE;
|
||||||
@@ -342,12 +341,12 @@ wxWindowOS2::~wxWindowOS2()
|
|||||||
|
|
||||||
for (wxWindow* pWin = GetParent(); pWin; pWin = pWin->GetParent())
|
for (wxWindow* pWin = GetParent(); pWin; pWin = pWin->GetParent())
|
||||||
{
|
{
|
||||||
wxFrame* pFrame = wxDynamicCast(pWin, wxFrame);
|
wxTopLevelWindow* pFrame = wxDynamicCast(pWin, wxTopLevelWindow);
|
||||||
|
|
||||||
if (pFrame)
|
if (pFrame)
|
||||||
{
|
{
|
||||||
if (pFrame->GetLastFocus() == this)
|
if (pFrame->GetLastFocus() == this)
|
||||||
pFrame->SetLastFocus((wxWindow*)NULL);
|
pFrame->SetLastFocus(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2732,11 +2731,14 @@ MRESULT wxWindowOS2::OS2WindowProc(
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_QUERYDLGCODE:
|
case WM_QUERYDLGCODE:
|
||||||
|
if (!IsOfStandardClass())
|
||||||
|
{
|
||||||
if ( m_lDlgCode )
|
if ( m_lDlgCode )
|
||||||
{
|
{
|
||||||
mResult = (MRESULT)m_lDlgCode;
|
mResult = (MRESULT)m_lDlgCode;
|
||||||
bProcessed = TRUE;
|
bProcessed = TRUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//
|
//
|
||||||
//else: get the dlg code from the DefWindowProc()
|
//else: get the dlg code from the DefWindowProc()
|
||||||
//
|
//
|
||||||
|
Reference in New Issue
Block a user