A TreeViewer allows the display of an acyclic directed graph of TreeViewerNodes. More...
#include <treeviewer.h>
Public Types | |
enum | cmd_constant { activate, deactivate, resize } |
values that will be passed to the function call operator method. More... | |
typedef CursorWindow::input_event | input_event |
typename alias | |
typedef std::list< std::string > | paste_buffer_type |
The data type of the paste buffer. | |
typedef CursorWindow::row_col | row_col |
typename alias | |
typedef CursorWindow::viewport | viewport |
Returns true if there are unsaved edit changes in this viewer. the default return value is false. Override this function if your viewer has the ability to have unsaved edit changes -- most don't. | |
Public Member Functions | |
virtual std::string const & | application_name () const |
Return a const references to a string which defines the name of the application being implemented in the viewer. This function must always return the same address and the string at that address must never change;. | |
void | commitPasteBuffer () const |
write the paste buffer to the os clipboard. | |
virtual std::string | description () const |
Get a description of this viewer. Typically, this just returns the name of the directory or the name of the file the viewer is being applied to. However, with FTP viewers, POP3 viewers, etc this may not refer to any real file. | |
virtual bool | fetchAllLines (std::list< std::string > &output) |
An optional method that fetches all the lines in this viewer object into a caller supplied list of strings. | |
void | fetchPasteBuffer () |
read the paste buffer from the os clipboard | |
void | flatten () |
virtual bool | handle_event (CursorWindow::input_event const *e, CursorWindow::viewport *vp) |
Handle input events -- and return true if the event is meant to terminate the viewer -- and make it go away. When handling key events -- either FunctionKey or DataKey, you will want to consult the CursorWindow::func mapping to figure out if the key corresponds to 'system wide' edit function. For example,. | |
virtual void | help () |
The interface to the help system. | |
virtual void | helpHeader (std::list< std::string > &helpText) |
Append help to helpText. | |
virtual bool | is_dirty () const |
ViewerManager * | manager () |
virtual void | operator() (CursorWindow::viewport *vp, int cmd) |
Handle screen repaint commands. | |
paste_buffer_type * | paste_buffer () |
Get a pointer to the viewer manager's paste buffer. | |
virtual void | set_row_col_hint (size_t line, size_t column, bool repaint=false) |
The set_row_col_hint() method lets you specify the location where the cursor should be positioned. It is called a 'hint' because mistakes in the calling parameters are silently ignored. Also, obedience to the hint is optional. The 'repaint' parameter indicates that the screen should be immediately updated to reflect the change. | |
void | setApplicationName (std::string const &name) |
void | setRootDir (FileName const &dirname) |
Set the root directory for file opens. | |
TreeViewerNode & | topNode () |
Get pointer to the top node. | |
TreeViewer (ViewerManager *vm) | |
virtual | ~TreeViewer () |
Static Public Member Functions | |
static Viewer * | app (ViewerManager *vm, std::string &fullname) |
Application "hook" function for the KeyViewer class. Use it as a parameter to add_app, like this: | |
Public Attributes | |
std::string | application_name_ |
Protected Attributes | |
ViewerManager * | manager_ |
Private Member Functions | |
void | acknowledgeViewport (CursorWindow::viewport *vp) |
void | close (CursorWindow::viewport *vp) |
void | displayCurrentLine (CursorWindow::viewport *vp, bool highlighted) |
void | findFirst (CursorWindow::viewport *vp) |
void | findMyParent (CursorWindow::viewport *vp) |
void | findNext (CursorWindow::viewport *vp) |
bool | findNextHelper (CursorWindow::viewport *vp, bool) |
return true if the string is found | |
void | findNextParent (CursorWindow::viewport *vp) |
void | make_line_visible (CursorWindow::viewport *vp) |
void | moveDown (CursorWindow::viewport *vp) |
void | moveUp (CursorWindow::viewport *vp) |
void | open (CursorWindow::viewport *vp) |
void | pageBottom (CursorWindow::viewport *vp) |
void | pageDown (CursorWindow::viewport *vp) |
void | pageTop (CursorWindow::viewport *vp) |
void | pageUp (CursorWindow::viewport *vp) |
void | paintNodeText (CursorWindow::viewport *vp, int nodeNumber, bool isCursor=false) |
void | paintTitle (CursorWindow::viewport *vp) |
void | paintViewport (CursorWindow::viewport *vp) |
void | positionCursor (CursorWindow::viewport *vp) |
void | toggle (CursorWindow::viewport *vp) |
void | toggleAll (CursorWindow::viewport *vp) |
Private Attributes | |
bool | active_ |
the current window is active | |
int | cursorNode_ |
int | displayNodes_ |
int | displayRows_ |
TreeViewerNode::FlatForm | flattenedNodes_ |
Linear list of all visible nodes. | |
bool | is_regex_ |
bool | keyKludge_ |
TreeViewerNode | nodes_ |
All nodes in the tree are found as children of this node. | |
SimpleRegex | regexp_ |
FileName | rootDir_ |
Root directory of the tree. This filename is used by the handle_events() method to associate tree nodes with actual files. If non-empty, then this string must end in \ or /. | |
std::string | search_text_ |
int | topNode_ |
int | treeStartRow_ |
A TreeViewer allows the display of an acyclic directed graph of TreeViewerNodes.
The TreeViewer class is does not provide a useful definition of TreeViewerNodes and you must derive from this class
Definition at line 150 of file treeviewer.h.
typedef CursorWindow::input_event input_event [inherited] |
typedef std::list<std::string> paste_buffer_type [inherited] |
typedef CursorWindow::row_col row_col [inherited] |
typedef CursorWindow::viewport viewport [inherited] |
enum cmd_constant [inherited] |
values that will be passed to the function call operator method.
activate |
means you have been activated |
deactivate |
some other viewport has taken focus |
resize |
only the size has changed |
Definition at line 793 of file cursorwindow.h.
~TreeViewer | ( | ) | [virtual] |
Definition at line 1072 of file treeviewer.cxx.
TreeViewer | ( | ViewerManager * | vm | ) |
void acknowledgeViewport | ( | CursorWindow::viewport * | vp | ) | [private] |
Definition at line 175 of file treeviewer.cxx.
Viewer * app | ( | ViewerManager * | vm, | |
std::string & | fullname | |||
) | [static] |
Application "hook" function for the KeyViewer class. Use it as a parameter to add_app, like this:
vm.add_app(TreeViewer::app, "TreeViewer");
Reimplemented in SymbolViewer.
Definition at line 131 of file treeviewer.cxx.
std::string const & application_name | ( | ) | const [virtual] |
Return a const references to a string which defines the name of the application being implemented in the viewer. This function must always return the same address and the string at that address must never change;.
Implements Viewer.
Definition at line 1064 of file treeviewer.cxx.
void close | ( | CursorWindow::viewport * | vp | ) | [private] |
Definition at line 584 of file treeviewer.cxx.
void commitPasteBuffer | ( | ) | const [inherited] |
write the paste buffer to the os clipboard.
Definition at line 625 of file viewer.cxx.
std::string description | ( | ) | const [virtual] |
Get a description of this viewer. Typically, this just returns the name of the directory or the name of the file the viewer is being applied to. However, with FTP viewers, POP3 viewers, etc this may not refer to any real file.
Implements Viewer.
Definition at line 1077 of file treeviewer.cxx.
void displayCurrentLine | ( | CursorWindow::viewport * | vp, | |
bool | highlighted | |||
) | [private] |
Definition at line 630 of file treeviewer.cxx.
bool fetchAllLines | ( | std::list< std::string > & | output | ) | [virtual, inherited] |
An optional method that fetches all the lines in this viewer object into a caller supplied list of strings.
[out] | output | The location to store all the lines from this viewer. |
Reimplemented in ListViewer.
Definition at line 705 of file viewer.cxx.
void fetchPasteBuffer | ( | ) | [inherited] |
read the paste buffer from the os clipboard
Definition at line 661 of file viewer.cxx.
void findFirst | ( | CursorWindow::viewport * | vp | ) | [private] |
Definition at line 781 of file treeviewer.cxx.
void findMyParent | ( | CursorWindow::viewport * | vp | ) | [private] |
Definition at line 1007 of file treeviewer.cxx.
void findNext | ( | CursorWindow::viewport * | vp | ) | [private] |
Definition at line 849 of file treeviewer.cxx.
bool findNextHelper | ( | CursorWindow::viewport * | vp, | |
bool | skipCurrentLine | |||
) | [private] |
return true if the string is found
Definition at line 899 of file treeviewer.cxx.
void findNextParent | ( | CursorWindow::viewport * | vp | ) | [private] |
Definition at line 1033 of file treeviewer.cxx.
void flatten | ( | ) |
bool handle_event | ( | CursorWindow::input_event const * | e, | |
CursorWindow::viewport * | vp | |||
) | [virtual] |
Handle input events -- and return true if the event is meant to terminate the viewer -- and make it go away. When handling key events -- either FunctionKey or DataKey, you will want to consult the CursorWindow::func mapping to figure out if the key corresponds to 'system wide' edit function. For example,.
int edit_func = vp->window()->func[e->value_]; switch(edit_func) { case CursorWindow::func_up: // the up arrow key
Choose this approach instead of looking at the key values directly to allow for consistence in system wide input remapping that occurs when the application modifies the CursorWindow::func map. Note that the CursorWindow::func_data is returned for all keys not mapped into one of the other named func_* keys.
Usage note: If your handle event creates a new viewport that covers this viewport, make sure that your current viewport doesn't draw anything until the next repaint request. Otherwise, your screen will get very jumbled up!
Implements Viewer.
Definition at line 391 of file treeviewer.cxx.
void help | ( | ) | [virtual] |
The interface to the help system.
Reimplemented from Viewer.
Definition at line 1093 of file treeviewer.cxx.
void helpHeader | ( | std::list< std::string > & | helpText | ) | [virtual] |
Append help to helpText.
Reimplemented in SymbolViewer.
Definition at line 1084 of file treeviewer.cxx.
bool is_dirty | ( | ) | const [virtual, inherited] |
Reimplemented in TableViewer.
Definition at line 611 of file viewer.cxx.
void make_line_visible | ( | CursorWindow::viewport * | vp | ) | [private] |
Definition at line 988 of file treeviewer.cxx.
ViewerManager* manager | ( | ) | [inherited] |
void moveDown | ( | CursorWindow::viewport * | vp | ) | [private] |
Definition at line 653 of file treeviewer.cxx.
void moveUp | ( | CursorWindow::viewport * | vp | ) | [private] |
Definition at line 502 of file treeviewer.cxx.
void open | ( | CursorWindow::viewport * | vp | ) | [private] |
Definition at line 605 of file treeviewer.cxx.
void operator() | ( | CursorWindow::viewport * | vp, | |
int | cmd | |||
) | [virtual] |
Handle screen repaint commands.
Implements Viewer.
Definition at line 143 of file treeviewer.cxx.
void pageBottom | ( | CursorWindow::viewport * | vp | ) | [private] |
Definition at line 715 of file treeviewer.cxx.
void pageDown | ( | CursorWindow::viewport * | vp | ) | [private] |
Definition at line 738 of file treeviewer.cxx.
void pageTop | ( | CursorWindow::viewport * | vp | ) | [private] |
Definition at line 705 of file treeviewer.cxx.
void pageUp | ( | CursorWindow::viewport * | vp | ) | [private] |
Definition at line 761 of file treeviewer.cxx.
void paintNodeText | ( | CursorWindow::viewport * | vp, | |
int | nodeNumber, | |||
bool | isCursor = false | |||
) | [private] |
Definition at line 312 of file treeviewer.cxx.
void paintTitle | ( | CursorWindow::viewport * | vp | ) | [private] |
Definition at line 373 of file treeviewer.cxx.
void paintViewport | ( | CursorWindow::viewport * | vp | ) | [private] |
Definition at line 256 of file treeviewer.cxx.
Viewer::paste_buffer_type * paste_buffer | ( | ) | [inherited] |
Get a pointer to the viewer manager's paste buffer.
Definition at line 601 of file viewer.cxx.
void positionCursor | ( | CursorWindow::viewport * | vp | ) | [private] |
Definition at line 1124 of file treeviewer.cxx.
virtual void set_row_col_hint | ( | size_t | line, | |
size_t | column, | |||
bool | repaint = false | |||
) | [virtual, inherited] |
The set_row_col_hint() method lets you specify the location where the cursor should be positioned. It is called a 'hint' because mistakes in the calling parameters are silently ignored. Also, obedience to the hint is optional. The 'repaint' parameter indicates that the screen should be immediately updated to reflect the change.
Again, obedience to this function is entirely optional and most viewers will ignore it.
The line and column numbers are 0 base! Contrary to normal user's expectations, so account for this in any input calculations you make.
Definition at line 202 of file viewer.h.
void setApplicationName | ( | std::string const & | name | ) |
void setRootDir | ( | FileName const & | dirname | ) |
Set the root directory for file opens.
Definition at line 461 of file treeviewer.h.
void toggle | ( | CursorWindow::viewport * | vp | ) | [private] |
Definition at line 543 of file treeviewer.cxx.
void toggleAll | ( | CursorWindow::viewport * | vp | ) | [private] |
Definition at line 557 of file treeviewer.cxx.
TreeViewerNode & topNode | ( | ) |
Get pointer to the top node.
Definition at line 405 of file treeviewer.h.
bool active_ [private] |
the current window is active
Definition at line 157 of file treeviewer.h.
std::string application_name_ |
Definition at line 167 of file treeviewer.h.
int cursorNode_ [private] |
Definition at line 172 of file treeviewer.h.
int displayNodes_ [private] |
Definition at line 171 of file treeviewer.h.
int displayRows_ [private] |
Definition at line 176 of file treeviewer.h.
TreeViewerNode::FlatForm flattenedNodes_ [private] |
Linear list of all visible nodes.
Definition at line 160 of file treeviewer.h.
bool is_regex_ [private] |
Definition at line 180 of file treeviewer.h.
bool keyKludge_ [private] |
Definition at line 178 of file treeviewer.h.
ViewerManager* manager_ [protected, inherited] |
TreeViewerNode nodes_ [private] |
All nodes in the tree are found as children of this node.
Definition at line 158 of file treeviewer.h.
SimpleRegex regexp_ [private] |
Definition at line 182 of file treeviewer.h.
Root directory of the tree. This filename is used by the handle_events() method to associate tree nodes with actual files. If non-empty, then this string must end in \ or /.
Definition at line 162 of file treeviewer.h.
std::string search_text_ [private] |
Definition at line 181 of file treeviewer.h.
int topNode_ [private] |
Definition at line 170 of file treeviewer.h.
int treeStartRow_ [private] |
Definition at line 174 of file treeviewer.h.