1 /////////////////////////////////////////////////////////////////////////////// 2 // Name: plugin.h 3 // Description: 4 // Author: madedit@gmail.com 5 // Licence: GPL 6 /////////////////////////////////////////////////////////////////////////////// 7 8 #ifndef _MADPLUGIN_H_ 9 #define _MADPLUGIN_H_ 10 11 /*************************************************************** 12 13 Export Functions: 14 15 // 16 PLUGIN_EXPORT int PluginExecute(); 17 18 // if the plugin registers Events and the Events had been triggered, 19 // Editor will call PluginOnEvents() 20 PLUGIN_EXPORT int PluginOnEvents(int PluginID, int nEvents, void* pParam); 21 22 // Editor send nMsg to the plugin for get or set data. 23 PLUGIN_EXPORT int PluginProc(int PluginID, int nMsg, void* pParam); 24 25 26 27 ChangeLogs: 28 v0.000009: not work yet. 29 30 ***************************************************************/ 31 32 #pragma pack(1) 33 34 35 #if defined(__GNUC__) 36 # define PLUGIN_EXPORT extern "C" 37 #elif defined(__MWERKS__) 38 # define PLUGIN_EXPORT extern "C" __declspec(export) 39 #else // __VISUALC__ __BORLANDC__ __WATCOMC__ 40 # define PLUGIN_EXPORT extern "C" __declspec(dllexport) 41 #endif 42 43 #if !defined(PLUGIN_EXPORT) 44 # define PLUGIN_EXPORT 45 #endif 46 47 #if defined(WIN32) 48 # include <windows.h> 49 # define WIN32_DLL_ENTRY() \ 50 static HINSTANCE gs_hInstance=NULL; \ 51 BOOL WINAPI \ 52 DllMain(HINSTANCE hModule, DWORD fdwReason, LPVOID lpReserved) \ 53 { \ 54 if(fdwReason == DLL_PROCESS_ATTACH ){ \ 55 gs_hInstance = hModule; \ 56 } \ 57 return TRUE; \ 58 } 59 #else 60 # define WIN32_DLL_ENTRY() 61 #endif 62 63 typedef int (*EditorProc_Proc)(int PluginID, int nMsg, void *pParam); 64 65 // Messages to Editor for EditorProc() 66 #define ED_GET_VERSION 1 67 #define ED_REGISTER_EVENTS 68 69 70 // Messages to Plugin for PluginProc() 71 72 #define PL_INITIALIZE 1 73 // pParam = (EditorProc_Proc) 74 75 #define PL_GET_INFORMATION 2 76 // pParam = (PluginInformation*) 77 struct PluginInformation 78 { 79 wchar_t* name; 80 wchar_t* version; 81 wchar_t* menutext; 82 wchar_t* hint; 83 char** xpm; 84 int checkable; 85 }; 86 87 #define PL_GET_NAME 2 88 #define PL_GET_VERSION 3 89 #define PL_GET_MENU_TEXT 4 90 #define PL_GET_HINT 5 91 #define PL_GET_XPM 6 92 #define PL_GET_CHECKABLE 7 93 94 95 // Events 96 #define EVENT_FIRST 0 97 98 99 #pragma pack() 100 101 #endif //_MADPLUGIN_H_ 102