Which delegate of the Custom section should I put the AddObject() method?
There is no delegate involved in creating a custom gadget. Hover the mouse over the gadget header and click the keyboard icon. You will then be in the script editor for that custom gadget. That is where you create your custom gadget UI.