FreeRDP
SDL2/dialogs/sdl_buttons.hpp
1 #pragma once
2 
3 #include <vector>
4 #include <cstdint>
5 
6 #include "sdl_button.hpp"
7 
9 {
10  public:
11  SdlButtonList() = default;
12  virtual ~SdlButtonList();
13 
14  bool populate(SDL_Renderer* renderer, const std::vector<std::string>& labels,
15  const std::vector<int>& ids, Sint32 total_width, Sint32 offsetY, Sint32 width,
16  Sint32 height);
17 
18  bool update(SDL_Renderer* renderer);
19  SdlButton* get_selected(const SDL_MouseButtonEvent& button);
20  SdlButton* get_selected(Sint32 x, Sint32 y);
21 
22  bool set_highlight_next(bool reset = false);
23  bool set_highlight(size_t index);
24  bool set_mouseover(Sint32 x, Sint32 y);
25 
26  void clear();
27 
28  SdlButtonList(const SdlButtonList& other) = delete;
29  SdlButtonList(SdlButtonList&& other) = delete;
30  SdlButtonList& operator=(const SdlButtonList& other) = delete;
31  SdlButtonList& operator=(SdlButtonList&& other) = delete;
32 
33  private:
34  std::vector<SdlButton> _list;
35  SdlButton* _highlighted = nullptr;
36  size_t _highlight_index = 0;
37  SdlButton* _mouseover = nullptr;
38 };