#include <stdio.h>
#endif
+#include "wx/os2/dcclient.h"
+
#if wxUSE_OWNER_DRAWN
#include "wx/ownerdrw.h"
#endif
QMSG s_currentMsg;
#if wxUSE_MENUS_NATIVE
-wxMenu* wxCurrentPopupMenu = NULL;
+extern wxMenu* wxCurrentPopupMenu;
#endif // wxUSE_MENUS_NATIVE
// ---------------------------------------------------------------------------
// method
#ifdef __WXUNIVERSAL__
IMPLEMENT_ABSTRACT_CLASS(wxWindowOS2, wxWindowBase)
-#else // __WXPM__
- IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase)
-#endif // __WXUNIVERSAL__/__WXPM__
+#endif // __WXUNIVERSAL__
BEGIN_EVENT_TABLE(wxWindowOS2, wxWindowBase)
EVT_ERASE_BACKGROUND(wxWindowOS2::OnEraseBackground)
//
wxWindowOS2::~wxWindowOS2()
{
- m_isBeingDeleted = true;
+ SendDestroyEvent();
for (wxWindow* pWin = GetParent(); pWin; pWin = pWin->GetParent())
{
if (m_hWnd)
{
if(!::WinDestroyWindow(GetHWND()))
+ {
wxLogLastError(wxT("DestroyWindow"));
+ }
//
// remove hWnd <-> wxWindow association
//
// static box
//
wxASSERT_MSG( !wxDynamicCast(pParent, wxStaticBox),
- _T("wxStaticBox can't be used as a window parent!") );
+ wxT("wxStaticBox can't be used as a window parent!") );
#endif // wxUSE_STATBOX
// Ensure groupbox backgrounds are painted
void wxWindowOS2::SetFocus()
{
HWND hWnd = GetHwnd();
- wxCHECK_RET( hWnd, _T("can't set focus to invalid window") );
+ wxCHECK_RET( hWnd, wxT("can't set focus to invalid window") );
if (hWnd)
::WinSetFocus(HWND_DESKTOP, hWnd);
/* static */ wxWindow* wxWindowBase::GetCapture()
{
HWND hwnd = ::WinQueryCapture(HWND_DESKTOP);
- return hwnd ? wxFindWinFromHandle((WXHWND)hwnd) : (wxWindow *)NULL;
+ return hwnd ? wxFindWinFromHandle((WXHWND)hwnd) : NULL;
} // end of wxWindowBase::GetCapture
bool wxWindowOS2::SetFont( const wxFont& rFont )
return false;
}
- if ( m_cursor.Ok() ) {
+ if ( m_cursor.IsOk() ) {
HWND hWnd = GetHwnd();
POINTL vPoint;
RECTL vRect;
(void)HandleWindowEvent(rEvent);
}
}
- if (wxUpdateUIEvent::CanUpdate(this))
- UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
} // end of wxWindowOS2::OnIdle
//
// Set this window to be the child of 'parent'.
//
-bool wxWindowOS2::Reparent( wxWindow* pParent)
+bool wxWindowOS2::Reparent( wxWindowBase* pParent)
{
if (!wxWindowBase::Reparent(pParent))
return false;
::WinUpdateWindow(GetHwnd());
} // end of wxWindowOS2::Update
-void wxWindowOS2::Freeze()
+void wxWindowOS2::DoFreeze()
{
::WinSendMsg(GetHwnd(), WM_VRNDISABLED, (MPARAM)0, (MPARAM)0);
} // end of wxWindowOS2::Freeze
-void wxWindowOS2::Thaw()
+void wxWindowOS2::DoThaw()
{
::WinSendMsg(GetHwnd(), WM_VRNENABLED, (MPARAM)TRUE, (MPARAM)0);
// use WinQueryWindowPos. This call, unlike the WIN32 call, however,
// returns a position relative to it's parent, so no parent adujstments
// are needed under OS/2. Also, windows should be created using
- // wxWindow coordinates, i.e 0,0 is the TOP left.
+ // wxWindow coordinates, i.e. 0,0 is the TOP left.
//
if (IsKindOf(CLASSINFO(wxFrame)))
{
return(vFontMetrics.lAveCharWidth);
} // end of wxWindowOS2::GetCharWidth
-void wxWindowOS2::GetTextExtent( const wxString& rString,
- int* pX,
- int* pY,
- int* pDescent,
- int* pExternalLeading,
- const wxFont* WXUNUSED(pTheFont) ) const
+void wxWindowOS2::DoGetTextExtent( const wxString& rString,
+ int* pX,
+ int* pY,
+ int* pDescent,
+ int* pExternalLeading,
+ const wxFont* WXUNUSED(pTheFont) ) const
{
POINTL avPoint[TXTBOX_COUNT];
POINTL vPtMin;
*pExternalLeading = 0;
}
::WinReleasePS(hPS);
-} // end of wxWindow::GetTextExtent
+} // end of wxWindow::DoGetTextExtent
bool wxWindowOS2::IsMouseInWindow() const
{
bool bIsWaiting = true;
int nHeight;
- // Protect against recursion
- if (wxCurrentPopupMenu)
- return false;
-
- pMenu->SetInvokingWindow(this);
pMenu->UpdateUI();
if ( nX == -1 && nY == -1 )
DoGetSize(0,&nHeight);
nY = nHeight - nY;
}
- wxCurrentPopupMenu = pMenu;
::WinPopupMenu( hWndParent
,hWndOwner
::WinDispatchMsg(vHabmain, (PQMSG)&vMsg);
}
- wxCurrentPopupMenu = NULL;
- pMenu->SetInvokingWindow(NULL);
return true;
} // end of wxWindowOS2::DoPopupMenu
#endif // wxUSE_MENUS_NATIVE
(pPage->ulPageIdNew > 0L && pPage->ulPageIdCur > 0L))
{
wxWindowOS2* pWin = wxFindWinFromHandle(pPage->hwndBook);
- wxNotebookEvent vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
+ wxBookCtrlEvent vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
,(int)SHORT1FROMMP(wParam)
,(int)pPage->ulPageIdNew
,(int)pPage->ulPageIdCur
{
wxString Newstr(pWin->GetClassInfo()->GetClassName());
wxString Oldstr(pOldWin->GetClassInfo()->GetClassName());
- wxLogError( _T("Bug! New window of class %s has same HWND %X as old window of class %s"),
+ wxLogError( wxT("Bug! New window of class %s has same HWND %X as old window of class %s"),
Newstr.c_str(),
(int)hWnd,
Oldstr.c_str()
{
vError = ::WinGetLastError(vHabmain);
sError = wxPMErrorToStr(vError);
- wxLogError(_T("Error creating frame. Error: %s\n"), sError.c_str());
+ wxLogError(wxT("Error creating frame. Error: %s\n"), sError.c_str());
return false;
}
SetSize( nX
// Delete our drop target if we've got one
//
#if wxUSE_DRAG_AND_DROP
- if (m_dropTarget != NULL)
- {
- delete m_dropTarget;
- m_dropTarget = NULL;
- }
+ wxDELETE(m_dropTarget);
#endif // wxUSE_DRAG_AND_DROP
//
WXDRAWITEMSTRUCT* pItemStruct )
{
#if wxUSE_OWNER_DRAWN
- wxDC vDc;
+ wxClientDC vDc(this);
#if wxUSE_MENUS_NATIVE
//
,pMeasureStruct->rclItem.xRight - pMeasureStruct->rclItem.xLeft
,pMeasureStruct->rclItem.yTop - pMeasureStruct->rclItem.yBottom
);
- vDc.SetHDC( hDC, false );
- vDc.SetHPS( pMeasureStruct->hps );
+
+ wxPMDCImpl *impl = (wxPMDCImpl*) vDc.GetImpl();
+ impl->SetHDC( hDC, false );
+ impl->SetHPS( pMeasureStruct->hps );
//
// Load the wxWidgets Pallete and set to RGB mode
//
{
vError = ::WinGetLastError(vHabmain);
sError = wxPMErrorToStr(vError);
- wxLogError(_T("Unable to set current color table (1). Error: %s\n"), sError.c_str());
+ wxLogError(wxT("Unable to set current color table (1). Error: %s\n"), sError.c_str());
}
//
// Set the color table to RGB mode
{
vError = ::WinGetLastError(vHabmain);
sError = wxPMErrorToStr(vError);
- wxLogError(_T("Unable to set current color table (2). Error: %s\n"), sError.c_str());
+ wxLogError(wxT("Unable to set current color table (2). Error: %s\n"), sError.c_str());
}
wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
wxPaintEvent& rEvent
)
{
- HDC hDC = (HDC)wxPaintDC::FindDCInCache((wxWindow*) rEvent.GetEventObject());
+ HDC hDC = (HDC)wxPaintDCImpl::FindDCInCache((wxWindow*) rEvent.GetEventObject());
if (hDC != 0)
{
if (vSwp.fl & SWP_MINIMIZE)
return true;
- wxDC vDC;
-
- vDC.m_hPS = (HPS)hDC; // this is really a PS
- vDC.SetWindow((wxWindow*)this);
+ wxClientDC vDC(this);
+ wxPMDCImpl *impl = (wxPMDCImpl*) vDC.GetImpl();
+ impl->SetHDC(hDC);
+ impl->SetHPS((HPS)hDC); // this is really a PS
wxEraseEvent vEvent(m_windowId, &vDC);
rc = HandleWindowEvent(vEvent);
- vDC.m_hPS = NULLHANDLE;
+ impl->SetHPS(NULLHANDLE);
return true;
} // end of wxWindowOS2::HandleEraseBkgnd
void wxWindowOS2::OnEraseBackground(wxEraseEvent& rEvent)
{
RECTL vRect;
- HPS hPS = rEvent.GetDC()->GetHPS();
+ wxPMDCImpl *impl = (wxPMDCImpl*) rEvent.GetDC()->GetImpl();
+ HPS hPS = impl->GetHPS();
APIRET rc;
LONG lColor = m_backgroundColour.GetPixel();