diff options
| author | maxim nikonov <maxim.nikonov@hqo.co> | 2026-02-05 21:32:25 +0500 |
|---|---|---|
| committer | maxim nikonov <maxim.nikonov@hqo.co> | 2026-02-05 21:32:25 +0500 |
| commit | dc39575fb3ef90e5a2689babe7fb335cd88f6727 (patch) | |
| tree | 24f6cef8f2b558ae6f1f812c75be0c09a53fe417 /src/fl_ask.cxx | |
| parent | 7d3793ce1d8cb26e7608bf859beca21359cec6e9 (diff) | |
wip
Diffstat (limited to 'src/fl_ask.cxx')
| -rw-r--r-- | src/fl_ask.cxx | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/src/fl_ask.cxx b/src/fl_ask.cxx index 205979d7e..b9c31fd43 100644 --- a/src/fl_ask.cxx +++ b/src/fl_ask.cxx @@ -32,9 +32,7 @@ - fl_ask() // deprecated since 1.1.7 (2006), see comment in FL/fl_ask.H - fl_choice() - fl_input() - - fl_input_str() - fl_password() - - fl_password_str() and some more functions to change their behavior (positioning, window title, and more). @@ -352,70 +350,6 @@ const char *fl_input(int maxchar, const char *fmt, const char *defstr, ...) { /** Shows an input dialog displaying the \p fmt message with variable arguments. - Like fl_input(), but this method has the additional argument \p maxchar - that limits the number of \b characters that can be input. Since the - string is encoded in UTF-8 it is possible that the number of bytes - in the string is larger than \p maxchar. - - Other than the deprecated fl_input() method w/o the \p maxchar argument, this one - returns the string in an std::string object that must be released after use. This - can be a local/automatic variable. - - The \p ret variable is set to 0 if the user clicked OK, and to a negative - value if the user canceled the dialog. If the dialog was canceled, the returned - string will be empty. - - \code #include <FL/fl_ask.H> \endcode - - Example: - \code - { int ret; - std::string str = fl_input_str(ret, 0, "Enter text:", ""); - if (ret < 0) - printf("Text input was canceled.\n"); - else - printf("Text is: '%s'\n", str.c_str()); - } // (str goes out of scope) - \endcode - - \param[out] ret 0 if user clicked OK, negative if dialog was canceled - \param[in] maxchar input size limit in characters (not bytes), use 0 for no limit - \param[in] fmt can be used as an sprintf-like format and variables for the message text - \param[in] defstr defines the default returned string if no text is entered - - \return the user string input if OK was clicked which can be empty - \return an empty string and set \p ret to a negative value if the user canceled the dialog - - \since 1.4.0 -*/ -std::string fl_input_str(int &ret, int maxchar, const char *fmt, const char *defstr, ...) { - Fl_Message msg("?"); - if (maxchar < 0) maxchar = 0; - va_list ap; - va_start(ap, defstr); - const char *r = msg.input_innards(fmt, ap, defstr, FL_NORMAL_INPUT, maxchar, true); - va_end(ap); - ret = (r == NULL) ? -1 : 0; - return (r == NULL) ? std::string("") : std::string(r); -} - -/** Shows an input dialog displaying the \p fmt message with variable arguments. - \note No information is given if the user canceled the dialog or clicked OK. - \see fl_input_str(int &ret, int maxchar, const char *label, const char *deflt = 0, ...) - */ -std::string fl_input_str(int maxchar, const char *fmt, const char *defstr, ...) { - Fl_Message msg("?"); - if (maxchar < 0) maxchar = 0; - va_list ap; - va_start(ap, defstr); - const char *r = msg.input_innards(fmt, ap, defstr, FL_NORMAL_INPUT, maxchar, true); - va_end(ap); - return (r == NULL) ? std::string("") : std::string(r); -} - - -/** Shows an input dialog displaying the \p fmt message with variable arguments. - Like fl_input() except the input text is not shown, '*' or similar replacement characters are displayed instead. @@ -461,55 +395,6 @@ const char *fl_password(int maxchar, const char *fmt, const char *defstr, ...) { } -/** Shows an input dialog displaying the \p fmt message with variable arguments. - - Like fl_input_str() except the input text is not shown, - '*' or similar replacement characters are displayed instead. - - Other than the fl_password() method w/o the \p maxchar argument, this one - returns the string in an std::string object that must be released after use. - This can be a local/automatic variable. - - For an example see fl_input_str() - - \code #include <FL/fl_ask.H> \endcode - - \param[out] ret 0 if user clicked OK, negative if dialog was canceled - \param[in] maxchar input size limit in characters (not bytes), use 0 for no limit - \param[in] fmt can be used as an sprintf-like format and variables for the message text - \param[in] defstr defines the default returned string if no text is entered - - \return the user string input if OK was clicked which can be empty - \return an empty string and set \p ret to a negative value if the user canceled the dialog - - \since 1.4.0 -*/ -std::string fl_password_str(int &ret, int maxchar, const char *fmt, const char *defstr, ...) { - Fl_Message msg("?"); - if (maxchar < 0) maxchar = 0; - va_list ap; - va_start(ap, defstr); - const char *r = msg.input_innards(fmt, ap, defstr, FL_SECRET_INPUT, maxchar, true); - va_end(ap); - ret = (r == NULL) ? -1 : 0; - return (r == NULL) ? std::string("") : std::string(r); -} - -/** Shows an input dialog displaying the \p fmt message with variable arguments. - \note No information is given if the user canceled the dialog or clicked OK. - \see fl_password_str(int &ret, int maxchar, const char *label, const char *deflt = 0, ...) - */ -std::string fl_password_str(int maxchar, const char *fmt, const char *defstr, ...) { - Fl_Message msg("?"); - if (maxchar < 0) maxchar = 0; - va_list ap; - va_start(ap, defstr); - const char *r = msg.input_innards(fmt, ap, defstr, FL_SECRET_INPUT, maxchar, true); - va_end(ap); - return (r == NULL) ? std::string("") : std::string(r); -} - - /** Sets the preferred position for the message box used in many common dialogs like fl_message(), fl_alert(), fl_ask(), fl_choice(), fl_input(), fl_password(). |
