12 #ifndef EMP_WEB_FILE_INPUT_H 13 #define EMP_WEB_FILE_INPUT_H 18 #include "../tools/File.h" 45 std::function<void(const std::string &)>
callback;
52 if (callback_id) emp::JSDelete(callback_id);
55 std::string
TypeName()
const override {
return "FileInputInfo"; }
62 virtual void GetHTML(std::stringstream & HTML)
override {
64 HTML <<
"<input type=\"file\"";
65 if (title !=
"") HTML <<
" title=\"" << title <<
"\"";
66 if (disabled) { HTML <<
" disabled=true"; }
67 HTML <<
" id=\"" <<
id <<
"\"";
68 HTML <<
" name=\"" <<
id <<
"\"";
69 HTML <<
" onchange=\"emp.LoadFileEvent(this.files, " << callback_id <<
")\"";
73 void UpdateCallback(
const std::function<
void(
const std::string &)> & in_cb) {
91 virtual std::string
GetType()
override {
return "web::FileInputInfo"; }
104 FileInput(
const std::function<
void(
const std::string &)> & in_cb,
const std::string & in_id=
"")
115 using callback_t = std::function<void(const std::string & file_body)>;
122 :
FileInput( [cb](const
std::string & in){ std::stringstream ss(in);
File file(ss); cb(file); } ) { ; }
A class to maintin files for loading, writing, storing, and easy access to components.
Definition: File.h:32
Definition: BitVector.h:785
If we are in emscripten, make sure to include the header.
Definition: array.h:37