00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _COMEVTH__
00024 #define _COMEVTH__
00025
00026 #include "wx/list.h"
00027 #include "wx/event.h"
00028 #include "wx/cmdproc.h"
00029 #include <wx/module.h>
00030
00031 #if wxCHECK_VERSION(2,9,0)
00032 #include "wx/chartype.h"
00033 #include "wx/strvararg.h"
00034 #endif
00035
00036 #include "wx/general/a2dlist.h"
00037 #include "wx/general/gen.h"
00038
00039 class A2DGENERALDLLEXP a2dEvtHandler;
00040
00041
00042
00043 typedef void (a2dEvtHandler::*a2dObjectEventFunction)(wxEvent&);
00044 typedef void (a2dEvtHandler::*a2dEventFunction)(wxEvent&);
00045
00046 #if wxUSE_GUI
00047 typedef void (a2dEvtHandler::*a2dCommandEventFunction)(wxCommandEvent&);
00048 typedef void (a2dEvtHandler::*a2dScrollEventFunction)(wxScrollEvent&);
00049 typedef void (a2dEvtHandler::*a2dScrollWinEventFunction)(wxScrollWinEvent&);
00050 typedef void (a2dEvtHandler::*a2dSizeEventFunction)(wxSizeEvent&);
00051 typedef void (a2dEvtHandler::*a2dMoveEventFunction)(wxMoveEvent&);
00052 typedef void (a2dEvtHandler::*a2dPaintEventFunction)(wxPaintEvent&);
00053 typedef void (a2dEvtHandler::*a2dEraseEventFunction)(wxEraseEvent&);
00054 typedef void (a2dEvtHandler::*a2dMouseEventFunction)(wxMouseEvent&);
00055 typedef void (a2dEvtHandler::*a2dCharEventFunction)(wxKeyEvent&);
00056 typedef void (a2dEvtHandler::*a2dFocusEventFunction)(wxFocusEvent&);
00057 typedef void (a2dEvtHandler::*a2dChildFocusEventFunction)(wxChildFocusEvent&);
00058 typedef void (a2dEvtHandler::*a2dActivateEventFunction)(wxActivateEvent&);
00059 typedef void (a2dEvtHandler::*a2dMenuEventFunction)(wxMenuEvent&);
00060 typedef void (a2dEvtHandler::*a2dJoystickEventFunction)(wxJoystickEvent&);
00061 typedef void (a2dEvtHandler::*a2dDropFilesEventFunction)(wxDropFilesEvent&);
00062 typedef void (a2dEvtHandler::*a2dInitDialogEventFunction)(wxInitDialogEvent&);
00063 typedef void (a2dEvtHandler::*a2dUpdateUIEventFunction)(wxUpdateUIEvent&);
00064 typedef void (a2dEvtHandler::*a2dIdleEventFunction)(wxIdleEvent&);
00065 typedef void (a2dEvtHandler::*a2dCloseEventFunction)(wxCloseEvent&);
00066 typedef void (a2dEvtHandler::*a2dShowEventFunction)(wxShowEvent&);
00067 typedef void (a2dEvtHandler::*a2dIconizeEventFunction)(wxIconizeEvent&);
00068 typedef void (a2dEvtHandler::*a2dMaximizeEventFunction)(wxMaximizeEvent&);
00069 typedef void (a2dEvtHandler::*a2dNavigationKeyEventFunction)(wxNavigationKeyEvent&);
00070 typedef void (a2dEvtHandler::*a2dPaletteChangedEventFunction)(wxPaletteChangedEvent&);
00071 typedef void (a2dEvtHandler::*a2dQueryNewPaletteEventFunction)(wxQueryNewPaletteEvent&);
00072 typedef void (a2dEvtHandler::*a2dWindowCreateEventFunction)(wxWindowCreateEvent&);
00073 typedef void (a2dEvtHandler::*a2dWindowDestroyEventFunction)(wxWindowDestroyEvent&);
00074 typedef void (a2dEvtHandler::*a2dSetCursorEventFunction)(wxSetCursorEvent&);
00075 typedef void (a2dEvtHandler::*a2dNotifyEventFunction)(wxNotifyEvent&);
00076 typedef void (a2dEvtHandler::*a2dHelpEventFunction)(wxHelpEvent&);
00077 typedef void (a2dEvtHandler::*a2dContextMenuEventFunction)(wxContextMenuEvent&);
00078 typedef void (a2dEvtHandler::*a2dMouseCaptureChangedEventFunction)(wxMouseCaptureChangedEvent&);
00079 typedef void (a2dEvtHandler::*a2dCommandEventFunction)(wxCommandEvent&);
00080 #endif // wxUSE_GUI
00081
00082
00083
00084
00085
00086
00087
00088
00089 #define A2D_EVT_UPDATE_UI(id, func) \
00090 A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_UPDATE_UI, id, wxID_ANY, (a2dObjectEventFunction) static_cast < a2dUpdateUIEventFunction > ( & func ), (wxObject *) NULL ),
00091
00092 #define A2D_EVT_MENU(id, func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_MENU_SELECTED, id, wxID_ANY, (a2dObjectEventFunction) static_cast < a2dCommandEventFunction > ( & func ), (wxObject *) NULL ),
00093
00094
00095 #define A2D_EVT_CUSTOM(event, winid, func) A2D_DECLARE_EVENT_TABLE_ENTRY( event, winid, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) & func, (wxObject *) NULL ),
00096 #define A2D_EVT_CUSTOM_RANGE(event, id1, id2, func) A2D_DECLARE_EVENT_TABLE_ENTRY( event, id1, id2, (a2dObjectEventFunction) (a2dEventFunction) & func, (wxObject *) NULL ),
00097
00098
00099
00100 #define A2D_EVT_SIZE(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_SIZE, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dSizeEventFunction) & func, (wxObject *) NULL ),
00101
00102 #define A2D_EVT_SIZING(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_SIZING, -1, -1, (a2dObjectEventFunction) (a2dEventFunction) (a2dSizeEventFunction) & func, (wxObject *) NULL ),
00103
00104 #define A2D_EVT_MOVE(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOVE, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dMoveEventFunction) & func, (wxObject *) NULL ),
00105
00106 #define A2D_EVT_MOVING(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOVING, -1, -1, (a2dObjectEventFunction) (a2dEventFunction) (a2dMoveEventFunction) & func, (wxObject *) NULL ),
00107
00108 #define A2D_EVT_CLOSE(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_CLOSE_WINDOW, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dCloseEventFunction) & func, (wxObject *) NULL ),
00109
00110 #define A2D_EVT_END_SESSION(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_END_SESSION, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dCloseEventFunction) & func, (wxObject *) NULL ),
00111
00112 #define A2D_EVT_QUERY_END_SESSION(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_QUERY_END_SESSION, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dCloseEventFunction) & func, (wxObject *) NULL ),
00113
00114 #define A2D_EVT_PAINT(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_PAINT, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dPaintEventFunction) & func, (wxObject *) NULL ),
00115
00116 #define A2D_EVT_NC_PAINT(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_NC_PAINT, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dPaintEventFunction) & func, (wxObject *) NULL ),
00117
00118 #define A2D_EVT_ERASE_BACKGROUND(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_ERASE_BACKGROUND, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dEraseEventFunction) & func, (wxObject *) NULL ),
00119
00120 #define A2D_EVT_CHAR(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_CHAR, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dCharEventFunction) & func, (wxObject *) NULL ),
00121
00122 #define A2D_EVT_KEY_DOWN(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_KEY_DOWN, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dCharEventFunction) & func, (wxObject *) NULL ),
00123
00124 #define A2D_EVT_KEY_UP(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_KEY_UP, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dCharEventFunction) & func, (wxObject *) NULL ),
00125 #if wxUSE_HOTKEY
00126
00127 #define A2D_EVT_HOTKEY(id, func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_HOTKEY, id, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dCharEventFunction) & func, (wxObject *) NULL ),
00128 #endif
00129
00130 #define A2D_EVT_CHAR_HOOK(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_CHAR_HOOK, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dCharEventFunction) & func, NULL ),
00131
00132 #define A2D_EVT_MENU_OPEN(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_MENU_OPEN, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dMenuEventFunction) & func, (wxObject *) NULL ),
00133
00134 #define A2D_EVT_MENU_CLOSE(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_MENU_CLOSE, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dMenuEventFunction) & func, (wxObject *) NULL ),
00135
00136 #define A2D_EVT_MENU_HIGHLIGHT(winid, func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_MENU_HIGHLIGHT, winid, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dMenuEventFunction) & func, (wxObject *) NULL ),
00137
00138 #define A2D_EVT_MENU_HIGHLIGHT_ALL(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_MENU_HIGHLIGHT, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dMenuEventFunction) & func, (wxObject *) NULL ),
00139
00140 #define A2D_EVT_SET_FOCUS(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_SET_FOCUS, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dFocusEventFunction) & func, (wxObject *) NULL ),
00141
00142 #define A2D_EVT_KILL_FOCUS(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_KILL_FOCUS, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dFocusEventFunction) & func, (wxObject *) NULL ),
00143
00144 #define A2D_EVT_CHILD_FOCUS(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_CHILD_FOCUS, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (wxCommandEventFunction) (a2dChildFocusEventFunction) & func, (wxObject *) NULL ),
00145
00146 #define A2D_EVT_ACTIVATE(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_ACTIVATE, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dActivateEventFunction) & func, (wxObject *) NULL ),
00147
00148 #define A2D_EVT_ACTIVATE_APP(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_ACTIVATE_APP, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dActivateEventFunction) & func, (wxObject *) NULL ),
00149
00150 #define A2D_EVT_END_SESSION(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_END_SESSION, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dCloseEventFunction) & func, (wxObject *) NULL ),
00151
00152 #define A2D_EVT_QUERY_END_SESSION(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_QUERY_END_SESSION, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dCloseEventFunction) & func, (wxObject *) NULL ),
00153
00154 #define A2D_EVT_DROP_FILES(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_DROP_FILES, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dDropFilesEventFunction) & func, (wxObject *) NULL ),
00155
00156 #define A2D_EVT_INIT_DIALOG(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_INIT_DIALOG, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dInitDialogEventFunction) & func, (wxObject *) NULL ),
00157
00158 #define A2D_EVT_SYS_COLOUR_CHANGED(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_SYS_COLOUR_CHANGED, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dSysColourChangedFunction) & func, (wxObject *) NULL ),
00159
00160 #define A2D_EVT_SHOW(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_SHOW, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dShowEventFunction) & func, (wxObject *) NULL ),
00161
00162 #define A2D_EVT_MAXIMIZE(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_MAXIMIZE, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dMaximizeEventFunction) & func, (wxObject *) NULL ),
00163
00164 #define A2D_EVT_ICONIZE(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_ICONIZE, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dIconizeEventFunction) & func, (wxObject *) NULL ),
00165
00166 #define A2D_EVT_NAVIGATION_KEY(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_NAVIGATION_KEY, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dCommandEventFunction) (a2dNavigationKeyEventFunction) & func, (wxObject *) NULL ),
00167
00168 #define A2D_EVT_PALETTE_CHANGED(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_PALETTE_CHANGED, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dPaletteChangedEventFunction) & func, (wxObject *) NULL ),
00169
00170 #define A2D_EVT_QUERY_NEW_PALETTE(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_QUERY_NEW_PALETTE, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dQueryNewPaletteEventFunction) & func, (wxObject *) NULL ),
00171
00172 #define A2D_EVT_WINDOW_CREATE(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_CREATE, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dWindowCreateEventFunction) & func, (wxObject *) NULL ),
00173
00174 #define A2D_EVT_WINDOW_DESTROY(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_DESTROY, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dWindowDestroyEventFunction) & func, (wxObject *) NULL ),
00175
00176 #define A2D_EVT_SET_CURSOR(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_SET_CURSOR, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dSetCursorEventFunction) & func, (wxObject *) NULL ),
00177
00178 #define A2D_EVT_MOUSE_CAPTURE_CHANGED(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOUSE_CAPTURE_CHANGED, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) (a2dMouseCaptureChangedEventFunction) & func, (wxObject *) NULL ),
00179
00180
00181
00182 #define A2D_EVT_LEFT_DOWN(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_LEFT_DOWN, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),
00183
00184 #define A2D_EVT_LEFT_UP(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_LEFT_UP, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),
00185
00186 #define A2D_EVT_MIDDLE_DOWN(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_MIDDLE_DOWN, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),
00187
00188 #define A2D_EVT_MIDDLE_UP(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_MIDDLE_UP, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),
00189
00190 #define A2D_EVT_RIGHT_DOWN(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_RIGHT_DOWN, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),
00191
00192 #define A2D_EVT_RIGHT_UP(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_RIGHT_UP, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),
00193
00194 #define A2D_EVT_MOTION(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOTION, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),
00195
00196 #define A2D_EVT_LEFT_DCLICK(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_LEFT_DCLICK, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),
00197
00198 #define A2D_EVT_MIDDLE_DCLICK(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_MIDDLE_DCLICK, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),
00199
00200 #define A2D_EVT_RIGHT_DCLICK(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_RIGHT_DCLICK, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),
00201
00202 #define A2D_EVT_LEAVE_WINDOW(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_LEAVE_WINDOW, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),
00203
00204 #define A2D_EVT_ENTER_WINDOW(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_ENTER_WINDOW, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),
00205
00206 #define A2D_EVT_MOUSEWHEEL(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOUSEWHEEL, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),
00207
00208
00209
00210 #define A2D_EVT_MOUSE_EVENTS(func) \
00211 A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_LEFT_DOWN, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),\
00212 A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_LEFT_UP, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),\
00213 A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_MIDDLE_DOWN, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),\
00214 A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_MIDDLE_UP, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),\
00215 A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_RIGHT_DOWN, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),\
00216 A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_RIGHT_UP, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),\
00217 A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOTION, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),\
00218 A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_LEFT_DCLICK, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),\
00219 A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_MIDDLE_DCLICK, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),\
00220 A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_RIGHT_DCLICK, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),\
00221 A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_ENTER_WINDOW, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),\
00222 A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_LEAVE_WINDOW, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),\
00223 A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOUSEWHEEL, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dMouseEventFunction > ( & func ), (wxObject *) NULL ),
00224
00225
00226
00227 #define A2D_EVT_IDLE(func) \
00228 A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_IDLE, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) (a2dEventFunction) static_cast < a2dIdleEventFunction > ( & func ), (wxObject *) NULL ),
00229
00230
00231 #define A2D_EVT_BUTTON(id, func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_BUTTON_CLICKED, id, wxID_ANY, (a2dObjectEventFunction) static_cast < a2dCommandEventFunction > ( & func ), (wxObject *) NULL ),
00232
00233 #define A2D_EVT_BUTTON_ANY(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_BUTTON_CLICKED, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) static_cast < a2dCommandEventFunction > ( & func ), (wxObject *) NULL ),
00234
00235
00236 #define A2D_EVT_CHOICE(id, func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_CHOICE_SELECTED, id, wxID_ANY, (a2dObjectEventFunction) static_cast < a2dCommandEventFunction > ( & func ), (wxObject *) NULL ),
00237
00238 #define A2D_EVT_CHOICE_ANY(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_CHOICE_SELECTED, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) static_cast < a2dCommandEventFunction > ( & func ), (wxObject *) NULL ),
00239
00240
00241
00242 class A2DGENERALDLLEXP a2dDynamicEventProperty;
00243 #if (defined(__WXMSW__) && defined(WXUSINGDLL) )
00244 template class A2DGENERALDLLEXP a2dPropertyIdProp< a2dDynamicEventProperty >;
00245 #endif
00246 typedef a2dPropertyIdProp< class a2dDynamicEventProperty> a2dPropertyIdDynamicEventProperty;
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256 struct A2DGENERALDLLEXP a2dEventTableEntry
00257 {
00258
00259 a2dEventTableEntry(const int& evType, int winid, int idLast,
00260 a2dObjectEventFunction fn, wxObject *data)
00261 : m_eventType(evType),
00262 m_id(winid),
00263 m_lastId(idLast),
00264 m_callbackUserData(data),
00265 m_fn(fn)
00266 { }
00267
00268
00269
00270
00271
00272
00273
00274 const int& m_eventType;
00275
00276
00277
00278 int m_id,
00279 m_lastId;
00280
00281
00282 wxObject* m_callbackUserData;
00283
00284
00285 a2dObjectEventFunction m_fn;
00286
00287 a2dEventTableEntry& operator=(const a2dEventTableEntry&);
00288 };
00289
00290
00291
00292
00293
00294
00295 struct A2DGENERALDLLEXP a2dEventTable
00296 {
00297 const a2dEventTable *baseTable;
00298 const a2dEventTableEntry *entries;
00299 };
00300
00301
00302 #define A2D_DECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \
00303 a2dEventTableEntry(type, winid, idLast, fn, obj)
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313 class A2DGENERALDLLEXP a2dDynamicEventProperty : public a2dNamedProperty
00314 {
00315 DECLARE_DYNAMIC_CLASS(a2dDynamicEventProperty)
00316
00317 public:
00318
00319 a2dDynamicEventProperty();
00320
00321 a2dDynamicEventProperty( const a2dPropertyIdDynamicEventProperty* propid, int evType, int id, int idLast, a2dObjectEventFunction fn );
00322
00323 a2dDynamicEventProperty( const a2dDynamicEventProperty &other );
00324
00325 virtual ~a2dDynamicEventProperty();
00326
00327 a2dNamedProperty* Clone( a2dObject::CloneOptions options ) const;
00328
00329 virtual void Assign( const a2dNamedProperty &other );
00330
00331
00332
00333 static a2dDynamicEventProperty *CreatePropertyFromString( const a2dPropertyIdDynamicEventProperty* WXUNUSED(id), const wxString& WXUNUSED(value) ) { return 0; }
00334
00335
00336 int m_eventType;
00337
00338
00339
00340 int m_id;
00341
00342
00343 int m_lastId;
00344
00345
00346 a2dObjectEventFunction m_fn;
00347
00348 protected:
00349
00350 #if wxART2D_USE_CVGIO
00351 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
00352 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
00353 #endif //wxART2D_USE_CVGIO
00354
00355 };
00356
00357 class A2DGENERALDLLEXP a2dEvent : public wxEvent
00358 {
00359
00360 public:
00361
00362 a2dEvent(int id = 0, wxEventType eventType = wxEVT_NULL)
00363 : wxEvent( id, eventType )
00364 {
00365 SetIntTimeStamp();
00366 }
00367
00368 void SetIntTimeStamp()
00369 {
00370 if ( ms_timestamp == LONG_MAX )
00371 ms_timestamp = 0;
00372 SetTimestamp( ++ms_timestamp );
00373 }
00374
00375 static long ms_timestamp;
00376 };
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393 class A2DGENERALDLLEXP a2dEvtHandler : public a2dPropObject
00394 {
00395 public:
00396
00397
00398 a2dEvtHandler();
00399
00400
00401 a2dEvtHandler( const a2dEvtHandler& other, CloneOptions options );
00402
00403
00404 virtual ~a2dEvtHandler();
00405
00406
00407 virtual a2dObject* Clone( CloneOptions options ) const;
00408
00409
00410 void SetEvtHandlerEnabled(bool enabled) { m_enabled = enabled; }
00411
00412
00413 bool GetEvtHandlerEnabled() const { return m_enabled; }
00414
00415
00416 a2dEvtHandler *GetEventHandler() const;
00417
00418
00419
00420
00421
00422 virtual a2dEvtHandler* GetParentEvtHandler() { return NULL; }
00423
00424
00425
00426
00427
00428
00429 virtual bool ProcessEvent(wxEvent& event);
00430
00431
00432
00433 virtual bool SearchEventTable(a2dEventTable& table, wxEvent& event);
00434
00435
00436 private:
00437
00438
00439 bool SearchDynamicEventProperties( wxEvent& event );
00440
00441
00442 static const a2dEventTableEntry sm_eventTableEntries[];
00443
00444 protected:
00445
00446 #if wxART2D_USE_CVGIO
00447 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList* towrite );
00448 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
00449 #endif //wxART2D_USE_CVGIO
00450
00451
00452 static const a2dEventTable sm_eventTable;
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464 virtual const a2dEventTable *GetEventTable() const;
00465
00466
00467 bool m_enabled;
00468
00469 private:
00470
00471 DECLARE_DYNAMIC_CLASS(a2dEvtHandler)
00472
00473 private:
00474
00475 a2dEvtHandler( const a2dEvtHandler &other );
00476 };
00477
00478 #if defined(WXDOCVIEW_USINGDLL)
00479 template class A2DGENERALDLLEXP a2dSmrtPtr<a2dEvtHandler>;
00480 #endif
00481
00482 typedef void (a2dEvtHandler::*a2dEvtHandlerEventFunction)(wxEvent&);
00483
00484 #define A2D_DECLARE_EVENT_TABLE() \
00485 private: \
00486 static const a2dEventTableEntry sm_eventTableEntries[]; \
00487 protected: \
00488 static const a2dEventTable sm_eventTable; \
00489 virtual const a2dEventTable* GetEventTable() const;
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499 #define A2D_BEGIN_EVENT_TABLE(theClass, baseClass) \
00500 const a2dEventTable theClass::sm_eventTable = \
00501 { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \
00502 const a2dEventTable *theClass::GetEventTable() const \
00503 { return &theClass::sm_eventTable; } \
00504 const a2dEventTableEntry theClass::sm_eventTableEntries[] = { \
00505
00506
00507 #define A2D_BEGIN_EVENT_TABLE_TEMPLATE1(theClass, baseClass, T1) \
00508 template<typename T1> \
00509 const a2dEventTable theClass<T1>::sm_eventTable = \
00510 { &baseClass::sm_eventTable, &theClass<T1>::sm_eventTableEntries[0] }; \
00511 template<typename T1> \
00512 const a2dEventTable *theClass<T1>::GetEventTable() const \
00513 { return &theClass<T1>::sm_eventTable; } \
00514 template<typename T1> \
00515 const a2dEventTableEntry theClass<T1>::sm_eventTableEntries[] = { \
00516
00517 #define A2D_BEGIN_EVENT_TABLE_TEMPLATE2(theClass, baseClass, T1, T2) \
00518 template<typename T1, typename T2> \
00519 const a2dEventTable theClass<T1, T2>::sm_eventTable = \
00520 { &baseClass::sm_eventTable, &theClass<T1, T2>::sm_eventTableEntries[0] }; \
00521 template<typename T1, typename T2> \
00522 const a2dEventTable *theClass<T1, T2>::GetEventTable() const \
00523 { return &theClass<T1, T2>::sm_eventTable; } \
00524 template<typename T1, typename T2> \
00525 const a2dEventTableEntry theClass<T1, T2>::sm_eventTableEntries[] = { \
00526
00527 #define A2D_BEGIN_EVENT_TABLE_TEMPLATE3(theClass, baseClass, T1, T2, T3) \
00528 template<typename T1, typename T2, typename T3> \
00529 const a2dEventTable theClass<T1, T2, T3>::sm_eventTable = \
00530 { &baseClass::sm_eventTable, &theClass<T1, T2, T3>::sm_eventTableEntries[0] }; \
00531 template<typename T1, typename T2, typename T3> \
00532 const a2dEventTable *theClass<T1, T2, T3>::GetEventTable() const \
00533 { return &theClass<T1, T2, T3>::sm_eventTable; } \
00534 template<typename T1, typename T2, typename T3> \
00535 const a2dEventTableEntry theClass<T1, T2, T3>::sm_eventTableEntries[] = { \
00536
00537 #define A2D_END_EVENT_TABLE() A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_NULL, 0, 0, 0, 0 ) };
00538
00539
00540
00541
00542
00543
00544
00545
00546 #define a2d__DECLARE_EVT2(evt, id1, id2, fn) \
00547 A2D_DECLARE_EVENT_TABLE_ENTRY(evt, id1, id2, fn, NULL),
00548 #define a2d__DECLARE_EVT1(evt, id, fn) \
00549 a2d__DECLARE_EVT2(evt, id, wxID_ANY, fn)
00550 #define a2d__DECLARE_EVT0(evt, fn) \
00551 a2d__DECLARE_EVT1(evt, wxID_ANY, fn)
00552
00553
00554
00555
00556 class A2DGENERALDLLEXP a2dCommandProcessor;
00557 #if (defined(__WXMSW__) && defined(WXUSINGDLL) )
00558 template class A2DGENERALDLLEXP a2dSmrtPtr<a2dCommandProcessor>;
00559 #endif
00560
00561 class A2DGENERALDLLEXP a2dCommandId;
00562
00563 class A2DGENERALDLLEXP a2dHashMapCommandIds;
00564 class A2DGENERALDLLEXP a2dHashMapCommandIds_wxImplementation_HashTable;
00565 class A2DGENERALDLLEXP a2dHashMapCommandIds_wxImplementation_KeyEx;
00566
00567
00568 WX_DECLARE_HASH_MAP_WITH_DECL( wxString, a2dCommandId*, wxStringHash, wxStringEqual, a2dHashMapCommandIds, class A2DGENERALDLLEXP );
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598 class A2DGENERALDLLEXP a2dCommandId
00599 {
00600 public:
00601
00602
00603 a2dCommandId( const wxString& commandName );
00604
00605
00606 virtual ~a2dCommandId() {};
00607
00608
00609 virtual wxString GetIdClassName() { return wxT("a2dCommandId"); }
00610
00611
00612 wxString GetName() const { return m_name; }
00613
00614
00615 static const a2dCommandId& GetCommandByName(const wxString& commandName);
00616
00617
00618 static a2dHashMapCommandIds &GetHashMap();
00619
00620 private:
00621
00622
00623 wxString m_name;
00624 };
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639 class A2DGENERALDLLEXP a2dCommand: public a2dPropObject
00640 {
00641
00642 public:
00643
00644
00645 static const a2dCommandId sm_noCommandId;
00646
00647 static const a2dCommandId sm_noCommandTypeId;
00648
00649 static const a2dCommandId sm_groupCommandId;
00650
00651
00652
00653
00654
00655
00656
00657
00658 a2dCommand( bool canUndo = false,
00659 const a2dCommandId& commandId = sm_noCommandId,
00660 const a2dCommandId& commandTypeId = sm_noCommandTypeId,
00661 const wxString& menuString = wxEmptyString
00662 );
00663
00664
00665 ~a2dCommand(void);
00666
00667
00668 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const;
00669
00670 inline a2dCommand* TClone( CloneOptions options = clone_deep ) { return (a2dCommand*) Clone( options ); }
00671
00672
00673
00674 virtual wxString GetName() const;
00675
00676
00677
00678
00679
00680
00681 const a2dCommandId* GetCommandId() { return m_commandId; }
00682
00683
00684 const a2dCommandId* GetCommandTypeId() { return m_commandTypeId; }
00685
00686
00687
00688
00689
00690
00691
00692
00693 virtual a2dCommand *CloneAndBind( a2dPropObject *object );
00694
00695
00696 virtual bool Do() = 0;
00697
00698
00699 virtual bool Undo() = 0;
00700
00701 virtual bool CanUndo() const { return m_canUndo; }
00702
00703
00704
00705 virtual bool Redo();
00706
00707
00708 void SetCommandProcessor( a2dCommandProcessor* cmp ) { m_cmp = cmp; }
00709
00710 a2dCommandProcessor* GetCommandProcessor() { return m_cmp; }
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720 virtual bool ClearAfterCurrentCommand( a2dCommand *current );
00721
00722
00723 virtual class a2dCommandGroup *IsCommandGroup() { return 0; }
00724
00725
00726 virtual a2dCommand *FindPrevious( a2dCommand *current ) const;
00727
00728
00729 virtual a2dCommand *FindNext( a2dCommand *current ) const;
00730
00731
00732 virtual bool Remove( a2dCommand *command );
00733
00734
00735 virtual bool ContainsCommand( a2dCommand *command );
00736
00737 virtual void DistributeEvent( wxEventType eventType );
00738
00739 protected:
00740
00741
00742 bool m_canUndo;
00743
00744
00745 const a2dCommandId* m_commandId;
00746
00747
00748 const a2dCommandId* m_commandTypeId;
00749
00750
00751 a2dCommandProcessor* m_cmp;
00752
00753
00754 wxString m_menuString;
00755
00756
00757 a2dCommand( const a2dCommand &other );
00758 };
00759
00760 typedef a2dSmrtPtr<a2dCommand> a2dCommandPtr;
00761
00762
00763
00764
00765
00766 class a2dCommandException
00767 {
00768
00769 public:
00770
00771 a2dCommandException( const wxString& exMessage): m_message(exMessage) {}
00772
00773
00774 a2dCommandException( const a2dCommandException& other)
00775 { m_message = other.m_message; }
00776
00777 a2dCommandException& operator=(const a2dCommandException& other)
00778 {
00779 if (&other != this) {
00780 m_message = other.m_message;
00781 }
00782
00783 return *this;
00784 }
00785
00786 virtual ~a2dCommandException() {}
00787
00788 wxString getMessage() const { return m_message; }
00789 void setMessage( const wxString& exMessage) { m_message = exMessage; }
00790
00791 protected:
00792
00793 wxString m_message;
00794 };
00795
00796
00797
00798 #if (defined(__WXMSW__) && defined(WXUSINGDLL) )
00799 template class A2DGENERALDLLEXP a2dSmrtPtr<a2dCommand>;
00800 template class A2DGENERALDLLEXP std::allocator<class a2dSmrtPtr<class a2dCommand> >;
00801 template class A2DGENERALDLLEXP std::allocator< std::_List_nod<class a2dSmrtPtr<class a2dCommand>, std::allocator<class a2dSmrtPtr<class a2dCommand> > >::_Node >;
00802 template class A2DGENERALDLLEXP std::allocator< std::_List_ptr<class a2dSmrtPtr<class a2dCommand>, std::allocator<class a2dSmrtPtr<class a2dCommand> > >::_Nodeptr >;
00803 template class A2DGENERALDLLEXP std::list<class a2dSmrtPtr<class a2dCommand> >;
00804 template class A2DGENERALDLLEXP a2dlist<class a2dSmrtPtr<class a2dCommand> >;
00805 template class A2DGENERALDLLEXP a2dSmrtPtrList<class a2dCommand >;
00806 #endif
00807
00808 typedef class A2DGENERALDLLEXP a2dSmrtPtrList< a2dCommand > a2dCommandList;
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831 class A2DGENERALDLLEXP a2dCommandGroup: public a2dCommand
00832 {
00833 public:
00834
00835
00836
00837
00838
00839
00840 a2dCommandGroup( const wxString &name, a2dCommandGroup* parent = NULL );
00841
00842
00843 ~a2dCommandGroup(void);
00844
00845
00846 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const;
00847
00848 inline a2dCommand* TClone( CloneOptions options = clone_deep ) { return (a2dCommand*) Clone( options ); }
00849
00850
00851 virtual wxString GetGroupName() const { return m_groupName; }
00852
00853
00854 bool ClearCommandsById( const a2dCommandId& commandId, a2dCommand *fromcommand = NULL );
00855
00856
00857 virtual bool ClearAfterCurrentCommand( a2dCommand *current );
00858
00859
00860 virtual class a2dCommandGroup *IsCommandGroup() { return this; }
00861
00862
00863 virtual a2dCommand *FindPrevious( a2dCommand *current ) const;
00864
00865
00866 virtual a2dCommand *FindNext( a2dCommand *current ) const;
00867
00868
00869 virtual bool Remove( a2dCommand *command );
00870
00871
00872 void Add( a2dCommand *command );
00873
00874
00875 virtual bool ContainsCommand( a2dCommand *command );
00876
00877
00878 a2dCommandGroup* GetParentGroup() { return m_parentGroup; }
00879
00880
00881 void SetParentGroup( a2dCommandGroup* parent ) { m_parentGroup = parent; }
00882
00883 public:
00884
00885 virtual bool Do();
00886 virtual bool Undo();
00887
00888 protected:
00889
00890
00891 a2dCommandGroup* m_parentGroup;
00892
00893
00894 wxString m_groupName;
00895
00896
00897 bool m_active;
00898
00899 a2dCommandList m_subcommands;
00900
00901 friend class a2dCommandProcessor;
00902 };
00903
00904 #if (defined(__WXMSW__) && defined(WXUSINGDLL) )
00905 template class A2DGENERALDLLEXP a2dAutoZeroPtr< a2dPropObject >;
00906 #endif
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921 class A2DGENERALDLLEXP a2dCommand_SetProperty: public a2dCommand
00922 {
00923 DECLARE_DYNAMIC_CLASS(a2dCommand_SetProperty)
00924
00925 public:
00926
00927
00928
00929
00930 static const a2dCommandId Id;
00931
00932
00933 a2dCommand_SetProperty();
00934
00935
00936
00937
00938
00939
00940
00941
00942 a2dCommand_SetProperty( a2dPropObject* object, a2dNamedProperty* property );
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952 a2dCommand_SetProperty( a2dPropObject* object, const a2dPropertyIdRefObject* id, a2dObject *value );
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962 a2dCommand_SetProperty( a2dPropObject* object, const a2dPropertyIdObject* id, const wxObject& value );
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972 a2dCommand_SetProperty( a2dPropObject* object, const a2dPropertyIdString* id, const wxString& value );
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982 a2dCommand_SetProperty( a2dPropObject* object, const a2dPropertyIdBool* id, bool value );
00983
00984 a2dCommand_SetProperty( a2dPropObject* object, const a2dPropertyIdBool* id, const wxString& value );
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994 a2dCommand_SetProperty( a2dPropObject* object, const a2dPropertyIdInt16* id, wxInt16 value );
00995
00996
00997
00998
00999
01000
01001
01002
01003
01004 a2dCommand_SetProperty( a2dPropObject* object, const a2dPropertyIdUint16* id, wxUint16 value );
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014 a2dCommand_SetProperty( a2dPropObject* object, const a2dPropertyIdInt32* id, wxInt32 value );
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024 a2dCommand_SetProperty( a2dPropObject* object, const a2dPropertyIdUint32* id, wxUint32 value );
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034 a2dCommand_SetProperty( a2dPropObject* object, const a2dPropertyIdDouble* id, double value );
01035
01036
01037
01038
01039
01040
01041
01042
01043
01044 a2dCommand_SetProperty( a2dPropObject* object, const a2dPropertyIdColour* id, const wxColour& colour );
01045
01046 ~a2dCommand_SetProperty(void);
01047
01048
01049 a2dCommand_SetProperty( const a2dCommand_SetProperty &other );
01050
01051
01052
01053 a2dNamedProperty* GetProperty() { return m_property; }
01054
01055
01056 const a2dPropertyId* GetPropertyId() { return m_id; }
01057
01058 a2dPropObject* GetObject() { return m_propRefObject.Get(); }
01059
01060 bool Do();
01061 bool Undo();
01062
01063 protected:
01064
01065 a2dCommand_SetProperty( a2dPropObject* object, const a2dPropertyId* id );
01066
01067
01068 a2dAutoZeroPtr< a2dPropObject > m_propRefObject;
01069
01070
01071 a2dNamedPropertyPtr m_property;
01072
01073
01074 const a2dPropertyId *m_id;
01075 };
01076
01077
01078
01079
01080
01081 BEGIN_DECLARE_EVENT_TYPES()
01082
01083 DECLARE_EXPORTED_EVENT_TYPE( A2DGENERALDLLEXP, wxEVT_BEGINBUSY, 1 )
01084
01085 DECLARE_EXPORTED_EVENT_TYPE( A2DGENERALDLLEXP, wxEVT_ENDBUSY, 1 )
01086
01087 DECLARE_EXPORTED_EVENT_TYPE( A2DGENERALDLLEXP, wxEVT_DO, 1 )
01088
01089 DECLARE_EXPORTED_EVENT_TYPE( A2DGENERALDLLEXP, wxEVT_UNDO, 1 )
01090
01091 DECLARE_EXPORTED_EVENT_TYPE( A2DGENERALDLLEXP, wxEVT_REDO, 1 )
01092
01093 DECLARE_EXPORTED_EVENT_TYPE( A2DGENERALDLLEXP, wxEVT_MENUSTRINGS, 1 )
01094
01095 DECLARE_EXPORTED_EVENT_TYPE( A2DGENERALDLLEXP, a2dEVT_PROPOBJECT_EDITPROPERTIES_EVENT, 1)
01096 END_DECLARE_EVENT_TYPES()
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107
01108
01109
01110 class A2DGENERALDLLEXP a2dPropertyEditEvent: public a2dEvent
01111 {
01112 public:
01113
01114
01115 a2dPropertyEditEvent( a2dPropObject* object, a2dNamedPropertyList* properties = NULL );
01116
01117
01118 a2dPropertyEditEvent( const a2dPropertyEditEvent& other );
01119
01120
01121 virtual wxEvent *Clone() const { return new a2dPropertyEditEvent(*this); }
01122
01123 a2dNamedPropertyList* GetPropertyList() { return m_properties; }
01124
01125
01126 bool GetEdited() { return m_edited; }
01127
01128
01129 void SetEdited( bool edited ) { m_edited = edited; }
01130
01131 private:
01132
01133 a2dNamedPropertyList* m_properties;
01134
01135 bool m_edited;
01136 };
01137
01138
01139 typedef void ( a2dEvtHandler::*a2dPropertyEditEventFunction )( a2dPropertyEditEvent& );
01140
01141 typedef void ( wxEvtHandler::*a2dPropertyEditEventFunctionEvt )( a2dPropertyEditEvent& );
01142
01143
01144
01145
01146
01147
01148 #define A2D_EVT_PROPOBJECT_EDITPROPERTIES_EVENT(func) A2D_DECLARE_EVENT_TABLE_ENTRY( a2dEVT_PROPOBJECT_EDITPROPERTIES_EVENT, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) static_cast < a2dPropertyEditEventFunction > ( & func ), (wxObject *) NULL ),
01149
01150 #define EVT_PROPOBJECT_EDITPROPERTIES_EVENT(func) DECLARE_EVENT_TABLE_ENTRY( a2dEVT_PROPOBJECT_EDITPROPERTIES_EVENT, wxID_ANY, wxID_ANY, (wxObjectEventFunction) static_cast < a2dPropertyEditEventFunctionEvt > ( & func ), (wxObject *) NULL ),
01151
01152
01153
01154
01155
01156
01157
01158
01159
01160
01161
01162
01163 class A2DGENERALDLLEXP a2dCommandProcessorEvent : public a2dEvent
01164 {
01165
01166 public:
01167
01168
01169
01170
01171
01172
01173 a2dCommandProcessorEvent( wxEventType type, a2dCommand* cmd )
01174 : a2dEvent( 0, type )
01175 {
01176 m_cmd = cmd;
01177 m_undoLabel = wxT("");
01178 m_redoLabel = wxT("");
01179 m_canUndo = false;
01180 m_canRedo = false;
01181 }
01182
01183
01184
01185
01186
01187
01188
01189
01190
01191
01192
01193 a2dCommandProcessorEvent( a2dCommand* cmd,
01194 const wxString& undoLabel, bool canUndo,
01195 const wxString& redoLabel, bool canRedo
01196 )
01197 : a2dEvent( 0, wxEVT_MENUSTRINGS )
01198 {
01199 m_cmd = cmd;
01200 m_undoLabel = undoLabel;
01201 m_redoLabel = redoLabel;
01202 m_canUndo = canUndo;
01203 m_canRedo = canRedo;
01204 }
01205
01206
01207 a2dCommandProcessorEvent(const a2dCommandProcessorEvent & event)
01208 : a2dEvent(event)
01209 {
01210 m_cmd = event.m_cmd;
01211 m_undoLabel = event.m_undoLabel;
01212 m_redoLabel = event.m_redoLabel;
01213 m_canUndo = event.m_canUndo;
01214 m_canRedo = event.m_canRedo;
01215 }
01216
01217
01218 virtual wxEvent *Clone() const { return new a2dCommandProcessorEvent(*this); }
01219
01220
01221 a2dCommand* GetCommand() { return m_cmd; }
01222
01223
01224 wxString& GetUndoMenuLabel() { return m_undoLabel; }
01225
01226 wxString& GetRedoMenuLabel() { return m_redoLabel; }
01227
01228 bool CanUndo() { return m_canUndo; }
01229
01230 bool CanRedo() { return m_canRedo; }
01231
01232 protected:
01233
01234
01235 a2dCommand* m_cmd;
01236
01237
01238 wxString m_undoLabel;
01239
01240
01241 bool m_canUndo;
01242
01243
01244 wxString m_redoLabel;
01245
01246
01247 bool m_canRedo;
01248 };
01249
01250
01251
01252
01253
01254 typedef void (a2dEvtHandler::*a2dObjectCommandProcessorEventFunction)(a2dCommandProcessorEvent&);
01255 typedef void (wxEvtHandler::*wxCommandProcessorEventFunction)(a2dCommandProcessorEvent&);
01256
01257
01258 #define A2D_EVT_DO(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_DO, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) static_cast< a2dObjectCommandProcessorEventFunction > (& func), (wxObject *) NULL ),
01259
01260 #define A2D_EVT_UNDO(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_UNDO, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) static_cast< a2dObjectCommandProcessorEventFunction > (& func), (wxObject *) NULL ),
01261
01262 #define A2D_EVT_REDO(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_REDO, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) static_cast< a2dObjectCommandProcessorEventFunction > (& func), (wxObject *) NULL ),
01263
01264 #define A2D_EVT_MENUSTRINGS(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_MENUSTRINGS, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) static_cast< a2dObjectCommandProcessorEventFunction > (& func), (wxObject *) NULL ),
01265
01266
01267 #define A2D_EVT_BEGINBUSY(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_BEGINBUSY, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) static_cast< a2dObjectCommandProcessorEventFunction > (& func), (wxObject *) NULL ),
01268
01269 #define A2D_EVT_ENDBUSY(func) A2D_DECLARE_EVENT_TABLE_ENTRY( wxEVT_ENDBUSY, wxID_ANY, wxID_ANY, (a2dObjectEventFunction) static_cast< a2dObjectCommandProcessorEventFunction > (& func), (wxObject *) NULL ),
01270
01271
01272 #define EVT_DO(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_DO, wxID_ANY, wxID_ANY, (wxObjectEventFunction) static_cast< wxCommandProcessorEventFunction > (& func), (wxObject *) NULL ),
01273
01274 #define EVT_UNDO(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_UNDO, wxID_ANY, wxID_ANY, (wxObjectEventFunction) static_cast< wxCommandProcessorEventFunction > (& func), (wxObject *) NULL ),
01275
01276 #define EVT_MENUSTRINGS(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MENUSTRINGS, wxID_ANY, wxID_ANY, (wxObjectEventFunction) static_cast< wxCommandProcessorEventFunction > (& func), (wxObject *) NULL ),
01277
01278
01279
01280
01281
01282
01283
01284
01285
01286
01287
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297 class A2DGENERALDLLEXP a2dCommandProcessor : public a2dEvtHandler
01298 {
01299 public:
01300
01301
01302
01303
01304
01305 a2dCommandProcessor(int maxCommands = -1);
01306
01307
01308 virtual ~a2dCommandProcessor();
01309
01310
01311
01312
01313
01314
01315
01316
01317 virtual bool Submit(a2dCommand *command, bool storeIt = true);
01318
01319
01320 virtual void Store(a2dCommand *command);
01321
01322
01323 virtual bool Undo();
01324
01325 virtual bool Redo();
01326
01327 virtual bool CanUndo() const;
01328
01329 virtual bool CanRedo() const;
01330
01331
01332 virtual void Initialize();
01333
01334
01335
01336
01337
01338
01339
01340
01341
01342
01343
01344
01345
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355
01356
01357
01358
01359
01360
01361
01362
01363
01364
01365
01366
01367
01368
01369
01370
01371
01372
01373 virtual void SetMenuStrings();
01374
01375
01376 wxString GetUndoMenuLabel() const;
01377
01378
01379 wxString GetRedoMenuLabel() const;
01380
01381
01382 a2dCommand *GetCurrentCommand() const
01383 {
01384 return m_currentCommand;
01385 }
01386
01387
01388 int GetMaxCommands() const { return m_maxNoCommands; }
01389
01390
01391 a2dCommandGroup* GetRootGroup() const { return m_rootGroup; }
01392
01393
01394 a2dCommandGroup* GetCurrentGroup() const { return m_currentGroup; }
01395
01396
01397 virtual void ClearCommands();
01398
01399
01400 const wxString& GetUndoAccelerator() const { return m_undoAccelerator; }
01401
01402 const wxString& GetRedoAccelerator() const { return m_redoAccelerator; }
01403
01404
01405 void SetUndoAccelerator(const wxString& accel) { m_undoAccelerator = accel; }
01406
01407 void SetRedoAccelerator(const wxString& accel) { m_redoAccelerator = accel; }
01408
01409
01410
01411
01412
01413
01414
01415
01416
01417 virtual bool SetOrAddPropertyToObject( a2dPropObject* propRefObject, const wxString& name, const wxString& value = wxT(""), bool withUndo = true );
01418
01419
01420
01421
01422
01423
01424
01425 virtual bool SetOrAddPropertyToObject( a2dPropObject* propRefObject, a2dNamedProperty *property, bool withUndo = true );
01426
01427
01428
01429 a2dCommandGroup *CommandGroupBegin( const wxString &name );
01430
01431
01432
01433 void CommandGroupEnd( a2dCommandGroup *group );
01434
01435
01436
01437 bool SmrtPtrRelease();
01438
01439 protected:
01440
01441
01442
01443
01444
01445
01446
01447 void SentBusyEvent( bool start, a2dCommand *command );
01448
01449
01450 a2dCommandGroup *FindActiveGroup();
01451
01452
01453 void SetCurrentToLastActive();
01454
01455
01456
01457
01458
01459
01460 virtual bool DoCommand(a2dCommand& cmd);
01461
01462
01463 virtual bool UndoCommand(a2dCommand& cmd);
01464
01465
01466 virtual bool RedoCommand(a2dCommand& cmd);
01467
01468
01469 wxUint32 m_maxNoCommands;
01470
01471 a2dSmrtPtr< a2dCommandGroup > m_rootGroup;
01472
01473
01474 a2dSmrtPtr< a2dCommandGroup > m_currentGroup;
01475
01476
01477 a2dCommandPtr m_currentCommand;
01478
01479
01480 wxString m_undoAccelerator;
01481
01482 wxString m_redoAccelerator;
01483
01484 private:
01485 DECLARE_DYNAMIC_CLASS(a2dCommandProcessor)
01486 };
01487
01488
01489
01490
01491
01492
01493
01494
01495
01496
01497 template<class T>
01498 class a2dSmrtPtrWrap: public wxObject
01499 {
01500 public:
01501
01502 a2dSmrtPtrWrap( T* caller )
01503 {
01504 m_smrtP = caller;
01505 }
01506
01507 ~a2dSmrtPtrWrap()
01508 {
01509 }
01510
01511 a2dSmrtPtr<T> m_smrtP;
01512 };
01513
01514 #if (defined(__WXMSW__) && defined(WXUSINGDLL) )
01515 template class A2DGENERALDLLEXP a2dSmrtPtrWrap< a2dCommand >;
01516 #endif
01517
01518
01519
01520 typedef a2dSmrtPtrWrap< a2dCommand > a2dCommandStore;
01521
01522 #if (defined(__WXMSW__) && defined(WXUSINGDLL) )
01523 template class A2DGENERALDLLEXP std::allocator< wxEventType >;
01524 template class A2DGENERALDLLEXP std::allocator< std::_List_nod< wxEventType, std::allocator< wxEventType > >::_Node >;
01525 template class A2DGENERALDLLEXP std::allocator< std::_List_ptr< wxEventType, std::allocator< wxEventType > >::_Nodeptr >;
01526 template class A2DGENERALDLLEXP std::list< wxEventType >;
01527 template class A2DGENERALDLLEXP a2dlist< wxEventType >;
01528 #endif
01529
01530
01531
01532
01533
01534
01535
01536
01537
01538
01539
01540
01541
01542 class A2DGENERALDLLEXP a2dDistributedEventReceiver : public a2dObject
01543 {
01544
01545 public:
01546
01547 enum a2dReceiverHandlerType {
01548 a2dReceiverwxEvtHandler,
01549 a2dReceivera2dObject
01550 };
01551
01552
01553 a2dDistributedEventReceiver( wxEvtHandler* handler )
01554 {
01555 m_valid = true;
01556 m_handler = handler;
01557 m_type = a2dReceiverwxEvtHandler;
01558 }
01559
01560 a2dDistributedEventReceiver( a2dObject* handler )
01561 {
01562 m_valid = true;
01563 m_handler = handler;
01564 m_type = a2dReceivera2dObject;
01565 }
01566
01567 ~a2dDistributedEventReceiver(){}
01568
01569 void AddWantedEventType( wxEventType type ) { m_eventTypesWanted.push_back( type ); }
01570 void RemoveWantedEventType( wxEventType type ) { m_eventTypesWanted.remove( type ); }
01571
01572 void AddNotWantedEventType( wxEventType type ) { m_eventTypesNotWanted.push_back( type ); }
01573 void RemoveNotWantedEventType( wxEventType type ) { m_eventTypesNotWanted.remove( type ); }
01574
01575 bool WantsType( wxEventType type )
01576 {
01577 if ( m_eventTypesWanted.empty() && m_eventTypesNotWanted.empty() )
01578 return true;
01579
01580 bool wanted = false;
01581 if ( m_eventTypesWanted.empty() )
01582 wanted = true;
01583 else
01584 forEachIn( a2dlist< wxEventType >, &m_eventTypesWanted )
01585 {
01586 if ( *iter == type )
01587 wanted = true;
01588 }
01589
01590 forEachIn( a2dlist< wxEventType >, &m_eventTypesNotWanted )
01591 {
01592 if ( *iter == type )
01593 wanted = false;
01594 }
01595 return wanted;
01596 }
01597
01598
01599 wxObject* m_handler;
01600
01601 a2dReceiverHandlerType m_type;
01602
01603
01604 bool m_valid;
01605
01606 protected:
01607
01608 a2dlist< wxEventType > m_eventTypesWanted;
01609
01610 a2dlist< wxEventType > m_eventTypesNotWanted;
01611
01612 virtual a2dObject* Clone( CloneOptions WXUNUSED(options) ) const
01613 {
01614 wxASSERT(0);
01615 return NULL;
01616 }
01617
01618 #if wxART2D_USE_CVGIO
01619 void DoSave( wxObject* WXUNUSED(parent), a2dIOHandlerXmlSerOut &WXUNUSED(out), a2dXmlSer_flag WXUNUSED(xmlparts), a2dObjectList* WXUNUSED(towrite) )
01620 {
01621 wxASSERT(0);
01622 }
01623
01624 void DoLoad( wxObject* WXUNUSED(parent), a2dIOHandlerXmlSerIn& WXUNUSED(parser), a2dXmlSer_flag WXUNUSED(xmlparts) )
01625 {
01626 wxASSERT(0);
01627 }
01628
01629 #endif //wxART2D_USE_CVGIO
01630
01631
01632 };
01633 #if (defined(__WXMSW__) && defined(WXUSINGDLL) )
01634 template class A2DGENERALDLLEXP a2dSmrtPtr<class a2dDistributedEventReceiver>;
01635 template class A2DGENERALDLLEXP std::allocator<class a2dSmrtPtr<class a2dDistributedEventReceiver> >;
01636 template class A2DGENERALDLLEXP std::allocator< std::_List_nod<class a2dSmrtPtr<class a2dDistributedEventReceiver>, std::allocator<class a2dSmrtPtr<class a2dDistributedEventReceiver> > >::_Node >;
01637 template class A2DGENERALDLLEXP std::allocator< std::_List_ptr<class a2dSmrtPtr<class a2dDistributedEventReceiver>, std::allocator<class a2dSmrtPtr<class a2dDistributedEventReceiver> > >::_Nodeptr >;
01638 template class A2DGENERALDLLEXP std::list<a2dSmrtPtr<class a2dDistributedEventReceiver> >;
01639 template class A2DGENERALDLLEXP a2dlist<class a2dSmrtPtr<class a2dDistributedEventReceiver> >;
01640 template class A2DGENERALDLLEXP a2dSmrtPtrList< a2dDistributedEventReceiver >;
01641 #endif
01642 typedef a2dSmrtPtrList< a2dDistributedEventReceiver > wxEventHandlersList;
01643
01644
01645
01646
01647
01648
01649
01650
01651
01652
01653
01654
01655
01656
01657
01658
01659
01660
01661
01662
01663
01664
01665
01666
01667 class A2DGENERALDLLEXP a2dEventDistributer : public wxEvtHandler
01668 {
01669
01670 public:
01671
01672
01673 a2dEventDistributer();
01674
01675
01676 ~a2dEventDistributer();
01677
01678
01679
01680
01681
01682
01683
01684
01685
01686 bool ProcessEvent( wxEvent& event);
01687
01688
01689 a2dDistributedEventReceiver* Register( wxEvtHandler* handler );
01690
01691
01692 bool Unregister( wxEvtHandler* handler );
01693
01694
01695 a2dDistributedEventReceiver* Register( a2dObject* handler );
01696
01697
01698 bool Unregister( a2dObject* handler );
01699
01700 protected:
01701
01702
01703 wxEventHandlersList m_handlers;
01704 };
01705
01706
01707
01708
01709
01710
01711
01712
01713
01714
01715
01716
01717
01718
01719
01720
01721
01722
01723
01724
01725
01726 class A2DGENERALDLLEXP a2dGeneralGlobal : public a2dObject
01727 {
01728
01729 DECLARE_CLASS( a2dGeneralGlobal )
01730
01731 public:
01732
01733 a2dGeneralGlobal();
01734
01735 virtual ~a2dGeneralGlobal();
01736
01737
01738
01739
01740
01741 virtual void ResetErrors();
01742
01743
01744 virtual void ReportError( const a2dError& error, const wxString& errorstr = wxEmptyString );
01745
01746
01747 #if !wxCHECK_VERSION(2,9,0)
01748 virtual void ReportErrorF( const a2dError& error, const wxChar* Format, ... );
01749 #else
01750 WX_DEFINE_VARARG_FUNC_VOID( ReportErrorF, 2, (const a2dError&, const wxFormatString&), DoPrintfWchar, DoPrintfUtf8)
01751 #endif
01752
01753 virtual void ReportWarning( const a2dError& error, const wxString& errorstr );
01754
01755
01756 #if !wxCHECK_VERSION(2,9,0)
01757 virtual void ReportWarningF( const a2dError& error, const wxChar* Format, ... );
01758 #else
01759 WX_DEFINE_VARARG_FUNC_VOID( ReportWarningF, 2, (const a2dError&, const wxFormatString&), DoPrintfWchar, DoPrintfUtf8)
01760 #endif
01761
01762
01763 static a2dErrorVector& GetErrors() { return m_errors; }
01764
01765
01766 wxString GetErrorsAsString();
01767
01768
01769
01770
01771
01772
01773
01774 void SendToLogTarget();
01775
01776
01777 a2dErrorWarningCode GetLastErrorCode() const;
01778
01779 a2dError GetLastError() const;
01780
01781
01782 void SetDoLog( bool onOff ) { m_showlog = onOff; }
01783
01784
01785 bool GetDoLog() { return m_showlog; }
01786
01787
01788
01789
01790
01791
01792 a2dEventDistributer* GetEventDistributer() const { return m_docviewEventDistributer; }
01793
01794
01795 void SetEventDistributer( a2dEventDistributer* docviewEventDistributer );
01796
01797
01798 void IgnoreError( unsigned int id );
01799
01800
01801 a2dVariablesHash& GetVariablesHash() { return m_variableList; }
01802
01803
01804 wxString* GetVariableString( const wxString& variablename );
01805
01806
01807 a2dPathList& GetConfigPathList() { return m_configpath; }
01808
01809
01810 a2dPropertyIdList& GetPropertyIdList() { return m_dynamicIdList; }
01811
01812 wxString GetWxArt2DVar( bool withSep = true ) const;
01813
01814 wxString GetWxArt2DArtVar( bool withSep = true ) const;
01815
01816 protected:
01817
01818 #if wxCHECK_VERSION(2,9,0)
01819 #if !wxUSE_UTF8_LOCALE_ONLY
01820 virtual void DoPrintfWchar( const a2dError&, const wxChar *format, ...);
01821 #endif
01822 #if wxUSE_UNICODE_UTF8
01823 virtual void DoPrintfUtf8( const a2dError&, const char *format, ...);
01824 #endif
01825 #endif
01826
01827
01828 static a2dPathList m_configpath;
01829
01830
01831 static bool m_showlog;
01832
01833
01834 static a2dErrorVector m_errors;
01835
01836
01837 static a2dEventDistributer* m_docviewEventDistributer;
01838
01839
01840 static wxArrayInt m_ignoredErrorIds;
01841
01842
01843 static a2dVariablesHash m_variableList;
01844
01845 static a2dPropertyIdList m_dynamicIdList;
01846
01847 private:
01848
01849
01850 virtual a2dObject* Clone( CloneOptions options ) const;
01851
01852 #if wxART2D_USE_CVGIO
01853 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList* towrite );
01854 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
01855 #endif //wxART2D_USE_CVGIO
01856
01857 };
01858
01859
01860
01861
01862
01863
01864
01865
01866 class A2DGENERALDLLEXP a2dGeneralModule : public wxModule
01867 {
01868 public:
01869
01870 a2dGeneralModule() {}
01871
01872 virtual bool OnInit();
01873 virtual void OnExit();
01874
01875 private:
01876
01877 DECLARE_DYNAMIC_CLASS(a2dGeneralModule)
01878 };
01879
01880 #if (defined(__WXMSW__) && defined(WXUSINGDLL) )
01881 template class A2DGENERALDLLEXP a2dSmrtPtr<a2dGeneralGlobal>;
01882 #endif
01883
01884
01885 A2DGENERALDLLEXP_DATA (extern a2dSmrtPtr<a2dGeneralGlobal>) a2dGeneralGlobals;
01886
01887
01888
01889
01890
01891
01892
01893 #define A2D_ARGUMENT_SETTER( TYPE, ARGUMENT_NAME ) \
01894 Args & \
01895 ARGUMENT_NAME( const TYPE& arg) { \
01896 this->argValue.ARGUMENT_NAME = arg; \
01897 this->argSet.ARGUMENT_NAME = true; \
01898 return *this; \
01899 }
01900
01901
01902
01903
01904
01905 class A2DGENERALDLLEXP a2dCommand_SetVariable: public a2dCommand
01906 {
01907 DECLARE_DYNAMIC_CLASS(a2dCommand_SetVariable)
01908
01909 public:
01910
01911
01912
01913
01914 static const a2dCommandId Id;
01915
01916 class A2DGENERALDLLEXP Args
01917 {
01918 public:
01919 Args()
01920 {
01921 argSet.varname = false;
01922 argSet.varvalue = false;
01923 }
01924
01925 ~Args()
01926 {
01927 }
01928
01929 A2D_ARGUMENT_SETTER( wxString, varname )
01930 A2D_ARGUMENT_SETTER( wxString, varvalue )
01931
01932 struct argValuet
01933 {
01934 wxString varname; wxString varvalue;
01935 } argValue;
01936
01937 struct argSett
01938 {
01939 bool varname, varvalue;
01940 } argSet;
01941 };
01942
01943 a2dCommand_SetVariable( const Args& args = Args() )
01944 {
01945 m_args.argValue.varname = args.argSet.varname ? args.argValue.varname: wxString(wxEmptyString);
01946 m_args.argValue.varvalue = args.argSet.varvalue ? args.argValue.varvalue: wxString(wxEmptyString);
01947 }
01948
01949 private:
01950
01951 Args m_args;
01952
01953 virtual bool Do()
01954 {
01955 a2dGeneralGlobals->GetVariablesHash().SetVariableString( m_args.argValue.varname, m_args.argValue.varvalue );
01956 return true;
01957 }
01958 virtual bool Undo()
01959 {
01960 return false;
01961 }
01962 };
01963
01964
01965
01966
01967
01968 class A2DGENERALDLLEXP a2dCommand_SetEnvironmentVariable: public a2dCommand
01969 {
01970 DECLARE_DYNAMIC_CLASS(a2dCommand_SetEnvironmentVariable)
01971
01972 public:
01973
01974
01975
01976
01977 static const a2dCommandId Id;
01978
01979 class A2DGENERALDLLEXP Args
01980 {
01981 public:
01982 Args()
01983 {
01984 argSet.varname = false;
01985 argSet.varvalue = false;
01986 }
01987
01988 ~Args()
01989 {
01990 }
01991
01992 A2D_ARGUMENT_SETTER( wxString, varname )
01993 A2D_ARGUMENT_SETTER( wxString, varvalue )
01994
01995 struct argValuet
01996 {
01997 wxString varname; wxString varvalue;
01998 } argValue;
01999
02000 struct argSett
02001 {
02002 bool varname, varvalue;
02003 } argSet;
02004 };
02005
02006 a2dCommand_SetEnvironmentVariable( const Args& args = Args() )
02007 {
02008 m_args.argValue.varname = args.argSet.varname ? args.argValue.varname: wxString(wxEmptyString);
02009 m_args.argValue.varvalue = args.argSet.varvalue ? args.argValue.varvalue: wxString(wxEmptyString);
02010 }
02011
02012 private:
02013
02014 Args m_args;
02015
02016 virtual bool Do()
02017 {
02018 if ( wxSetEnv( m_args.argValue.varname, m_args.argValue.varvalue ) )
02019 return true;
02020
02021 #if wxCHECK_VERSION(2,9,0)
02022 a2dGeneralGlobals->ReportErrorF( a2dError_SetEnv, _(" SetEnv() Error: Could not set Environment variable %s = %s\n"),
02023 m_args.argValue.varname, m_args.argValue.varvalue );
02024 #else
02025 a2dGeneralGlobals->ReportErrorF( a2dError_SetEnv, _(" SetEnv() Error: Could not set Environment variable %s = %s\n"),
02026 m_args.argValue.varname.c_str(), m_args.argValue.varvalue.c_str() );
02027 #endif
02028 return true;
02029 }
02030 virtual bool Undo()
02031 {
02032 return false;
02033 }
02034 };
02035
02036
02037
02038
02039
02040 class A2DGENERALDLLEXP a2dCommand_GetVariable: public a2dCommand
02041 {
02042 DECLARE_DYNAMIC_CLASS(a2dCommand_GetVariable)
02043
02044 public:
02045
02046
02047
02048
02049 static const a2dCommandId Id;
02050
02051 class A2DGENERALDLLEXP Args
02052 {
02053 public:
02054 Args()
02055 {
02056 argSet.varname = false;
02057 argSet.varvalue = false;
02058 }
02059
02060 ~Args()
02061 {
02062 }
02063
02064
02065 A2D_ARGUMENT_SETTER( wxString, varname )
02066 A2D_ARGUMENT_SETTER( wxString, varvalue )
02067
02068 struct argValuet
02069 {
02070 wxString varname; wxString varvalue;
02071 } argValue;
02072
02073 struct argSett
02074 {
02075 bool varname, varvalue;
02076 } argSet;
02077 };
02078
02079 a2dCommand_GetVariable( const Args& args = Args() )
02080 {
02081 m_args.argValue.varname = args.argSet.varname ? args.argValue.varname: wxString(wxEmptyString);
02082 m_args.argValue.varvalue = args.argSet.varvalue ? args.argValue.varvalue: wxString(wxEmptyString);
02083 }
02084
02085 private:
02086
02087 Args m_args;
02088
02089 virtual bool Do()
02090 {
02091 const a2dNamedProperty* propfound = a2dGeneralGlobals->GetVariablesHash().GetVariable( m_args.argValue.varname );
02092 if( !propfound )
02093 {
02094 a2dGeneralGlobals->ReportError( a2dError_GetVar, _("wrong variable name, variable does not exist") );
02095 return false;
02096 }
02097
02098 m_args.argSet.varvalue = true;
02099 m_args.argValue.varvalue = propfound->StringValueRepresentation();
02100 return true;
02101 }
02102 virtual bool Undo()
02103 {
02104 return false;
02105 }
02106 };
02107
02108
02109
02110
02111
02112 class A2DGENERALDLLEXP a2dCommand_GetEnvVariable: public a2dCommand
02113 {
02114
02115 DECLARE_DYNAMIC_CLASS(a2dCommand_GetEnvVariable)
02116
02117 public:
02118
02119
02120
02121
02122 static const a2dCommandId Id;
02123
02124 class A2DGENERALDLLEXP Args
02125 {
02126 public:
02127 Args()
02128 {
02129 argSet.varname = false;
02130 argSet.varvalue = false;
02131 }
02132
02133 ~Args()
02134 {
02135 }
02136
02137
02138 A2D_ARGUMENT_SETTER( wxString, varname )
02139 A2D_ARGUMENT_SETTER( wxString, varvalue )
02140
02141 struct argValuet
02142 {
02143 wxString varname; wxString varvalue;
02144 } argValue;
02145
02146 struct argSett
02147 {
02148 bool varname, varvalue;
02149 } argSet;
02150 };
02151
02152 a2dCommand_GetEnvVariable( const Args& args = Args() )
02153 {
02154 m_args.argValue.varname = args.argSet.varname ? args.argValue.varname: wxString(wxEmptyString);
02155 if ( !args.argSet.varname || m_args.argValue.varname.IsEmpty() )
02156 a2dGeneralGlobals->ReportError( a2dError_GetEnv, _("wrong variable name, variable may not be empty") );
02157 }
02158
02159 private:
02160
02161 Args m_args;
02162
02163 virtual bool Do()
02164 {
02165 wxString envValue;
02166 if( !wxGetEnv( m_args.argValue.varname, &envValue ) )
02167 {
02168 a2dGeneralGlobals->ReportError( a2dError_GetEnv, _("environment variable does not exist") );
02169 return false;
02170 }
02171
02172 m_args.argSet.varvalue = true;
02173 m_args.argValue.varvalue = envValue;
02174 return true;
02175 }
02176 virtual bool Undo()
02177 {
02178 return false;
02179 }
02180 };
02181
02182
02183
02184
02185
02186
02187
02188
02189
02190
02191
02192
02193 BEGIN_DECLARE_EVENT_TYPES()
02194
02195 DECLARE_EXPORTED_EVENT_TYPE( A2DGENERALDLLEXP, a2dEVT_COM_EVENT, 1 )
02196 END_DECLARE_EVENT_TYPES()
02197
02198
02199
02200
02201
02202
02203
02204
02205
02206
02207
02208
02209
02210
02211
02212
02213
02214
02215
02216
02217
02218
02219
02220
02221
02222
02223
02224
02225
02226
02227
02228
02229
02230
02231
02232
02233
02234
02235
02236
02237
02238
02239
02240
02241
02242
02243
02244
02245
02246
02247
02248
02249
02250
02251
02252
02253
02254
02255
02256
02257
02258
02259
02260
02261
02262
02263 class A2DGENERALDLLEXP a2dComEvent: public wxEvent
02264 {
02265 DECLARE_DYNAMIC_CLASS( a2dComEvent )
02266
02267 public:
02268
02269
02270
02271
02272 static const wxEventType sm_changedProperty;
02273
02274
02275 static const wxEventType sm_changedRefObject;
02276
02277
02278 static const wxEventType sm_non;
02279
02280
02281 a2dComEvent( wxObject* sender, const wxEventType* id );
02282
02283
02284
02285
02286
02287
02288
02289 a2dComEvent( a2dPropObject* sender, const a2dPropertyId* id, const wxEventType* eventid = &sm_changedProperty );
02290
02291
02292
02293
02294
02295
02296
02297
02298 a2dComEvent( wxObject* sender, a2dNamedProperty* property, const wxEventType* id = &sm_changedProperty, bool ownProp = false );
02299
02300
02301
02302
02303
02304
02305
02306 a2dComEvent( wxObject* sender, const a2dNamedProperty& property, const wxEventType* eventid = &sm_changedProperty );
02307
02308
02309
02310
02311
02312
02313
02314
02315
02316 a2dComEvent( wxObject* sender, a2dObject* refObject, const wxEventType* eventid = &sm_changedRefObject );
02317
02318
02319
02320
02321
02322
02323
02324
02325
02326
02327 a2dComEvent( wxObject* sender, const a2dPropertyIdRefObject* id, a2dObject* refObject, const wxEventType* eventid = &sm_changedProperty );
02328
02329
02330 a2dComEvent( wxObject* sender, const a2dPropertyIdBool* id, bool propertyValue, const wxEventType* eventid = &sm_changedProperty );
02331
02332
02333 a2dComEvent( wxObject* sender, const a2dPropertyIdUint16* id, wxUint16 propertyValue, const wxEventType* eventid = &sm_changedProperty );
02334
02335
02336 a2dComEvent( wxObject* sender, const a2dPropertyIdInt32* id, wxInt32 propertyValue, const wxEventType* eventid = &sm_changedProperty );
02337
02338
02339 a2dComEvent( wxObject* sender, const a2dPropertyIdDouble* id, double propertyValue, const wxEventType* eventid = &sm_changedProperty );
02340
02341
02342 a2dComEvent( wxObject* sender, const a2dPropertyIdString* id, const wxString& propertyValue, const wxEventType* eventid = &sm_changedProperty );
02343
02344 a2dComEvent();
02345
02346 ~a2dComEvent();
02347
02348 a2dComEvent( const a2dComEvent& other );
02349
02350 wxEvent* Clone(void) const;
02351
02352 a2dNamedProperty* GetProperty() { return m_property; }
02353
02354 const wxEventType* GetEventComId() { return m_comid; }
02355
02356 const wxEventType* GetEventComIdReturn() { return m_comReturn; }
02357
02358
02359 wxObject* GetHandler() { return m_handler; }
02360
02361
02362
02363
02364
02365
02366
02367 void SetHandler( wxObject* sentTo ) { m_handler = sentTo; }
02368
02369 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
02370
02371 a2dSmrtPtr<a2dComEvent> *m_ownerlist;
02372
02373 typedef a2dSmrtPtr<a2dComEvent> TOwnerListClass;
02374
02375
02376 void DumpOwners();
02377 #endif
02378
02379 private:
02380
02381
02382
02383
02384
02385
02386
02387
02388
02389
02390
02391
02392 a2dComEvent* SmrtPtrOwn() { m_refcount++; return this; }
02393
02394
02395
02396
02397 bool SmrtPtrRelease()
02398 {
02399 m_refcount--;
02400 wxASSERT_MSG( m_refcount >= 0, wxT("a2dComEvent Own/Release not matched (extra Release calls)") );
02401 if ( m_refcount <= 0 )
02402 {
02403 delete this;
02404 return true;
02405 }
02406 return false;
02407 }
02408
02409 friend class a2dSmrtPtrBase;
02410
02411
02412 wxObject* m_handler;
02413
02414
02415 int m_refcount;
02416
02417
02418 a2dNamedProperty* m_property;
02419
02420
02421 const wxEventType* m_comid;
02422
02423
02424 const wxEventType* m_comReturn;
02425
02426
02427 bool m_ownProp;
02428 };
02429
02430 #if (defined(__WXMSW__) && defined(WXUSINGDLL) )
02431 template class A2DGENERALDLLEXP a2dSmrtPtr<class a2dComEvent>;
02432 template class A2DGENERALDLLEXP std::allocator<class a2dSmrtPtr<class a2dComEvent> >;
02433 template class A2DGENERALDLLEXP std::allocator< std::_List_nod<class a2dSmrtPtr<class a2dComEvent>, std::allocator<class a2dSmrtPtr<class a2dComEvent> > >::_Node >;
02434 template class A2DGENERALDLLEXP std::allocator< std::_List_ptr<class a2dSmrtPtr<class a2dComEvent>, std::allocator<class a2dSmrtPtr<class a2dComEvent> > >::_Nodeptr >;
02435 template class A2DGENERALDLLEXP std::list<class a2dSmrtPtr<class a2dComEvent> >;
02436 template class A2DGENERALDLLEXP a2dlist<class a2dSmrtPtr<class a2dComEvent> >;
02437 template class A2DGENERALDLLEXP a2dSmrtPtrList<class a2dComEvent>;
02438 #endif
02439
02440 typedef void ( wxEvtHandler::*a2dComEventFunction ) ( a2dComEvent& );
02441 typedef void ( a2dEvtHandler::*a2dObjectComEventFunction ) ( a2dComEvent& );
02442
02443 #define a2dComEventHandler(func) \
02444 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(a2dComEventFunction, &func)
02445 #define a2dObjectComEventHandler(func) \
02446 (a2dObjectEventFunction)(a2dEventFunction)wxStaticCastEvent(a2dObjectComEventFunction, &func)
02447
02448
02449
02450
02451
02452
02453 #define EVT_COM_EVENT(func) wx__DECLARE_EVT0( a2dEVT_COM_EVENT, a2dComEventHandler( func ))
02454
02455 #define A2D_EVT_COM_EVENT(func) a2d__DECLARE_EVT0( a2dEVT_COM_EVENT, a2dObjectComEventHandler( func ))
02456
02457
02458
02459
02460 #endif // _COMEVTH__