EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged)
EVT_INIT_DIALOG(wxWindow::OnInitDialog)
EVT_IDLE(wxWindow::OnIdle)
+ EVT_SET_FOCUS(wxWindow::OnSetFocus)
END_EVENT_TABLE()
// ===========================================================================
if (m_hWnd)
{
-// UnsubclassWin();
-
if(!::WinDestroyWindow(GetHWND()))
wxLogLastError(wxT("DestroyWindow"));
//
// set in those class create procs. PM's basic windows styles are
// very limited.
//
+ ulCreateFlags |= WS_VISIBLE;
+
+
+ if ( lStyle & wxCLIP_SIBLINGS )
+ ulCreateFlags |= WS_CLIPSIBLINGS;
+
if (lStyle & wxCLIP_CHILDREN )
ulCreateFlags |= WS_CLIPCHILDREN;
HWND hwnd = (HWND)hWnd;
wxASSERT_MSG( !m_fnOldWndProc, wxT("subclassing window twice?") );
-
wxCHECK_RET(::WinIsWindow(vHabmain, hwnd), wxT("invalid HWND in SubclassWin") );
-
-// wxAssociateWinWithHandle(hwnd, this);
-
m_fnOldWndProc = (WXFARPROC) ::WinSubclassWindow(hwnd, (PFNWP)wxWndProc);
-// ::WinSetWindowULong(hwnd, QWL_USER, (ULONG)wxWndProc);
} // end of wxWindow::SubclassWin
void wxWindow::UnsubclassWin()
{
-// wxRemoveHandleAssociation(this);
-
//
// Restore old Window proc
//
if (m_hWnd)
{
-// m_hWnd = 0;
-
wxCHECK_RET( ::WinIsWindow(vHabmain, hwnd), wxT("invalid HWND in UnsubclassWin") );
PFNWP fnProc = (PFNWP)::WinQueryWindowPtr(hwnd, QWP_PFNWP);
+
if ( (m_fnOldWndProc != 0) && (fnProc != (PFNWP) m_fnOldWndProc))
{
WinSubclassWindow(hwnd, (PFNWP)m_fnOldWndProc);
RECTL vRect;
hWndClient = ::WinWindowFromID(GetHwnd(), FID_CLIENT);
- ::WinQueryWindowRect(hWndClient, &vRect);
+ if( hWndClient == NULLHANDLE)
+ ::WinQueryWindowRect(GetHwnd(), &vRect);
+ else
+ ::WinQueryWindowRect(hWndClient, &vRect);
if (pWidth)
*pWidth = vRect.xRight;
hPs = ::WinGetPS(GetHwnd());
if(!GpiQueryFontMetrics(hPs, sizeof(FONTMETRICS), &vFontMetrics))
+ {
+ ::WinReleasePS(hPs);
return (0);
- else
- return(vFontMetrics.lMaxAscender + vFontMetrics.lMaxDescender);
+ }
::WinReleasePS(hPs);
+ return(vFontMetrics.lMaxAscender + vFontMetrics.lMaxDescender);
} // end of wxWindow::GetCharHeight
int wxWindow::GetCharWidth() const
hPs = ::WinGetPS(GetHwnd());
if(!GpiQueryFontMetrics(hPs, sizeof(FONTMETRICS), &vFontMetrics))
+ {
+ ::WinReleasePS(hPs);
return (0);
- else
- return(vFontMetrics.lAveCharWidth);
+ }
::WinReleasePS(hPs);
+ return(vFontMetrics.lAveCharWidth);
} // end of wxWindow::GetCharWidth
void wxWindow::GetTextExtent(
WXMSG* pMsg
)
{
- return m_acceleratorTable.Translate(m_hWnd, pMsg);
+#if wxUSE_ACCEL
+ return m_acceleratorTable.Translate(m_hWnd, pMsg);
+#else
+ return FALSE;
+#endif //wxUSE_ACCEL
} // end of wxWindow::OS2TranslateMessage
// ---------------------------------------------------------------------------
, WORD* pCmd
)
{
-/*
- *pId = LOWORD(wParam);
- *phWnd = (WXHWND)lParam;
- *pCmd = HIWORD(wParam);
-*/
*pId = LOWORD(wParam);
*phWnd = NULL; // or may be GetHWND() ?
*pCmd = LOWORD(lParam);
WXHICON hIcon;
WXHBRUSH hBrush;
- //
- // The return value
- //
-// union
-// {
-// bool bAllow;
-// MRESULT mResult;
-// WXHICON hIcon;
-// WXHBRUSH hBrush;
-// } vRc;
-
//
// For most messages we should return 0 when we do process the message
//
}
break;
}
-
if (!bProcessed)
{
#ifdef __WXDEBUG__
wxLogTrace(wxTraceMessages, wxT("Forwarding %s to DefWindowProc."),
wxGetMessageName(uMsg));
#endif // __WXDEBUG__
- mResult = OS2DefWindowProc(uMsg, wParam, lParam);
+ if (IsKindOf(CLASSINFO(wxFrame)))
+ mResult = ::WinDefWindowProc(m_hWnd, uMsg, wParam, lParam);
+ else
+ mResult = OS2DefWindowProc(uMsg, wParam, lParam);
}
return mResult;
} // end of wxWindow::OS2WindowProc
long lWidth1 = 20L;
long lHeight1 = 20L;
int nControlId = 0;
+ int nNeedsubclass = 0;
+ PCSZ pszClass = zClass;
//
// Find parent's size, if it exists, to set up a possible default
{
nControlId = ulId;
}
+ else
+ {
+ // no standard controls
+ if(wxString (wxT("wxFrameClass")) == wxString(zClass) )
+ {
+ pszClass = WC_FRAME;
+ nNeedsubclass = 1;
+ }
+ else
+ {
+ nControlId = ulId;
+ if(nControlId < 0)
+ nControlId = FID_CLIENT;
+ }
+ }
//
// We will either have a registered class via string name or a standard PM Class via a long
,(LONG)lY1
,(LONG)lWidth
,(LONG)lHeight
- ,NULLHANDLE
+ ,hOwner
,HWND_TOP
- ,(ULONG)ulId
+ ,(ULONG)nControlId
,pCtlData
,pPresParams
);
//
// Now need to subclass window.
//
-
- SubclassWin(GetHWND());
-
+ if(!nNeedsubclass)
+ {
+ wxAssociateWinWithHandle((HWND)m_hWnd,this);
+ }
+ else
+ {
+ SubclassWin(GetHWND());
+ }
return TRUE;
} // end of wxWindow::OS2Create
wxLogLastError("CreateRectRgn");
return FALSE;
}
+ //
+ // Debug code
+ //
+#ifdef __WXDEBUG__
+ {
+ HWND hWnd;
+ HWND hWnd0 = NULLHANDLE;
+
+ hWnd = GetHwnd();
+ if(hWnd != hWnd0)
+ printf("HandlePaint hWnd=%x ",hWnd);
+ }
+#endif
+
m_updateRegion = wxRegion(hRgn);
-/*
- hPS = WinBeginPaint(GetHWND(), 0L, &vRect);
- WinFillRect(hPS, &vRect, SYSCLR_WINDOW);
- WinEndPaint(hPS);
-*/
vEvent.SetEventObject(this);
return (GetEventHandler()->ProcessEvent(vEvent));
} // end of wxWindow::HandlePaint
// Find the wxWindow at the current mouse position, returning the mouse
// position.
-wxWindow* wxFindWindowAtPointer(wxPoint& pt)
+wxWindow* wxFindWindowAtPointer(
+ wxPoint& rPt
+)
{
return wxFindWindowAtPoint(wxGetMousePosition());
}
-wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
+wxWindow* wxFindWindowAtPoint(
+ const wxPoint& rPt
+)
{
-#if 0
- POINT pt2;
- pt2.x = pt.x;
- pt2.y = pt.y;
- HWND hWndHit = ::WindowFromPoint(pt2);
+ POINTL vPt2;
+
+ vPt2.x = rPt.x;
+ vPt2.y = rPt.y;
- wxWindow* win = wxFindWinFromHandle((WXHWND) hWndHit) ;
- HWND hWnd = hWndHit;
+ HWND hWndHit = ::WinWindowFromPoint(HWND_DESKTOP, &vPt2, FALSE);
+ wxWindow* pWin = wxFindWinFromHandle((WXHWND)hWndHit) ;
+ HWND hWnd = hWndHit;
+ //
// Try to find a window with a wxWindow associated with it
- while (!win && (hWnd != 0))
+ //
+ while (!pWin && (hWnd != 0))
{
- hWnd = ::GetParent(hWnd);
- win = wxFindWinFromHandle((WXHWND) hWnd) ;
+ hWnd = ::WinQueryWindow(hWnd, QW_PARENT);
+ pWin = wxFindWinFromHandle((WXHWND)hWnd) ;
}
- return win;
-#endif
- return (wxWindow*)NULL;
+ return pWin;
}
// Get the current mouse position.
wxPoint wxGetMousePosition()
{
-#if 0
- POINT pt;
- GetCursorPos( & pt );
- return wxPoint(pt.x, pt.y);
-#endif
- return wxPoint(0,0);
+ POINTL vPt;
+
+ ::WinQueryPointerPos(HWND_DESKTOP, &vPt);
+ return wxPoint(vPt.x, vPt.y);
}