Graphite Version 3
An experimental 3D geometry processing program
Loading...
Searching...
No Matches
imgui_ext.h
1/*
2 * Copyright (c) 2000-2022 Inria
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * * Neither the name of the ALICE Project-Team nor the names of its
14 * contributors may be used to endorse or promote products derived from this
15 * software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 *
29 * Contact: Bruno Levy
30 *
31 * https://www.inria.fr/fr/bruno-levy
32 *
33 * Inria,
34 * Domaine de Voluceau,
35 * 78150 Le Chesnay - Rocquencourt
36 * FRANCE
37 *
38 */
39
40#ifndef GEOGRAM_GFX_IMGUI_EXT
41#define GEOGRAM_GFX_IMGUI_EXT
42
44#include <string>
45
46#ifdef GEO_COMPILER_GCC_FAMILY
47#pragma GCC diagnostic push
48#pragma GCC diagnostic ignored "-Wsign-conversion"
49#ifdef GEO_COMPILER_CLANG
50#pragma GCC diagnostic ignored "-Wunknown-warning-option"
51#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
52#pragma GCC diagnostic ignored "-Wc++98-compat-pedantic"
53#endif
54#endif
55
56#include <geogram_gfx/third_party/imgui/imgui.h>
57#include <geogram_gfx/third_party/imgui/misc/cpp/imgui_stdlib.h>
58
59#if defined(GEO_COMPILER_GCC_FAMILY)
60#pragma GCC diagnostic pop
61#endif
62
63
69namespace GEO {
75 enum { geo_imgui_string_length = 4096 };
76
77 namespace FileSystem {
78 class Node;
79 }
80}
81
82typedef int ImGuiExtFileDialogFlags;
83
84
85enum ImGuiExtFileDialogFlags_ {
86 ImGuiExtFileDialogFlags_Load = 1,
87 ImGuiExtFileDialogFlags_Save = 2
88};
89
90#ifdef GOMGEN
91#undef GEOGRAM_GFX_API
92#define GEOGRAM_GFX_API
93#endif
94
95namespace ImGui {
96
104 float GEOGRAM_GFX_API scaling();
105
113 void GEOGRAM_GFX_API set_scaling(float x);
114
124 bool GEOGRAM_GFX_API ColorEdit3WithPalette(
125 const char* label, float color[3]
126 );
127
137 bool GEOGRAM_GFX_API ColorEdit4WithPalette(
138 const char* label, float color[4]
139 );
140
152 void GEOGRAM_GFX_API OpenFileDialog(
153 const char* label,
154 const char* extensions,
155 const char* filename,
156 ImGuiExtFileDialogFlags flags,
157 GEO::FileSystem::Node* root = nullptr
158 );
159
170 bool GEOGRAM_GFX_API FileDialog(
171 const char* label,
172 char* filename, size_t filename_buff_len
173 );
174
182 void GEOGRAM_GFX_API Tooltip(const char* str);
183
188 void GEOGRAM_GFX_API EnableTooltips();
189
194 void GEOGRAM_GFX_API DisableTooltips();
195
196
200 bool GEOGRAM_GFX_API SimpleButton(const char* label);
201
205 bool GEOGRAM_GFX_API SimpleButton(const char* label, const ImVec2& size);
206
211 void GEOGRAM_GFX_API CenteredText(const char* text);
212
216 void GEOGRAM_GFX_API PushFont(ImFont* font);
217
218
219#ifndef GOMGEN
223 inline bool MenuItem(
224 const std::string& name, const char* shortcut,
225 bool* p_selected = nullptr, bool enabled = true
226 ) {
227 return ImGui::MenuItem(name.c_str(), shortcut, p_selected, enabled);
228 }
229
233 inline bool MenuItem(
234 const std::string& name, const char* shortcut = nullptr,
235 bool selected = false, bool enabled = true
236 ) {
237 return ImGui::MenuItem(name.c_str(), shortcut, selected, enabled);
238 }
239
243 inline bool BeginMenu(const std::string& name) {
244 return ImGui::BeginMenu(name.c_str());
245 }
246
250 inline bool Button(const std::string& name) {
251 return ImGui::Button(name.c_str());
252 }
253
257 inline bool SimpleButton(const std::string& label) {
258 return SimpleButton(label.c_str());
259 }
260
268 inline void Tooltip(const std::string& s) {
269 Tooltip(s.c_str());
270 }
271#endif
272
273}
274
275#endif
A Node in a FileSystem.
Definition file_system.h:69
Common include file, providing basic definitions. Should be included before anything else by all head...
#define GEOGRAM_GFX_API
Linkage declaration for geogram symbols.
Definition defs.h:55
Global Vorpaline namespace.