Look at the definition for the Dialog component at /libs/cq/ui/widgets/source/widgets/Dialog.js. The Dialog is a "custom" widget that CQ uses often. It'll give you a guy idea of how they extended CQ.Ext.Window (probably another custom widget), and they added functonality. Then the last line registers the widget.
Hope this helps.
Custom widget cab be created using Ext Js,
Please walk through this article for detailed information on creating custom widget.