TextViewer Class Reference

A TextViewer is a Viewer meant for displaying but not editing ascii text files. It presents the user with the text of the named file and allows for scrolling (vertically and horizontally) as well as marking lines with the file for copying/pasting. More...

#include <textviewer.h>

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

List of all members.

Classes

struct  impl
 This class holds the actual guts of a viewer. More...

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

std::string const & application_name () const
 Return the name of the application to use when describing this viewer in the ViewerManager::appChooser or in the ViewerManager::ViewerSelector.
void commitPasteBuffer () const
 write the paste buffer to the os clipboard.
std::string description () const
 Returns a description of the file being view -- its name only.
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
virtual bool handle_event (CursorWindow::input_event const *e, CursorWindow::viewport *vp)
 Handle input events.
virtual void help ()
 Present the user with help information that is specific to this viewer's operation and contains information about system keep bindings, etc.
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.
 TextViewer (ViewerManager *vm, FileName f)
 ~TextViewer ()

Static Public Member Functions

static Viewerapp (ViewerManager *vm, std::string &fullname)
 Application "hook" function for the DirectoryViewer class. Use it as a parameter to add_app, like this:

Public Attributes

std::auto_ptr< implimpl_
 implementation data not needing to be visible to users.

Static Public Attributes

static std::string app_name = "VIEW TEXT"
 The name to prompt the user with in the ViewerManager::appChooser menu.

Protected Attributes

ViewerManagermanager_

Private Member Functions

void ensure_cursor_visible (viewport *)
 force any screen scrolling needed to make the cursor visible

Detailed Description

A TextViewer is a Viewer meant for displaying but not editing ascii text files. It presents the user with the text of the named file and allows for scrolling (vertically and horizontally) as well as marking lines with the file for copying/pasting.

Definition at line 43 of file textviewer.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

TextViewer ( ViewerManager vm,
FileName  f 
)

Definition at line 82 of file textviewer.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

~TextViewer (  ) 

Definition at line 77 of file textviewer.cxx.


Member Function Documentation

Viewer * app ( ViewerManager vm,
std::string &  fullname 
) [static]

Application "hook" function for the DirectoryViewer class. Use it as a parameter to add_app, like this:

       vm.add_app(DirectoryViewer::app, "DirectoryViewer");

Definition at line 898 of file textviewer.cxx.

Here is the call graph for this function:

std::string const& application_name (  )  const [virtual]

Return the name of the application to use when describing this viewer in the ViewerManager::appChooser or in the ViewerManager::ViewerSelector.

Implements Viewer.

Definition at line 94 of file textviewer.h.

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]

Returns a description of the file being view -- its name only.

Implements Viewer.

Definition at line 933 of file textviewer.cxx.

void ensure_cursor_visible ( viewport vp  )  [private]

force any screen scrolling needed to make the cursor visible

Definition at line 1050 of file textviewer.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:

bool handle_event ( CursorWindow::input_event const *  e,
CursorWindow::viewport vp 
) [virtual]

Handle input events.

Handle input events. Return false means we didn't terminate.

Implements Viewer.

Definition at line 311 of file textviewer.cxx.

Here is the call graph for this function:

void help (  )  [virtual]

Present the user with help information that is specific to this viewer's operation and contains information about system keep bindings, etc.

Reimplemented from Viewer.

Definition at line 867 of file textviewer.cxx.

Here is the call 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:

ViewerManager* manager (  )  [inherited]

Definition at line 126 of file viewer.h.

Here is the caller graph for this function:

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

Handle screen repaint commands.

Implements Viewer.

Definition at line 180 of file textviewer.cxx.

Here is the call 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:

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:


Member Data Documentation

std::string app_name = "VIEW TEXT" [static]

The name to prompt the user with in the ViewerManager::appChooser menu.

Definition at line 90 of file textviewer.h.

std::auto_ptr<impl> impl_

implementation data not needing to be visible to users.

Pointer to the implementation data

Definition at line 61 of file textviewer.h.

ViewerManager* manager_ [protected, inherited]

Definition at line 117 of file viewer.h.


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