class Fl_Input_


Class Hierarchy

Include Files

Description

This is a virtual base class below Fl_Input. It has all the same interfaces, but lacks the handle() and draw() method. You may want to subclass it if you are one of those people who likes to change how the editing keys work.

This can act like any of the subclasses of Fl_Input, by setting type() to one of the following values:

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_()

The destructor removes the widget and any value associated with it.

int Fl_Input_::wordboundary(int i) const

Returns true if position i is at the start or end of a word.

int Fl_Input_::lineboundary(int i) const

Returns true if position i is at the start or end of a line.

void Fl_Input_::drawtext(int,int,int,int)

Draw the text in the passed bounding box. If damage() & FL_DAMAGE_ALL is true, this assumes the area has already been erased to color(). Otherwise it does minimal update and erases the area itself.

void Fl_Input_::handletext(int e,int,int,int,int)

Default handler for all event types. Your handle() method should call this for all events that it does not handle completely. You must pass it the same bounding box as passed to draw(). Handles FL_PUSH, FL_DRAG, FL_RELEASE to select text, handles FL_FOCUS and FL_UNFOCUS to show and hide the cursor.

int Fl_Input_::up_down_position(int i, int keepmark=0)

Do the correct thing for arrow keys. Sets the position (and mark if keepmark is zero) to somewhere in the same line as i, such that pressing the arrows repeatedly will cause the point to move up and down.

void Fl_Input_::maybe_do_callback()

Does the callback if changed() is true or if when() & FL_WHEN_NOT_CHANGED is non-zero. You should call this at any point you think you should generate a callback.

void Fl_Input_::maximum_size(int m)
int Fl_Input_::maximum_size() const

Sets or returns the maximum length of the input field.

int Fl_Input_::position() const
int Fl_Input_::position(int new_position, int new_mark)
int Fl_Input_::position(int new_position_and_new_mark)

The input widget maintains two pointers into the string. The "position" is where the cursor is. The "mark" is the other end of the selected text. If they are equal then there is no selection. Changing this does not affect the clipboard (use copy() to do that).

Changing these values causes a redraw(). The new values are bounds checked. The return value is non-zero if the new position is different than the old one. position(n) is the same as position(n,n). mark(n) is the same as position(position(),n).

int Fl_Input_::mark() const
int Fl_Input_::mark(int new_mark)

Gets or sets the current selection mark. mark(n) is the same as position(position(),n).

int Fl_Input_::replace(int a, int b, const char *insert, int length=0)

This call does all editing of the text. It deletes the region between a and b (either one may be less or equal to the other), and then inserts the string insert at that point and leaves the mark() and position() after the insertion. Does the callback if when() & FL_WHEN_CHANGED and there is a change.

Set start and end equal to not delete anything. Set insert to NULL to not insert anything.

length must be zero or strlen(insert), this saves a tiny bit of time if you happen to already know the length of the insertion, or can be used to insert a portion of a string or a string containing nul's.

a and b are clamped to the 0..size() range, so it is safe to pass any values.

cut() and insert() are just inline functions that call replace().

int Fl_Input_::cut()
int Fl_Input_::cut(int n)
int Fl_Input_::cut(int a, int b);

Fl_Input_::cut() deletes the current selection. cut(n) deletes n characters after the position(). cut(-n) deletes n characters before the position(). cut(a,b) deletes the characters between offsets a and b. A, b, and n are all clamped to the size of the string. The mark and point are left where the deleted text was.

If you want the data to go into the clipboard, do Fl_Input_::copy() before calling Fl_Input_::cut(), or do Fl_Input_::copy_cuts() afterwards.

int Fl_Input_::insert(const char *t,int l=0)

Insert the string t at the current position, and leave the mark and position after it. If l is not zero then it is assumed to be strlen(t).

int Fl_Input_::copy()

Put the current selection between mark() and position() into the clipboard. Does not replace the old clipboard contents if position() and mark() are equal.

int Fl_Input_::undo()

Does undo of several previous calls to replace(). Returns non-zero if any change was made.

int Fl_Input_::copy_cuts()

Copy all the previous contiguous cuts from the undo information to the clipboard. This is used to make ^K work.

int Fl_Input_::input_type() const
void Fl_Input_::input_type(int)

Gets or sets the input field type.

int Fl_Input_::readonly() const
void Fl_Input_::readonly(int)

Gets or sets the read-only state of the input field.

int Fl_Input_::wrap() const
void Fl_Input_::wrap(int)

Gets or sets the word wrapping state of the input field. Word wrap is only functional with multi-line input fields.