From: Markus R. <rol...@us...> - 2007-04-29 15:32:40
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv21044 Modified Files: Tag: RSGEDIT_FILEREF sparkcontext.cpp sparkcontext.h Log Message: - added member mContextNode - added method GetContextMenu() and GetContextNode() Index: sparkcontext.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/sparkcontext.h,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** sparkcontext.h 15 Apr 2007 11:17:10 -0000 1.3 --- sparkcontext.h 29 Apr 2007 15:32:36 -0000 1.3.2.1 *************** *** 30,33 **** --- 30,34 ---- class wxEvtHandler; + class wxMenu; class SparkContext *************** *** 45,48 **** --- 46,52 ---- int GetEventId(); + wxMenu* GetContextMenu(boost::weak_ptr<zeitgeist::Leaf> leaf); + boost::weak_ptr<zeitgeist::Leaf> GetContextNode() const; + private: SparkContext(); *************** *** 52,55 **** --- 56,62 ---- boost::weak_ptr<zeitgeist::Leaf> mSelectedNode; + //! the node that context menu commands refer to + boost::weak_ptr<zeitgeist::Leaf> mContextNode; + //! assigned event notification target wxEvtHandler* mEventHandler; Index: sparkcontext.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/sparkcontext.cpp,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** sparkcontext.cpp 15 Apr 2007 11:17:08 -0000 1.3 --- sparkcontext.cpp 29 Apr 2007 15:32:36 -0000 1.3.2.1 *************** *** 20,23 **** --- 20,26 ---- #include "sparkcontext.h" #include "sparkcontextevent.h" + #include "constants.h" + #include <wx/menu.h> + #include <zeitgeist/leaf.h> using namespace zeitgeist; *************** *** 77,78 **** --- 80,103 ---- return mEventId; } + + wxMenu* SparkContext::GetContextMenu(weak_ptr<Leaf> leaf) + { + if (leaf.expired()) + { + assert(false); + return 0; + } + + mContextNode = leaf; + + long style = 0; + wxMenu* menu(new wxMenu(leaf.lock()->GetFullPath(), 0)); + menu->Append(ID_CONTEXT_PROPERTIES, wxT("&Properties")); + + return menu; + } + + weak_ptr<Leaf> SparkContext::GetContextNode() const + { + return mContextNode; + } |