00001 /* 00002 Copyright (C) 1999-2006 Id Software, Inc. and contributors. 00003 For a list of contributors, see the accompanying CONTRIBUTORS file. 00004 00005 This file is part of GtkRadiant. 00006 00007 GtkRadiant is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2 of the License, or 00010 (at your option) any later version. 00011 00012 GtkRadiant is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with GtkRadiant; if not, write to the Free Software 00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00020 */ 00021 00022 #if !defined(INCLUDED_IPLUGIN_H) 00023 #define INCLUDED_IPLUGIN_H 00024 00025 #include "generic/constant.h" 00026 00027 typedef const char* (* PFN_QERPLUG_INIT) (void* hApp, void* pMainWidget); 00028 typedef const char* (* PFN_QERPLUG_GETNAME) (); 00029 typedef const char* (* PFN_QERPLUG_GETCOMMANDLIST) (); 00030 typedef const char* (* PFN_QERPLUG_GETCOMMANDTITLELIST) (); 00031 typedef void (* PFN_QERPLUG_DISPATCH) (const char* p, float* vMin, float* vMax, bool bSingleBrush); 00032 00033 struct _QERPluginTable 00034 { 00035 INTEGER_CONSTANT(Version, 1); 00036 STRING_CONSTANT(Name, "plugin"); 00037 00038 PFN_QERPLUG_INIT m_pfnQERPlug_Init; 00039 PFN_QERPLUG_GETNAME m_pfnQERPlug_GetName; 00040 PFN_QERPLUG_GETCOMMANDLIST m_pfnQERPlug_GetCommandList; 00041 PFN_QERPLUG_GETCOMMANDTITLELIST m_pfnQERPlug_GetCommandTitleList; 00042 PFN_QERPLUG_DISPATCH m_pfnQERPlug_Dispatch; 00043 }; 00044 00045 template<typename Type> 00046 class Modules; 00047 typedef Modules<_QERPluginTable> PluginModules; 00048 00049 template<typename Type> 00050 class ModulesRef; 00051 typedef ModulesRef<_QERPluginTable> PluginModulesRef; 00052 00053 // =============================================================================== 00054 00055 #include <cstddef> 00056 00057 /* Pure virtual interface for a plugin 00058 * temporary solution for migration from old plugin tech to synapse plugins */ 00059 class IPlugin 00060 { 00061 public: 00062 IPlugin () 00063 { 00064 } 00065 virtual ~IPlugin () 00066 { 00067 } 00068 00069 virtual const char* getMenuName () = 0; 00070 virtual std::size_t getCommandCount () = 0; 00071 virtual const char* getCommand (std::size_t) = 0; 00072 virtual const char* getCommandTitle (std::size_t) = 0; 00073 virtual void addMenuID (std::size_t) = 0; 00074 virtual bool ownsCommandID (std::size_t n) = 0; 00075 }; 00076 00077 #endif