FreeRDP
Loading...
Searching...
No Matches
sdl_input_widget_pair.hpp
1
20#pragma once
21
22#include <vector>
23#include <string>
24
25#include <SDL3/SDL.h>
26#include "sdl_widget.hpp"
27#include "sdl_input_widget.hpp"
28
30{
31 public:
32 enum
33 {
34 SDL_INPUT_MASK = 1,
35 SDL_INPUT_READONLY = 2
36 };
37
38 SdlInputWidgetPair(std::shared_ptr<SDL_Renderer>& renderer, const std::string& label,
39 const std::string& initial, Uint32 flags, size_t offset, size_t width,
40 size_t height);
41 SdlInputWidgetPair(SdlInputWidgetPair&& other) noexcept;
42 SdlInputWidgetPair(const SdlInputWidgetPair& other) = delete;
43 ~SdlInputWidgetPair() = default;
44
45 SdlInputWidgetPair& operator=(const SdlInputWidgetPair& other) = delete;
46 SdlInputWidgetPair& operator=(SdlInputWidgetPair&& other) = delete;
47
48 bool set_mouseover(bool mouseOver);
49 bool set_highlight(bool highlight);
50
51 bool set_str(const std::string& text);
52 bool remove_str(size_t count);
53 bool append_str(const std::string& text);
54
55 [[nodiscard]] const SDL_FRect& input_rect() const;
56 [[nodiscard]] std::string value() const;
57
58 [[nodiscard]] bool readonly() const;
59
60 bool update();
61
62 protected:
63 bool update_input_text(const std::string& txt);
64
65 Uint32 _vpadding = 5;
66 Uint32 _hpadding = 10;
67
68 private:
69 Uint32 _flags{};
70 SdlWidget _label;
71 SdlInputWidget _input;
72 std::string _text;
73};