From 1209e9dcd7e1e97bedc747d06ba4eea837562158 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sun, 22 Oct 2023 19:30:37 +0200 Subject: 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 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) --- examples/callbacks.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'examples') diff --git a/examples/callbacks.cxx b/examples/callbacks.cxx index 3fb240d30..d657b3573 100644 --- a/examples/callbacks.cxx +++ b/examples/callbacks.cxx @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -34,8 +33,8 @@ void hello_0_args_cb() { fl_message("Hello with 0 arguments"); } -void hello_2_args_cb(Fl_String &text, int number) { - fl_message("Hello with 2 arguments,\n\"%s\" and '%d'", text.c_str(), number); +void hello_2_args_cb(const char *text, int number) { + fl_message("Hello with 2 arguments,\n\"%s\" and '%d'", text, number); } void hello_4_args_cb(int a1, int a2, int a3, int a4) { @@ -89,7 +88,7 @@ int main(int argc, char ** argv) { FL_FUNCTION_CALLBACK_0(func_cb_btn_0, hello_0_args_cb); Fl_Button *func_cb_btn_2 = new Fl_Button(10, 60, 180, 25, "2 args"); - FL_FUNCTION_CALLBACK_2(func_cb_btn_2, hello_2_args_cb, Fl_String, "FLTK", int, 2); + FL_FUNCTION_CALLBACK_2(func_cb_btn_2, hello_2_args_cb, const char *, "FLTK", int, 2); Fl_Button *func_cb_btn_4 = new Fl_Button(10, 90, 180, 25, "4 args"); FL_FUNCTION_CALLBACK_4(func_cb_btn_4, hello_4_args_cb, int, 1, int, 2, int, 3, int, 4); -- cgit v1.2.3