I have been trying to figure out how to add a control to wxSmith. Obviously I need to add defitems/wxs***.cpp and defitems/wxs***.h to define the control. icons/***.png and .icons/***16.png are the icons. properties/** are custom property editors.
I am not sure how you actually register the control with wxSmith.
Thanks,
Les
Ok, first thing, you don't have to put files inside defitems folder, they can be placed anywhere. If this item is not in base wxWidgets pack it should in fact be placed in some other folder (let's call it contrib) to leave code structure more readable
Same thing comes for icons. They should be put somewhere inside C::B's data folder, not necessarily inside wxSmith. Icon loading code is done when registering item inside wxSmith and here's how registering is done:
If you look into .cpp files for all current widgets, each have unnamed namespace with line like this:
wxsRegisterItem<wxsBitmapButton> Reg(_T("BitmapButton"),wxsTWidget,_T("Standard"),50);
And in fact this is all you need to register item inside wxSmith. The only thing required here is to instantiate wxsRegisterItem template just like in example and create one global instance of it.
But... This example is used for all default widgets - it will register item with wxWidgets's license, icons will be loaded automatically by taking item's name and loading it from images/wxsmith folder and few other things.
To do registration of really custom item, following code should be used instead:
namespace
{
wxsregisterItem<WxsClassName> Reg( // WxsClassName should be name of class added into wxSmith, not real widget's class
const wxString& ClassName, // Name of real widget's class
wxsItemType Type, // Usualy wxsTWidget, may be also wxsTContainer, wxsTSizer or wxsTool
const wxString& License, // Something like _T("GPL")
const wxString& Author,
const wxString& Email,
const wxString& Site,
const wxString& Category, // Category in item palette
long Priority, // Priority in palette (usually 0...100, more important items houdl have higher values)
const wxString& DefaultVarName, // Name of default variable (also used for default id)
long Languages, // OR-ed supported languages (currently only wxsCPP)
unsigned short VerHi, // Hiher version of item
unsigned short VerLo, // Lower version of item
const wxString& Bmp32FileName, // File name of 32x32 icon relative to C::B data folder (f.ex. _T("images/wxSmith/wxBitmap.png")
const wxString& Bmp16FileName, // File name of 16x16 icon relative to C::B data folder, this one will be used in resource browser
bool AllowInXRC = true); // If set to true, this item is supported by XRC loading routines, usually most custom controls will have to set this to false. This
...
This should give more customization to custom widgets
Regards
BYO