~ubuntu-branches/ubuntu/quantal/mysql-workbench/quantal

« back to all changes in this revision

Viewing changes to library/forms/winforms/wf_code_editor.h

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2012-03-01 21:57:30 UTC
  • Revision ID: package-import@ubuntu.com-20120301215730-o7y8av8y38n162ro
Tags: upstream-5.2.38+dfsg
ImportĀ upstreamĀ versionĀ 5.2.38+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
 
3
 *
 
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
 
7
 * License.
 
8
 * 
 
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.
 
13
 * 
 
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
 
17
 * 02110-1301  USA
 
18
 */
 
19
 
 
20
#ifndef _WF_CODE_EDITOR_H_
 
21
#define _WF_CODE_EDITOR_H_
 
22
 
 
23
/**
 
24
 * Implements an mforms wrapper class for the Scintilla editor.
 
25
 *
 
26
 * @ingroup mforms
 
27
 */
 
28
 
 
29
#include "mforms/code_editor.h"
 
30
#include "wf_view.h"
 
31
 
 
32
using namespace System;
 
33
using namespace Windows::Forms;
 
34
 
 
35
namespace MySQL {
 
36
  namespace Forms {
 
37
 
 
38
    public ref class CodeEditorImpl : public ViewImpl
 
39
    {
 
40
    protected:
 
41
      CodeEditorImpl(mforms::CodeEditor *self);
 
42
 
 
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);
 
57
 
 
58
      void text_changed(Object^ sender, ScintillaNet::TextModifiedEventArgs^ args);
 
59
      void margin_clicked(Object^ sender, ScintillaNet::MarginClickEventArgs^ args);
 
60
    public:
 
61
      static void init(Manager ^mgr)
 
62
      {
 
63
        ::mforms::ControlFactory *f= ::mforms::ControlFactory::get_instance();
 
64
 
 
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);
 
79
      }
 
80
    };
 
81
 
 
82
  };
 
83
};
 
84
 
 
85
#endif // _WF_CODE_EDITOR_H_