FileInput.hpp

Specs for the FileInput widget (click on to upload a file)

Todo:

Setup FileInput to work outside of web mode as well.

class FileInput : public internal::WidgetFacet<FileInput>
#include <FileInput.hpp>

FileInput will convert the file to a std::string and pass the result to a designated function.

To create a new file input, you must pass it a void function that takes a const std::string & as its only argument. When a file is loaded, the specified function is called and the body of the file is passed in as the string.

Public Types

using INFO_TYPE = FileInputInfo

Public Functions

inline FileInput(const std::function<void(const std::string&)> &in_cb, const std::string &in_id = "")

Create a new Fileinput; supply the function to call with the file contents as a string (and optionally the HTML identifier to be used).

inline FileInput(const std::function<void(const File&)> &cb, const std::string& = "")

Create a new FileInput; supply the function to call with the file contents as a File object (and optionally the HTML identifier to be used).

inline FileInput(const FileInput &in)

Load a pre-existing FileInput object.

inline FileInput(const Widget &in)
inline virtual ~FileInput()
inline FileInput &Callback(const std::function<void(const std::string&)> &in_cb)

Change the callback function to use when a new file is loaded.

inline FileInput &Autofocus(bool in_af)

Set this FileInput object to have autofocus (or not)

inline FileInput &Disabled(bool in_dis)

Set this FileInput object to be disabled (or renable it.)

inline bool HasAutofocus() const

Determine if this object currently has autofocus.

inline bool IsDisabled() const

Determine if this object is currently disabled.

Protected Functions

inline FileInputInfo *Info()
inline const FileInputInfo *Info() const
inline FileInput(FileInputInfo *in_info)

Friends

friend class FileInputInfo