diff --git a/include/wx/os2/notebook.h b/include/wx/os2/notebook.h index 68fc28013b..4adaa2c64f 100644 --- a/include/wx/os2/notebook.h +++ b/include/wx/os2/notebook.h @@ -189,9 +189,6 @@ protected: // // Helper functions // - void ChangePage( int nOldSel - ,int nSel - ); // change pages int m_nSelection; // The current selection (-1 if none) diff --git a/include/wx/os2/textctrl.h b/include/wx/os2/textctrl.h index 8770ddbda2..9eb7c15000 100644 --- a/include/wx/os2/textctrl.h +++ b/include/wx/os2/textctrl.h @@ -30,6 +30,7 @@ public: { Create(pParent, vId, rsValue, rPos, rSize, lStyle, rValidator, rsName); } + ~wxTextCtrl(); bool Create( wxWindow* pParent ,wxWindowID vId @@ -154,12 +155,16 @@ public: void OnPaste(wxCommandEvent& rEvent); void OnUndo(wxCommandEvent& rEvent); void OnRedo(wxCommandEvent& rEvent); + void OnDelete(wxCommandEvent& rEvent); + void OnSelectAll(wxCommandEvent& rEvent); void OnUpdateCut(wxUpdateUIEvent& rEvent); void OnUpdateCopy(wxUpdateUIEvent& rEvent); void OnUpdatePaste(wxUpdateUIEvent& rEvent); void OnUpdateUndo(wxUpdateUIEvent& rEvent); void OnUpdateRedo(wxUpdateUIEvent& rEvent); + void OnUpdateDelete(wxUpdateUIEvent& rEvent); + void OnUpdateSelectAll(wxUpdateUIEvent& rEvent); inline bool IsMLE(void) {return m_bIsMLE;} inline void SetMLE(bool bIsMLE) {m_bIsMLE = bIsMLE;} diff --git a/src/os2/app.cpp b/src/os2/app.cpp index 1024579bb0..4d47ed1550 100644 --- a/src/os2/app.cpp +++ b/src/os2/app.cpp @@ -613,7 +613,7 @@ int wxEntry( { if (wxTheApp->OnInit()) { - nRetValue = wxTheApp->OnRun(); + wxTheApp->OnRun(); } // Normal exit wxWindow* pTopWindow = wxTheApp->GetTopWindow(); @@ -641,7 +641,7 @@ int wxEntry( printf("wxTheApp->OnExit "); fflush(stdout); #endif - wxTheApp->OnExit(); + nRetValue = wxTheApp->OnExit(); #if wxUSE_CONSOLEDEBUG printf("wxApp::CleanUp "); fflush(stdout); diff --git a/src/os2/combobox.cpp b/src/os2/combobox.cpp index 038fa35ec5..867815ccdf 100644 --- a/src/os2/combobox.cpp +++ b/src/os2/combobox.cpp @@ -173,37 +173,8 @@ void wxComboBox::SetValue( const wxString& rsValue ) { - // - // If newlines are denoted by just 10, must stick 13 in front. - // - int nSingletons = 0; - int nLen = rsValue.Length(); - int i; - - for (i = 0; i < nLen; i ++) - { - if ((i > 0) && (rsValue[i] == 10) && (rsValue[i - 1] != 13)) - nSingletons ++; - } - if (nSingletons > 0) - { - wxChar* zTmp = new wxChar[nLen + nSingletons + 1]; - int j = 0; - - for (i = 0; i < nLen; i ++) - { - if ((i > 0) && (rsValue[i] == 10) && (rsValue[i - 1] != 13)) - { - zTmp[j] = 13; - j++; - } - zTmp[j] = rsValue[i]; - j++; - } - zTmp[j] = 0; - ::WinSetWindowText(GetHwnd(), zTmp); - delete[] zTmp; - } + if ( HasFlag(wxCB_READONLY) ) + SetStringSelection(rsValue); else ::WinSetWindowText(GetHwnd(), rsValue.c_str()); } // end of wxComboBox::SetValue diff --git a/src/os2/notebook.cpp b/src/os2/notebook.cpp index dbf582f6d4..d8b8a7c8be 100644 --- a/src/os2/notebook.cpp +++ b/src/os2/notebook.cpp @@ -212,19 +212,33 @@ int wxNotebook::SetSelection( ) { wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, wxT("notebook page out of range") ); - int nOldPage = GetSelection(); - ChangePage( m_nSelection - ,nPage - ); + if (nPage != m_nSelection) + { + wxNotebookEvent event( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING + ,m_windowId + ); + vEvent.SetSelection(nPage); + vEvent.SetOldSelection(m_nSelection); + vEvent.SetEventObject(this); + if (!GetEventHandler()->ProcessEvent(vEvent) || vEvent.IsAllowed()) + { + + // + // Program allows the page change + // + vEvent.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED); + GetEventHandler()->ProcessEvent(vEvent); - ULONG ulPageId = (ULONG)m_alPageId[nPage]; + ULONG ulPageId = (ULONG)m_alPageId[nPage]; - ::WinSendMsg( GetHWND() - ,BKM_TURNTOPAGE - ,MPFROMLONG((ULONG)m_alPageId[nPage]) - ,(MPARAM)0 - ); + ::WinSendMsg( GetHWND() + ,BKM_TURNTOPAGE + ,MPFROMLONG((ULONG)m_alPageId[nPage]) + ,(MPARAM)0 + ); + } + } m_nSelection = nPage; return nPage; } // end of wxNotebook::SetSelection @@ -891,56 +905,5 @@ bool wxNotebook::OS2OnScroll ( ); } // end of wxNotebook::OS2OnScroll -// ---------------------------------------------------------------------------- -// wxNotebook helper functions -// ---------------------------------------------------------------------------- - -// -// Generate the page changing and changed events, hide the currently active -// panel and show the new one -// -void wxNotebook::ChangePage ( - int nOldSel -, int nSel -) -{ - static bool sbInsideChangePage = FALSE; - - // - // When we call ProcessEvent(), our own OnSelChange() is called which calls - // this function - break the infinite loop - // - if (sbInsideChangePage) - return; - - // - // It's not an error (the message may be generated by the tab control itself) - // and it may happen - just do nothing - // - if (nSel == nOldSel) - return; - - sbInsideChangePage = TRUE; - - wxNotebookEvent rEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING - ,m_windowId - ); - - rEvent.SetSelection(nSel); - rEvent.SetOldSelection(nOldSel); - rEvent.SetEventObject(this); - if (GetEventHandler()->ProcessEvent(rEvent) && !rEvent.IsAllowed()) - { - // - // Program doesn't allow the page change - // - sbInsideChangePage = FALSE; - return; - } - rEvent.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED); - GetEventHandler()->ProcessEvent(rEvent); - sbInsideChangePage = FALSE; -} // end of wxNotebook::ChangePage - #endif // wxUSE_NOTEBOOK diff --git a/src/os2/radiobut.cpp b/src/os2/radiobut.cpp index 7912d9c7e3..76e9a65dde 100644 --- a/src/os2/radiobut.cpp +++ b/src/os2/radiobut.cpp @@ -224,6 +224,63 @@ void wxRadioButton::SetValue( ) { ::WinSendMsg((HWND)GetHWND(), BM_SETCHECK, (MPARAM)bValue, (MPARAM)0); + if (bValue) + { + const wxWindowList& rSiblings = GetParent()->GetChildren(); + wxWindowList::Node* pNodeThis = rSiblings.Find(this); + + wxCHECK_RET(pNodeThis, _T("radio button not a child of its parent?")); + + // + // Turn off all radio buttons before this one + // + for ( wxWindowList::Node* pNodeBefore = pNodeThis->GetPrevious(); + pNodeBefore; + pNodeBefore = pNodeBefore->GetPrevious() ) + { + wxRadioButton* pBtn = wxDynamicCast( pNodeBefore->GetData() + ,wxRadioButton + ); + if (!pBtn) + { + // + // The radio buttons in a group must be consecutive, so there + // are no more of them + // + break; + } + pBtn->SetValue(FALSE); + if (pBtn->HasFlag(wxRB_GROUP)) + { + // + // Even if there are other radio buttons before this one, + // they're not in the same group with us + // + break; + } + } + + // + // ... and all after this one + // + for (wxWindowList::Node* pNodeAfter = pNodeThis->GetNext(); + pNodeAfter; + pNodeAfter = pNodeAfter->GetNext()) + { + wxRadioButton* pBtn = wxDynamicCast( pNodeAfter->GetData() + ,wxRadioButton + ); + + if (!pBtn || pBtn->HasFlag(wxRB_GROUP) ) + { + // + // No more buttons or the first button of the next group + // + break; + } + pBtn->SetValue(FALSE); + } + } } // end of wxRadioButton::SetValue MRESULT wxRadioButton::OS2WindowProc(