Accesing the (scintilla) editor control

To access the underlying Scintilla editor control you must include in your plugin's code the Sci* headers provided.

Those header files are part of Scintilla, and authored by Neil Hodgson, more info on Scintilla at http://scintilla.org .

Use always the cssed's provided headers, because those are the ones used when cssed was built. Newer or older headers can cause unexpected problems.

The Scintilla's include files are:

ScintillaWidget.h - Definition of Scintilla widget for GTK+.

Scintilla.h - Interface to the edit control.

SciLexer.h - Interface to the lexer functions in the SciLexer version of the edit control.

Those files are released under the terms of the License for Scintilla and SciTE.

Scintilla uses a simple - but powerful - message based interface, really similar to the Windows RichEdit control.

To access the scintilla editor control you need the function cssed_plugin_send_scintilla_message that wraps the scintilla's function scintilla_send_message defined in Scintilla.h.

There's an active mailing list, and great documentation on Scintilla at the scintilla home page ( http://scintilla.org ).

Use those resources to find out more information on scintilla.

Example ussage:

        #include <gtk/gtk.h>
        #include <plugin.h>
        #include <Scintilla.h>
        #include <ScintillaWidget.h>

        // This function gets the pixel coordinates on the widget at the given character position.
        // Usefull to show a pop menu at any position on the document's text.
        // Here, x and y are return values.
        void
        get_x_y_from_character_position( CssedPlugin* plugin, gint pos, gint* x, gint* y)
        {
                g_return_if_fail( plugin != NULL );
                *x = cssed_plugin_send_scintilla_message(plugin, SCI_POINTXFROMPOSITION,0, (int) pos);
                *y = cssed_plugin_send_scintilla_message(plugin, SCI_POINTYFROMPOSITION,0, (int) pos);          
        }

[ Previous | Main Page | Next ]


Back to Index

This documentation is © Iago Rubio Sanfiz, 2004