mirror of
https://github.com/fltk/fltk.git
synced 2026-03-23 07:24:03 +08:00
Fluid: lambda
This commit is contained in:
@@ -164,8 +164,9 @@ protected:
|
||||
const char *name_;
|
||||
/** Label text of a widget. */
|
||||
const char *label_;
|
||||
/** If it is just a word, it's the name of the callback function. Otherwise
|
||||
it is the full callback C++ code. Can be nullptr. */
|
||||
/** If it is just a word, it's the name of the callback function. If it starts
|
||||
with a '[', it's a lambda function. Otherwise it is the full callback
|
||||
C++ code. Can be nullptr. */
|
||||
const char *callback_;
|
||||
/** Widget user data field as C++ text. */
|
||||
std::string user_data_;
|
||||
|
||||
@@ -1927,7 +1927,7 @@ void Widget_Node::write_widget_code(fld::io::Code_Writer& f) {
|
||||
std::string ud = user_data();
|
||||
if (class_name(1) && !parent->is_widget()) ud = "this";
|
||||
if (callback()) {
|
||||
if (callback()[0] == '[') {
|
||||
if (callback()[0] == '[') { // lambda callback function
|
||||
f.write_c("%s%s->callback(\n", f.indent(), var);
|
||||
f.tag(Mergeback::Tag::GENERIC, Mergeback::Tag::WIDGET_CALLBACK, 0);
|
||||
f.write_c_indented(callback(), 1, 0);
|
||||
|
||||
Reference in New Issue
Block a user