summaryrefslogtreecommitdiff
path: root/test/forms.cxx
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2023-12-20 16:56:29 +0100
committerAlbrecht Schlosser <albrechts.fltk@online.de>2023-12-20 17:33:37 +0100
commit5df5daf78e135e0c8371012ffe56df5cae357755 (patch)
treeafd619b32d1f35b949f07b9dd35f0184400a1f93 /test/forms.cxx
parent9023648e6c182a4142894b3e6c1b309b699b0629 (diff)
Make the 'Forms' compatibility library 'fltk_forms' optional
This library is no longer needed in FLTK itself. There is only one demo program (test/forms.cxx) that uses it if it is built. The demo program displays a message if fltk_forms is not available. The default is 'enabled' for backwards compatibility but this may be changed to 'disabled' in a future version.
Diffstat (limited to 'test/forms.cxx')
-rw-r--r--test/forms.cxx23
1 files changed, 20 insertions, 3 deletions
diff --git a/test/forms.cxx b/test/forms.cxx
index 84f623649..e19fade77 100644
--- a/test/forms.cxx
+++ b/test/forms.cxx
@@ -19,10 +19,13 @@
// https://www.fltk.org/bugs.php
//
-#include <FL/forms.H> // changed for FLTK
+#include <FL/Fl.H> // FLTK: includes <FL/fl_config.h>
+#ifdef FLTK_HAVE_FORMS // FLTK: defined in <FL/fl_config.h> since FLTK 1.4.0
-static int border = 1; // changed from FL_TRANSIENT for FLTK
-// (this is so the close box and Esc work to close the window)
+#include <FL/forms.H> // changed for FLTK
+
+static int border = 1; // changed from FL_TRANSIENT for FLTK
+ // (this is so the close box and Esc work to close the window)
typedef struct { Fl_Boxtype val; const char *name; } VN_struct;
@@ -173,4 +176,18 @@ int main(int argc, char *argv[]) {
;
return 0;
+
+}
+
+#else // (!FLTK_HAVE_FORMS)
+
+#include <FL/fl_ask.H>
+
+int main(int argc, char **argv) {
+ fl_message_title("This program needs the Forms compatibility library");
+ fl_message(
+ "Please configure FLTK with Forms enabled (--enable-forms)\n"
+ "or the CMake option FLTK_BUILD_FORMS=ON.");
+ return 0;
}
+#endif // (FLTK_HAVE_FORMS)