FreeRDP
SDL2/dialogs/sdl_selectlist.hpp
1 #pragma once
2 
3 #include <string>
4 #include <vector>
5 
6 #include <SDL.h>
7 
8 #include "sdl_select.hpp"
9 #include "sdl_button.hpp"
10 #include "sdl_buttons.hpp"
11 
13 {
14  public:
15  SdlSelectList(const std::string& title, const std::vector<std::string>& labels);
16  virtual ~SdlSelectList();
17 
18  int run();
19 
20  SdlSelectList(const SdlSelectList& other) = delete;
21  SdlSelectList(SdlSelectList&& other) = delete;
22  SdlSelectList& operator=(const SdlSelectList& other) = delete;
23  SdlSelectList& operator=(SdlSelectList&& other) = delete;
24 
25  private:
26  enum
27  {
28  INPUT_BUTTON_ACCEPT = 0,
29  INPUT_BUTTON_CANCEL = -2
30  };
31 
32  ssize_t get_index(const SDL_MouseButtonEvent& button);
33  bool update_text();
34  void reset_mouseover();
35  void reset_highlight();
36 
37  SDL_Window* _window;
38  SDL_Renderer* _renderer;
39  std::vector<SdlSelectWidget> _list;
40  SdlButtonList _buttons;
41 };