#include <CtrlLib/CtrlLib.h> using namespace Upp; /* Plugins */ static StaticCriticalSection sAnyStoragePlugin; class StoragePlugin { typedef StoragePlugin *(*StorageFactory)(); template <class T> static StoragePlugin *FactoryFn() { return new T; } static void AddPlugin(StorageFactory f) { INTERLOCKED_(sAnyStoragePlugin)Map().Add(f); } static Array<StorageFactory>& Map() { static Array<StorageFactory> x; return x; } public: template <class T> static void Register() { AddPlugin(&StoragePlugin::FactoryFn<T>); } }; class DiskStorage : public StoragePlugin { TreeCtrl c; // <<<< Comment me to get a correct GUI and remove the memory leak Button b; }; INITBLOCK { StoragePlugin::Register<DiskStorage>(); } /* App */ class DeBunny : public TopWindow { Button button; public: typedef DeBunny CLASSNAME; DeBunny() { Add(button.SetLabel("&I'm an Ultimate++ button!").VCenterPos(20).HCenterPos(200)); }; }; GUI_APP_MAIN { DeBunny().Run(); }
Report message to a moderator