FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
SDL3/dialogs/sdl_input.hpp
1
20#pragma once
21
22#include <vector>
23#include <string>
24
25#include <SDL3/SDL.h>
26#include "sdl_widget.hpp"
27
29{
30 public:
31 enum
32 {
33 SDL_INPUT_MASK = 1,
34 SDL_INPUT_READONLY = 2
35 };
36
37 SdlInputWidget(SDL_Renderer* renderer, std::string label, std::string initial, Uint32 flags,
38 size_t offset, size_t width, size_t height);
39 SdlInputWidget(SdlInputWidget&& other) noexcept;
40 SdlInputWidget(const SdlInputWidget& other) = delete;
41
42 SdlInputWidget& operator=(const SdlInputWidget& other) = delete;
43 SdlInputWidget& operator=(SdlInputWidget&& other) = delete;
44
45 bool fill_label(SDL_Renderer* renderer, SDL_Color color);
46 bool update_label(SDL_Renderer* renderer);
47
48 bool set_mouseover(SDL_Renderer* renderer, bool mouseOver);
49 bool set_highlight(SDL_Renderer* renderer, bool highlight);
50 bool update_input(SDL_Renderer* renderer);
51 bool resize_input(size_t size);
52
53 bool set_str(SDL_Renderer* renderer, const std::string& text);
54 bool remove_str(SDL_Renderer* renderer, size_t count);
55 bool append_str(SDL_Renderer* renderer, const std::string& text);
56
57 [[nodiscard]] const SDL_FRect& input_rect() const;
58 [[nodiscard]] std::string value() const;
59
60 [[nodiscard]] bool readonly() const;
61
62 protected:
63 bool update_input(SDL_Renderer* renderer, SDL_Color fgcolor);
64
65 private:
66 Uint32 _flags;
67 std::string _text;
68 std::string _text_label;
69 SdlWidget _label;
70 SdlWidget _input;
71 bool _highlight;
72 bool _mouseover;
73};