00001 #ifndef PLUGINSLOTS_H_ 00002 #define PLUGINSLOTS_H_ 00003 00004 /* greebo: A plugin is contained in the class CPluginSlot and multiple PluginSlots are 00005 * owned by the class CPluginSlots. 00006 */ 00007 00008 #include <list> 00009 #include <string> 00010 #include "iplugin.h" 00011 #include "PluginsVisitor.h" 00012 00013 // Forward declaration to avoid including the whole gtk stuff 00014 typedef struct _GtkWidget GtkWidget; 00015 00016 // ================================================================================= 00017 00018 /* greebo: This is a PlugInSlot containing a single plugin. It maintains a list of 00019 * commands that are necessary to integrate it into the radiant core and the 00020 * plugin interface. 00021 */ 00022 class CPluginSlot: public IPlugin 00023 { 00024 std::string m_menu_name; 00025 const _QERPluginTable *mpTable; 00026 std::list<std::string> m_CommandStrings; 00027 std::list<std::string> m_CommandTitleStrings; 00028 std::list<std::size_t> m_CommandIDs; 00029 00030 public: 00034 CPluginSlot (GtkWidget* main_window, const std::string& name, const _QERPluginTable& table); 00038 void Dispatch (const std::string& p); 00039 00040 // IPlugin ------------------------------------------------------------ 00041 const char* getMenuName (); 00042 std::size_t getCommandCount (); 00043 const char* getCommand (std::size_t n); 00044 const char* getCommandTitle (std::size_t n); 00045 void addMenuID (std::size_t n); 00046 bool ownsCommandID (std::size_t n); 00047 }; 00048 00049 // ================================================================================= 00050 00051 class CPluginSlots 00052 { 00053 std::list<CPluginSlot*> mSlots; 00054 public: 00055 virtual ~CPluginSlots (); 00056 00057 void AddPluginSlot (GtkWidget* main_window, const std::string& name, const _QERPluginTable& table) 00058 { 00059 mSlots.push_back(new CPluginSlot(main_window, name, table)); 00060 } 00061 00062 void PopulateMenu (PluginsVisitor& menu); 00063 bool Dispatch (std::size_t n, const std::string& p); 00064 }; 00065 00066 #endif /*PLUGINSLOTS_H_*/