51 std::string
text()
const {
return text_; }
60 std::function<void(
const std::string& new_text)>
on_change;
79 void set_markers(
const std::vector<std::pair<int, std::string>>& markers);
86 std::string selection_;
89 bool initialized_ =
false;
117 void* native_handle_ =
nullptr;
118 std::string icon_path_;
119 std::string tooltip_;
120 bool visible_ =
false;
174 const std::vector<std::string>&
files()
const {
return files_; }
189 std::vector<std::string> files_;
190 int max_entries_ = 10;
Definition canvas.hpp:240
int cursor_line() const
Get cursor position.
Definition code_editor.hpp:66
void insert_text(std::string_view text)
Insert text at cursor.
std::function< void(int line, int column)> on_cursor_change
Called when the cursor position changes.
Definition code_editor.hpp:63
std::string text() const
Definition code_editor.hpp:51
void set_read_only(bool ro)
Set read-only mode.
void set_language(CodeLanguage lang)
Set the language mode.
std::string selected_text() const
Get selected text.
Definition code_editor.hpp:70
std::function< void(const std::string &new_text)> on_change
Called when the text changes.
Definition code_editor.hpp:60
int cursor_column() const
Definition code_editor.hpp:67
void set_markers(const std::vector< std::pair< int, std::string > > &markers)
Accept error markers (line → message); native fallback currently treats them as a no-op.
void paint(canvas::Canvas &canvas) override
void set_text(std::string text)
Get/set the editor content.
void go_to_line(int line)
Go to a specific line.
void configure(const CodeEditorConfig &config)
Set the editor configuration.
bool save()
Save to the current path.
std::string title() const
Document title (filename without extension).
bool save_as(std::string_view path)
Save to a new path.
const std::string & file_path() const
Current file path.
Definition code_editor.hpp:143
FileBasedDocument()=default
virtual ~FileBasedDocument()=default
void set_dirty(bool d=true)
Definition code_editor.hpp:140
bool load(std::string_view path)
Load from a file path.
virtual bool save_to_file(std::string_view path)=0
Override to implement saving.
virtual bool load_from_file(std::string_view path)=0
Override to implement loading.
bool is_dirty() const
Whether the document has unsaved changes.
Definition code_editor.hpp:139
std::function< void(bool is_dirty)> on_dirty_changed
Called when dirty state changes.
Definition code_editor.hpp:155
bool load(std::string_view path)
Load from a JSON file.
void set_max_entries(int max)
Maximum number of entries (default: 10).
Definition code_editor.hpp:177
void add(std::string_view path)
Add a file to the recent list (moves to front if already present).
void clear()
Clear the list.
Definition code_editor.hpp:180
const std::vector< std::string > & files() const
Get the list (most recent first).
Definition code_editor.hpp:174
bool save(std::string_view path) const
Save to a JSON file.
RecentlyOpenedFilesList()=default
void remove(std::string_view path)
Remove a file from the list.
void show()
Show the tray icon.
void hide()
Hide the tray icon.
void set_icon(std::string_view icon_path)
Set the tray icon image (path to PNG or system icon name).
std::function< void()> on_click
Called when the icon is clicked.
Definition code_editor.hpp:111
void set_tooltip(std::string_view text)
Set the tooltip text.
std::function< void()> on_right_click
Called when the icon is right-clicked (for context menu).
Definition code_editor.hpp:114
Definition affine_transform.hpp:24
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
@ path
Definition anchor_strategy.hpp:42
@ text
Plain text (default color).
Definition code_editor_tokenizer.hpp:37
@ d
Definition input_events.hpp:39
@ column
Definition design_ir.hpp:53
CodeLanguage
Language mode for syntax highlighting.
Definition code_editor.hpp:15
@ Lua
Definition code_editor.hpp:19
@ JSON
Definition code_editor.hpp:21
@ GLSL
Definition code_editor.hpp:23
@ XML
Definition code_editor.hpp:22
@ JSFX
Definition code_editor.hpp:25
@ JavaScript
Definition code_editor.hpp:18
@ Faust
Definition code_editor.hpp:24
@ Python
Definition code_editor.hpp:20
@ PlainText
Definition code_editor.hpp:16
@ Cpp
Definition code_editor.hpp:17
Configuration for the code editor.
Definition code_editor.hpp:29
bool word_wrap
Definition code_editor.hpp:33
CodeLanguage language
Definition code_editor.hpp:30
bool minimap
Definition code_editor.hpp:32
int tab_size
Definition code_editor.hpp:35
bool line_numbers
Definition code_editor.hpp:31
bool read_only
Definition code_editor.hpp:34
float font_size
Definition code_editor.hpp:37
std::string theme
Definition code_editor.hpp:36
std::string font_family
Definition code_editor.hpp:38