#if wxUSE_MENUS
+ // Column Menu
menu =new wxMenu;
wxMenuItem* m1=menu->Append(wxID_ANY, _T("&Sort ascending"));
wxMenuItem* m2=menu->Append(wxID_ANY, _T("&Sort descending"));
Connect( mAscendingID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnPopupSort) );
Connect( mDescendingID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnPopupSort) );
Connect( mFilterID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnPopupFilter) );
+
+
+
+ //ItemMenu
+ menuItem =new wxMenu;
+ wxMenuItem* m1Item=menuItem->Append(wxID_ANY, _T("&Anonymize"));
+ wxMenuItem* m2Item=menuItem->Append(wxID_ANY, _T("&Local Copy"));
+
+ mAnonymizingID=m1Item->GetId();
+ mLocalCopyID=m2Item->GetId();
+ //Connect( mAnonymizingID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnAnonymize) );
+ //Connect( mLocalCopyID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnLocalCopy) );
+
#endif // wxUSE_MENUS
PopupMenu(menu, clientpt);
}
+
+ void WxTreeView::OnItemMenu(wxListEvent &event)
+ {
+ wxPoint clientpt;
+ clientpt.x = wxGetMousePosition().x - this->GetScreenPosition().x;
+ clientpt.y = wxGetMousePosition().y - this->GetScreenPosition().y;
+ senderCtrl = event.GetEventObject();
+ unsigned int level = 0;
+ for (level = 0; level<mLevelList.size(); ++level)
+ {
+ if ( GetCtrl(level) == senderCtrl ) break;
+ }
+ PopupMenu(menuItem, clientpt);
+ }
+
//================================================================
//================================================================
*/
EVT_LIST_KEY_DOWN(-1, WxTreeView::OnKeyDown)
EVT_LIST_ITEM_SELECTED(-1, WxTreeView::OnItemSelected)
-
+ EVT_LIST_ITEM_RIGHT_CLICK(-1, WxTreeView::OnItemMenu)
EVT_LIST_ITEM_DESELECTED(-1, WxTreeView::OnItemDeSelected)
/*
EVT_LIST_KEY_DOWN(LIST_CTRL, MyListCtrl::OnListKeyDown)
///Callback on mouse click
void OnMouseClick(wxMouseEvent& event);
+
+ // Display a menu for items
+ void OnItemMenu(wxListEvent &event);
/// Actual processing of item selection/deselection
/// Called by OnItemSelected and OnItemDeSelected
std::vector<std::string> mColorPalette;
wxMenu* menu;
+
wxObject* senderCtrl;
int mAscendingID;
int mDescendingID;
int mFilterID;
unsigned int mLastLevel;
+ wxMenu* menuItem;
+ int mAnonymizingID;
+ int mLocalCopyID;
// If set to true then OnSelectedChanged returns immediately.
// Used to do avoid useless process during multiple selections
// or sorting