| 29 | } |
| 30 | |
| 31 | TextInput::TextInput(Element *parent, bool text_visible) : Element(parent, Events(EventType::Text, EventType::Focus), "input") { |
| 32 | if (!text_visible) { |
| 33 | set_attribute("type", "password"); |
| 34 | } |
| 35 | set_min_width(60.0f); |
| 36 | set_border_color(Color{ 242, 242, 242, 255 }); |
| 37 | set_border_bottom_width(1.0f); |
| 38 | set_padding_bottom(6.0f); |
| 39 | set_focusable(true); |
| 40 | set_nav_auto(NavDirection::Up); |
| 41 | set_nav_auto(NavDirection::Down); |
| 42 | set_tab_index_auto(); |
| 43 | } |
| 44 | |
| 45 | void TextInput::set_text(std::string_view text) { |
| 46 | this->text = std::string(text); |