New Plugin doen't catch events
Posted: Fri Dec 19, 2008 10:46 pm
Hi
I'm creating a new Plugin (surprise for christmas ), and I have a problem : I can catch event from my own menu (created in, but not from CL (those inside EVENT_TABLE) :
Do I make a big mistake ?
FYI, I'm using CL 2527, build from sources with wxWidgets 2.8.9.
--
Jérémie
I'm creating a new Plugin (surprise for christmas ), and I have a problem : I can catch event from my own menu (created in
Code: Select all
void MyPlugin::CreatePluginMenu(wxMenu *pluginsMenu)
Code: Select all
static MyPlugin* thePlugin = NULL;
//Define the plugin entry point
extern "C" __declspec(dllexport) IPlugin *CreatePlugin(IManager *manager)
{
if (thePlugin == 0) {
thePlugin = new MyPlugin(manager);
}
return thePlugin;
}
extern "C" __declspec(dllexport) PluginInfo GetPluginInfo()
{
PluginInfo info;
info.SetAuthor(wxT("Jérémie Fouché"));
info.SetName(wxT("MyPlugin"));
info.SetDescription(wxT("MyPlugin"));
info.SetVersion(wxT("v0.1"));
return info;
}
extern "C" __declspec(dllexport) int GetPluginInterfaceVersion()
{
return PLUGIN_INTERFACE_VERSION;
}
BEGIN_EVENT_TABLE(MyPlugin, IPlugin)
EVT_COMMAND(wxID_ANY, wxEVT_SHELL_COMMAND_STARTED, MyPlugin::OnShellCommandStarted)
EVT_COMMAND(wxID_ANY, wxEVT_SHELL_COMMAND_STARTED_NOCLEAN, MyPlugin::OnShellCommandStarted)
EVT_COMMAND(wxID_ANY, wxEVT_SHELL_COMMAND_PROCESS_ENDED, MyPlugin::OnShellCommandEnded)
END_EVENT_TABLE()
MyPlugin::MyPlugin(IManager *manager)
: IPlugin(manager)
, m_topWindow(NULL)
{
m_longName = wxT("MyPlugin");
m_shortName = wxT("MyPlugin");
m_topWindow = m_mgr->GetTheApp();
}
MyPlugin::~MyPlugin()
{
}
wxToolBar *MyPlugin::CreateToolBar(wxWindow *parent)
{
return NULL;
}
void MyPlugin::CreatePluginMenu(wxMenu *pluginsMenu)
{
wxMenu *menu = new wxMenu();
wxMenuItem *item(NULL);
item = new wxMenuItem(menu, XRCID("MyPlugin_settings"), _("Settings..."), _("MyPlugin settings"), wxITEM_NORMAL);
menu->Append(item);
pluginsMenu->Append(wxID_ANY, _("AutoVersion"), menu);
m_topWindow->Connect(XRCID("MyPlugin_settings"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(AutoVersion::OnSettings), NULL, this);
}
void MyPlugin::HookPopupMenu(wxMenu *menu, MenuType type)
{
if (type == MenuTypeEditor) {
//TODO::Append items for the editor context menu
} else if (type == MenuTypeFileExplorer) {
//TODO::Append items for the file explorer context menu
} else if (type == MenuTypeFileView_Workspace) {
//TODO::Append items for the file view / workspace context menu
} else if (type == MenuTypeFileView_Project) {
//TODO::Append items for the file view/Project context menu
} else if (type == MenuTypeFileView_Folder) {
//TODO::Append items for the file view/Virtual folder context menu
} else if (type == MenuTypeFileView_File) {
//TODO::Append items for the file view/file context menu
}
}
void MyPlugin::UnHookPopupMenu(wxMenu *menu, MenuType type)
{
if (type == MenuTypeEditor) {
//TODO::Unhook items for the editor context menu
} else if (type == MenuTypeFileExplorer) {
//TODO::Unhook items for the file explorer context menu
} else if (type == MenuTypeFileView_Workspace) {
//TODO::Unhook items for the file view / workspace context menu
} else if (type == MenuTypeFileView_Project) {
//TODO::Unhook items for the file view/Project context menu
} else if (type == MenuTypeFileView_Folder) {
//TODO::Unhook items for the file view/Virtual folder context menu
} else if (type == MenuTypeFileView_File) {
//TODO::Unhook items for the file view/file context menu
}
}
void MyPlugin::UnPlug()
{
//TODO:: perform the unplug action for this plugin
}
void MyPlugin::OnSettings(wxCommandEvent& event)
{
wxMessageBox(wxT("MyPlugin::OnSettings")); // OK
}
void MyPlugin::OnShellCommandStarted(wxCommandEvent& event)
{
wxMessageBox(wxT("MyPlugin::OnShellCommandStarted")); // KO : never appears
}
void MyPlugin::OnShellCommandEnded(wxCommandEvent& event)
{
wxMessageBox(wxT("MyPlugin::OnShellCommandEnded")); // KO : never appears
}
FYI, I'm using CL 2527, build from sources with wxWidgets 2.8.9.
--
Jérémie