diff --git a/docs/changes.txt b/docs/changes.txt index 6c080eb811..c4605bcd8b 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -582,6 +582,10 @@ All: - Fix silent data loss in wx[F]File::Write(wxString) if conversion fails. - Make wxString::FromCDouble() work when the global C++ locale is not the C one. +All (GUI): + +- Add wxGenericListCtrl::EndEditLabel() (Tim Kosse). + wxGTK: - Fix mouse handling in wxNotebook containing wxListCtrl (Charlie Fenton). diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index 7e18eeccbf..a7bdebf6e3 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -120,6 +120,12 @@ public: wxTextCtrl *EditLabel(long item, wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl)); + + // End label editing, optionally cancelling the edit +#if wxABI_VERSION >= 30002 + bool EndEditLabel(bool cancel); +#endif + wxTextCtrl* GetEditControl() const; void Edit( long item ) { EditLabel(item); } diff --git a/include/wx/generic/private/listctrl.h b/include/wx/generic/private/listctrl.h index 32afaada6f..5cd210f486 100644 --- a/include/wx/generic/private/listctrl.h +++ b/include/wx/generic/private/listctrl.h @@ -564,6 +564,9 @@ public: // start editing the label of the given item wxTextCtrl *EditLabel(long item, wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl)); + + bool EndEditLabel(bool cancel); + wxTextCtrl *GetEditControl() const { return m_textctrlWrapper ? m_textctrlWrapper->GetText() : NULL; diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index f4d5fffc28..16c2ed6276 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -2260,6 +2260,17 @@ wxTextCtrl *wxListMainWindow::EditLabel(long item, wxClassInfo* textControlClass return m_textctrlWrapper->GetText(); } +bool wxListMainWindow::EndEditLabel(bool cancel) +{ + if (!m_textctrlWrapper) + { + return false; + } + + m_textctrlWrapper->EndEdit(cancel ? wxListTextCtrlWrapper::End_Discard : wxListTextCtrlWrapper::End_Accept); + return true; +} + void wxListMainWindow::OnRenameTimer() { wxCHECK_RET( HasCurrent(), wxT("unexpected rename timer") ); @@ -5070,6 +5081,13 @@ wxTextCtrl *wxGenericListCtrl::EditLabel(long item, return m_mainWin->EditLabel( item, textControlClass ); } +#if wxABI_VERSION >= 30002 +bool wxGenericListCtrl::EndEditLabel(bool cancel) +{ + return m_mainWin->EndEditLabel(cancel); +} +#endif + wxTextCtrl *wxGenericListCtrl::GetEditControl() const { return m_mainWin->GetEditControl(); diff --git a/version-script.in b/version-script.in index 858bed2804..aa4493a3d8 100644 --- a/version-script.in +++ b/version-script.in @@ -29,6 +29,11 @@ *wxTDIChildFrame*DoMoveWindow*; }; +# public symbols added in 3.0.2 (please keep in alphabetical order): +@WX_VERSION_TAG@.2 { + *wxGenericListCtrl*EndEditLabel*; +}; + # symbols available since the beginning of this branch are only given # generic branch tag (don't remove this!):