Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
etorth committed Jan 12, 2025
1 parent cde8998 commit 599de84
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions server/src/serverpasswordwindow.fl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
version 1.0308
header_name {.h}
code_name {.cxx}
decl {\#include<functional>} {public global
}

class ServerPasswordWindow {} {
decl {std::function<void(ServerPasswordWindow *)> m_callback;} {private local
}
Function {ServerPasswordWindow()} {} {
Fl_Window m_window {
label ServerPasswordWindow
Expand All @@ -16,17 +21,40 @@ class ServerPasswordWindow {} {
xywh {5 40 290 25} type Secret labeltype NO_LABEL
}
}
code {{
m_input->when(FL_WHEN_ENTER_KEY | FL_WHEN_NOT_CHANGED);
auto fnCallback = [](Fl_Widget *, void *data)
{
if(auto winptr = static_cast<ServerPasswordWindow *>(data)){
winptr->triggerCallback();
}
};

m_input->callback(+fnCallback, this);
}} {}
}
Function {setTitle(const char *s)} {return_type void
} {
code {m_titleBox->copy_label(s);} {}
}
Function {setCallback(std::function<void(ServerPasswordWindow *)> cb)} {return_type void
} {
code {m_callback = std::move(cb);} {}
}
Function {showAll()} {return_type void
} {
code {m_window->show();} {}
}
Function {hideAll()} {return_type void
} {
code {m_window->hide();} {}
}
Function {getPassword()} {return_type {const char *}
} {
code {return m_input->value();} {}
}
Function {triggerCallback()} {return_type void
} {
code {if(m_callback){ m_callback(this); }} {}
}
}

0 comments on commit 599de84

Please sign in to comment.