20 #ifndef _CODE_EDITOR_H_
21 #define _CODE_EDITOR_H_
26 #include "Scintilla.h"
153 std::map<int, std::map<std::string, std::string> >
_styles;
158 void parse_properties();
159 void parse_settings();
160 void parse_keywords();
170 std::map<std::string, std::string>
get_keywords() {
return _keywords; };
172 std::map<std::string, std::string>
get_settings() {
return _settings; };
173 std::map<int, std::map<std::string, std::string> >
get_styles() {
return _styles; };
177 #ifndef DOXYGEN_SHOULD_SKIP_THIS
179 struct CodeEditorImplPtrs
181 bool (*create)(CodeEditor*
self);
182 sptr_t (*send_editor)(CodeEditor*
self,
unsigned int message, uptr_t wParam, sptr_t lParam);
183 void (*set_status_text)(CodeEditor*
self,
const std::string &text);
198 void set_text(
const char* text);
200 void set_value(
const std::string& text);
205 void set_text_keeping_state(
const char* text);
210 void append_text(
const char* text,
int length);
214 void replace_selected_text(
const std::string& text);
220 const std::string get_text(
bool selection_only);
226 const std::string get_text_in_range(
int start,
int end);
236 std::pair<const char*, size_t> get_text_ptr();
242 void set_selection(
int start,
int length);
245 void get_selection(
int &start,
int &length);
248 void clear_selection();
251 bool get_range_of_line(
int line,
int &start,
int &end);
257 void show_markup(
LineMarkup markup,
int line);
264 void remove_markup(
LineMarkup markup,
int line);
267 void show_indicator(
RangeIndicator indicator,
int start,
int length);
273 void remove_indicator(
RangeIndicator indicator,
int start,
int length);
282 int position_from_line(
int line_number);
285 int line_from_position(
int position);
287 void set_font(
const std::string &fontDescription);
301 void set_caret_pos(
int position);
304 void get_line_column_pos(
int position,
int &line,
int &column);
322 void set_status_text(
const std::string& text);
325 void show_find_panel(
bool replace);
326 void hide_find_panel();
333 void set_show_find_panel_callback(boost::function<
void (
CodeEditor*,
bool)> callback);
337 bool find_and_highlight_text(
const std::string& search_text,
FindFlags flags,
338 bool scroll_to,
bool backwards);
342 int find_and_replace_text(
const std::string& search_text,
const std::string& new_text,
347 void jump_to_next_placeholder();
359 void auto_completion_show(
int chars_entered,
const std::vector<std::pair<int, std::string> >& entries);
360 void auto_completion_show(
int chars_entered,
const std::vector<std::string>& entries);
364 void auto_completion_cancel();
377 void auto_completion_options(
bool ignore_case,
bool choose_single,
bool auto_hide,
378 bool drop_rest_of_word,
bool cancel_at_start);
386 void auto_completion_max_size(
int width,
int height);
393 void auto_completion_register_images(
const std::vector<std::pair<int, std::string> >& images);
396 bool auto_completion_active();
399 void auto_completion_stops(
const std::string& stops);
404 void auto_completion_fillups(
const std::string& fillups);
407 void show_calltip(
bool show,
int position,
const std::string& value);
427 sptr_t send_editor(
unsigned int message, uptr_t wParam, sptr_t lParam);
437 boost::signals2::signal<void (int, int, int, bool)>*
signal_changed() {
return &_change_event; }
445 boost::signals2::signal<void (int, int, mforms::ModifierKey)>*
signal_gutter_clicked() {
return &_gutter_clicked_event; }
453 boost::signals2::signal<void (AutoCompletionEventType, int, const std::string&)>*
signal_auto_completion() {
return &_auto_completion_event; };
462 boost::signals2::signal<void (bool, int, int, int)>*
signal_dwell() {
return &_dwell_event; }
474 #ifndef DOXYGEN_SHOULD_SKIP_THIS
476 void on_notify(Scintilla::SCNotification* notification);
479 void on_command(
int command);
482 virtual void resize();
494 void setup_marker(
int marker,
const std::string& name);
508 #endif // _CODE_EDITOR_H_