Ok, here are basics about wxSmith (I'll try to prepare some moredetailed doc, but need some time).
Main plugin's class is wxSmith - it's purpose is to: initialize and shutdown plugin (as all plugins shoud
), process global events and signals inside plugin. These currently are: events from Code::Blocks and notifications from resource browser. I'll add other features (widget selection and event handler creation should also get thoiugh this I think). Other purpose of wxSmith class is to keep wxsProject class for each cbProject one. This association can be found using wxSmith::GetSmithProject and wxSmith::GetCBProject members. Currently it has also pointer to resource browser tree but it will be changed to singleton object soon.
Each cbProject has associated wxsProject class - associations are updated automatically so there's no need to care about that. wxsProject can be in three states - NotBinded (wxsProject has not been connected with cbPrject - it's set for a short time just after creation), NotWxsProject (set when there's no wxSmith configuration inside project) and Integrated (associated cbPrject use wxxSmith). Each wxsProject has list of different resources (currently only dialogs). These are automatically read from wxSmith's 'private' directory called of course 'wxsmith' - currently it must be located in same dir where C::B's .cbp file is found. wxSmith data is stored inside 'wxsmith/wxsmith.cfg' file - it's just a list of resources and files which handle them.
Resource is represented throughclass derived from wxsResource. I've decided to place these classes inside 'resources' directory. Currently there's one called wxsDialogRes. It can load and save xrc-like files.
Dialog is made of wxsWidget and wxsContainer classes (wxsContainer is derived from wxsWidget but adds abilities to handle child widgets). wxsWidget is the biggest class in wxSmith (maybe even too big but most of it's features can be just skipped in case of usual widgets). I'll deescribe each feature a little bit:
* Preview system - these are member functions operating on preview. MyCreatePreview() should create widget's preview and MyUpdate should update it's content, MyDeletePreview() should delete preview - but simple delete operator is enough. Currently change of any property value causes all dialog to be recreated (I tried to recreate or update separate widgets only but it didn't worked properly)
* Properties system - wxsWidget class has PropertiesObject (class: wxsProperties) - this object keeps list of all properties and manages them automatically. It is handling many default properties (like size, id etc) - this will be described later. If non-deefautl property should be added - this can be made by overriding wxsWidget::CreateObjectProperties function (wxample inside wxsButton class
).
* Default properties - all dedfautls are kept inside protected BaseParams variable (type: wxsWidgetBaseParams). Derived class can choose properties which are really used by passing pType param to constructor). It will mask properties shown inside properties window and all default values saved to and readeed from Xml.
* Xml saving / loading - XmlLoad loads whole tree structure for widget, XmlSave saves it. By deefault base params are laded and saved. To load/save other parametrs, MyXmlLoad and MyXmlSave can be overriden. Inside these funnctions XmlGetXXX and XmlSetXXX function can be used to read/save non-default properties.
* Code generation - currently not fully developed. GetProducingCode - this should produce code creating given widget, GetFinalizingCode - code add after creating children of this widget (may be usefull inside sizers etc) GetDeclarationCode - code declaring variable for this widget.
* Support for additional widget - I tried to add feature which would allow to use non-standard widgets. These could be supplied in library or even a source code for them could be given. It won't be developen now so should be considered as a dead code
Each widget shoud have it's manager - such manager should be able to create and delete widget. There could be more managers currently loaded, but all shuold be registered insided wxsWidgetFactory class.
wxsWidgetFactory is a main clas producing and deleting widgets. All widget object MUST be created through it and MUST be deleted usind wxsWidgetFactory::Kill() function. wxsWidgetFactory is a singleton object.
Hope this will clarify a little bit how my plugin works. If You have any questions: just ask