Update of /cvsroot/simspark/simspark/contrib/rsgedit
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv31114
Modified Files:
sparkcontext.cpp sparkcontext.h
Log Message:
- use SparkContextEvent to notify about state changes
Index: sparkcontext.h
===================================================================
RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/sparkcontext.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** sparkcontext.h 15 Apr 2007 10:50:12 -0000 1.2
--- sparkcontext.h 15 Apr 2007 11:17:10 -0000 1.3
***************
*** 29,32 ****
--- 29,34 ----
}
+ class wxEvtHandler;
+
class SparkContext
{
***************
*** 39,47 ****
--- 41,59 ----
void ResetSelection();
+ void SetEventHandler(wxEvtHandler* handler, int id);
+ wxEvtHandler* GetEventHandler();
+ int GetEventId();
+
private:
SparkContext();
protected:
+ //! the current selection
boost::weak_ptr<zeitgeist::Leaf> mSelectedNode;
+
+ //! assigned event notification target
+ wxEvtHandler* mEventHandler;
+ int mEventId;
+
};
Index: sparkcontext.cpp
===================================================================
RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/sparkcontext.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** sparkcontext.cpp 15 Apr 2007 10:50:12 -0000 1.2
--- sparkcontext.cpp 15 Apr 2007 11:17:08 -0000 1.3
***************
*** 19,22 ****
--- 19,23 ----
*/
#include "sparkcontext.h"
+ #include "sparkcontextevent.h"
using namespace zeitgeist;
***************
*** 24,27 ****
--- 25,29 ----
SparkContext::SparkContext()
+ : mEventHandler(0), mEventId(1)
{
}
***************
*** 40,43 ****
--- 42,53 ----
{
mSelectedNode = node;
+
+ if (mEventHandler == 0)
+ {
+ return;
+ }
+
+ SparkContextEvent event(mEventId,SparkContextEvent::T_SELECTION_CHANGED);
+ wxPostEvent(mEventHandler,event);
}
***************
*** 49,53 ****
void SparkContext::ResetSelection()
{
! mSelectedNode.reset();
}
--- 59,78 ----
void SparkContext::ResetSelection()
{
! SetSelection(weak_ptr<Leaf>());
}
+ void SparkContext::SetEventHandler(wxEvtHandler* handler, int id)
+ {
+ mEventHandler = handler;
+ mEventId = id;
+ }
+
+ wxEvtHandler* SparkContext::GetEventHandler()
+ {
+ return mEventHandler;
+ }
+
+ int SparkContext::GetEventId()
+ {
+ return mEventId;
+ }
|