FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
SDL3/dialogs/sdl_input_widgets.hpp
1
20#pragma once
21
22#include <string>
23#include <vector>
24#include <SDL3/SDL.h>
25
26#include "sdl_widget_list.hpp"
27#include "sdl_input.hpp"
28#include "sdl_buttons.hpp"
29
31{
32 public:
33 SdlInputWidgetList(const std::string& title, const std::vector<std::string>& labels,
34 const std::vector<std::string>& initial, const std::vector<Uint32>& flags);
35 SdlInputWidgetList(const SdlInputWidgetList& other) = delete;
36 SdlInputWidgetList(SdlInputWidgetList&& other) = delete;
37
38 virtual ~SdlInputWidgetList();
39
40 SdlInputWidgetList& operator=(const SdlInputWidgetList& other) = delete;
41 SdlInputWidgetList& operator=(SdlInputWidgetList&& other) = delete;
42
43 int run(std::vector<std::string>& result);
44
45 protected:
46 bool update(std::shared_ptr<SDL_Renderer>& renderer);
47 ssize_t get_index(const SDL_MouseButtonEvent& button);
48
49 private:
50 enum
51 {
52 INPUT_BUTTON_ACCEPT = 1,
53 INPUT_BUTTON_CANCEL = -2
54 };
55
56 ssize_t next(ssize_t current);
57 [[nodiscard]] bool valid(ssize_t current) const;
58 std::shared_ptr<SdlInputWidget> get(ssize_t index);
59
60 std::vector<std::shared_ptr<SdlInputWidget>> _list;
61};