edelib 1.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
SchemeEditor Class Reference

Editing component for Scheme language. More...

`#include <edelib/SchemeEditor.h>`

Inheritance diagram for SchemeEditor:

## Public Member Functions
| SchemeEditor (int X, int Y, int W, int H, const char *l=0)
void | textsize (int sz)
virtual int | handle (int e)
Fl_Text_Buffer * | style_buffer (void)
void | object_color (int id, int color)
void | object_color (int id, const char *color)
void | match_parenthesis (bool m)

## Detailed Description

Editing component for Scheme language.

SchemeEditor is extension of Fl_Text_Editor, where is provided syntax higlighting for Scheme-like languages (and the rest of LISP family) with parenthesis matching. It will highligh known Scheme keywords and functions, plus some extensions from edelib-script (see sslib/init-2.ss for those extensions).

Note
  This is simple editor intended for small code snippets where full editor is not suitable.

There are few caveats you should be aware of, if you are planning to use this component. First, you should not explicitly set editor buffer (via Fl_Text_Editor::buffer) as SchemeEditor will set it when object is constructed. This is needed so class can correctly setup style buffer too (for syntax highlight). If you specify own buffer object, syntax highlight will not work.

The second is how SchemeEditor will use Fl_Text_Editor::add_modify_callback internally to match parenthesis, so if you overwrite it, editor will not highlight them any more.

## Constructor & Destructor Documentation

SchemeEditor | ( | int | X,
|  | int | Y,
|  | int | W,
|  | int | H,
|  | const char * | l = `0`
| ) |  |

Create widget at given position with given size.

## Member Function Documentation

virtual int handle | ( | int | e | ) |
| virtual

Event handler.

void match_parenthesis | ( | bool | m | ) |
| inline

Match or highlight block of parenthesis.

void object_color | ( | int | id,
|  | int | color
| ) |  |

Set color for text object. Object can be keyword, comment, parenthesis, etc. and is setup according to given list:

- 0 - plain text
- 1 - comments
- 2 - strings
- 3 - directives
- 4 - types
- 5 - keywords
- 6 - parenthesis

For example, to draw comments in red color, you would use object_color(2, FL_RED).

void object_color | ( | int | id,
|  | const char * | color
| ) |  |

Set color using html color

Fl_Text_Buffer* style_buffer | ( | void |  | ) |
| inline

Return style buffer.

void textsize | ( | int | sz | ) |

Set text size; applied on all styles.

The documentation for this class was generated from the following file:

- edelib/SchemeEditor.h