cgv
Loading...
Searching...
No Matches
dialog.h
1#pragma once
2
3#include <string>
4#include <vector>
5#include <cgv/gui/window.h>
6
7#include "lib_begin.h"
8
9namespace cgv {
10 namespace gui {
12 extern CGV_API void message(const std::string& _message);
14 extern CGV_API int question(const std::string& question, const std::vector<std::string>& answers = {}, int default_answer = -1);
16 extern CGV_API int question(const std::string& question, const std::string& answers, int default_answer = -1);
18
19 extern CGV_API bool query(const std::string& question, std::string& text, bool password = false);
21 class CGV_API dialog
22 {
23 bool adjust_size;
24 bool result;
25 protected:
27 static void set_true_and_hide(bool* result, cgv::gui::window* w);
28 public:
30 dialog(const std::string& title, const std::string& group_type = "align_group");
32 dialog(int w, int h, const std::string& title, const std::string& group_type = "align_group");
36 void add_std_buttons(const std::string& ok_label = "ok", const std::string& cancel_label = "");
38 bool exec();
39 };
40
41 }
42}
43
44#include <cgv/config/lib_end.h>
use this class to construct and execute a modal dialog.
Definition dialog.h:22
gui independent window class
Definition window.h:14
void message(const std::string &_message)
tell the user something with a message box
Definition dialog.cxx:14
int question(const std::string &_question, const std::vector< std::string > &answers, int default_answer)
ask the user with question to select one of the answers, where default_answer specifies index of defa...
Definition dialog.cxx:24
bool query(const std::string &question, std::string &text, bool password)
query the user for a text, where the second parameter is the default text as well as the returned tex...
Definition dialog.cxx:61
the cgv namespace
Definition print.h:11