From b72f2783eb5b08b5c6f70f0f2acbd3a7af4cce3e Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Tue, 10 Feb 2015 18:17:37 +0000 Subject: Added doxygen docs to clarify: o fl_ask() is deprecated (since compiler warns about its use) o fl_choice() includes example code for various usage forms git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10569 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/fl_ask.cxx | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/fl_ask.cxx b/src/fl_ask.cxx index a74055ac3..7a62a9b43 100644 --- a/src/fl_ask.cxx +++ b/src/fl_ask.cxx @@ -378,6 +378,10 @@ void fl_alert(const char *fmt, ...) { \param[in] fmt can be used as an sprintf-like format and variables for the message text \retval 0 if the no button is selected or another dialog box is still open \retval 1 if yes is selected + + \deprecated fl_ask() is deprecated since it uses "Yes" and "No" for the buttons which + does not conform to the current FLTK Human Interface Guidelines. + Use fl_choice() with the appropriate verbs instead. */ int fl_ask(const char *fmt, ...) { @@ -401,10 +405,43 @@ int fl_ask(const char *fmt, ...) { can be open at any time. Requests for additional dialog boxes are ignored. \note \#include + Three choice example: + \code + switch ( fl_choice("How many musketeers?", "One", "Two", "Three") ) { + case 0: .. // One (default) + case 1: .. // Two + case 2: .. // Three + } + \endcode + + Three choices with printf() style formatting: + \code + int num_msgs = GetNumberOfMessages(); + switch ( fl_choice("What to do with %d messages?", "Send", "Save", "Delete", num_msgs) ) { + case 0: .. // Send (default) + case 1: .. // Save + case 2: .. // Delete + .. + } + \endcode + + Two choice example: + \code + switch ( fl_choice("Empty trash?", "Yes", "No", 0) ) { + case 0: .. // Yes (default) + case 1: .. // No + } + \endcode + + One choice example: + \code + fl_choice("All hope is lost.", "OK", 0, 0); + \endcode + \param[in] fmt can be used as an sprintf-like format and variables for the message text \param[in] b0 text label of button 0 - \param[in] b1 text label of button 1 - \param[in] b2 text label of button 2 + \param[in] b1 text label of button 1 (can be 0) + \param[in] b2 text label of button 2 (can be 0) \retval 0 if the first button with \p b0 text is selected or another dialog box is still open \retval 1 if the second button with \p b1 text is selected \retval 2 if the third button with \p b2 text is selected -- cgit v1.2.3