class Fl_MultiEditor

Class Hierarchy

Include Files


This is a subclass of the Fl_Editor widget that supports editing multiple buffers. You can switch back and forth among the buffers as desired. There is no preset limit to the number or size of the buffers.


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

Creates a new Fl_MultiEditor widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. The widget will be created to fit within the given dimensions (it will be sized down slightly to make room for the scrollbar and status panel).

virtual Fl_MultiEditor::~Fl_MultiEditor()

Destroys the widget and any value associated with it, along with all its edit buffers.

long Fl_MultiEditor::ActiveSessions()

Returns the number of sessions presently open and managed by the widget. Note that this may not be the same as the number returned by long Fl_MultiEditor::GetSessionCount(), since the session count includes those sessions which are already closed. This returns only the number of sessions that are open and available.

long Fl_MultiEditor::CloseCurrent()

Closes the current editor session (buffer) and moves to the next buffer. If there is no next buffer, it moves to the previous buffer. If there is no previous buffer either, then a new empty session is created and activated.

const char *Fl_MultiEditor::CurrentFileName()

Returns the file name under which the current buffer is saved. If the current buffer has never been saved, this will return an empty string ("");

void Fl_MultiEditor::FirstSession()

Activates the first edit session that the widget manages. Useful if you need to walk the sessions -- call this first, then do NextSession() until you have gone ActiveSessions() number of iterations.

long Fl_MultiEditor::GetSessionCount()

Returns the total number of sessions a particular widget has managed during its lifetime, including closed sessions. If you are only concerned about open documents, use ActiveSessions() instead.

void Fl_MultiEditor::NewSession(const char *)

Creates a new edit session (buffer). If the passed string is not NULL, the editor will attempt to load a file by that name. Cursor will be positioned at the top of the document.

void Fl_MultiEditor::NextSession()
void Fl_MultiEditor::PreviousSession()

Switch to the next or previous edit session in the list of sessions this widget manages. Both of these "wrap" -- that is, if you are already at the first session and you do a PreviousSession() call, you will be switched to the last session, and if you are already at the last session and do a NextSession(), you will be switched to the first session.

void Fl_MultiEditor::RenameSession(const char *oldname, const char *newname)
void Fl_MultiEditor::RenameSession(long sessionID, const char *newname)

Rename an open editor session. Sessions are known by an integer ID as well as by a name. The name might be a filename or whatever you chose. This allows for changing the name of a session (such as if you renamed a file, etc.).

void Fl_MultiEditor::SaveCurrent(const char *)

Save the current session (the one presently being edited) to a file with the given name. If successful, renames the session to match the file name.

void Fl_MultiEditor::Session(const char *)
void Fl_MultiEditor::Session(long)
long Fl_MultiEditor::Session()

The last form returns the session ID of the current editing session. The other two switch to an active session with the given ID or name.

const char *Fl_MultiEditor::SessionName()
void Fl_MultiEditor::SessionName(const char *newname)

Allows for getting or setting the name of the currently edited session. Note that this is not the same as the filename. You should use SaveCurrent to change the file where a buffer is saved.

Fl_Font Fl_MultiEditor::textfont() const
void Fl_MultiEditor::textfont(Fl_Font)

Gets or sets the font of the text in the editor. The change is propogated across all active buffers.

uchar Fl_MultiEditor::textsize() const
void Fl_MultiEditor::textsize(uchar)

Gets or sets the size of the text in the input field. The change is propogated across all active buffers.