1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // wxFormBuilder - A Visual Dialog Editor for wxWidgets.
4 // Copyright (C) 2005 José Antonio Hurtado
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 //
20 // Written by
21 //   José Antonio Hurtado - joseantonio.hurtado@gmail.com
22 //   Juan Antonio Ortega  - jortegalalmolda@gmail.com
23 //
24 ///////////////////////////////////////////////////////////////////////////////
25 
26 #include "wxfbevent.h"
27 #include "model/objectbase.h"
28 
29 DEFINE_EVENT_TYPE( wxEVT_FB_PROJECT_LOADED )
DEFINE_EVENT_TYPE(wxEVT_FB_PROJECT_SAVED)30 DEFINE_EVENT_TYPE( wxEVT_FB_PROJECT_SAVED )
31 DEFINE_EVENT_TYPE( wxEVT_FB_OBJECT_EXPANDED )
32 DEFINE_EVENT_TYPE( wxEVT_FB_OBJECT_SELECTED )
33 DEFINE_EVENT_TYPE( wxEVT_FB_OBJECT_CREATED )
34 DEFINE_EVENT_TYPE( wxEVT_FB_OBJECT_REMOVED )
35 DEFINE_EVENT_TYPE( wxEVT_FB_PROPERTY_MODIFIED )
36 DEFINE_EVENT_TYPE( wxEVT_FB_PROJECT_REFRESH )
37 DEFINE_EVENT_TYPE( wxEVT_FB_CODE_GENERATION )
38 DEFINE_EVENT_TYPE( wxEVT_FB_EVENT_HANDLER_MODIFIED )
39 
40 wxFBEvent::wxFBEvent( wxEventType commandType )
41 :
42 wxEvent( 0, commandType )
43 {
44 	//ctor
45 }
46 
47 // required for sending with wxPostEvent()
Clone() const48 wxEvent* wxFBEvent::Clone() const
49 {
50 	return new wxFBEvent( *this );
51 }
52 
wxFBEvent(const wxFBEvent & event)53 wxFBEvent::wxFBEvent( const wxFBEvent& event )
54 :
55 wxEvent( event ),
56 m_string( event.m_string )
57 {
58 }
59 
~wxFBEvent()60 wxFBEvent::~wxFBEvent()
61 {
62 	//dtor
63 }
64 
65 #define CASE( EVENT )									\
66 	if ( EVENT == m_eventType )							\
67 	{													\
68 		return wxT( #EVENT );							\
69 	}
70 
GetEventName()71 wxString wxFBEvent::GetEventName()
72 {
73 	CASE( wxEVT_FB_PROJECT_LOADED )
74 	CASE( wxEVT_FB_PROJECT_SAVED )
75 	CASE( wxEVT_FB_OBJECT_EXPANDED )
76 	CASE( wxEVT_FB_OBJECT_SELECTED )
77 	CASE( wxEVT_FB_OBJECT_CREATED )
78 	CASE( wxEVT_FB_OBJECT_REMOVED )
79 	CASE( wxEVT_FB_PROPERTY_MODIFIED )
80 	CASE( wxEVT_FB_EVENT_HANDLER_MODIFIED )
81 	CASE( wxEVT_FB_PROJECT_REFRESH )
82 	CASE( wxEVT_FB_CODE_GENERATION )
83 
84 	return wxT( "Unknown Type" );
85 }
86 
SetString(const wxString & newString)87 void wxFBEvent::SetString( const wxString& newString )
88 {
89 	m_string = newString;
90 }
91 
GetString()92 wxString wxFBEvent::GetString()
93 {
94 	return m_string;
95 }
96 
wxFBPropertyEvent(wxEventType commandType,PProperty property)97 wxFBPropertyEvent::wxFBPropertyEvent(wxEventType commandType, PProperty property)
98  : wxFBEvent(commandType), m_property(property)
99 {
100 }
101 
wxFBPropertyEvent(const wxFBPropertyEvent & event)102 wxFBPropertyEvent::wxFBPropertyEvent( const wxFBPropertyEvent& event )
103 :
104 wxFBEvent( event ),
105 m_property( event.m_property )
106 {
107 }
108 
Clone() const109 wxEvent* wxFBPropertyEvent::Clone() const
110 {
111 	return new wxFBPropertyEvent( *this );
112 }
113 
wxFBObjectEvent(wxEventType commandType,PObjectBase object)114 wxFBObjectEvent::wxFBObjectEvent(wxEventType commandType, PObjectBase object)
115  : wxFBEvent(commandType), m_object(object)
116 {
117 }
118 
wxFBObjectEvent(const wxFBObjectEvent & event)119 wxFBObjectEvent::wxFBObjectEvent( const wxFBObjectEvent& event )
120 :
121 wxFBEvent( event ),
122 m_object( event.m_object )
123 {
124 }
125 
Clone() const126 wxEvent* wxFBObjectEvent::Clone() const
127 {
128 	return new wxFBObjectEvent( *this );
129 }
130 
wxFBEventHandlerEvent(wxEventType commandType,PEvent event)131 wxFBEventHandlerEvent::wxFBEventHandlerEvent(wxEventType commandType, PEvent event)
132  : wxFBEvent(commandType), m_event(event)
133 {
134 }
135 
wxFBEventHandlerEvent(const wxFBEventHandlerEvent & event)136 wxFBEventHandlerEvent::wxFBEventHandlerEvent( const wxFBEventHandlerEvent& event )
137 :
138 wxFBEvent( event ),
139 m_event( event.m_event )
140 {
141 }
142 
Clone() const143 wxEvent* wxFBEventHandlerEvent::Clone() const
144 {
145 	return new wxFBEventHandlerEvent( *this );
146 }
147