CEvent Class Reference
[GUI Utility Classes and Modules]

Search Toolkit Book for CEvent

#include <event.hpp>

Inheritance diagram for CEvent:

Inheritance graph
[legend]
Collaboration diagram for CEvent:

Collaboration graph
[legend]
List of all members.

Detailed Description

CEvent - generic event implementation TODO TODO - Attachments.

Definition at line 85 of file event.hpp.

Public Types

typedef const char * TEventTypeInfo
typedef CRef< CEventTEventObject
typedef Int4 TEventID
typedef CEventHandler TEventSender
typedef Int4 TEventRefs
typedef std::type_info TAttachmentTypeInfo
typedef EEventClass TEventClass
enum  EEventClass { eEvent_Message, eEvent_Command, eEvent_CommandUpdate }
 default event classes More...
enum  EEventID { eEvent_LastID = -1, eEvent_InvalidID = -2, eEvent_MinClientID = 0 }
 Predefining event IDs. More...
enum  EOwnershipPolicy { eDelete, eRelease }

Public Member Functions

 CEvent ()
 default ctor
 CEvent (TEventID eid)
 create an event for a given event ID, with event class Unknown
 CEvent (TEventClass ecl, TEventID eid, TEventSender *sender=NULL)
 create an event for a specific event class and ID
 CEvent (TEventClass ecl, TEventID eid, IEventAttachment *att, EOwnershipPolicy policy, TEventSender *sender)
 create an event with all the bells and whistles
virtual ~CEvent (void)
 virtual dtor
const TEventRefs GetRefs (void) const
void AddRef (void)
const TEventID GetID (void) const
 Inline Implementation.
const TEventClass GetEventClass (void) const
const TEventSenderGetSender (void) const
TEventTypeInfo GetTypeInfo (void)
virtual void SetAttachment (IEventAttachment *att, EOwnershipPolicy policy)
 attach an object to the Event
virtual IEventAttachmentGetAttachment (void)
virtual bool HasAttachment (void) const
bool Visit (CEventHandler *handler)
 Checks whether this event has been visited by the given handler.

Protected Attributes

TEventClass m_Class
TEventID m_ID
 Event class - to speed up avoiding extra dynamic casts.
TEventSenderm_Sender
 Defines unique event identity within its C++ class and Event Class.
auto_ptr< IEventAttachmentm_Attachment
 pointer to the class that sent this event
EOwnershipPolicy m_AttPolicy
set< CEventHandler * > m_Visited
 list of handler who have seen this event already


Member Typedef Documentation

typedef std::type_info CEvent::TAttachmentTypeInfo
 

Definition at line 94 of file event.hpp.

typedef EEventClass CEvent::TEventClass
 

Definition at line 103 of file event.hpp.

typedef Int4 CEvent::TEventID
 

Definition at line 90 of file event.hpp.

typedef CRef<CEvent> CEvent::TEventObject
 

Definition at line 89 of file event.hpp.

typedef Int4 CEvent::TEventRefs
 

Definition at line 92 of file event.hpp.

typedef CEventHandler CEvent::TEventSender
 

Definition at line 91 of file event.hpp.

typedef const char* CEvent::TEventTypeInfo
 

Definition at line 88 of file event.hpp.


Member Enumeration Documentation

enum CEvent::EEventClass
 

default event classes

Enumerator:
eEvent_Message 
eEvent_Command  message from one class to another
eEvent_CommandUpdate  request to update the user interface

Definition at line 98 of file event.hpp.

enum CEvent::EEventID
 

Predefining event IDs.

Enumerator:
eEvent_LastID 
eEvent_InvalidID 
eEvent_MinClientID 

Definition at line 106 of file event.hpp.

enum CEvent::EOwnershipPolicy
 

Enumerator:
eDelete 
eRelease  release object (do not delete)

Definition at line 112 of file event.hpp.


Constructor & Destructor Documentation

CEvent::CEvent  ) 
 

default ctor

Definition at line 38 of file event.cpp.

CEvent::CEvent TEventID  eid  ) 
 

create an event for a given event ID, with event class Unknown

Definition at line 47 of file event.cpp.

CEvent::CEvent TEventClass  ecl,
TEventID  eid,
TEventSender sender = NULL
 

create an event for a specific event class and ID

Definition at line 57 of file event.cpp.

CEvent::CEvent TEventClass  ecl,
TEventID  eid,
IEventAttachment att,
EOwnershipPolicy  policy,
TEventSender sender
 

create an event with all the bells and whistles

Definition at line 67 of file event.cpp.

References SetAttachment().

CEvent::~CEvent void   )  [virtual]
 

virtual dtor

Definition at line 76 of file event.cpp.

References eRelease, m_Attachment, m_AttPolicy, and auto_ptr< X >::release().


Member Function Documentation

void CEvent::AddRef void   ) 
 

IEventAttachment * CEvent::GetAttachment void   )  [virtual]
 

Definition at line 84 of file event.cpp.

References auto_ptr< X >::get(), and m_Attachment.

Referenced by CEventHandler::OnEvent(), and CTextView::x_OnWidgetPositionChanged().

const TEventRefs CEvent::GetRefs void   )  const
 

bool CEvent::HasAttachment void   )  const [virtual]
 

Definition at line 101 of file event.cpp.

References auto_ptr< X >::get(), and m_Attachment.

void CEvent::SetAttachment IEventAttachment att,
EOwnershipPolicy  policy
[virtual]
 

attach an object to the Event

Definition at line 90 of file event.cpp.

References eRelease, m_Attachment, m_AttPolicy, auto_ptr< X >::release(), and auto_ptr< X >::reset().

Referenced by CEvent(), CSeqTextWidget::OnDeleteFeature(), CSeqTextWidget::OnEditFeature(), and CTextItemPanel::x_TextPosChanged().

bool CEvent::Visit CEventHandler handler  ) 
 

Checks whether this event has been visited by the given handler.

Returns "true" if this is the first visit.

Definition at line 107 of file event.cpp.

References set< Key, Compare >::end(), set< Key, Compare >::find(), handler(), set< Key, Compare >::insert(), and m_Visited.

Referenced by CEventHandler::Dispatch(), and CEventHandler::OnEvent().


Member Data Documentation

auto_ptr<IEventAttachment> CEvent::m_Attachment [protected]
 

pointer to the class that sent this event

Definition at line 155 of file event.hpp.

Referenced by GetAttachment(), HasAttachment(), SetAttachment(), and ~CEvent().

EOwnershipPolicy CEvent::m_AttPolicy [protected]
 

Definition at line 156 of file event.hpp.

Referenced by SetAttachment(), and ~CEvent().

TEventClass CEvent::m_Class [protected]
 

Definition at line 151 of file event.hpp.

Referenced by GetEventClass().

TEventID CEvent::m_ID [protected]
 

Event class - to speed up avoiding extra dynamic casts.

Definition at line 152 of file event.hpp.

Referenced by CTestEvent::CTestEvent(), and GetID().

TEventSender* CEvent::m_Sender [protected]
 

Defines unique event identity within its C++ class and Event Class.

Definition at line 153 of file event.hpp.

Referenced by CSelectionEvent::CSelectionEvent(), and GetSender().

set<CEventHandler*> CEvent::m_Visited [protected]
 

list of handler who have seen this event already

Definition at line 159 of file event.hpp.

Referenced by Visit().


The documentation for this class was generated from the following files:
Generated on Mon Dec 7 11:29:25 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Mon Dec 07 16:23:03 2009 by modify_doxy.py rev. 173732