title: how to handle close button of window in cocoa
body: <p>I am developing cocoa application having multiple windows. There is a red close button on left corner of window. And I want to handle click event of close button so that I can show message to ask user whether he wants to close window or not. If user accept to close window then application will be terminated otherwise same window shown to user.
  Any idea how can I handle click event of close button???</p>