From 2b2739754f76da41764a922b4bb35b420d703956 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 24 Oct 1999 00:30:53 +0000 Subject: [PATCH] 1. compilation fix for wxArrayTreeItemIds 2. small bug fixes for recent fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4154 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/treectrl.h | 2 +- src/common/docview.cpp | 13 ++++++++++--- src/msw/choice.cpp | 7 ++++++- src/msw/listbox.cpp | 1 + 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/include/wx/msw/treectrl.h b/include/wx/msw/treectrl.h index c143a0b..48881c4 100644 --- a/include/wx/msw/treectrl.h +++ b/include/wx/msw/treectrl.h @@ -122,7 +122,7 @@ protected: long m_itemId; }; -WX_DEFINE_EXPORTED_ARRAY(wxTreeItemId, wxArrayTreeItemIds); +WX_DEFINE_EXPORTED_ARRAY(WXHTREEITEM, wxArrayTreeItemIds); // ---------------------------------------------------------------------------- // wxTreeItemData is some (arbitrary) user class associated with some item. The diff --git a/src/common/docview.cpp b/src/common/docview.cpp index e21cda1..93f4e5e 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -1909,9 +1909,6 @@ void wxFileHistory::RemoveFileFromHistory(int i) { wxMenu* menu = (wxMenu*) node->Data(); - // delete the menu items - menu->Delete(wxID_FILE1 + i); - // delete the element from the array (could use memmove() too...) delete [] m_fileHistory[i]; @@ -1930,7 +1927,17 @@ void wxFileHistory::RemoveFileFromHistory(int i) } node = node->Next(); + + // delete the last menu item which is unused now + menu->Delete(wxID_FILE1 + m_fileHistoryN - 1); + + // unfortunately, we can't delete separator (there is no function to + // delete item by position, only by id - and what if there are several + // separators in this menu?) - so we will be always left with at least + // one and, even worse, we will add another one if this was the last + // file... (FIXME) } + m_fileHistoryN--; } diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index 9c7c335..c6a9f79 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -317,10 +317,15 @@ bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) return FALSE; } + int n = GetSelection(); wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId); - event.SetInt(GetSelection()); + event.SetInt(n); event.SetEventObject(this); event.SetString(GetStringSelection()); + if ( HasClientObjectData() ) + event.SetClientObject( GetClientObject(n) ); + else if ( HasClientUntypedData() ) + event.SetClientData( GetClientData(n) ); ProcessCommand(event); return TRUE; diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index 71d0b7c..9851873 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -357,6 +357,7 @@ void wxListBox::Clear() } void wxListBox::Free() +{ #if wxUSE_OWNER_DRAWN size_t uiCount = m_aItems.Count(); while ( uiCount-- != 0 ) { -- 2.7.4