X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/776d87d504387377f87033b2ade9a2da0b819c17..3b59cdbfaf7df79499424c92ff6177736429ff8a:/src/os2/window.cpp diff --git a/src/os2/window.cpp b/src/os2/window.cpp index fb16810ccc..088db7e071 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -109,9 +109,7 @@ wxWindow *wxFindWinFromHandle(WXHWND hWnd); // event tables // --------------------------------------------------------------------------- -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase) -#endif BEGIN_EVENT_TABLE(wxWindow, wxWindowBase) EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground) @@ -309,41 +307,80 @@ bool wxWindow::Create( void wxWindow::SetFocus() { - // TODO: + HWND hWnd = GetHwnd(); + + if (hWnd) + ::WinSetFocus(HWND_DESKTOP, hWnd); } wxWindow* wxWindowBase::FindFocus() { - wxWindow* window = NULL; - // TODO: - return(window); + HWND hWnd = ::WinQueryFocus(HWND_DESKTOP); + + if (hWnd) + { + return wxFindWinFromHandle((WXHWND)hWnd); + } + return NULL; } -bool wxWindow::Enable(bool enable) // check if base implementation is OK +bool wxWindow::Enable( + bool bEnable +) { - // TODO: + if (!wxWindowBase::Enable(bEnable)) + return(FALSE); + + HWND hWnd = GetHwnd(); + + if ( hWnd ) + ::WinEnableWindow(hWnd, (BOOL)bEnable); + + wxWindowList::Node* pNode = GetChildren().GetFirst(); + + while (pNode) + { + wxWindow* pChild = pNode->GetData(); + + pChild->Enable(bEnable); + pNode = pNode->GetNext(); + } return(TRUE); } -bool wxWindow::Show(bool show) // check if base implementation is OK +bool wxWindow::Show( + bool bShow +) { - // TODO: + if (!wxWindowBase::Show(bShow)) + return(FALSE); + + HWND hWnd = GetHwnd(); + + ::WinShowWindow(hWnd, bShow); + + if (bShow) + { + ::WinSetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE); + } return(TRUE); } void wxWindow::Raise() { - // TODO: + ::WinSetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_ACTIVATE); } void wxWindow::Lower() { - // TODO: + ::WinSetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_DEACTIVATE); } -void wxWindow::SetTitle( const wxString& title) +void wxWindow::SetTitle( + const wxString& rTitle +) { -// TODO: SetWindowText(GetHwnd(), title.c_str()); + ::WinSetWindowText(GetHwnd(), rTitle.c_str()); } wxString wxWindow::GetTitle() const @@ -353,24 +390,77 @@ wxString wxWindow::GetTitle() const void wxWindow::CaptureMouse() { - // TODO: + HWND hWnd = GetHwnd(); + + if (hWnd && !m_bWinCaptured) + { + ::WinSetCapture(HWND_DESKTOP, hWnd); + m_bWinCaptured = TRUE; + } } void wxWindow::ReleaseMouse() { - // TODO: + if ( m_bWinCaptured ) + { + ::WinSetCapture(HWND_DESKTOP, NULLHANDLE); + m_bWinCaptured = FALSE; + } } -bool wxWindow::SetFont(const wxFont& f) +bool wxWindow::SetFont( + const wxFont& rFont +) { - // TODO: + if (!wxWindowBase::SetFont(rFont)) + { + // nothing to do + return(FALSE); + } + + HWND hWnd = GetHwnd(); + + if (hWnd != 0) + { + wxChar zFont[128]; + + sprintf(zFont, "%d.%s", rFont.GetPointSize(), rFont.GetFaceName().c_str()); + return(::WinSetPresParam(hWnd, PP_FONTNAMESIZE, strlen(zFont), (PVOID)zFont)); + } return(TRUE); } -bool wxWindow::SetCursor(const wxCursor& cursor) // check if base implementation is OK +bool wxWindow::SetCursor( + const wxCursor& rCursor +) // check if base implementation is OK { - // TODO: - return(TRUE); + if ( !wxWindowBase::SetCursor(rCursor)) + { + // no change + return FALSE; + } + + wxASSERT_MSG( m_cursor.Ok(), + wxT("cursor must be valid after call to the base version")); + + HWND hWnd = GetHwnd(); + POINTL vPoint; + RECTL vRect; + HPS hPS; + HRGN hRGN; + + hPS = ::WinGetPS(hWnd); + + ::WinQueryPointerPos(HWND_DESKTOP, &vPoint); + ::WinQueryWindowRect(hWnd, &vRect); + + hRGN = ::GpiCreateRegion(hPS, 1L, &vRect); + + if ((::GpiPtInRegion(hPS, hRGN, &vPoint) == PRGN_INSIDE) && !wxIsBusy()) + { +// ::SetCursor((HCURSOR)m_cursor.GetHCURSOR()); + } + return TRUE; } void wxWindow::WarpPointer(int x_pos, int y_pos) @@ -531,7 +621,7 @@ WXDWORD wxWindow::MakeExtendedStyle(long style, bool eliminateBorders) WXDWORD wxWindow::Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D) const { - DWORD exStyle; // remove after implementation doe + DWORD exStyle = 0L; // remove after implementation doe /* TODO: this ought to be fun * // If matches certain criteria, then assume no 3D effects @@ -722,12 +812,6 @@ void wxWindow::DoSetSize(int x, int y, // TODO: } -// for a generic window there is no natural best size - just use the current one -wxSize wxWindow::DoGetBestSize() -{ - return GetSize(); -} - void wxWindow::DoSetClientSize(int width, int height) { // TODO: @@ -891,7 +975,7 @@ void wxWindow::UnpackMenuSelect(WXWPARAM wParam, WXLPARAM lParam, wxWindow *wxWndHook = NULL; // Main window proc -MRESULT wxWndProc(HWND hWnd, UINT message, MPARAM wParam, MPARAM lParam) +MRESULT wxWndProc(HWND hWnd, ULONG message, MPARAM wParam, MPARAM lParam) { // trace all messages - useful for the debugging #ifdef __WXDEBUG__