40 #ifndef H_GEOGRAM_GFX_GUI_CONSOLE_H
41 #define H_GEOGRAM_GFX_GUI_CONSOLE_H
44 #include <geogram_gfx/imgui_ext/imgui_ext.h>
73 void div(
const std::string& value)
override;
78 void out(
const std::string& value)
override;
83 void warn(
const std::string& value)
override;
88 void err(
const std::string& value)
override;
93 void status(
const std::string& value)
override;
103 virtual void printf(
const char* fmt, ...) ;
113 virtual void draw(
bool* visible=
nullptr,
bool with_window=
true);
115 int TextEditCallback(ImGuiInputTextCallbackData* data);
118 *visible_flag_ =
true;
122 *visible_flag_ =
false;
125 typedef void (*CompletionCallback)(
128 const std::string& cmpword, std::vector<std::string>& matches
131 void set_completion_callback(CompletionCallback CB) {
132 completion_callback_ = CB;
135 typedef void (*HistoryCallback)(
141 void set_history_callback(HistoryCallback CB) {
142 history_callback_ = CB;
145 void set_history_size(
index_t n) {
146 if(n != max_history_index_) {
149 max_history_index_ = n;
152 void show_command_prompt() {
153 command_prompt_ =
true;
156 void hide_command_prompt() {
157 command_prompt_ =
false;
170 virtual bool exec_command(
const char* command);
177 bool command_prompt_;
178 ImGuiTextBuffer buf_;
179 ImGuiTextFilter filter_;
184 char input_buf_[geo_imgui_string_length];
185 CompletionCallback completion_callback_;
186 HistoryCallback history_callback_;
A console, that displays logger messages, and where the user can enter commands.
void status(const std::string &value) override
Handles a status message.
virtual void notify_error(const std::string &err)
This function is called whenever an error is displayed using err()
ImVector< int > line_offsets_
Index to lines offset.
Console(bool *visible_flag=nullptr)
Console constructor.
void clear()
Clears the contents of the console.
void err(const std::string &value) override
Handles an error message.
void div(const std::string &value) override
Creates a new division.
void out(const std::string &value) override
Handles an information message.
virtual void printf(const char *fmt,...)
Displays a formatted string to the console.
virtual void update()
Redraws the GUI.
void warn(const std::string &value) override
Handles a warning message.
virtual void draw(bool *visible=nullptr, bool with_window=true)
Draws the console and handles the gui.
Logger client base class.
#define GEOGRAM_GFX_API
Linkage declaration for geogram symbols.
Common include file, providing basic definitions. Should be included before anything else by all head...
Generic logging mechanism.
Global Vorpaline namespace.
geo_index_t index_t
The type for storing and manipulating indices.