So I can distribute successfully a toolbar with my PlugIn installation. What I want now is to deploy more than one toolbar with my PlugIn (so I cannot follow the convention to have a toolbar named like my PlugIn followed by .rui extension). And depending my GUI and probably a license code I would like to switch visibility of my toolbars.
I tried several things using CRhinoFileUtilities::XXX() functionality (copying different toolbars to be the default toolbar in my install folder or/and the APPDATA folder) but in this case I may have permission problems there if the user executing the PlugIn has no admin privileges.
So the best way seems to be to deploy several toolbars with my PlugIn and make them optionally appear/disappear. Since Rhino can do this in commands like _showtoolbar I would assume there are some SDK calls for this?
Under the hood Rhino copies plug-in associated RUI files to a directory located int %APPDATA%\McNeel\Rhinoceros\<rhino version>\UI\Plug-ins then loads the copied file. This allows changes to the file to be written when Rhino closes. You can use CRhinoUiFile::FileOpen() to load a RUI file in your CRhinoPlugIn::OnLoadPlugIn override.
Tool-bars represent the tabs that are displayed in a tool-bar group, a group is the container that is displayed and contains references to one or more tool-bar objects. You can use CRhinoUiFile::GroupIsVisible to see if a group is visible and CRhinoUiFile::GroupShow to show or hide a specific group when your plug-in loads.
The problem you may encounter is that if you plug-in is loaded at start up your OnLoadPlugIn will be called prior to Rhino’s UI restoration code. The net result is your plug-in’s OnLoad will display/hide a group but the restoration code will then return the group to the visibility state the users chose when Rhion last closed. This means if the user chose to hide the group it will be hidden for the user next time Rhino starts.