Rogue Wave Views
Gadgets Package API Reference Guide
Product Documentation:

Rogue Wave Views
Documentation Home
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends
IlvText Class Reference

Gadget class. More...

#include <ilviews/gadgets/text.h>

Inheritance diagram for IlvText:
IlvScrolledGadget IlvGadget IlvSimpleGraphic IlvStylable IlvGraphic IlvValueInterface

Public Member Functions

 IlvText (IlvDisplay *display, const IlvPoint &point, const char *const *labels=0, IlUShort count=0, IlBoolean copy=IlTrue, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0)
 Constructor. More...
 
 IlvText (IlvDisplay *display, const IlvRect &rect, const char *const *labels=0, IlUShort count=0, IlBoolean copy=IlTrue, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0)
 Constructor. More...
 
 IlvText (IlvDisplay *display, const IlvPoint &point, const char *text, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0)
 Constructor. More...
 
 IlvText (IlvDisplay *display, const IlvRect &rect, const char *text, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0)
 Constructor. More...
 
void addLine (const char *text, IlShort line=-1)
 Inserts a new text line at the specified location. More...
 
virtual void addLines (const char *const *labels, IlUShort count, IlShort line=-1, IlBoolean redraw=IlFalse)
 Adds the specified text lines to the text gadget. More...
 
void addText (const char *text, IlShort line=-1, IlBoolean redraw=IlFalse)
 Adds the specified text to the text gadget. More...
 
virtual void adjustScrollBars (IlBoolean=IlFalse)
 Recomputes the scroll bars. More...
 
virtual IlBoolean check (IlUShort character)
 Is called by the interactor for each key down event that corresponds to a regular character. More...
 
virtual void cursorMoved ()
 Is called from the interactor when the cursor is moved. More...
 
void cutLine (const IlvTextLocation &location)
 Removes the end of the specified line. More...
 
virtual void drawBackground (IlvPort *, const IlvTransformer *, const IlvRegion *) const
 Draws the gadget background. More...
 
virtual void drawFrame (IlvPort *, const IlvTransformer *, const IlvRegion *) const
 Draws the gadget frame. More...
 
virtual void drawGadgetContents (IlvPort *, const IlvTransformer *=0, const IlvRegion *=0) const
 Draws the gadget contents. More...
 
void ensureVisible (const IlvTextLocation &location, const IlvTransformer *t=0)
 Changes the first line and the offset of the text gadget to ensure that the specified text location is visible. More...
 
IlvTextLocation getCursorLocation () const
 Returns the current location of the cursor. More...
 
IlvTextLocation getEndLocation () const
 Returns the last location of the text. More...
 
IlUShort getFirstLine () const
 Returns the index of the first text line displayed. More...
 
IlUShort getLastFullVisibleLine (const IlvTransformer *t=0) const
 Returns the index of the last visible line that can be seen without scrolling. More...
 
IlUShort getLastLine (const IlvTransformer *t=0) const
 Returns the index of the last text line displayed. More...
 
const char * getLine (IlUShort index) const
 Returns the specified text line. More...
 
IlUShort getLineLength (IlUShort index) const
 Returns the number of characters in the specified text line. More...
 
const char *const * getLines (IlUShort &count) const
 Returns an array of strings representing the text stored in the gadget. More...
 
IlvDim getMaxWidth () const
 Returns the width of the largest visible line. More...
 
IlUShort getNumberOfLines () const
 Returns the number of text lines stored in the object. More...
 
IlUShort getNumberOfVisibleLines (const IlvTransformer *t=0) const
 Returns the number of visible text lines. More...
 
IlvDim getOffset () const
 Returns the text gadget offset. More...
 
const char * getSelectedText () const
 Returns the selected text. More...
 
void getSelection (IlvTextLocation &from, IlvTextLocation &to) const
 Returns the location of the current selection. More...
 
const char * getText () const
 Returns the text stored in the text gadget. More...
 
virtual IlBoolean handleAltKey (IlUShort character)
 Is called by the interactor to handle keys pressed with the IlvMetaModifier. More...
 
virtual IlBoolean handleControl (IlUShort character)
 Is called by the interactor to handle the control keys. More...
 
virtual IlBoolean handleGadgetEvent (IlvEvent &)
 Handles the gadget events. More...
 
void insertChar (const IlvTextLocation &location, IlUShort character)
 Inserts a character at the specified location. More...
 
void insertText (const char *text, IlvTextLocation &location, IlBoolean redraw=IlFalse)
 Inserts text into the text gadget at the specified location. More...
 
IlBoolean isCursorShown () const
 Indicates whether the cursor is visible. More...
 
IlBoolean isEditable () const
 Indicates whether the text gadget can be edited. More...
 
void locateWord (const IlvTextLocation &location, IlvTextLocation &start, IlvTextLocation &end) const
 Finds the word at the specified location. More...
 
IlvTextLocation pointToPosition (const IlvPoint &point, const IlvTransformer *t=0) const
 Returns the location of the specified point in the text. More...
 
IlBoolean readText (const char *filename=0, const IlvTransformer *t=0)
 Inserts the contents of the specified file into the text gadget. More...
 
void readText (std::istream &istream, const IlvTransformer *t=0)
 Inserts the contents of the specified stream into the text gadget. More...
 
void removeChar (const IlvTextLocation &location)
 Removes a character from a specified location. More...
 
void removeLine (IlUShort line)
 Removes and deletes the specified text line. More...
 
void removeLines (IlUShort line, IlUShort count)
 Removes and deletes several text lines. More...
 
virtual void scrollBarVisibilityChanged (IlvDirection)
 Is called when an internal scroll bar is shown or hidden. More...
 
virtual void selectionChanged ()
 Is called from the interactor when the selection is modified. More...
 
void setCursorLocation (const IlvTextLocation &location)
 Sets the cursor location to a new location. More...
 
void setEditable (IlBoolean value)
 Specifies whether editing is allowed for the text gadget. More...
 
void setFirstLine (IlUShort line)
 Sets the first text line to be displayed. More...
 
void setLine (IlUShort line, const char *text, IlBoolean copy=IlTrue)
 Replaces the text line specified by line with text. More...
 
virtual void setLines (const char *const *labels, IlUShort count, IlBoolean copy=IlTrue)
 Replaces all the text in the text gadget. More...
 
void setOffset (IlvDim offset)
 Sets the text gadget offset. More...
 
void setSelection (const IlvTextLocation &from, const IlvTextLocation &to)
 Sets the location of the current selection. More...
 
virtual void setText (const char *text)
 Sets the text to be stored in the text gadget. More...
 
void showCursor (IlBoolean value)
 Specifies whether the cursor should be visible. More...
 
virtual void valueChanged ()
 Is called from the interactor when the value is modified. More...
 
- Public Member Functions inherited from IlvScrolledGadget
 IlvScrolledGadget (IlvDisplay *display, const IlvRect &rect, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0)
 Constructor. 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 IlvScrollBarcreateScrollBar (const IlvRect &rect, IlvDirection direction, IlUShort thickness, IlvPalette *palette)
 Returns a new instance of the IlvScrollBar class. 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...
 
IlvScrollBargetHorizontalScrollBar () 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...
 
IlvScrollBargetScrollBar (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...
 
IlvScrollBargetVerticalScrollBar () const
 Returns a pointer to the internal vertical scroll bar. More...
 
virtual IlBoolean handleScrollBarsEvent (IlvEvent &event)
 Handles the internal scroll bars event. 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 scrollableSize (IlvDim &width, IlvDim &height) const
 Returns the size of the scrollable area of the gadget. More...
 
virtual void scrollBarBBox (IlvDirection direction, IlvRect &bbox, const IlvTransformer *t=0) const
 Returns the bounding box of the specified internal scroll bar. More...
 
void scrollBarShowAsNeeded (IlBoolean vertical, IlBoolean horizontal, IlBoolean redraw=IlTrue)
 Sets the scroll bar mode of the internal scroll bars. 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...
 

Static Public Member Functions

static IlSymbolCursorMovedSymbol ()
 Returns the callback type of the Cursor Moved callback. More...
 
static IlSymbolSelectionChangedSymbol ()
 Returns the callback type of the Selection Changed callback. More...
 
static IlSymbolValueChangedSymbol ()
 Returns the callback type of the Value Changed callback. More...
 
- Static Public Member Functions inherited from IlvScrolledGadget
static IlSymbolScrollBarMovedSymbol ()
 Returns the callback type for the Scroll Bar Moved callback. More...
 
static IlSymbolScrollBarVisibilitySymbol ()
 Returns the callback type for the Scroll Bar Visibility Changed callback. More...
 

Protected Member Functions

virtual void adjustFromScrollBar (const IlvScrollBar *, IlvDirection)
 Is called to adjust the gadget to the scroll bars values. More...
 
void adjustScrollBarValue (IlvScrollBar *, IlvDirection)
 Is called to adjust the scroll bar values. More...
 
virtual void scrollBarHasMoved (IlvDirection)
 Is called when an internal scroll bar has moved. 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...
 

Friends

class IlvDefaultTextLFHandler
 

Detailed Description

Gadget class.

Library: ilvadvgdt

The IlvText class defines a multiline text editor that can contain up to 65535 lines of text. The contents of a text gadget can be edited.

A Multiline Text Gadget

See also
IlvTextLocation, IlvTextField.

Accessors

Accessors provide a scriptable and uniform way to inspect and modify an object by using its base class methods IlvValueInterface::queryValue(), IlvValueInterface::queryValues(), IlvValueInterface::changeValue(), IlvValueInterface::changeValues(). This class inherits the accessors of its superclass IlvScrolledGadget and adds the following ones:

Data accessors

Name Type Equivalent methods
lines UInt getNumberOfLines()
text String getText(), setText()
selectedText String getSelectedText()
editable Boolean isEditable(), setEditable()
cursorLocation UInt getCursorLocation(), setCursorLocation()
selectionStart UInt getSelection(), setSelection()
selectionEnd UInt getSelection(), setSelection()

Method accessors

Name Return type Equivalent methods
getLine(UInt index) String getLine(IlUShort index) const
setLine(UInt index, String str) Void setLine(IlUShort index, const char* str, IlBoolean)
removeLine(UInt index) Void removeLine(IlUShort index)
addLine(String str, UInt index) Void addLine(const char* str, IlShort index)

Styling

This class supports the following CSS properties:

Graphic property CSS property Type
Background color background-colorColor
Text color color Color

Constructor & Destructor Documentation

IlvText::IlvText ( IlvDisplay display,
const IlvPoint point,
const char *const *  labels = 0,
IlUShort  count = 0,
IlBoolean  copy = IlTrue,
IlUShort  thickness = IlvDefaultGadgetThickness,
IlvPalette palette = 0 
)

Constructor.

Initializes a new instance of the class IlvText. The size of the object is computed by calling the method IlvGadget::fitToContents(). If you want to specify its size, use a constructor that takes an IlvRect reference instead of an IlvPoint object as parameter.

Parameters
displayThe connection to the display.
pointThe position of the text gadget.
labelsAn array of strings representing the lines of the text gadget.
countThe number of elements in the labels array.
copyIf IlTrue, the labels array is copied. Otherwise it is stored as is, and deleted when this IlvText is destroyed.
thicknessThe thickness of the text gadget.
paletteThe palette used by the text gadget.
IlvText::IlvText ( IlvDisplay display,
const IlvRect rect,
const char *const *  labels = 0,
IlUShort  count = 0,
IlBoolean  copy = IlTrue,
IlUShort  thickness = IlvDefaultGadgetThickness,
IlvPalette palette = 0 
)

Constructor.

Initializes a new instance of the class IlvText.

Parameters
displayThe connection to the display.
rectThe size and position of the text gadget.
labelsAn array of strings representing the lines of the text gadget.
countThe number of elements in the labels array.
copyIf IlTrue, the labels array is copied. Otherwise it is stored as is, and deleted when this IlvText is destroyed.
thicknessThe thickness of the text gadget.
paletteThe palette used by the text gadget.
IlvText::IlvText ( IlvDisplay display,
const IlvPoint point,
const char *  text,
IlUShort  thickness = IlvDefaultGadgetThickness,
IlvPalette palette = 0 
)

Constructor.

Initializes a new instance of the class IlvText. The size of the object is computed by calling the IlvGadget::fitToContents() method. If you want to specify its size, use a constructor that takes an IlvRect reference instead of an IlvPoint object as parameter.

Parameters
displayThe connection to the display.
pointThe position of the text gadget.
textThe text of the text gadget. The '
' character identifies a new line. The text is copied.
thicknessThe thickness of the text gadget.
paletteThe palette used by the text gadget.
IlvText::IlvText ( IlvDisplay display,
const IlvRect rect,
const char *  text,
IlUShort  thickness = IlvDefaultGadgetThickness,
IlvPalette palette = 0 
)

Constructor.

Initializes a new instance of the class IlvText.

Parameters
displayThe connection to the display.
rectThe size and position of the text gadget.
textThe text of the text gadget. The '
' character identifies a new line. The text is copied.
thicknessThe thickness of the text gadget.
paletteThe palette used by the text gadget.

Member Function Documentation

void IlvText::addLine ( const char *  text,
IlShort  line = -1 
)

Inserts a new text line at the specified location.

Parameters
textThe new text line. This string is copied.
lineThe index where text should be inserted.
See also
setLine(), removeLine(), setLines().
virtual void IlvText::addLines ( const char *const *  labels,
IlUShort  count,
IlShort  line = -1,
IlBoolean  redraw = IlFalse 
)
virtual

Adds the specified text lines to the text gadget.

The labels are copied.

Parameters
labelsThe array of strings to be added.
countThe number of elements in the labels array.
lineThe index of the line where the labels array will be inserted.
redrawIndicates whether the text gadget should be redrawn.
void IlvText::addText ( const char *  text,
IlShort  line = -1,
IlBoolean  redraw = IlFalse 
)

Adds the specified text to the text gadget.

Parameters
textThe text to be added. The '
' character identifies a new line. The text is copied.
lineThe index of the line where the text will be inserted.
redrawA Boolean value specifying whether the text gadget should be redrawn.
See also
addLines(), insertText().
virtual void IlvText::adjustFromScrollBar ( const IlvScrollBar scrollbar,
IlvDirection  direction 
)
protectedvirtual

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.

Parameters
scrollbarThe scroll bar object.
directionThe direction of the scroll bar. Valid values are: IlvHorizontal and IlvVertical.
See also
adjustScrollBarValue().

Reimplemented from IlvScrolledGadget.

virtual void IlvText::adjustScrollBars ( IlBoolean  redraw = IlFalse)
virtual

Recomputes the scroll bars.

Sets the right values to the scroll bars.

Parameters
redrawA Boolean value specifying whether the gadget should be redrawn.

Reimplemented from IlvScrolledGadget.

void IlvText::adjustScrollBarValue ( IlvScrollBar scrollbar,
IlvDirection  direction 
)
protectedvirtual

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.

Parameters
scrollbarThe scroll bar object.
directionThe direction of the scroll bar. Valid values are: IlvHorizontal and IlvVertical.
See also
adjustFromScrollBar().

Reimplemented from IlvScrolledGadget.

virtual IlBoolean IlvText::check ( IlUShort  character)
virtual

Is called by the interactor for each key down event that corresponds to a regular character.

Its default implementation inserts the character (erasing the selection if there is one) and updates the display accordingly.

Parameters
characterThe ASCII code of the character.
virtual void IlvText::cursorMoved ( )
virtual

Is called from the interactor when the cursor is moved.

The default implementation calls the Cursor Moved callback.

See also
CursorMovedSymbol().
static IlSymbol* IlvText::CursorMovedSymbol ( )
static

Returns the callback type of the Cursor Moved callback.

The Cursor Moved callback is invoked after the cursor of the text gadget is moved through the interactor.

Returns
The callback type of the Cursor Moved callback.
See also
SelectionChangedSymbol(), ValueChangedSymbol(), IlvGraphic::setCallback().
void IlvText::cutLine ( const IlvTextLocation location)

Removes the end of the specified line.

Parameters
locationThe location from which the line will be removed.
See also
removeChar(), removeLine().
virtual void IlvText::drawBackground ( IlvPort dst,
const IlvTransformer t,
const IlvRegion clip 
) const
virtual

Draws the gadget background.

Is called from the draw() method. This method is not called if the gadget is transparent.

Parameters
dstThe destination drawing port.
tThe transformer applied to the gadget.
clipThe clipping area.
See also
drawFrame(), drawScrollBar(), drawGadgetContents(), IlvGadget::isTransparent().

Reimplemented from IlvScrolledGadget.

virtual void IlvText::drawFrame ( IlvPort dst,
const IlvTransformer t,
const IlvRegion clip 
) const
virtual

Draws the gadget frame.

Is called from the draw() method. This method is not called if the method isShowingFrame() returns IlFalse.

Parameters
dstThe destination drawing port.
tThe transformer applied to the gadget.
clipThe clipping area.
See also
drawBackground(), drawScrollBar(), drawGadgetContents().

Reimplemented from IlvScrolledGadget.

virtual void IlvText::drawGadgetContents ( IlvPort dst,
const IlvTransformer t = 0,
const IlvRegion clip = 0 
) const
virtual

Draws the gadget contents.

Is called from the draw() method. The default implementation does nothing.

Parameters
dstThe destination drawing port.
tThe transformer applied to the gadget.
clipThe clipping area.
See also
drawBackground(), drawScrollBar(), drawFrame().

Reimplemented from IlvScrolledGadget.

void IlvText::ensureVisible ( const IlvTextLocation location,
const IlvTransformer t = 0 
)

Changes the first line and the offset of the text gadget to ensure that the specified text location is visible.

Parameters
locationThe text location.
tThe transformer applied to the text gadget.
See also
setOffset(), setFirstLine().
IlvTextLocation IlvText::getCursorLocation ( ) const

Returns the current location of the cursor.

Returns
The current location of the cursor.
See also
setCursorLocation(), getEndLocation().
IlvTextLocation IlvText::getEndLocation ( ) const

Returns the last location of the text.

Returns
The last location of the text.
See also
getCursorLocation(), pointToPosition().
IlUShort IlvText::getFirstLine ( ) const

Returns the index of the first text line displayed.

Returns
The index of the first line of text displayed.
See also
setFirstLine(), ensureVisible().
IlUShort IlvText::getLastFullVisibleLine ( const IlvTransformer t = 0) const

Returns the index of the last visible line that can be seen without scrolling.

Parameters
tThe transformer applied to the text gadget.
Returns
The index of the last visible line that can be seen without scrolling when the text is displayed with the transformer t.
See also
getLastLine(), getNumberOfVisibleLines().
IlUShort IlvText::getLastLine ( const IlvTransformer t = 0) const

Returns the index of the last text line displayed.

Parameters
tThe transformer applied to the text gadget.
Returns
The index of the last text line displayed when the text is displayed with the transformer t.
See also
getLastFullVisibleLine(), getNumberOfVisibleLines().
const char* IlvText::getLine ( IlUShort  index) const

Returns the specified text line.

Parameters
indexThe index of the text line.
Returns
The text line specified by index. The returned value should not be modified or deleted.
See also
getLines(), setLine().
IlUShort IlvText::getLineLength ( IlUShort  index) const

Returns the number of characters in the specified text line.

Parameters
indexThe index of the line.
Returns
The number of characters in the text line specified by index. In a mutibyte environment, this might be different from the number of bytes, as a character may be stored on several bytes.
const char* const* IlvText::getLines ( IlUShort count) const

Returns an array of strings representing the text stored in the gadget.

Parameters
countThe number of elements in the returned array.
Returns
An array of count strings representing the text stored in the gadget. This array should not be modified or deleted.
See also
getLine(), setLines().
IlvDim IlvText::getMaxWidth ( ) const

Returns the width of the largest visible line.

Returns
The width of the largest visible line.
IlUShort IlvText::getNumberOfLines ( ) const

Returns the number of text lines stored in the object.

Returns
The number of lines stored in the object.
See also
addLine().
IlUShort IlvText::getNumberOfVisibleLines ( const IlvTransformer t = 0) const

Returns the number of visible text lines.

The last line is not taken into account if it is not entirely visible.

Parameters
tThe transformer applied to the text gadget.
Returns
The number of visible text lines when the text gadget is displayed with the transformer t.
See also
getNumberOfLines().
IlvDim IlvText::getOffset ( ) const

Returns the text gadget offset.

This offset value is the distance between the left side of the text gadget bounding box and the starting point of the text.

Returns
The text gadget offset.
See also
setOffset().
const char* IlvText::getSelectedText ( ) const

Returns the selected text.

Returns
The selected text. The returned string should not be deleted.
See also
getSelection(), setSelection().
void IlvText::getSelection ( IlvTextLocation from,
IlvTextLocation to 
) const

Returns the location of the current selection.

Parameters
fromThe returned starting location of the current selection.
toThe returned ending location of the current selection.
See also
setSelection().
const char* IlvText::getText ( ) const

Returns the text stored in the text gadget.

Returns
The text stored in the text gadget. The returned string must not be modified or deleted.
See also
getLines().
virtual IlBoolean IlvText::handleAltKey ( IlUShort  character)
virtual

Is called by the interactor to handle keys pressed with the IlvMetaModifier.

Parameters
characterThe ASCII code of the character.
See also
handleControl().
virtual IlBoolean IlvText::handleControl ( IlUShort  character)
virtual

Is called by the interactor to handle the control keys.

Should only handle control characters, that is, characters for which a call to iscntrl() returns a value different from 0.

Parameters
characterThe ASCII code of the control character.
See also
handleAltKey().
virtual IlBoolean IlvText::handleGadgetEvent ( IlvEvent event)
virtual

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.

Parameters
eventThe event.
See also
handleScrollBarsEvent().

Reimplemented from IlvScrolledGadget.

void IlvText::insertChar ( const IlvTextLocation location,
IlUShort  character 
)

Inserts a character at the specified location.

Parameters
locationThe location where the character is inserted.
characterThe character to be inserted.
See also
removeChar(), pointToPosition().
void IlvText::insertText ( const char *  text,
IlvTextLocation location,
IlBoolean  redraw = IlFalse 
)

Inserts text into the text gadget at the specified location.

Parameters
textThe text to be inserted. The "\n" character identifies a new line. The text is copied.
locationThe location where text will be inserted. If this location is not valid, the new text is inserted at the end of the existing text.
redrawA Boolean value specifying whether the text gadget should be redrawn.
See also
insertLabels(), addText().
IlBoolean IlvText::isCursorShown ( ) const

Indicates whether the cursor is visible.

Returns
IlTrue if the cursor is visible. Otherwise, returns IlFalse.
See also
showCursor().
IlBoolean IlvText::isEditable ( ) const

Indicates whether the text gadget can be edited.

The user cannot type in a text gadget for which editing is not allowed. However, the text can still be selected and copied.

Returns
IlTrue if the text gadget is editable. Otherwise, returns IlFalse.
See also
setEditable().
void IlvText::locateWord ( const IlvTextLocation location,
IlvTextLocation start,
IlvTextLocation end 
) const

Finds the word at the specified location.

Uses start and end to return the locators of the word at the specified location. A word is composed of successive characters that are not in the set: _.,;:-=+/()[]{}*&%!|'

Parameters
locationThe initial location.
startThe returned starting location of the word found.
endThe returned ending location of the word found.
IlvTextLocation IlvText::pointToPosition ( const IlvPoint point,
const IlvTransformer t = 0 
) const

Returns the location of the specified point in the text.

Parameters
pointThe point to be located.
tThe transformer applied to the text gadget.
Returns
The location in the text of point, when the text object is displayed with the transformer t.
IlBoolean IlvText::readText ( const char *  filename = 0,
const IlvTransformer t = 0 
)

Inserts the contents of the specified file into the text gadget.

Removes the existing text and inserts the contents of filename.

Parameters
filenameThe name of the file to be inserted.
tNot used.
void IlvText::readText ( std::istream &  istream,
const IlvTransformer t = 0 
)

Inserts the contents of the specified stream into the text gadget.

Removes the existing text and inserts the contents of istream.

Parameters
istreamThe input stream.
tNot used.
void IlvText::removeChar ( const IlvTextLocation location)

Removes a character from a specified location.

Parameters
locationThe location of the character to be removed.
See also
insertChar(), pointToPosition().
void IlvText::removeLine ( IlUShort  line)

Removes and deletes the specified text line.

Parameters
lineThe index of the text line to be removed.
See also
addLine(), setLine(), getLine().
void IlvText::removeLines ( IlUShort  line,
IlUShort  count 
)

Removes and deletes several text lines.

Parameters
lineThe index of the first text line to be removed.
countThe number of lines to delete.
See also
addLine(), setLine(), getLine(), removeLine().
virtual void IlvText::scrollBarHasMoved ( IlvDirection  direction)
protectedvirtual

Is called when an internal scroll bar has moved.

Is called by handleEvent() each time the value of the internal scroll bar specified by direction changes. The default implementation invokes the Scroll Bar Moved callback.

Parameters
directionThe direction of the internal scroll bar. Valid values are: IlvHorizontal and IlvVertical.
See also
ScrollBarMovedSymbol().

Reimplemented from IlvScrolledGadget.

virtual void IlvText::scrollBarVisibilityChanged ( IlvDirection  direction)
virtual

Is called when an internal scroll bar is shown or hidden.

Is called by handleEvent() each time the internal scroll bar specified by direction is shown or hidden. The default implementation invokes the Scroll Bar Visibility Changed callback.

Parameters
directionThe direction of the internal scroll bar. Valid values are: IlvHorizontal and IlvVertical.
See also
ScrollBarVisibilitySymbol().

Reimplemented from IlvScrolledGadget.

virtual void IlvText::selectionChanged ( )
virtual

Is called from the interactor when the selection is modified.

The default implementation calls the Selection Changed callback.

See also
SelectionChangedSymbol().
static IlSymbol* IlvText::SelectionChangedSymbol ( )
static

Returns the callback type of the Selection Changed callback.

The Selection Changed callback is invoked after the selection of the text gadget has changed through the interactor.

Returns
The callback type of the Selection Changed callback.
See also
CursorMovedSymbol(), ValueChangedSymbol(), IlvGraphic::setCallback().
void IlvText::setCursorLocation ( const IlvTextLocation location)

Sets the cursor location to a new location.

If location is not a valid value, it is converted to the nearest valid location.

Parameters
locationThe new cursor location.
See also
getCursorLocation().
void IlvText::setEditable ( IlBoolean  value)

Specifies whether editing is allowed for the text gadget.

The user cannot type in a text gadget for which editing is not allowed. However, the text can still be selected and copied.

Parameters
valueA Boolean value specifying whether the text gadget can be edited (IlTrue) or not (IlFalse).
void IlvText::setFirstLine ( IlUShort  line)

Sets the first text line to be displayed.

Parameters
lineThe index of the new first line of text.
See also
getFirstLine().
void IlvText::setLine ( IlUShort  line,
const char *  text,
IlBoolean  copy = IlTrue 
)

Replaces the text line specified by line with text.

Parameters
lineThe index of the text line to be replaced.
textThe new text line.
copyIf IlTrue, the text string is copied. Otherwise it is stored as is, and deleted when this IlvText is destroyed.
See also
addLine(), removeLine(), setLines().
virtual void IlvText::setLines ( const char *const *  labels,
IlUShort  count,
IlBoolean  copy = IlTrue 
)
virtual

Replaces all the text in the text gadget.

Sets the contents of this object to the labels array of count text lines.

Parameters
labelsThe array of new strings.
countThe number of elements in the labels array.
copyIf IlTrue, the labels array is copied. Otherwise it is stored as is, and deleted when this IlvText is destroyed.
void IlvText::setOffset ( IlvDim  offset)

Sets the text gadget offset.

Parameters
offsetThe new text gadget offset.
See also
getOffset(), ensureVisible().
void IlvText::setSelection ( const IlvTextLocation from,
const IlvTextLocation to 
)

Sets the location of the current selection.

Parameters
fromThe location where the new selection starts.
toThe location where the new selection ends.
See also
getSelection().
virtual void IlvText::setText ( const char *  text)
virtual

Sets the text to be stored in the text gadget.

Parameters
textThe text to be stored in the text gadget. The '
' character identifies a new line. The text is copied.
See also
getText().
void IlvText::showCursor ( IlBoolean  value)

Specifies whether the cursor should be visible.

Parameters
valueA Boolean value specifying whether the cursor should be visible (IlTrue) or not (IlFalse).
See also
isCursorShown().
virtual void IlvText::valueChanged ( )
virtual

Is called from the interactor when the value is modified.

The default implementation calls the Value Changed callback.

See also
ValueChangedSymbol().
static IlSymbol* IlvText::ValueChangedSymbol ( )
static

Returns the callback type of the Value Changed callback.

The Value Changed callback is invoked after the text gadget has been modified through the interactor.

Returns
The callback type of the Value Changed callback.
See also
CursorMovedSymbol(), SelectionChangedSymbol(), IlvGraphic::setCallback().

© 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.