TreeViewer Class Reference

A TreeViewer allows the display of an acyclic directed graph of TreeViewerNodes. More...

#include <treeviewer.h>

Inheritance diagram for TreeViewer:
Inheritance graph
[legend]
Collaboration diagram for TreeViewer:
Collaboration graph
[legend]

List of all members.

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
ViewerManagermanager ()
virtual void operator() (CursorWindow::viewport *vp, int cmd)
 Handle screen repaint commands.
paste_buffer_typepaste_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.
TreeViewerNodetopNode ()
 Get pointer to the top node.
 TreeViewer (ViewerManager *vm)
virtual ~TreeViewer ()

Static Public Member Functions

static Viewerapp (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

ViewerManagermanager_

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_

Detailed Description

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.


Member Typedef Documentation

typename alias

Definition at line 192 of file viewer.h.

typedef std::list<std::string> paste_buffer_type [inherited]

The data type of the paste buffer.

Definition at line 194 of file viewer.h.

typedef CursorWindow::row_col row_col [inherited]

typename alias

Definition at line 191 of file viewer.h.

typedef CursorWindow::viewport viewport [inherited]

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.

typename alias

Definition at line 190 of file viewer.h.


Member Enumeration Documentation

enum cmd_constant [inherited]

values that will be passed to the function call operator method.

Enumerator:
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.


Constructor & Destructor Documentation

~TreeViewer (  )  [virtual]

Definition at line 1072 of file treeviewer.cxx.

TreeViewer ( ViewerManager vm  ) 

Definition at line 386 of file treeviewer.h.

Here is the caller graph for this function:


Member Function Documentation

void acknowledgeViewport ( CursorWindow::viewport vp  )  [private]

Definition at line 175 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Here is the call graph for this function:

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.

Here is the caller graph for this function:

void close ( CursorWindow::viewport vp  )  [private]

Definition at line 584 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void commitPasteBuffer (  )  const [inherited]

write the paste buffer to the os clipboard.

Definition at line 625 of file viewer.cxx.

Here is the caller graph for this function:

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.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Warning:
This is an optional feature, many viewers do not support it.
Parameters:
[out] output The location to store all the lines from this viewer.
Returns:
true to indicate that the data was extracted and false to indicate that this viewer does not support this feature.

Reimplemented in ListViewer.

Definition at line 705 of file viewer.cxx.

Here is the caller graph for this function:

void fetchPasteBuffer (  )  [inherited]

read the paste buffer from the os clipboard

Definition at line 661 of file viewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void findFirst ( CursorWindow::viewport vp  )  [private]

Definition at line 781 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void findMyParent ( CursorWindow::viewport vp  )  [private]

Definition at line 1007 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void findNext ( CursorWindow::viewport vp  )  [private]

Definition at line 849 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

bool findNextHelper ( CursorWindow::viewport vp,
bool  skipCurrentLine 
) [private]

return true if the string is found

Definition at line 899 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void findNextParent ( CursorWindow::viewport vp  )  [private]

Definition at line 1033 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void flatten (  ) 

Definition at line 188 of file treeviewer.h.

Here is the call graph for this function:

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.

Here is the call graph for this function:

void help (  )  [virtual]

The interface to the help system.

Reimplemented from Viewer.

Definition at line 1093 of file treeviewer.cxx.

Here is the call graph for this function:

void helpHeader ( std::list< std::string > &  helpText  )  [virtual]

Append help to helpText.

Reimplemented in SymbolViewer.

Definition at line 1084 of file treeviewer.cxx.

Here is the caller graph for this function:

bool is_dirty (  )  const [virtual, inherited]

Reimplemented in TableViewer.

Definition at line 611 of file viewer.cxx.

Here is the caller graph for this function:

void make_line_visible ( CursorWindow::viewport vp  )  [private]

Definition at line 988 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

ViewerManager* manager (  )  [inherited]

Definition at line 126 of file viewer.h.

Here is the caller graph for this function:

void moveDown ( CursorWindow::viewport vp  )  [private]

Definition at line 653 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void moveUp ( CursorWindow::viewport vp  )  [private]

Definition at line 502 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void open ( CursorWindow::viewport vp  )  [private]

Definition at line 605 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void operator() ( CursorWindow::viewport vp,
int  cmd 
) [virtual]

Handle screen repaint commands.

Note:
The vp parameter gets deleted regularly, don't save it!

Implements Viewer.

Definition at line 143 of file treeviewer.cxx.

Here is the call graph for this function:

void pageBottom ( CursorWindow::viewport vp  )  [private]

Definition at line 715 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void pageDown ( CursorWindow::viewport vp  )  [private]

Definition at line 738 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void pageTop ( CursorWindow::viewport vp  )  [private]

Definition at line 705 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void pageUp ( CursorWindow::viewport vp  )  [private]

Definition at line 761 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void paintNodeText ( CursorWindow::viewport vp,
int  nodeNumber,
bool  isCursor = false 
) [private]

Definition at line 312 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void paintTitle ( CursorWindow::viewport vp  )  [private]

Definition at line 373 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void paintViewport ( CursorWindow::viewport vp  )  [private]

Definition at line 256 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Here is the call graph for this function:

Here is the caller graph for this function:

void positionCursor ( CursorWindow::viewport vp  )  [private]

Definition at line 1124 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Here is the caller graph for this function:

void setApplicationName ( std::string const &  name  ) 

Definition at line 451 of file treeviewer.h.

Here is the caller graph for this function:

void setRootDir ( FileName const &  dirname  ) 

Set the root directory for file opens.

Definition at line 461 of file treeviewer.h.

Here is the caller graph for this function:

void toggle ( CursorWindow::viewport vp  )  [private]

Definition at line 543 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void toggleAll ( CursorWindow::viewport vp  )  [private]

Definition at line 557 of file treeviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

TreeViewerNode & topNode (  ) 

Get pointer to the top node.

Definition at line 405 of file treeviewer.h.

Here is the caller graph for this function:


Member Data Documentation

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.

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]

Definition at line 117 of file viewer.h.

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.

FileName rootDir_ [private]

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.


The documentation for this class was generated from the following files:
Generated on Wed Feb 29 22:57:40 2012 for CXXUtilities by  doxygen 1.6.3