summaryrefslogtreecommitdiff
path: root/FL/fl_ask.H
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2023-10-22 19:30:37 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2023-10-22 19:35:17 +0200
commit1209e9dcd7e1e97bedc747d06ba4eea837562158 (patch)
tree7897d3c61368958f191bfe684b96d1d08467a2bb /FL/fl_ask.H
parent05ac0247cbd902f910fa89f8d4f4fde9de904b0f (diff)
Make Fl_String and Fl_Int_Vector private (#789)
- add CMake option 'OPTION_USE_STD' - add configure option '--enable-use_std' - move FL/Fl_String.H to src/Fl_String.H - move FL/Fl_Int_Vector.H to src/Fl_Int_Vector.H - remove Fl_String from demo program examples/callbacks.cxx - remove Fl_Int_Vector from public header FL/Fl_Table.H - some methods of Fl_Table are no longer inline - add CMake option OPTION_USE_STD to allow std::string in some selected functions and methods Experimental, may be removed before release: - use either Fl_Int_Vector or std::vector in Fl_Table depending on CMake OPTION_USE_STD or configure --enable-use_std Move all fl_filename* functions that use Fl_String to fluid Main changes in fluid: - add fluid_filename.h and .cxx - include "fluid_filename.h" rather than <FL/filename.H> Update fl_input(), fl_password() and test/ask - add maxchar parameter to fl_input() and fl_password() - fl_input_str() and fl_password_str() are optional and return std::string if enabled (FLTK_USE_STD)
Diffstat (limited to 'FL/fl_ask.H')
-rw-r--r--FL/fl_ask.H32
1 files changed, 24 insertions, 8 deletions
diff --git a/FL/fl_ask.H b/FL/fl_ask.H
index c4eb3ab86..2387a1947 100644
--- a/FL/fl_ask.H
+++ b/FL/fl_ask.H
@@ -22,9 +22,12 @@
#define _FL_fl_ask_H_
#include <FL/Enumerations.H>
-#include <FL/Fl_String.H>
#include <FL/fl_attr.h>
+#if (FLTK_USE_STD)
+#include <string>
+#endif
+
class Fl_Widget;
/** Defines the different system beeps available.
@@ -65,22 +68,35 @@ FL_EXPORT const char *fl_password(const char *label, const char *deflt = 0, ...)
FL_EXPORT int fl_choice_n(const char *q, const char *b0, const char *b1, const char *b2, ...)
__fl_attr((__format__(__printf__, 1, 5)));
-// since FLTK 1.4.0:
-// - fl_input_str() with limited input size
-// - fl_password_str() with limited input size (*_str)
+// since FLTK 1.4.0: with 'maxchar' to limit input size
+
+FL_EXPORT const char *fl_input(int maxchar, const char *label, const char *deflt = 0, ...)
+ __fl_attr((__format__(__printf__, 2, 4)));
-FL_EXPORT Fl_String fl_input_str(int maxchar, const char *label, const char *deflt = 0, ...)
+FL_EXPORT const char *fl_password(int maxchar, const char *label, const char *deflt = 0, ...)
__fl_attr((__format__(__printf__, 2, 4)));
-FL_EXPORT Fl_String fl_input_str(int &ret, int maxchar, const char *label, const char *deflt = 0, ...)
+// since FLTK 1.4.0 -- only with option FLTK_USE_STD
+
+// - fl_input_str() with limited input size, returns std::string
+// - fl_password_str() with limited input size, returns std::string
+
+#if (FLTK_USE_STD)
+
+FL_EXPORT std::string fl_input_str(int maxchar, const char *label, const char *deflt = 0, ...)
+ __fl_attr((__format__(__printf__, 2, 4)));
+
+FL_EXPORT std::string fl_input_str(int &ret, int maxchar, const char *label, const char *deflt = 0, ...)
__fl_attr((__format__(__printf__, 3, 5)));
-FL_EXPORT Fl_String fl_password_str(int maxchar, const char *label, const char *deflt = 0, ...)
+FL_EXPORT std::string fl_password_str(int maxchar, const char *label, const char *deflt = 0, ...)
__fl_attr((__format__(__printf__, 2, 4)));
-FL_EXPORT Fl_String fl_password_str(int &ret, int maxchar, const char *label, const char *deflt = 0, ...)
+FL_EXPORT std::string fl_password_str(int &ret, int maxchar, const char *label, const char *deflt = 0, ...)
__fl_attr((__format__(__printf__, 3, 5)));
+#endif
+
FL_EXPORT Fl_Widget *fl_message_icon();
extern FL_EXPORT Fl_Font fl_message_font_;
extern FL_EXPORT Fl_Fontsize fl_message_size_;