FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
SDL2/dialogs/sdl_input_widgets.hpp
1#pragma once
2
3#include <string>
4#include <vector>
5#include <SDL.h>
6
7#include "sdl_input.hpp"
8#include "sdl_buttons.hpp"
9
11{
12 public:
13 SdlInputWidgetList(const std::string& title, const std::vector<std::string>& labels,
14 const std::vector<std::string>& initial, const std::vector<Uint32>& flags);
15 SdlInputWidgetList(const SdlInputWidgetList& other) = delete;
16 SdlInputWidgetList(SdlInputWidgetList&& other) = delete;
17
18 SdlInputWidgetList& operator=(const SdlInputWidgetList& other) = delete;
19 SdlInputWidgetList& operator=(SdlInputWidgetList&& other) = delete;
20
21 virtual ~SdlInputWidgetList();
22
23 int run(std::vector<std::string>& result);
24
25 protected:
26 bool update(SDL_Renderer* renderer);
27 ssize_t get_index(const SDL_MouseButtonEvent& button);
28
29 private:
30 enum
31 {
32 INPUT_BUTTON_ACCEPT = 1,
33 INPUT_BUTTON_CANCEL = -2
34 };
35
36 ssize_t next(ssize_t current);
37 [[nodiscard]] bool valid(ssize_t current) const;
38 SdlInputWidget* get(ssize_t index);
39
40 SDL_Window* _window;
41 SDL_Renderer* _renderer;
42 std::vector<SdlInputWidget> _list;
43 SdlButtonList _buttons;
44};