FreeRDP
Loading...
Searching...
No Matches
sdl_connection_dialog_wrapper.hpp
1
21#pragma once
22
23#include <mutex>
24#include <memory>
25#include <string>
26
27#include <winpr/platform.h>
28#include <freerdp/types.h>
29
30#include <SDL3/SDL.h>
31
33
35{
36 public:
37 enum MsgType
38 {
39 MSG_NONE,
40 MSG_INFO,
41 MSG_WARN,
42 MSG_ERROR,
43 MSG_DISCARD
44 };
45
48
51
52 SdlConnectionDialogWrapper& operator=(const SdlConnectionDialogWrapper& other) = delete;
53 SdlConnectionDialogWrapper& operator=(SdlConnectionDialogWrapper&& other) = delete;
54
55 void create(rdpContext* context);
56 void destroy();
57
58 bool isRunning() const;
59 bool isVisible() const;
60
61 bool handleEvent(const SDL_Event& event);
62
63 WINPR_ATTR_FORMAT_ARG(2, 3)
64 void setTitle(WINPR_FORMAT_ARG const char* fmt, ...);
65 void setTitle(const std::string& title);
66
67 WINPR_ATTR_FORMAT_ARG(2, 3)
68 void showInfo(WINPR_FORMAT_ARG const char* fmt, ...);
69 void showInfo(const std::string& info);
70
71 WINPR_ATTR_FORMAT_ARG(2, 3)
72 void showWarn(WINPR_FORMAT_ARG const char* fmt, ...);
73 void showWarn(const std::string& info);
74
75 WINPR_ATTR_FORMAT_ARG(2, 3)
76 void showError(WINPR_FORMAT_ARG const char* fmt, ...);
77 void showError(const std::string& error);
78
79 void show(SdlConnectionDialogWrapper::MsgType type, const std::string& msg);
80
81 void show(bool visible = true);
82
83 void handleShow();
84
85 private:
86 mutable std::mutex _mux;
87 std::string _title;
88 std::string _message;
89 bool _visible = false;
91 std::unique_ptr<SDLConnectionDialog> _connection_dialog;
92};