A toolbar "parent" is created in the root of your mod directory structure. A toolbar "child" (the button you press to build the actual building) is created partially in the root and partially in the template file for the building. The button mechanics are inside the UI directory of your mod directory structure.
Here is the root of the Mathieuso Houses mod. It only uses "child" buttons because the houses are attached to the housing button on the main toolbar.

The contents of the Resource file are shown in the code section below.
ExternalList resource
{
External _resources
[
// toolbar - references building and everything else - nothing else need be listed here
smallwoodhouse
mediumstonehouse
inn
]
}
Toolbar smallwoodhouse
{
Toolbar _parent = "Game\Toolbar.rsc:housing";
int _sortPriority = 20;
Action _action = Tool;
ComponentDescription _tool = "Template/SmallWoodHouse.rsc";
bool _autoHotKey = false;
}
Toolbar mediumstonehouse
{
Toolbar _parent = "Game\Toolbar.rsc:housing";
int _sortPriority = 300;
Action _action = Tool;
ComponentDescription _tool = "Template/mediumstonehouse.rsc";
bool _autoHotKey = true;
}
Toolbar inn
{
Toolbar _parent = "Game\Toolbar.rsc:housing";
int _sortPriority = 600;
Action _action = Tool;
ComponentDescription _tool = "Template/Inn.rsc";
bool _autoHotKey = true;
}
In each of the templates there is a section as shown below, for the Inn.
ToolbarDescription toolbar
{
SpriteSheet _spriteSheet = "UI/MathieusoHousesSpriteSheet.rsc";
String _spriteName = "BuildInn";
StringTable _stringTable = "UI/MathieusoHousesStringTable.rsc";
String _stringName = "Inn";
String _stringNameLwr = "InnLwr";
String _toolTip = "InnTip";
String _statusStrings
[
"CreateOk",
"CreateBlocked",
]
int _group = 2;
}
The files under the UI directory are shown below.

MathiesoHousesSpriteSheet.rsc contains the following text.
SpriteSheet resource
{
String _materialName = "MathieusoHousesSpriteSheetMaterial.rsc";
String _imageName = "Build/MathieusoHousesSpriteSheet.png";
int _imageWidth = 256;
int _imageHeight = 256;
bool _padForFiltering = true;
Sprite _sprites
[
{ String _name = "BuildSmallHouse"; String _source = "UI/Sprite/BuildSmallWoodHouse.png"; }
{ String _name = "BuildMediumHouse"; String _source = "UI/Sprite/BuildStoneHouse.png"; }
{ String _name = "BuildInn"; String _source = "UI/Sprite/BuildInn.png"; }
]
}
And finally, the Sprite directory contains the three PNG files listed in the text file above.
Making a "parent" toolbar button is a little more complicated, but only a little. The text required in the resources file is slightly different depending on whether you are adding the parent to an existing tree, or adding it to the base of the toolbar structure.
Here I added my markets to the storage button, under a button of my own.
Toolbar sjglsmallmarkets
{
StringTable _stringTable = "UI/SJGLSmallMarketsStringTable.rsc";
SpriteSheet _spriteSheet = "UI/SJGLSmallMarketsSpriteSheet.rsc";
Toolbar _parent = "Game\Toolbar.rsc:storage";
int _sortPriority = 500;
String _toolTip = "SmallMarketsItemsTip";
String _image = "SmallMarketsItems";
Action _action = ShowGroup;
bool _autoHotKey = true;
}
And here I added a new button to the base of the toolbar, and attached a nesting of two levels to include the hedges in Mathiesuo Decorations. This required that I include a definition of the standard "base" in my resource file. The first of the actual hedge buttons is also in the code shown. Notice that the bottom-most button has not got a parent line. Attempting to define the decorations button with a '_parent line' and no ': "base"' in the title causes the button not to appear. I have no idea why. Probably it has to do with other code locating the main toolbar on the screen and so forth.
Toolbar base
{
StringTable _stringTable = "Dialog/StringTable.rsc:toolBar";
SpriteSheet _spriteSheet = "Dialog/SpriteSheet.rsc";
}
Toolbar decorations : "base"
{
StringTable _stringTable = "UI/DecorationsStringTable.rsc";
SpriteSheet _spriteSheet = "UI/DecorationsSpriteSheet.rsc";
int _sortPriority = 900;
String _toolTip = "DecorationsItemsTip";
String _image = "DecorationsItems";
Action _action = ShowGroup;
bool _autoHotKey = false;
}
// HEDGES
Toolbar hedges
{
StringTable _stringTable = "UI/DecorationsStringTable.rsc";
SpriteSheet _spriteSheet = "UI/DecorationsSpriteSheet.rsc";
Toolbar _parent = decorations;
int _sortPriority = 100;
String _toolTip = "HedgesTip";
String _image = "Hedges";
Action _action = ShowGroup;
bool _autoHotKey = false;
}
Toolbar hedge
{
Toolbar _parent = hedges;
int _sortPriority = 100;
Action _action = Tool;
ComponentDescription _tool = "Template/Hedge.rsc";
bool _autoHotKey = false;
}
One point to notice is that "parent" buttons contain this line:
Action _action = ShowGroup;
whereas "child" buttons contain this line:
Action _action = Tool;