MeshLib C++ Docs
Loading...
Searching...
No Matches
MRModalDialog.h
Go to the documentation of this file.
1#pragma once
2
3#include "exports.h"
4
5#include <functional>
6#include <string>
7
8namespace MR
9{
10
13{
15 float windowWidth = 0.f;
18 std::string headline;
20 bool closeButton = false;
22 std::string text;
25 bool* dontShowAgain = nullptr;
27 bool closeOnClickOutside = false;
29 std::function<void ()> onWindowClose;
30};
31
35{
36public:
37 MRVIEWER_API ModalDialog( std::string label, ModalDialogSettings settings );
38
41 MRVIEWER_API bool beginPopup();
43 MRVIEWER_API void endPopup();
44
46 [[nodiscard]] MRVIEWER_API static float windowWidth();
47
48private:
49 void setStyle_();
50 void unsetStyle_();
51
52private:
53 std::string label_;
54 ModalDialogSettings settings_;
55};
56
57} // namespace MR
Helper class to display modal dialogs. ModalDialogSettings.
Definition MRModalDialog.h:35
MRVIEWER_API void endPopup()
Render the dialog's footer ("Don't show again" checkbox) and finish the dialog.
MRVIEWER_API ModalDialog(std::string label, ModalDialogSettings settings)
MRVIEWER_API bool beginPopup()
static MRVIEWER_API float windowWidth()
Returns the current window width in pixels.
Definition MRCameraOrientationPlugin.h:8
Settings for ModalDialog.
Definition MRModalDialog.h:13
std::function< void()> onWindowClose
Callback for the window close event.
Definition MRModalDialog.h:29
bool closeOnClickOutside
If set, close the dialog on mouse click outside of it.
Definition MRModalDialog.h:27
bool * dontShowAgain
Definition MRModalDialog.h:25
std::string text
Render a centered text under the headline.
Definition MRModalDialog.h:22
bool closeButton
Add a close button next in the top right corner of the dialog.
Definition MRModalDialog.h:20
std::string headline
Definition MRModalDialog.h:18
float windowWidth
Dialog window width. If the value is zero or negative, defaults to cModalWindowWidth * UI::scale().
Definition MRModalDialog.h:15