/** * @file InputField.h * @author apio (cloudapio.eu) * @brief Single line text input widget. * * @copyright Copyright (c) 2024, the Luna authors. * */ #pragma once #include #include #include namespace ui { class InputField : public ui::TextInput { public: InputField(Window* window, Widget* parent); void set_font(SharedPtr font) { m_font = font; } Result handle_key_event(const ui::KeyEventRequest& request) override; Result draw(ui::Canvas& canvas) override; StringView data(); void on_submit(os::Function&& action) { m_on_submit_action = move(action); m_has_on_submit_action = true; } private: SharedPtr m_font; os::Function m_on_submit_action; bool m_has_on_submit_action { false }; }; }