From 4dc5732a3e0f376786d1d6b788e5cf601439e890 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 27 Nov 2001 04:55:48 +0000 Subject: Image class docos. Start of text buffer docos. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1754 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- documentation/Fl_Text_Buffer.html | 681 ++++++++++++++++++++------------------ 1 file changed, 354 insertions(+), 327 deletions(-) (limited to 'documentation/Fl_Text_Buffer.html') diff --git a/documentation/Fl_Text_Buffer.html b/documentation/Fl_Text_Buffer.html index e0b27db16..8ae988a6b 100644 --- a/documentation/Fl_Text_Buffer.html +++ b/documentation/Fl_Text_Buffer.html @@ -1,336 +1,363 @@ - -
-

class Fl_Input

+ + + + + +

class Fl_Text_Buffer

+
+

Class Hierarchy

- + + +

Include Files

- + + +

Description

-

This is the FLTK text input widget. It displays a single line of text -and lets the user edit it. Normally it is drawn with an inset box and -a white background. The text may contain any characters (even 0), and -will correctly display anything, using ^X notation for unprintable -control characters and \nnn notation for unprintable characters with -the high bit set. It assumes the font can draw any characters in the -ISO-8859-1 character set. - -

- - - - - - - - - - - - - - - - - - - - - - - - -
Mouse button 1Moves the cursor to - this point. Drag selects characters. Double click selects words. - Triple click selects all text. Shift+click extends the selection. - When you select text it is automatically copied to the clipboard. -
Mouse button 2Insert the clipboard at -the point clicked. You can also select a region and replace it with the -clipboard by selecting the region with mouse button 2. -
Mouse button 3Currently acts like button 1.
BackspaceDeletes one character to the left, or -deletes the selected region.
EnterMay cause the callback, see when().
^A or HomeGo to start of line.
^B or LeftMove left
^CCopy the selection to the clipboard
^D or DeleteDeletes one character to the right -or deletes the selected region.
^E or EndGo to the end of line.
^F or RightMove right
^KDelete to the end of line (next \n character) -or deletes a single \n character. These deletions are all concatenated -into the clipboard.
^N or DownMove down (for Fl_Multiline_Input -only, otherwise it moves to the next input field).
^P or UpMove up (for Fl_Multiline_Input only, -otherwise it moves to the previous input field).
^UDelete everything.
^V or ^YPaste the clipboard
^X or ^WCopy the region to the clipboard and -delete it.
^Z or ^_Undo. This is a single-level undo -mechanism, but all adjacent deletions and insertions are concatenated -into a single "undo". Often this will undo a lot more than you -expected.
Shift+moveMove the cursor but also extend the -selection.
RightCtrl or -
Compose
Start -a compose-character -sequence. The next one or two keys typed define the character to -insert (see table that follows.) - -

For instance, to type "á" type [compose][a]['] or [compose]['][a]. - -

The character "nbsp" (non-breaking space) is typed by using -[compose][space]. - -

The single-character sequences may be followed by a space if -necessary to remove ambiguity. For instance, if you really want to -type "ª~" rather than "ã" you must type [compose][a][space][~]. - -

The same key may be used to "quote" control characters into the -text. If you need a ^Q character you can get one by typing -[compose][Control+Q]. - -

X may have a key on the keyboard -defined as XK_Multi_key. If so this key may be used as well -as the right-hand control key. You can set this up with the program -xmodmap. - -

If your keyboard is set to support a foreign language you should -also be able to type "dead key" prefix characters. On X you will -actually be able to see what dead key you typed, and if you then move -the cursor without completing the sequence the accent will remain -inserted. -

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Character Composition Table
KeysCharKeysCharKeysCharKeysCharKeysCharKeysChar
spnbsp*°` AÀD -Ð` aàd -ð -
!¡+ -±' AÁ~ NÑ' aá~ nñ -
%¢2²A ^Â` OÒ^ aâ` oò -
#£3³~ AÃ' OÓ~ aã' oó -
$¤'´: AÄ^ OÔ: aä^ oô -
y =¥uµ* AÅ~ OÕ* aå~ oõ -
|¦pA EÆ: OÖa eæ: oö -
&§.·, CÇx×, cç- :÷ -
:¨,¸E `ÈO /Ø` eèo /ø -
c©1¹' EÉ` UÙ' eé` uù -
aªoº^ EÊ' UÚ^ eê' uú -
< <«> >»: EË^ UÛ: eë^ uû -
~¬1 4¼` IÌ: UÜ` iì: uü -
-­1 2½' IÍ' YÝ' ií' yý -
r®3 4¾^ IÎT HÞ^ iît hþ -
_¯?¿: IÏs sß: iï: yÿ -
+

The Fl_Text_Buffer class is used by the Fl_Text_Display +and Fl_Text_Editor to manage complex text data and is based upon the +excellent NEdit text editor engine - see +http://www.nedit.org/.

Methods

-
- - -
- - - - - - - - - -
-
-

Fl_Input::Fl_Input(int x, int y, int w, -int h, const char *label = 0)

- Creates a new Fl_Input widget using the given position, size, -and label string. The default boxtype is FL_DOWN_BOX. -

virtual Fl_Input::~Fl_Input()

- Destroys the widget and any value associated with it. -

const char *Fl_Input::value() const -
int Fl_Input::value(const char*) -
int Fl_Input::value(const char*, int)

- The first form returns the current value, which is a pointer to the -internal buffer and is valid only until the next event is handled. -

The second two forms change the text and set the mark and the point -to the end of it. The string is copied to the internal buffer. Passing -NULL is the same as "". This returns non-zero if the new value is -different than the current one. You can use the second version to -directly set the length if you know it already or want to put nul's in -the text.

-

int Fl_Input::static_value(const -char*) -
int Fl_Input::static_value(const char*, int)

- Change the text and set the mark and the point to the end of it. The -string is not copied. If the user edits the string it is copied -to the internal buffer then. This can save a great deal of time and -memory if your program is rapidly changing the values of text fields, -but this will only work if the passed string remains unchanged until -either the Fl_Input is destroyed or value() is called -again. -

int Fl_Input::size() const

- Returns the number of characters in value(). This may be -greater than strlen(value()) if there are nul characters in -it. -

char Fl_Input::index(int) const

- Same as value()[n], but may be faster in plausible -implementations. No bounds checking is done. -

Fl_When Fl_Widget::when() const -
void Fl_Widget::when(Fl_When)

- Controls when callbacks are done. The following values are useful, -the default value is FL_WHEN_RELEASE: + -

Fl_Color Fl_Input::textcolor() const -
void Fl_Input::textcolor(Fl_Color)

- Gets or sets the color of the text in the input field. -

Fl_Font Fl_Input::textfont() const -
void Fl_Input::textfont(Fl_Font)

- Gets or sets the font of the text in the input field. -

uchar Fl_Input::textsize() const -
void Fl_Input::textsize(uchar)

- Gets or sets the size of the text in the input field. -

Fl_Color Fl_Input::cursor_color() -const -
void Fl_Input::cursor_color(Fl_Color)

- Get or set the color of the cursor. This is black by default. - - + +

Fl_Text_Buffer

+ +

~Fl_Text_Buffer

+ +

add_modify_callback

+ +

append

+ +

appendfile

+ +

call_modify_callbacks

+ +

character

+ +

character_width

+ +

clear_rectangular

+ +

copy

+ +

count_displayed_characters

+ +

count_lines

+ +

expand_character

+ +

findchar_backward

+ +

findchar_forward

+ +

findchars_backward

+ +

findchars_forward

+ +

highlight

+ +

highlight_position

+ +

highlight_rectangular

+ +

highlight_selection

+ +

highlight_text

+ +

insert_column

+ +

insertfile

+ +

insert

+ +

length

+ +

line_end

+ +

line_start

+ +

line_text

+ +

loadfile

+ +

null_substitution_character

+ +

outputfile

+ +

overlay_rectangular

+ +

primary_selection

+ +

remove_modify_callback

+ +

remove_rectangular

+ +

remove

+ +

remove_secondary_selection

+ +

remove_selection

+ +

replace_rectangular

+ +

replace

+ +

replace_secondary_selection

+ +

replace_selection

+ +

rewind_lines

+ +

savefile

+ +

search_backward

+ +

search_forward

+ +

secondary_selection_position

+ +

secondary_selection

+ +

secondary_selection_text

+ +

secondary_select_rectangular

+ +

secondary_select

+ +

secondary_unselect

+ +

selected

+ +

selection_position

+ +

selection_text

+ +

select_rectangular

+ +

select

+ +

skip_displayed_characters

+ +

skip_lines

+ +

substitute_null_characters

+ +

tab_distance

+ +

tab_distance

+ +

text_in_rectangle

+ +

text_range

+ +

text

+ +

unhighlight

+ +

unselect

+ +

unsubstitute_null_characters

+ +

word_end

+ +

word_start

+ + + + Fl_Text_Buffer(int requestedSize = 0); + ~Fl_Text_Buffer(); + + int length() { return mLength; } + const char* text(); + void text(const char* text); + const char* text_range(int start, int end); + char character(int pos); + const char* text_in_rectangle(int start, int end, int rectStart, int rectEnd); + void insert(int pos, const char* text); + void append(const char* text) { insert(length(), text); } + void remove(int start, int end); + void replace(int start, int end, const char *text); + void copy(Fl_Text_Buffer* fromBuf, int fromStart, int fromEnd, int toPos); + int insertfile(const char *file, int pos, int buflen = 128*1024); + int appendfile(const char *file, int buflen = 128*1024) + { return insertfile(file, length(), buflen); } + int loadfile(const char *file, int buflen = 128*1024) + { select(0, length()); remove_selection(); return appendfile(file, buflen); } + int outputfile(const char *file, int start, int end, int buflen = 128*1024); + int savefile(const char *file, int buflen = 128*1024) + { return outputfile(file, 0, length(), buflen); } + + void insert_column(int column, int startPos, const char* text, + int* charsInserted, int* charsDeleted); + + void replace_rectangular(int start, int end, int rectStart, int rectEnd, + const char* text); + + void overlay_rectangular(int startPos, int rectStart, int rectEnd, + const char* text, int* charsInserted, + int* charsDeleted); + + void remove_rectangular(int start, int end, int rectStart, int rectEnd); + void clear_rectangular(int start, int end, int rectStart, int rectEnd); + int tab_distance() { return mTabDist; } + void tab_distance(int tabDist); + void select(int start, int end); + int selected() { return mPrimary.selected(); } + void unselect(); + void select_rectangular(int start, int end, int rectStart, int rectEnd); + int selection_position(int* start, int* end); + + int selection_position(int* start, int* end, int* isRect, int* rectStart, + int* rectEnd); + + const char* selection_text(); + void remove_selection(); + void replace_selection(const char* text); + void secondary_select(int start, int end); + void secondary_unselect(); + + void secondary_select_rectangular(int start, int end, int rectStart, + int rectEnd); + + int secondary_selection_position(int* start, int* end, int* isRect, + int* rectStart, int* rectEnd); + + const char* secondary_selection_text(); + void remove_secondary_selection(); + void replace_secondary_selection(const char* text); + void highlight(int start, int end); + void unhighlight(); + void highlight_rectangular(int start, int end, int rectStart, int rectEnd); + + int highlight_position(int* start, int* end, int* isRect, int* rectStart, + int* rectEnd); + + const char* highlight_text(); + void add_modify_callback(Fl_Text_Modify_Cb bufModifiedCB, void* cbArg); + void remove_modify_callback(Fl_Text_Modify_Cb bufModifiedCB, void* cbArg); + + void call_modify_callbacks() { call_modify_callbacks(0, 0, 0, 0, 0); } + + const char* line_text(int pos); + int line_start(int pos); + int line_end(int pos); + int word_start(int pos); + int word_end(int pos); + int expand_character(int pos, int indent, char *outStr); + + static int expand_character(char c, int indent, char* outStr, int tabDist, + char nullSubsChar); + + static int character_width(char c, int indent, int tabDist, char nullSubsChar); + int count_displayed_characters(int lineStartPos, int targetPos); + int skip_displayed_characters(int lineStartPos, int nChars); + int count_lines(int startPos, int endPos); + int skip_lines(int startPos, int nLines); + int rewind_lines(int startPos, int nLines); + int findchar_forward(int startPos, char searchChar, int* foundPos); + int findchar_backward(int startPos, char searchChar, int* foundPos); + int findchars_forward(int startPos, const char* searchChars, int* foundPos); + int findchars_backward(int startPos, const char* searchChars, int* foundPos); + + int search_forward(int startPos, const char* searchString, int* foundPos, + int matchCase = 0); + + int search_backward(int startPos, const char* searchString, int* foundPos, + int matchCase = 0); + + int substitute_null_characters(char* string, int length); + void unsubstitute_null_characters(char* string); + char null_substitution_character() { return mNullSubsChar; } + Fl_Text_Selection* primary_selection() { return &mPrimary; } + Fl_Text_Selection* secondary_selection() { return &mSecondary; } + Fl_Text_Selection* highlight_selection() { return &mHighlight; } + + + -- cgit v1.2.3