CRhinoAppUiToolBarManager


(G Migliorelli) #1

Hi all,
can someone tell me how to implement this snippet of code for Rhinoceros 6.0? Or at least which classes to use, since these ones are obsolete.
My aim is to implement a plugin to force Rhinoceros into loading some toolbar of interest.

Thank a lot!

BOOL MyPluginPlugIn::OnLoadPlugIn()
{
	// Get the full path to plug-in file
	#ifdef WIN32
	ON_wString collection_name(_T("MyToolbar"));
	#else
	ON_wString collection_name(_T("MyToolbar"));
	#endif

    // Get reference to Rhino's toolbar manager 
    CRhinoAppUiToolBarManager& tm = RhinoApp().RhinoUiToolBarManager();

    // Load the toolbar collection, if necessary.
    if( tm.ReadFile(collection_name, true, true, true) )
    {
		// Get the toolbar collection
		const CRhinoUiToolBarCollection* col = tm.Collection( tm.CollectionIndex(collection_name, false) );
		if( col )
		{
			// Find the "Default" toolbar
			if(  col->ToolBarCount() > 0 )
			{
				const CRhinoUiToolBar* tb = col->ToolBar(0);
				if( tb )
					tm.ShowToolBar(tb, true, false); // Load it
			}
		  
		}
    }

	return CRhinoUtilityPlugIn::OnLoadPlugIn();
}

(Dale Fugier) #2

Hi @gm_user,

Use the static functions on CRhinoUiFile. See rhinoSdkUiFile.h for details.

– Dale