summaryrefslogtreecommitdiff
path: root/src/Fl_Color_Chooser.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2026-01-04 15:50:49 +0100
committerMatthias Melcher <github@matthiasm.com>2026-01-04 15:50:56 +0100
commit0e570fb6729ff6b97249256c2c9d5f3aa58c7bb4 (patch)
tree7140e3b2d97c6f7852e915759918d14bf6b35b00 /src/Fl_Color_Chooser.cxx
parent357336bd40d868fd65e95c61d1adaf9de0fb7811 (diff)
Add C++11 Fl_Valuator::format API.
This is helpful for writing language wrapper, in this particular case for PyFLTK.
Diffstat (limited to 'src/Fl_Color_Chooser.cxx')
-rw-r--r--src/Fl_Color_Chooser.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/Fl_Color_Chooser.cxx b/src/Fl_Color_Chooser.cxx
index 209f4b45b..341a51347 100644
--- a/src/Fl_Color_Chooser.cxx
+++ b/src/Fl_Color_Chooser.cxx
@@ -1,7 +1,7 @@
//
// Color chooser for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2023 by Bill Spitzak and others.
+// Copyright 1998-2026 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -32,6 +32,7 @@
// The "hue box" can be a circle or rectilinear.
// You get a circle by defining this:
#define CIRCLE 1
+
// And the "hue box" can auto-update when the value changes
// you get this by defining this:
#define UPDATE_HUE_BOX 1
@@ -98,11 +99,21 @@ static const Fl_Menu_Item mode_menu[] = {
};
#ifndef FL_DOXYGEN
+
int Flcc_Value_Input::format(char* buf) {
Fl_Color_Chooser* c = (Fl_Color_Chooser*)parent();
if (c->mode() == M_HEX) return snprintf(buf, 5,"0x%02X", int(value()));
else return Fl_Valuator::format(buf);
}
+
+// Note: although Flcc_Value_Input is marked private in the header files,
+// it nevertheless is publicly accessible, so implement this here just in case.
+std::string Flcc_Value_Input::format_str() {
+ char buffer[129];
+ int size = format(buffer);
+ return std::string(buffer, size);
+}
+
#endif // !FL_DOXYGEN
void Fl_Color_Chooser::set_valuators() {