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