Shu-Rong,
Widget related questions belong in the Flex Viewer Forum:
http://forums.arcgis.com/forums/111-ArcGIS-Viewer-for-Flex
To answer your question: You will learn more about the inner workings of the Viewer by looking at the source code.
The addTitlebarButton function in a widget takes three properties
- A url to a icon
- A String that will be displayed as the tooltip when you hover over the button.
- A function that should be called when the button is clicked.
- and an optional forth which is a Boolean that indicates if the button is a toggle type or a standard button