Graphite  Version 3
An experimental 3D geometry processing program
text_editor.h
1 /*
2  * OGF/Graphite: Geometry and Graphics Programming Library + Utilities
3  * Copyright (C) 2000 Bruno Levy
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  * If you modify this software, you should include a notice giving the
20  * name of the person performing the modification, the date of modification,
21  * and the reason for such modification.
22  *
23  * Contact: Bruno Levy
24  *
25  * levy@loria.fr
26  *
27  * ISA Project
28  * LORIA, INRIA Lorraine,
29  * Campus Scientifique, BP 239
30  * 54506 VANDOEUVRE LES NANCY CEDEX
31  * FRANCE
32  *
33  * Note that the GNU General Public License does not permit incorporating
34  * the Software into proprietary programs.
35  */
36 
37 #ifndef H_SKIN_IMGUI_TEXT_EDITOR_H
38 #define H_SKIN_IMGUI_TEXT_EDITOR_H
39 
41 #include <OGF/gom/types/node.h>
42 
43 // Forward declaration for ImGui text editor.
44 class TextEditor;
45 
46 namespace OGF {
47 
51  gom_class TextEditor : public Object {
52  public:
56  TextEditor(Interpreter* interpreter);
57 
61  ~TextEditor() override;
62 
68  return impl_;
69  }
70 
76  return interpreter_;
77  }
78 
84  std::vector<std::string>& completions() {
85  return completions_;
86  }
87 
88  gom_properties:
94  void set_text(const std::string& value);
95 
100  std::string get_text() const;
101 
106  std::string get_selection() const;
107 
112  void set_language(const std::string& language);
113 
117  const std::string& get_language() const;
118 
119  gom_slots:
123  void clear();
124 
130  void draw(const std::string& title);
131 
136  void load(const std::string& filename);
137 
142  void save(const std::string& filename);
143 
144  void add_error_marker(index_t line, const std::string& error_message);
145 
146  void clear_error_markers();
147 
148  void add_breakpoint(index_t line);
149 
150  void clear_breakpoints();
151 
152  void find(const std::string& s);
153 
154  void cursor_forward();
155 
156  gom_signals:
160  void run_request();
161 
165  void save_request();
166 
170  void find_request();
171 
175  void stop_request();
176 
183  void tooltip_request(const std::string& context);
184 
185  private:
186  Interpreter* interpreter_;
187  ::TextEditor* impl_;
188  std::string language_;
189  std::vector<std::string> completions_;
190  };
191 
192 }
193 
194 #endif
Abstract base class for the GOM interpreter.
Definition: interpreter.h:222
Base class for all objects in the GOM system.
Definition: object.h:65
A TextEditor for writing LUA functions.
Definition: text_editor.h:51
void load(const std::string &filename)
Loads a file in the editor.
Interpreter * interpreter()
Gets the Interpreter.
Definition: text_editor.h:75
void draw(const std::string &title)
Draws the editor.
void find_request()
Invoked when <Ctrl><F> is pressed.
::TextEditor * impl()
Gets the implementation.
Definition: text_editor.h:67
void set_language(const std::string &language)
Sets the language used for syntax highlighting.
void save_request()
Invoked when <F2> is pressed.
void stop_request()
Invoked when <Ctrl> is pressed.
TextEditor(Interpreter *interpreter)
TextEditor constructor.
std::string get_text() const
Gets the text.
std::vector< std::string > & completions()
Gets the current list of completions.
Definition: text_editor.h:84
void save(const std::string &filename)
Saves the contents of the editor into a file.
void tooltip_request(const std::string &context)
Invoked when the cursor hovers over a word.
~TextEditor() override
TextEditor destructor.
std::string get_selection() const
Gets the selected text.
const std::string & get_language() const
Gets the language used for syntax highlighting.
void clear(void *addr, size_t size)
Clears a memory block.
Definition: memory.h:116
geo_index_t index_t
The type for storing and manipulating indices.
Definition: numeric.h:329
Global Graphite namespace.
Definition: common.h:76
The base class for all composite objects in the GOM system.
Definitions common to all include files in the skin_imgui library.