当前位置: 首页>>代码示例>>C++>>正文


C++ Plugin::GetEventHandler方法代码示例

本文整理汇总了C++中Plugin::GetEventHandler方法的典型用法代码示例。如果您正苦于以下问题:C++ Plugin::GetEventHandler方法的具体用法?C++ Plugin::GetEventHandler怎么用?C++ Plugin::GetEventHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Plugin的用法示例。


在下文中一共展示了Plugin::GetEventHandler方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ProcessAllPlugins

//=================================================================================
bool PluginManager::ProcessAllPlugins( PluginProcessor* pluginProcessor )
{
	for( PluginList::iterator iter = pluginList.begin(); iter != pluginList.end(); iter++ )
	{
		Plugin* plugin = *iter;
		if( !pluginProcessor->ProcessPlugin( plugin->GetEventHandler(), plugin->GetLibraryPath() ) )
			return false;
	}
	return true;
}
开发者ID:spencerparkin,项目名称:Junk,代码行数:11,代码来源:PluginManager.cpp

示例2: LoadPlugin

//=================================================================================
bool PluginManager::LoadPlugin( const Cornucopia::Path& libraryPath )
{
	bool success = false;
	Plugin* plugin = 0;

	do
	{
		// Make sure that the plugin is not already loaded.
		if( FindPlugin( libraryPath ) )
		{
			wxMessageBox( wxString::Format( wxT( "The plugin \"%s\" is already loaded." ), ( const char* )libraryPath ), wxT( "Error" ), wxOK | wxCENTRE );
			break;
		}

		// Create a new plugin object to represent the plugin in our list.
		plugin = new ( std::nothrow ) Plugin();
		if( !plugin )
			break;

		// Attempt to load the plugin library.
		if( !plugin->Load( libraryPath ) )
			break;

		// Attempt to initialize the plugin.
		CornucopiaEditor::Plugin* eventHandler = plugin->GetEventHandler();
		if( !eventHandler->Initialize( &assistant ) )
		{
			wxMessageBox( wxString::Format( wxT( "The plugin \"%s\" failed to initialize." ), ( const char* )libraryPath ), wxT( "Error" ), wxOK | wxCENTRE );
			break;
		}

		// Send the first event to the plugin.
		PluginEvent event;
		event.SetEventObject(0);
		event.SetEventType( CORNUCOPIA_PLUGIN_INITIALIZE );
		( void )CallPlugin( plugin, event );

		// We made it threw the gauntlet!
		success = true;
	}
	while( false );

	// Discard or keep the plugin.
	if( !success )
		delete plugin;
	else
		pluginList.push_back( plugin );

	return success;
}
开发者ID:spencerparkin,项目名称:Junk,代码行数:51,代码来源:PluginManager.cpp

示例3: UnloadPlugin

//=================================================================================
bool PluginManager::UnloadPlugin( PluginList::iterator& iter )
{
	// Remove the plugin from our list.
	Plugin* plugin = *iter;
	pluginList.erase( iter );

	// Send the last event to the plugin.
	PluginEvent event;
	event.SetEventObject(0);
	event.SetEventType( CORNUCOPIA_PLUGIN_FINALIZE );
	( void )CallPlugin( plugin, event );

	// We can now dispose of the plugin.
	plugin->GetEventHandler()->Finalize( &assistant );
	plugin->Unload();
	delete plugin;
	return true;
}
开发者ID:spencerparkin,项目名称:Junk,代码行数:19,代码来源:PluginManager.cpp


注:本文中的Plugin::GetEventHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。