2
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License as
6
* published by the Free Software Foundation; version 2 of the
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20
#ifndef _WF_CODE_EDITOR_H_
21
#define _WF_CODE_EDITOR_H_
24
* Implements an mforms wrapper class for the Scintilla editor.
29
#include "mforms/code_editor.h"
32
using namespace System;
33
using namespace Windows::Forms;
38
public ref class CodeEditorImpl : public ViewImpl
41
CodeEditorImpl(mforms::CodeEditor *self);
43
static bool create(mforms::CodeEditor* self);
44
static void set_text(mforms::CodeEditor * self, const std::string& text);
45
static const std::string get_text(mforms::CodeEditor* self, bool selection_only);
46
static void get_selection(mforms::CodeEditor* self, int &start, int &length);
47
static void set_selection(mforms::CodeEditor* self, int start, int length);
48
static bool get_range_of_line(mforms::CodeEditor* self, int line, int &start, int &length);
49
static void set_language(mforms::CodeEditor* self, mforms::SyntaxHighlighterLanguage language);
50
static void set_read_only(mforms::CodeEditor* self, bool flag);
51
static void show_markup(mforms::CodeEditor* self, mforms::LineMarkup markup, int line);
52
static void remove_markup(mforms::CodeEditor* self, mforms::LineMarkup markup, int line);
53
static int line_count(mforms::CodeEditor* self);
54
static void set_font(mforms::CodeEditor* self, const std::string& fontDescription);
55
static void show_gutter(mforms::CodeEditor* self, bool flag);
56
static void set_features(mforms::CodeEditor* self, mforms::CodeEditorFeature features, bool flag);
58
void text_changed(Object^ sender, ScintillaNet::TextModifiedEventArgs^ args);
59
void margin_clicked(Object^ sender, ScintillaNet::MarginClickEventArgs^ args);
61
static void init(Manager ^mgr)
63
::mforms::ControlFactory *f= ::mforms::ControlFactory::get_instance();
65
DEF_CALLBACK1(bool, mforms::CodeEditor*, mgr, f->_code_editor_impl, CodeEditorImpl, create);
66
DEF_CALLBACK2(void, mforms::CodeEditor*, const std::string&, mgr, f->_code_editor_impl, CodeEditorImpl, set_text);
67
DEF_CALLBACK2(const std::string, mforms::CodeEditor*, bool, mgr, f->_code_editor_impl, CodeEditorImpl, get_text);
68
DEF_CALLBACK3(void, mforms::CodeEditor*, int&, int&, mgr, f->_code_editor_impl, CodeEditorImpl, get_selection);
69
DEF_CALLBACK3(void, mforms::CodeEditor*, int, int, mgr, f->_code_editor_impl, CodeEditorImpl, set_selection);
70
DEF_CALLBACK4(bool, mforms::CodeEditor*, int, int&, int&, mgr, f->_code_editor_impl, CodeEditorImpl, get_range_of_line);
71
DEF_CALLBACK2(void, mforms::CodeEditor*, mforms::SyntaxHighlighterLanguage, mgr, f->_code_editor_impl, CodeEditorImpl, set_language);
72
DEF_CALLBACK2(void, mforms::CodeEditor*, bool, mgr, f->_code_editor_impl, CodeEditorImpl, set_read_only);
73
DEF_CALLBACK3(void, mforms::CodeEditor*, mforms::LineMarkup, int, mgr, f->_code_editor_impl, CodeEditorImpl, show_markup);
74
DEF_CALLBACK3(void, mforms::CodeEditor*, mforms::LineMarkup, int, mgr, f->_code_editor_impl, CodeEditorImpl, remove_markup);
75
DEF_CALLBACK1(int, mforms::CodeEditor*, mgr, f->_code_editor_impl, CodeEditorImpl, line_count);
76
DEF_CALLBACK2(void, mforms::CodeEditor*, const std::string&, mgr, f->_code_editor_impl, CodeEditorImpl, set_font);
77
DEF_CALLBACK2(void, mforms::CodeEditor*, bool, mgr, f->_code_editor_impl, CodeEditorImpl, show_gutter);
78
DEF_CALLBACK3(void, mforms::CodeEditor*, mforms::CodeEditorFeature, bool, mgr, f->_code_editor_impl, CodeEditorImpl, set_features);
85
#endif // _WF_CODE_EDITOR_H_