Rogue Wave Views Gadgets Package API Reference Guide |
Rogue Wave Views Documentation Home |
This class allows the edition of text contents with editing features and syntax coloring, autoindent, undo/redo etc... More...
#include <ilviews/gadgets/codeedit.h>
Classes | |
class | Binding |
Holds the key binding for the commands of a Code Editor . More... | |
class | CommandPerformedObserver |
This observer is notified when a command was executed in a Code Editor. More... | |
class | ContentChangedObserver |
This observer is notified when the content of a Code Editor is modified, or when the read-only state of the Code Editor is changed. More... | |
class | CursorMovedObserver |
This observer is notified when the location of the cursor of a Code Editor is modified. More... | |
class | Location |
The position of a logical character in the text managed by an IlvCodeEditor . More... | |
class | Observer |
Observers receive notifications when commands impact the Code Editor. More... | |
class | Parser |
A Parser can read the text content of a CodeEditor and decorate it. More... | |
class | SelectionChangedObserver |
This observer is notified when the selected area of a Code Editor is changed. More... | |
class | StyleSheet |
A style sheet is a container with several styles that holds palettes for the decorations and options like syntax highlighting, auto-indent mode, brace highlighting, tabulations shown has blank characters. More... | |
class | Trigger |
Triggers are invoked when a Code Editor handles key events that trigger actions that must be implemented on the application side. More... | |
Public Member Functions | |
IlvCodeEditor (IlvDisplay *display, const IlvRect &rect, IlUShort thickness=IlvDefaultGadgetThickness, Binding::Mode mode=Binding::MSVCMode, StyleSheet *sheet=0) | |
Constructor. More... | |
IlvCodeEditor (IlvDisplay *display, const IlvRect &rect, const char *text, IlUShort thickness, StyleSheet *sheet, IlvDim marginWidth, Binding::Mode mode, Parser *parser=0) | |
Constructor. More... | |
void | adjustFromScrollBar (const IlvScrollBar *sb, IlvDirection dir) |
Is called to adjust the gadget to the scroll bars values. More... | |
void | adjustScrollBarValue (IlvScrollBar *sb, IlvDirection dir) |
Is called to adjust the scroll bar values. More... | |
void | appendText (const char *text) |
Appends the given text to the buffer. More... | |
IlBoolean | appendToClipBoard () |
Appends the current selection to the clipboard. More... | |
void | blockUndoRedo () |
Inhibits the undo/redo feature. More... | |
IlBoolean | braceHighLight () const |
Tells if brace matching highlighting is activated. More... | |
IlInt | breakLine (IlBoolean autoIndent) |
Breaks a line at the current cursor position. More... | |
IlBoolean | centerOnCurrentLine () |
Scrolls as needed to place the current line at the center of the editor view. More... | |
void | clearEditSignal () |
Sets the edition signal to IlFalse . | |
IlBoolean | commentRegion () |
Inserts a mono-line comment in the text. More... | |
IlBoolean | completeWord () |
Tries to complete the word preceding the cursor. More... | |
char * | concatText (const Location &begin, const Location &end, IlBoolean tabAsBlanks) const |
Concatenates the text between two locations. More... | |
IlBoolean | copyToClipBoard () const |
Copies the current selection to the clipboard. More... | |
IlBoolean | cutLineToClipBoard () |
Executes a partial cut from cursor to end of line and puts it into the clipboard. More... | |
IlBoolean | cutToClipBoard () |
Cuts the current selection to the clipboard. More... | |
virtual void | drawGadgetContents (IlvPort *dst, const IlvTransformer *t=0, const IlvRegion *clip=0) const |
Draws the gadget contents. More... | |
IlBoolean | find (IlBoolean forwardDir, IlBoolean limited, IlBoolean caseSensitive, IlBoolean wholeWord, const char *pattern, Location from, Location to, IlBoolean s=IlTrue) |
Finds the first occurence of the specified pattern from the current cursor position. More... | |
IlInt | getCursorColumn () const |
Returns the column where the cursor is located. More... | |
IlInt | getCursorLine () const |
Returns the index of the line where the cursor is located. More... | |
const Location & | getCursorLocation () const |
Returns the location of the cursor. | |
void | getRedoCommandLabel (IlString &l) const |
Returns in its argument the label of the last redoable command. More... | |
char * | getSelection () const |
Retrieves the text from the current selection. More... | |
void | getSelection (Location &from, Location &to) const |
Returns the start and end locations of the current selection. | |
Location | getSelectionEnd () const |
Returns the location of the end of the current selection. More... | |
IlInt | getSelectionEndColumn () const |
Returns the index of the last column of the current selection. More... | |
IlInt | getSelectionEndLine () const |
Returns the index of the last line of the current selection. More... | |
Location | getSelectionStart () const |
Returns the location of the start of the current selection. More... | |
IlInt | getSelectionStartColumn () const |
Returns the index of the first column of the current selection. More... | |
IlInt | getSelectionStartLine () const |
Returns the index of the first line of the current selection. More... | |
char * | getText (IlBoolean blanks) |
Gets the text from the buffer. More... | |
void | getUndoCommandLabel (IlString &l) const |
Returns in its argument the label of the last undoable command. More... | |
void | gotoEnd () |
Moves the cursor to the end of the buffer. More... | |
IlBoolean | gotoLine (IlInt line) |
Moves the cursor to the given line. More... | |
virtual IlBoolean | handleGadgetEvent (IlvEvent &event) |
Handles the gadget events. More... | |
virtual IlBoolean | handleScrollBarsEvent (IlvEvent &event) |
Handles the internal scroll bars event. More... | |
IlBoolean | hasSelection () const |
Tells whether there is an active selection or not. More... | |
IlInt | indentLine (IlInt line) |
indents the specified line. More... | |
IlInt | insertCharacter (char key, IlBoolean bckIndent=IlTrue) |
Inserts the given charater at the current cursor location. More... | |
IlInt | insertTabulation () |
Inserts a tabulation at the current cursor location. More... | |
void | insertText (const char *text, IlInt line, IlInt column, IlBoolean reDraw=IlFalse) |
Inserts the given text at the given location. More... | |
Location | insertText (const char *text, const Location &at, IlBoolean reDraw=IlFalse) |
Concatenates the text between two locations. More... | |
void | insertTextReversible (const char *text, IlInt line, IlInt column, IlBoolean reDraw) |
Inserts the given text at the given location. More... | |
IlBoolean | isBlockCloser (char character) const |
tells if the given charater is a block closer. More... | |
IlBoolean | isMultilineSelection () const |
Indicates if the current selection spans several lines. More... | |
IlBoolean | isReadOnly () const |
Returns the editor read-only state. More... | |
IlBoolean | isRedoable () const |
Tells if the redo feature is usable. More... | |
IlBoolean | isSaveNeeded () const |
Tells if the buffer has been changed. More... | |
IlBoolean | isTabulation (const Location &l) const |
Tells if the character at location is a tabulation. More... | |
IlBoolean | isUndoable () const |
Tells if the undo feature is usable. More... | |
IlBoolean | killComment () |
Removes a mono-line comment in the text. More... | |
IlBoolean | loadFile (const IlPathName &filePath, IlBoolean redraw=IlTrue) |
Loads text from given file into the buffer. More... | |
void | loadText (const char *text) |
Loads the given text into the buffer. More... | |
IlBoolean | pasteFromClipBoard () |
Pastes the clipboard contents replacing the current selection if any. More... | |
void | propagateSheet (const StyleSheet *s=0) |
Propagates style sheet modifications. More... | |
IlBoolean | redo () |
Replays the last undone command. More... | |
void | removeMarker (IlvCEdtMarker &marker, IlInt line) |
Removes a marker from the margin of a line. More... | |
void | removeMarkers (IlInt line=-1) |
Removes all markers from the margin of a given line or all lines. More... | |
void | removeOneLogicalCharacter () |
Removes one logical character just before the cursor. More... | |
char * | removeText (const Location &start, const Location &end, IlBoolean retStr=IlTrue) |
Removes the text and the lines between two locations. More... | |
void | replaceSelection (const char *replacement, IlBoolean autoRedraw, IlBoolean forwardDir) |
Replaces the selected text by the new value. More... | |
void | resetAll () |
Empties the buffer and releases the internal memory. | |
void | resetSaveNeeded () |
Resets the buffer changed indicator. More... | |
virtual void | scrollableSize (IlvDim &w, IlvDim &h) const |
Returns the size of the scrollable area of the gadget. More... | |
IlBoolean | selectAll () |
Selects all text from the buffer. More... | |
void | setCursorLocation (const Location &loc) |
Sets the location of the cursor. | |
void | setCursorLocation (IlInt line, IlInt column) |
Moves the cursor to the location given by its arguments. More... | |
void | setEditable (IlBoolean mode) |
Sets the editor to be editable or read-only. More... | |
void | setFindTrigger (Trigger *trigger) |
Sets the Find trigger. More... | |
void | setGotoTrigger (Trigger *trigger) |
Sets the Goto trigger. More... | |
void | setKillBufferTrigger (Trigger *trigger) |
Sets the Kill Buffer trigger. More... | |
void | setLine (IlInt line, const char *text) |
Replaces the text at line by the new value. More... | |
IlBoolean | setMark () |
Sets the selection mark. More... | |
void | setMarker (IlvCEdtMarker &marker, IlInt line) |
Adds a marker to the margin of a line. More... | |
void | setOpenTrigger (Trigger *trigger) |
Sets the Open trigger. More... | |
void | setQuitTrigger (Trigger *trigger) |
Sets the Quit trigger. More... | |
void | setReadOnlyTrigger (Trigger *trigger) |
Sets the Read Only trigger. More... | |
void | setReplaceTrigger (Trigger *trigger) |
Sets the Replace trigger. More... | |
void | setSaveAllTrigger (Trigger *trigger) |
Sets the Save All trigger. More... | |
void | setSaveAsTrigger (Trigger *trigger) |
Sets the Save As trigger. More... | |
void | setSaveTrigger (Trigger *trigger) |
Sets the Save trigger. More... | |
IlBoolean | setSelection (IlInt startOffset, IlInt endOffset) |
Selects part of the text on current line. More... | |
void | setSwitchBufferTrigger (Trigger *trigger) |
Sets the Switch Buffer trigger. More... | |
void | setText (const char *text) |
Loads the given text into the buffer. More... | |
void | stopBraceHighLighting () |
Inhibits the brace matching highlight feature. | |
IlBoolean | syntaxHighLight () const |
Tells if syntax highlighting is activated. More... | |
IlBoolean | undo () |
Reverses the effects of the last run command. More... | |
IlInt | unindentLine (IlInt line) |
Outdents the specified line. More... | |
void | unsetMark () |
Removes the selection mark. More... | |
Public Member Functions inherited from IlvScrolledGadget | |
IlvScrolledGadget (IlvDisplay *display, const IlvRect &rect, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. More... | |
virtual void | adjustScrollBars (IlBoolean redraw=IlFalse) |
Recomputes the scroll bars. More... | |
void | computeBBox (IlvRect &ibox, IlvRect &vs, IlvRect &hs, const IlvTransformer *t=0) const |
Computes the bounding boxes of the elements that compose the gadget. More... | |
void | computeBBox (IlvRect &ibox, IlvRect &vbox, IlvRect &vs, IlvRect &hs, const IlvTransformer *t=0) const |
Computes the bounding boxes of the elements that compose the gadget. More... | |
virtual IlvScrollBar * | createScrollBar (const IlvRect &rect, IlvDirection direction, IlUShort thickness, IlvPalette *palette) |
Returns a new instance of the IlvScrollBar class. More... | |
virtual void | drawBackground (IlvPort *dst, const IlvTransformer *t=0, const IlvRegion *clip=0) const |
Draws the gadget background. More... | |
virtual void | drawFrame (IlvPort *dst, const IlvTransformer *t=0, const IlvRegion *clip=0) const |
Draws the gadget frame. More... | |
virtual void | drawScrollBar (IlvPort *dst, IlvDirection direction, const IlvTransformer *t=0, const IlvRegion *clip=0) const |
Draws the specified internal scroll bar. More... | |
void | fitToRect (const IlvRect &rect) |
Resizes the object so that the scrollable area fits the specified rectangle. More... | |
IlUShort | getBottomMargin () const |
Returns the bottom margin. More... | |
IlvScrollBar * | getHorizontalScrollBar () const |
Returns a pointer to the internal horizontal scroll bar. More... | |
IlUShort | getLeftMargin () const |
Returns the left margin. More... | |
IlUShort | getRightMargin () const |
Returns the right margin. More... | |
IlvScrollBar * | getScrollBar (IlvDirection direction) const |
Returns a pointer to the specified internal scroll bar. More... | |
void | getScrollBarShowAsNeeded (IlBoolean &vert, IlBoolean &hor) const |
Returns the scroll bar mode of the internal scroll bars. More... | |
IlUShort | getTopMargin () const |
Returns the top margin. More... | |
IlvScrollBar * | getVerticalScrollBar () const |
Returns a pointer to the internal vertical scroll bar. More... | |
void | hideScrollBar (IlvDirection direction, IlBoolean redraw=IlTrue) |
Hides the specified internal scroll bar. More... | |
virtual void | internalBBox (IlvRect &bbox, const IlvTransformer *t=0) const |
Returns the internal bounding box of the gadget. More... | |
void | moveScrollBar (IlvDirection direction, IlvPosition where, IlBoolean redraw=IlTrue) |
Moves the specified internal scroll bar to a new position. More... | |
virtual void | scrollBarBBox (IlvDirection direction, IlvRect &bbox, const IlvTransformer *t=0) const |
Returns the bounding box of the specified internal scroll bar. More... | |
virtual void | scrollBarHasMoved (IlvDirection direction) |
Is called when an internal scroll bar has moved. More... | |
void | scrollBarShowAsNeeded (IlBoolean vertical, IlBoolean horizontal, IlBoolean redraw=IlTrue) |
Sets the scroll bar mode of the internal scroll bars. More... | |
virtual void | scrollBarVisibilityChanged (IlvDirection direction) |
Is called when an internal scroll bar is shown or hidden. More... | |
void | setBottomMargin (IlUShort margin) |
Sets the bottom margin. More... | |
void | setLeftMargin (IlUShort margin) |
Sets the left margin. More... | |
void | setMargin (IlUShort val) |
Sets the left, right, top, and bottom margins. More... | |
void | setRightMargin (IlUShort margin) |
Sets the right margin. More... | |
void | setTopMargin (IlUShort margin) |
Sets the top margin. More... | |
void | showScrollBar (IlvDirection direction, IlBoolean redraw=IlTrue) |
Shows the specified internal scroll bar. More... | |
virtual void | visibleBBox (IlvRect &bbox, const IlvTransformer *t=0) const |
Returns the visible bounding box of the gadget. More... | |
IlvPosition | whereIsScrollBar (IlvDirection direction) const |
Returns the location of the specified internal scroll bar. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from IlvScrolledGadget | |
static IlSymbol * | ScrollBarMovedSymbol () |
Returns the callback type for the Scroll Bar Moved callback. More... | |
static IlSymbol * | ScrollBarVisibilitySymbol () |
Returns the callback type for the Scroll Bar Visibility Changed callback. More... | |
Protected Member Functions inherited from IlvScrolledGadget | |
IlvDim | getLimitHeightValue () const |
Returns the limit value for the vertical scrolling. More... | |
IlvDim | getLimitWidthValue () const |
Returns the limit value for the horizontal scrolling. More... | |
IlvDim | getScrollableHeight () const |
Returns the height of the scrollable area. More... | |
IlvDim | getScrollableWidth () const |
Returns the width of the scrollable area. More... | |
void | setLimitHeightValue (IlvDim value) |
Sets the limit value for the vertical scrolling. More... | |
void | setLimitWidthValue (IlvDim value) |
Sets the limit value for the horizontal scrolling. More... | |
void | setScrollableHeight (IlvDim height) |
Sets the height of the scrollable area. More... | |
void | setScrollableWidth (IlvDim width) |
Sets the width of the scrollable area. More... | |
This class allows the edition of text contents with editing features and syntax coloring, autoindent, undo/redo etc...
Library: ilvadvgdt
It uses a series of Line
objects as a fundamental data structure for representing source code.
It delegates to the lines the drawing. The lines themselves delegate to their margin and to their decorators the corresponding drawing actions. Most of the interactions (handleGadgetEvent()
) are encapsulated in an IlvCodeEditor::Binding
derived class, which is a kind of interactor, so that it is possible to switch at runtime between MSVC-like and EMACS-like key binding modes.
When a file is loaded and its extension has been associated to a parser with Parser::associate()
, it uses this Parser
for syntax coloring, autoindentation and word selection/navigation features. It delegates to the parser the decorator instantiation for each line of text.
It uses an StyleSheet
as a style sheet for coloration, and tabulation size.
The undo and redo chain management is delegated to an instance of the CommandProcessor
class. The instance is implicitly created when the editor is build. The command processor, in turn, implicitly creates a command factory.
An instance of this class knows when to notify observers for enabling/disabling outside menu items, buttons, modifier indicators, etc...
It manages a list of syntax error lines and allows to add markers in the margin.
It also has a mechanism for keyword online help.
IlFalse
then the tab stops calculation does not occur, resulting in fixed size tabulations. IlvCodeEditor::IlvCodeEditor | ( | IlvDisplay * | display, |
const IlvRect & | rect, | ||
IlUShort | thickness = IlvDefaultGadgetThickness , |
||
Binding::Mode | mode = Binding::MSVCMode , |
||
StyleSheet * | sheet = 0 |
||
) |
Constructor.
Initializes a new empty Code Editor.
display | the display to attach to. |
rect | the bounding box for the editor. |
thickness | the editor border thickness. |
mode | the editor key binding mode |
sheet | the style sheet to use. |
IlvCodeEditor::IlvCodeEditor | ( | IlvDisplay * | display, |
const IlvRect & | rect, | ||
const char * | text, | ||
IlUShort | thickness, | ||
StyleSheet * | sheet, | ||
IlvDim | marginWidth, | ||
Binding::Mode | mode, | ||
Parser * | parser = 0 |
||
) |
Constructor.
Initializes a new Code Editor for the given style sheet, text, and parser.
The given text is split into lines, at the EoL characters. It is always copied.
display | the display to attach to. |
rect | the bounding box for the editor. |
text | the text to insert in the editor and colorize . |
thickness | the editor border thickness. |
sheet | the style sheet to use. |
marginWidth | the width of the margin, set on one side. |
mode | the editor key binding mode |
parser | the parser to scan the text |
|
virtual |
Is called to adjust the gadget to the scroll bars values.
Is called each time the scroll bar scrollbar of direction direction moves. If you want to detect these events, you must redefine this member function in a subclass. The default implementation does nothing.
scrollbar | The scroll bar object. |
direction | The direction of the scroll bar. Valid values are: IlvHorizontal and IlvVertical . |
adjustScrollBarValue()
. Reimplemented from IlvScrolledGadget.
|
virtual |
Is called to adjust the scroll bar values.
Is called by the member function adjustScrollBars()
to adjust the values of the scroll bar scrollbar of direction direction. This member function must modify the scrollbar values to match the gadget scrolling mode. If you want to detect these events, you must redefine this member function in a subclass. The default implementation does nothing.
scrollbar | The scroll bar object. |
direction | The direction of the scroll bar. Valid values are: IlvHorizontal and IlvVertical . |
adjustFromScrollBar()
. Reimplemented from IlvScrolledGadget.
void IlvCodeEditor::appendText | ( | const char * | text | ) |
Appends the given text to the buffer.
text | The text to append. |
IlBoolean IlvCodeEditor::appendToClipBoard | ( | ) |
Appends the current selection to the clipboard.
IlTrue
if the selection was added to the clipboard; IlFalse
if there is no current selection. void IlvCodeEditor::blockUndoRedo | ( | ) |
Inhibits the undo/redo feature.
This function delegates the actual processing to the command processor.
IlBoolean IlvCodeEditor::braceHighLight | ( | ) | const |
Tells if brace matching highlighting is activated.
IlTrue
if the brace matching highlighting feature is enabled. Breaks a line at the current cursor position.
autoIndent | set the possibility to automatically indent the new line. |
IlBoolean IlvCodeEditor::centerOnCurrentLine | ( | ) |
Scrolls as needed to place the current line at the center of the editor view.
IlBoolean IlvCodeEditor::commentRegion | ( | ) |
Inserts a mono-line comment in the text.
The comment is inserted at the cursor line.
IlBoolean IlvCodeEditor::completeWord | ( | ) |
Tries to complete the word preceding the cursor.
If a potential completion is found, it is inserted after the cursor location.
IlTrue
if the command processor succeeded; IlFalse
if there is no current selection.char* IlvCodeEditor::concatText | ( | const Location & | begin, |
const Location & | end, | ||
IlBoolean | tabAsBlanks | ||
) | const |
Concatenates the text between two locations.
begin | the start location. |
end | the end location. |
tabAsBlanks | should tabs be converted to blank charaters. |
It is the caller responsibility to destroy the returned value.
IlBoolean IlvCodeEditor::copyToClipBoard | ( | ) | const |
Copies the current selection to the clipboard.
IlTrue
if the selection was put to the clipboard; IlFalse
if there is no current selection. IlBoolean IlvCodeEditor::cutLineToClipBoard | ( | ) |
Executes a partial cut from cursor to end of line and puts it into the clipboard.
IlTrue
if the command processor succeeded; IlFalse
if the cursor is not in a valid location.IlBoolean IlvCodeEditor::cutToClipBoard | ( | ) |
Cuts the current selection to the clipboard.
IlTrue
if the command processor succeeded; IlFalse
if there is no current selection.
|
virtual |
Draws the gadget contents.
Is called from the draw()
method. The default implementation does nothing.
dst | The destination drawing port. |
t | The transformer applied to the gadget. |
clip | The clipping area. |
drawBackground()
, drawScrollBar()
, drawFrame()
. Reimplemented from IlvScrolledGadget.
IlBoolean IlvCodeEditor::find | ( | IlBoolean | forwardDir, |
IlBoolean | limited, | ||
IlBoolean | caseSensitive, | ||
IlBoolean | wholeWord, | ||
const char * | pattern, | ||
Location | from, | ||
Location | to, | ||
IlBoolean | s = IlTrue |
||
) |
Finds the first occurence of the specified pattern from the current cursor position.
forwardDir | Will the search proceed forward or backward. |
limited | Will the search proceed only between valid start and end locations. |
caseSensitive | Case sensitivity of the search. |
wholeWord | Should only find whole words. |
pattern | The pattern to search. |
from | Start location of the search. |
to | End location of the search. |
s | Should the selection be extended if the pattern spans several lines. |
IlTrue
if the pattern is found. IlInt IlvCodeEditor::getCursorColumn | ( | ) | const |
Returns the column where the cursor is located.
0
. IlInt IlvCodeEditor::getCursorLine | ( | ) | const |
Returns the index of the line where the cursor is located.
0
. void IlvCodeEditor::getRedoCommandLabel | ( | IlString & | l | ) | const |
Returns in its argument the label of the last redoable command.
This function delegates the actual processing to the command processor.
l | On output, will contain the label of the command. |
char* IlvCodeEditor::getSelection | ( | ) | const |
Retrieves the text from the current selection.
Location IlvCodeEditor::getSelectionEnd | ( | ) | const |
Returns the location of the end of the current selection.
Location(-1, -1)
otherwise. IlInt IlvCodeEditor::getSelectionEndColumn | ( | ) | const |
Returns the index of the last column of the current selection.
-1
otherwise. IlInt IlvCodeEditor::getSelectionEndLine | ( | ) | const |
Returns the index of the last line of the current selection.
-1
otherwise. Location IlvCodeEditor::getSelectionStart | ( | ) | const |
Returns the location of the start of the current selection.
Location(-1, -1)
otherwise. IlInt IlvCodeEditor::getSelectionStartColumn | ( | ) | const |
Returns the index of the first column of the current selection.
-1
otherwise. IlInt IlvCodeEditor::getSelectionStartLine | ( | ) | const |
Returns the index of the first line of the current selection.
-1
otherwise. char* IlvCodeEditor::getText | ( | IlBoolean | blanks | ) |
Gets the text from the buffer.
blanks | Should tabs be translated to blank chars. |
void IlvCodeEditor::getUndoCommandLabel | ( | IlString & | l | ) | const |
Returns in its argument the label of the last undoable command.
l | On output, will contain the label of the command. |
This function delegates the actual processing to the command processor.
void IlvCodeEditor::gotoEnd | ( | ) |
Moves the cursor to the end of the buffer.
Moves the cursor to the given line.
line | The line number to move the cursor to. |
IlTrue
unless the line number is invalid. Handles the gadget events.
Is called by handleEvent()
when the member function handleScrollBarsEvent()
returns IlFalse
. Its default implementation does nothing. You can override this member function to implement your own gadget behavior.
event | The event. |
handleScrollBarsEvent()
. Reimplemented from IlvScrolledGadget.
Handles the internal scroll bars event.
Is called from the handleEvent
method. You can override this member function to implement your own scroll bar behavior.
event | The event. |
IlFalse
if the event has not been handled by the scroll bars. In this case, handleGadgetEvent()
will be called. handleGadgetEvent()
. Reimplemented from IlvScrolledGadget.
IlBoolean IlvCodeEditor::hasSelection | ( | ) | const |
Tells whether there is an active selection or not.
IlTrue
is some text is selected. indents the specified line.
line | the line index. |
0
. Inserts the given charater at the current cursor location.
key | the character to insert. |
bckIndent | . |
IlInt IlvCodeEditor::insertTabulation | ( | ) |
Inserts a tabulation at the current cursor location.
void IlvCodeEditor::insertText | ( | const char * | text, |
IlInt | line, | ||
IlInt | column, | ||
IlBoolean | reDraw = IlFalse |
||
) |
Inserts the given text at the given location.
The function will do nothing if the given text is null or is an empty string.
If need be, the text may be converted to wide chars.
text | The text to insert. |
line | The line at which the insertion is to be done. |
column | The column at which the insertion is to be done. |
reDraw | Should the buffer be redrawn. |
Location IlvCodeEditor::insertText | ( | const char * | text, |
const Location & | at, | ||
IlBoolean | reDraw = IlFalse |
||
) |
Concatenates the text between two locations.
text | the text to insert. |
at | the insertion start location. |
reDraw | is re-drawing requested. |
void IlvCodeEditor::insertTextReversible | ( | const char * | text, |
IlInt | line, | ||
IlInt | column, | ||
IlBoolean | reDraw | ||
) |
Inserts the given text at the given location.
The function will do nothing if the given text is null or is an empty string.
If need be, the text may be converted to wide chars.
text | The text to insert. |
line | The line at which the insertion is to be done. |
column | The column at which the insertion is to be done. |
reDraw | Should the buffer be redrawn. |
IlBoolean IlvCodeEditor::isBlockCloser | ( | char | character | ) | const |
tells if the given charater is a block closer.
character | the character to test. |
IlTrue
if there is a parser and the character is declared as a block closer. IlBoolean IlvCodeEditor::isMultilineSelection | ( | ) | const |
Indicates if the current selection spans several lines.
IlTrue
if there is a selection that spans across several lines. IlBoolean IlvCodeEditor::isReadOnly | ( | ) | const |
Returns the editor read-only state.
IlTrue
if the editor is read only, IlFalse
otherwise. IlBoolean IlvCodeEditor::isRedoable | ( | ) | const |
Tells if the redo feature is usable.
This function delegates the actual processing to the command processor.
IlBoolean IlvCodeEditor::isSaveNeeded | ( | ) | const |
Tells if the buffer has been changed.
IlTrue
if the text was changed; IlFalse
otherwise. Tells if the character at location is a tabulation.
IlTrue
if the character is a tabulation or a blank character part of one. IlBoolean IlvCodeEditor::isUndoable | ( | ) | const |
Tells if the undo feature is usable.
This function delegates the actual processing to the command processor.
IlBoolean IlvCodeEditor::killComment | ( | ) |
Removes a mono-line comment in the text.
The comment is removed at the cursor line or in the lines selected. Only the first comment met is processed.
IlBoolean IlvCodeEditor::loadFile | ( | const IlPathName & | filePath, |
IlBoolean | redraw = IlTrue |
||
) |
Loads text from given file into the buffer.
The function will do nothing if the given pathanme is empty.
If need be, the file contents may be converted to wide chars.
filePath | The file path that is loaded. |
redraw | if IlTrue , the Code Editor is redrawn. |
IlTrue
if the file was accessible and the load proceeded; IlFalse
in all other cases. void IlvCodeEditor::loadText | ( | const char * | text | ) |
Loads the given text into the buffer.
The function will do nothing if the given text is null.
If need be, the text may be converted to wide chars.
text | The text to load. |
IlBoolean IlvCodeEditor::pasteFromClipBoard | ( | ) |
Pastes the clipboard contents replacing the current selection if any.
IlTrue
if the command processor succeeded; IlFalse
if there is no current selection.void IlvCodeEditor::propagateSheet | ( | const StyleSheet * | s = 0 | ) |
Propagates style sheet modifications.
s | The style sheet to propagate. |
The function propagates the effect of the sheet modification, ensuring consistency of lines ans editor internal states. If the s sheet argument is null then it propagates the value of the current sheet. It copies the s sheet before propagating if it is not null.
IlBoolean IlvCodeEditor::redo | ( | ) |
Replays the last undone command.
This function delegates the actual processing to the command processor.
void IlvCodeEditor::removeMarker | ( | IlvCEdtMarker & | marker, |
IlInt | line | ||
) |
Removes a marker from the margin of a line.
marker | the marker to remove. |
line | the line to remove the symbol from the margin. |
The line number should be valid with respect to the contents of the editor. That is greater or equal to 0 and lesser than the number of lines in the editor text.
The line is redrawn.
void IlvCodeEditor::removeMarkers | ( | IlInt | line = -1 | ) |
Removes all markers from the margin of a given line or all lines.
line | the line to remove the markers from the margin. |
If given the line number should be valid with respect to the contents of the editor. That is greater or equal to 0 and lesser than the number of lines in the editor text. If no line number is given, all markers will be removed from all lines.
The editor is redrawn.
void IlvCodeEditor::removeOneLogicalCharacter | ( | ) |
Removes one logical character just before the cursor.
If the character is a tabulation represented with blanks, all are deleted.
char* IlvCodeEditor::removeText | ( | const Location & | start, |
const Location & | end, | ||
IlBoolean | retStr = IlTrue |
||
) |
Removes the text and the lines between two locations.
start | The start location. |
end | The end location. |
retStr | Whether or not the removed text should be returned. |
Tabs are translated to blank characters in the returned string.
void IlvCodeEditor::replaceSelection | ( | const char * | replacement, |
IlBoolean | autoRedraw, | ||
IlBoolean | forwardDir | ||
) |
Replaces the selected text by the new value.
replacement | The text to replace the selection with. |
autoRedraw | Should the buffer be redrawn after insertion. |
forwardDir | If false, the cursor will be set at the begining of the selection. |
The function does nothing if the cursor is not in a valid position or there if is no selected text.
Actually the action is turned into two commands: one to remove the selected text and one to insert the new text.
void IlvCodeEditor::resetSaveNeeded | ( | ) |
Resets the buffer changed indicator.
The change is propagated to the observers.
Returns the size of the scrollable area of the gadget.
Puts the width and height of the scrollable area in width and height, respectively. These values are used to compute the values of the scroll bars. You can override this member function to change the scrollable area.
Reimplemented from IlvScrolledGadget.
IlBoolean IlvCodeEditor::selectAll | ( | ) |
Selects all text from the buffer.
IlTrue
. Moves the cursor to the location given by its arguments.
0
. void IlvCodeEditor::setEditable | ( | IlBoolean | mode | ) |
Sets the editor to be editable or read-only.
mode | the state to set the readOnly option to. |
If the editor needs an input method, it is set when the mode is set to editable, removed if the opposite is true.
void IlvCodeEditor::setFindTrigger | ( | Trigger * | trigger | ) |
Sets the Find trigger.
When the Find action is invoked from the Code Editor, the trigger is invoked.
trigger | The trigger to be set. If trigger is 0 then the Find trigger is removed. |
void IlvCodeEditor::setGotoTrigger | ( | Trigger * | trigger | ) |
Sets the Goto trigger.
When the Goto Line action is invoked from the Code Editor, the trigger is invoked.
trigger | The trigger to be set. If trigger is 0 then the Goto trigger is removed. |
void IlvCodeEditor::setKillBufferTrigger | ( | Trigger * | trigger | ) |
Sets the Kill Buffer trigger.
When the Kill Buffer action is invoked from the Code Editor, the trigger is invoked.
trigger | The trigger to be set. If trigger is 0 then the Kill Buffer trigger is removed. |
void IlvCodeEditor::setLine | ( | IlInt | line, |
const char * | text | ||
) |
Replaces the text at line by the new value.
line | The line number. |
text | The new contents for the line |
IlBoolean IlvCodeEditor::setMark | ( | ) |
Sets the selection mark.
IlTrue
.Binding::Emacs
mode. void IlvCodeEditor::setMarker | ( | IlvCEdtMarker & | marker, |
IlInt | line | ||
) |
Adds a marker to the margin of a line.
marker | The marker to add. |
line | The line to add the symbol to. |
The line number should be valid with respect to the contents of the editor. That is greater or equal to 0 and lesser than the number of lines in the editor text.
The line is redrawn.
void IlvCodeEditor::setOpenTrigger | ( | Trigger * | trigger | ) |
Sets the Open trigger.
When the Open action is invoked from the Code Editor, the trigger is invoked.
trigger | The trigger to be set. If trigger is 0 then the Open trigger is removed. |
void IlvCodeEditor::setQuitTrigger | ( | Trigger * | trigger | ) |
Sets the Quit trigger.
When the Quit action is invoked from the Code Editor, the trigger is invoked.
trigger | The trigger to be set. If trigger is 0 then the Quit trigger is removed. |
void IlvCodeEditor::setReadOnlyTrigger | ( | Trigger * | trigger | ) |
Sets the Read Only trigger.
When the Code Editor cannot perform an action because it is read-only, this trigger is invoked.
trigger | The trigger to be set. If trigger is 0 then the Read Only trigger is removed. |
void IlvCodeEditor::setReplaceTrigger | ( | Trigger * | trigger | ) |
Sets the Replace trigger.
When the Replace action is invoked from the Code Editor, the trigger is invoked.
trigger | The trigger to be set. If trigger is 0 then the Replace trigger is removed. |
void IlvCodeEditor::setSaveAllTrigger | ( | Trigger * | trigger | ) |
Sets the Save All trigger.
When the Save All action is invoked from the Code Editor, the trigger is invoked.
trigger | The trigger to be set. If trigger is 0 then the Save All trigger is removed. |
void IlvCodeEditor::setSaveAsTrigger | ( | Trigger * | trigger | ) |
Sets the Save As trigger.
When the Save As action is invoked from the Code Editor, the trigger is invoked.
trigger | The trigger to be set. If trigger is 0 then the Save As trigger is removed. |
void IlvCodeEditor::setSaveTrigger | ( | Trigger * | trigger | ) |
Sets the Save trigger.
When the Save action is invoked from the Code Editor, the trigger is invoked.
trigger | The trigger to be set. If trigger is 0 then the Save trigger is removed. |
Selects part of the text on current line.
startOffset | The start index of the new selection. |
endOffset | The end index of the new selection. |
void IlvCodeEditor::setSwitchBufferTrigger | ( | Trigger * | trigger | ) |
Sets the Switch Buffer trigger.
When the Switch Buffer action is invoked from the Code Editor, the trigger is invoked.
trigger | The trigger to be set. If trigger is 0 then the Switch Buffer trigger is removed. |
void IlvCodeEditor::setText | ( | const char * | text | ) |
Loads the given text into the buffer.
The function is for compatibility with IlvText
; it is strictly equivalent to loadText()
.
text | The text to set. |
IlBoolean IlvCodeEditor::syntaxHighLight | ( | ) | const |
Tells if syntax highlighting is activated.
IlTrue
if the syntax highlighting feature is enabled. IlBoolean IlvCodeEditor::undo | ( | ) |
Reverses the effects of the last run command.
This function delegates the actual processing to the command processor.
Outdents the specified line.
line | the line index. |
0
. void IlvCodeEditor::unsetMark | ( | ) |
Removes the selection mark.
The selection is completely released, hence the involved lines are redrawn.
Binding::Emacs
mode. © Copyright 2016, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.