From 6e348b12dcc7f994da8c2552b80d60140578a745 Mon Sep 17 00:00:00 2001 From: David Webster Date: Thu, 17 Apr 2003 15:47:35 +0000 Subject: [PATCH] More OS/2 updates reflecting changes in 24 Branch git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20248 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/os2/spinctrl.h | 1 + src/os2/cursor.cpp | 4 +++ src/os2/makefile.va | 4 +-- src/os2/radiobut.cpp | 54 ++++++++++++++++++++++----------------- src/os2/scrolbar.cpp | 1 + src/os2/spinctrl.cpp | 14 ++++++++++ src/os2/stattext.cpp | 24 +++++++++++++++++ src/os2/textctrl.cpp | 9 +++++++ src/os2/toplevel.cpp | 2 +- src/os2/window.cpp | 4 ++- src/os2/wx25.def | 4 ++- 11 files changed, 92 insertions(+), 29 deletions(-) diff --git a/include/wx/os2/spinctrl.h b/include/wx/os2/spinctrl.h index bcda821de6..5a0983870b 100644 --- a/include/wx/os2/spinctrl.h +++ b/include/wx/os2/spinctrl.h @@ -115,6 +115,7 @@ protected: // void OnSpinChange(wxSpinEvent& rEvent); void OnChar(wxKeyEvent& rEvent); + void OnSetFocus(wxFocusEvent& rEvent); WXHWND m_hWndBuddy; static wxArraySpins m_svAllSpins; diff --git a/src/os2/cursor.cpp b/src/os2/cursor.cpp index be4238b9b2..a3dddf55b8 100644 --- a/src/os2/cursor.cpp +++ b/src/os2/cursor.cpp @@ -310,6 +310,10 @@ wxCursor::wxCursor( ); break; } + // + // No need to destroy the stock cursors + // + ((wxCursorRefData *)m_refData)->m_bDestroyCursor = FALSE; } // end of wxCursor::wxCursor // Global cursor setting diff --git a/src/os2/makefile.va b/src/os2/makefile.va index f34ff5ebaa..6b662e3db8 100644 --- a/src/os2/makefile.va +++ b/src/os2/makefile.va @@ -1163,9 +1163,9 @@ clean: $(PERIPH_CLEAN_TARGET) clean_png clean_zlib clean_jpeg clean_tiff rd ..\common\$D rd ..\html\$D rd ..\os2\$D - del $(LIBTARGET) + del ..\lib\wx.lib !if "$(WXMAKINGDLL)" == "1" - erase /N ..\..\lib\wx25.lib + del ..\lib\wx25.lib !endif cleanall: clean diff --git a/src/os2/radiobut.cpp b/src/os2/radiobut.cpp index 540bb7deff..8d1b543ad8 100644 --- a/src/os2/radiobut.cpp +++ b/src/os2/radiobut.cpp @@ -227,36 +227,42 @@ void wxRadioButton::SetValue( 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() ) + // If it's not the first item of the group ... + // + if ( !HasFlag(wxRB_GROUP) ) { - wxRadioButton* pBtn = wxDynamicCast( pNodeBefore->GetData() + // + // ...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; + 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(); @@ -269,7 +275,7 @@ void wxRadioButton::SetValue( if (!pBtn || pBtn->HasFlag(wxRB_GROUP) ) { - // + // // No more buttons or the first button of the next group // break; diff --git a/src/os2/scrolbar.cpp b/src/os2/scrolbar.cpp index a27773d308..8b88e4078c 100644 --- a/src/os2/scrolbar.cpp +++ b/src/os2/scrolbar.cpp @@ -226,6 +226,7 @@ bool wxScrollBar::OS2OnScroll ( ,m_windowId ); + vEvent.SetOrientation(IsVertical() ? wxVERTICAL : wxHORIZONTAL); vEvent.SetPosition(nPosition); vEvent.SetEventObject(this); return GetEventHandler()->ProcessEvent(vEvent); diff --git a/src/os2/spinctrl.cpp b/src/os2/spinctrl.cpp index d526cfa43f..d5fb52d270 100644 --- a/src/os2/spinctrl.cpp +++ b/src/os2/spinctrl.cpp @@ -49,7 +49,9 @@ wxArraySpins wxSpinCtrl::m_svAllSpins; IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl) BEGIN_EVENT_TABLE(wxSpinCtrl, wxSpinButton) + EVT_CHAR(wxSpinCtrl::OnChar) EVT_SPIN(-1, wxSpinCtrl::OnSpinChange) + EVT_SET_FOCUS(wxSpinCtrl::OnSetFocus) END_EVENT_TABLE() // ---------------------------------------------------------------------------- // constants @@ -404,6 +406,18 @@ void wxSpinCtrl::OnSpinChange( } } // end of wxSpinCtrl::OnSpinChange +void wxSpinCtrl::OnSetFocus ( + wxFocusEvent& rEvent +) +{ + // + // When we get focus, give it to our buddy window as it needs it more than + // we do + // + ::WinSetFocus(HWND_DESKTOP, (HWND)m_hWndBuddy); + rEvent.Skip(); +} // end of wxSpinCtrl::OnSetFocus + bool wxSpinCtrl::ProcessTextCommand( WXWORD wCmd , WXWORD wId diff --git a/src/os2/stattext.cpp b/src/os2/stattext.cpp index 167caa3e86..d5cfd5c9e4 100644 --- a/src/os2/stattext.cpp +++ b/src/os2/stattext.cpp @@ -121,6 +121,7 @@ wxSize wxStaticText::DoGetBestSize() const int nHeightLineDefault = 0; int nHeightLine = 0; wxString sCurLine; + bool bLastWasAmpersand = FALSE; for (const wxChar *pc = sText; ; pc++) { @@ -161,6 +162,29 @@ wxSize wxStaticText::DoGetBestSize() const } else { + // + // We shouldn't take into account the '&' which just introduces the + // mnemonic characters and so are not shown on the screen -- except + // when it is preceded by another '&' in which case it stands for a + // literal ampersand + // + if (*pc == _T('&')) + { + if (!bLastWasAmpersand) + { + bLastWasAmpersand = TRUE; + + // + // Skip the statement adding pc to curLine below + // + continue; + } + + // + // It is a literal ampersand + // + bLastWasAmpersand = FALSE; + } sCurLine += *pc; } } diff --git a/src/os2/textctrl.cpp b/src/os2/textctrl.cpp index 3b2b97719a..679d0fa248 100644 --- a/src/os2/textctrl.cpp +++ b/src/os2/textctrl.cpp @@ -507,6 +507,15 @@ void wxTextCtrl::SetInsertionPointEnd() { long lPos = GetLastPosition(); + // + // We must not do anything if the caret is already there because calling + // SetInsertionPoint() thaws the controls if Freeze() had been called even + // if it doesn't actually move the caret anywhere and so the simple fact of + // doing it results in horrible flicker when appending big amounts of text + // to the control in a few chunks (see DoAddText() test in the text sample) + // + if (GetInsertionPoint() == GetLastPosition()) + return; SetInsertionPoint(lPos); } // end of wxTextCtrl::SetInsertionPointEnd diff --git a/src/os2/toplevel.cpp b/src/os2/toplevel.cpp index 4b3857b386..3fbed4f755 100644 --- a/src/os2/toplevel.cpp +++ b/src/os2/toplevel.cpp @@ -801,7 +801,7 @@ void wxTopLevelWindowOS2::Maximize( // We can't maximize the hidden frame because it shows it as well, so // just remember that we should do it later in this case // - m_bMaximizeOnShow = TRUE; + m_bMaximizeOnShow = bMaximize; } } // end of wxTopLevelWindowOS2::Maximize diff --git a/src/os2/window.cpp b/src/os2/window.cpp index 25610ad248..e99ecaa4d2 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -3513,7 +3513,9 @@ bool wxWindowOS2::HandleCreate( bool wxWindowOS2::HandleDestroy() { - SendDestroyEvent(); + wxWindowDestroyEvent vEvent((wxWindow*)this); + vEvent.SetId(GetId()); + (void)GetEventHandler()->ProcessEvent(vEvent); // // Delete our drop target if we've got one diff --git a/src/os2/wx25.def b/src/os2/wx25.def index 70a327186f..e8199fef0c 100644 --- a/src/os2/wx25.def +++ b/src/os2/wx25.def @@ -4,7 +4,7 @@ DATA MULTIPLE NONSHARED READWRITE LOADONCALL CODE LOADONCALL EXPORTS -;From library: H:\DEV\WX2\WXWINDOWS\lib\wx.lib +;From library: H:\DEV\WX2\WXWINDOWS\LIB\wx.lib ;From object file: dummy.cpp ;PUBDEFs (Symbols available from object file): wxDummyChar @@ -13090,6 +13090,8 @@ EXPORTS SetFocus__10wxSpinCtrlFv ;wxSpinCtrl::SetValue(const wxString&) SetValue__10wxSpinCtrlFRC8wxString + ;wxSpinCtrl::OnSetFocus(wxFocusEvent&) + OnSetFocus__10wxSpinCtrlFR12wxFocusEvent ;wxSpinCtrl::sm_classwxSpinCtrl sm_classwxSpinCtrl__10wxSpinCtrl ;wxSpinCtrl::m_svAllSpins -- 2.45.2