Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
GUI_MessageBox.h
Go to the documentation of this file.
1/*
2 This source file is part of Rigs of Rods
3 Copyright 2005-2012 Pierre-Michel Ricordel
4 Copyright 2007-2012 Thomas Fischer
5 Copyright 2013-2020 Petr Ohlidal
6
7 For more information, see http://www.rigsofrods.org/
8
9 Rigs of Rods is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License version 3, as
11 published by the Free Software Foundation.
12
13 Rigs of Rods is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20*/
21
26
27#pragma once
28
29#include "ForwardDeclarations.h"
30#include "Application.h"
31
32#include <string>
33#include <vector>
34
35namespace RoR {
36namespace GUI {
37
38 // ----------------------------
39 // Config
40
49
51{
52 std::string mbc_title;
53 std::string mbc_text;
55 bool* mbc_close_handle = nullptr;
56 bool mbc_allow_close = false;
57 float mbc_content_width = 300.f;
58
59 std::vector<MessageBoxButton> mbc_buttons;
60};
61
62 // ----------------------------
63 // Execution
64
66{
67public:
68 void Show(MessageBoxConfig const& cfg);
69 void Show(const char* title, const char* text, bool allow_close, const char* button1_text, const char* button2_text);
70 void Draw();
71 bool IsVisible() const { return m_is_visible; }
72
73private:
74 void DrawButton(MessageBoxButton const& button);
75
77 bool* m_close_handle = nullptr;
78 bool m_is_visible = false;
79};
80
81} // namespace GUI
82} // namespace RoR
Central state/object manager and communications hub.
Global forward declarations.
Quake-style console variable, defined in RoR.cfg or crated via Console UI and scripts.
Definition CVar.h:53
bool * m_close_handle
If nullptr, close button is hidden. Otherwise visible.
void DrawButton(MessageBoxButton const &button)
void Show(MessageBoxConfig const &cfg)
MsgType
Global gameplay message loop, see struct Message in GameContext.h.
Definition Application.h:76
@ MSG_INVALID
Definition Application.h:84
void * mbb_mq_payload
Message argument to queue on click.
int mbb_script_number
Valid values are >= 1. -1 means not defined.
MsgType mbb_mq_message
Message to queue on click.
std::string mbb_mq_description
Message argument to queue on click.
float mbc_content_width
Parameter to ImGui::SetContentWidth() - hard limit on content size.
bool * mbc_close_handle
External close handle - not required for mbc_allow_close.
std::vector< MessageBoxButton > mbc_buttons
bool mbc_allow_close
Show close handle even if dbc_close_handle isn't set.
CVar * mbc_always_ask_conf
If set, displays classic checkbox "[x] Always ask".