WC_STATIC, TreeView_SetLineColor: Seems like you need a newer version of the Platform SDK.
My understanding is as follows: Every single extension is a ui_extension from which multiples can be grouped with the help of a ui_extension_host. Am I right that there are three different host in foo_ui_columns? One for the sidebar, one for the toolbar and one for the playlist?
That's about right. I'm not sure about the actual number of host implementations in foo_ui_columns right now; I think I only detected two, when I tried enumerating ui_extension_hosts.
Another thing is the case 0 and case 1 stuff mentioned in the comments. Am I right that case 0 functions are called only when for example foo_ui_columns is loaded and that case 1 functions are responsible for the 'true' work of the extension?
'Case 0' is for querying information about an extension without creating a window. 'Case 1' is for managing an 'active' extension, i.e. window creation, destruction and transfer to a new host.
The function is_available() is called from the host if for example the user has chosen to add an extension to a panel. So if I want my extension to have only one instance I have to return false after the first 'window' is created? Speaking of single instance, what's the difference between ui_extension_factory and ui_extension_single_factory?
The 'single' version of the ui_extension factory returns the same object everytime, while the normal version creates new a object when it is called. Use the 'single' version for a singleton extension.
Sorry if the above are stupid questions but as soon as some fancy OO design template things and stuff appears in source code my understanding becomes nearly zero. I learned much from the foobar SDK but sadly it is yet not enough to understand all the things which are done in there
I'd like to add a part about implementing a ui_extension to my tutorial - or create a new tutorial for that - but I currently don't have time for that. In the meantime, you might fing this useful. Some time ago, I started rewriting the documentation in the ui_extension include files as doxygen comment. This work is not completely finished though.
You might also be interested in ui_extension_helper.h from my foosion_helpers library. It implements a template class (don't worry, it's simple to use) that takes care of most of the basic tasks involved in implementing a ui_extension. Example:
#include "../SDK/foobar2000.h"
#include "../ui_extension/ui_extension.h"
#include "../foosion_helpers/ui_extension_helper.h"
// add other includes you might need
// for this example, we create a sidebar extension that supports multiple instances
class my_extension : public ui_extension_base_t< UET_PANEL, UEM_MULTIPLE >
{
virtual const GUID & get_extension_guid() {
// replace this with your own GUID to avoid clashes with the history toolbar :)
// {FCA54897-6BD0-438c-B63E-91E987AEDB51}
static const GUID guid =
{ 0xfca54897, 0x6bd0, 0x438c, { 0xb6, 0x3e, 0x91, 0xe9, 0x87, 0xae, 0xdb, 0x51 } };
return guid;
}
virtual void get_name(string_base & out) {
out = "My panel";
}
virtual void get_category(string_base & out) {
out = "General";
}
virtual HWND create_window(HWND wnd_parent) {
// TODO: create your window here
return NULL;
}
// add any needed fields and methods
}
The ui_extension_base_t class takes care of transfering your extension to a new host, so unless you need to do something in that event, you shouldn't have to worry about that. The code currently does not handle docking and undocking, only host-to-host transfers. The first template parameter determines the type of your extension (a combination of UET_* flags), the second parameter determines the multiplicity (UEM_MULTIPLE or UEM_SINGLE for a multiple resp. single instance extension). I admit I haven't really tested the single instance case, so better be careful.
Edit: A sidebar panel called "My toolbar" in the "Toolbars" category?