KeyViewer Struct Reference

An object of the KeyViewer class is passed to a ListViewer at the time of its construction so that the list viewer implements a way to see how keys are interpreted. More...

#include <keyviewer.h>

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

List of all members.

Public Member Functions

std::string const & application_name () const
 The name to prompt the user with in the ViewerManager::appChooser menu.
std::string description () const
 Return the name of the application to use when describing this viewer in the ViewerManager::appChooser or in the ViewerManager::ViewerSelector.
virtual bool fetchAllLines (std::list< std::string > &output)
int handle_event (CursorWindow::input_event const *e, size_t index, ViewerManager *vm)
 This is a no-op for the key viewer.
void handle_resize (CursorWindow::row_col const &vp_size)
 This method is optional -- it will be invoked to tell you what the current viewport size is. If you dont' care, don't implement this method. If you do care, you'll want to save the size for later use. You might want to define this function if want to re-architect the strings_ array based on available screen space.
virtual std::auto_ptr
< std::list< std::string > > 
help_text ()
 return true if this item should be displayed bold
bool is_marked (size_t index)
 Is this item marked? Never returns true.
virtual bool is_special (size_t index)
 KeyViewer ()
virtual ~KeyViewer ()

Static Public Member Functions

static Viewerapp (ViewerManager *vm, std::string &fullname)
 Handle user events -- no interpretation is done. All events just get logged to the window along with their categorization.

Public Attributes

std::vector< std::string > strings_
 items to display in the ListViewer
std::string title_
 title of list display viewer

Static Public Attributes

static std::string app_name = "KeyViewer"
 Application "hook" function for the KeyViewer class. Use it as a parameter to add_app, like this:

Detailed Description

An object of the KeyViewer class is passed to a ListViewer at the time of its construction so that the list viewer implements a way to see how keys are interpreted.

KeyViewer derives from ListViewer::policies and specializes the event handler function. It uses the strings_ member of policies_ to hold the displayable version of text describing keys.

To use add this class to the list of valid applications for a a ViewerManager object, do this:

ViewerManger vm; ... vm.add_app(KeyViewer::app, KeyViewer::app_name);

This makes the directory viewer avaiable in the application chooser menu brought up when you split the screen or replace the current viewer.

There is of course, no reason to have a KeyViewer object unless you are also creating a ListViewer object because a KeyViewer is nothing more than a set of policies for controlling a ListViewer's behavior. There is really no reason to have either unless you have a ViewerManager because it declares global variables used by ListViewer.

Here's how to manually create a KeyViewer and pop it up in the viewer manager:

ViewerManger vm; ... vm.add_app(KeyViewer::app, KeyViewer::app_name); ... FileName curdir="*"; curdir.convert_to_absolute_path(); vm.add(new ListViewer(new KeyViewer(curdir), &vm), curdir);

This example both adds the KeyViewer class as a valid application type _and_ it creates and pops up a viewer that lets you look at keys.

Definition at line 19 of file keyviewer.h.


Constructor & Destructor Documentation

KeyViewer (  ) 

Definition at line 111 of file keyviewer.cxx.

Here is the caller graph for this function:

~KeyViewer (  )  [virtual]

Definition at line 118 of file keyviewer.cxx.


Member Function Documentation

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

Handle user events -- no interpretation is done. All events just get logged to the window along with their categorization.

Definition at line 103 of file keyviewer.cxx.

Here is the call graph for this function:

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

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

Implements policies.

Definition at line 96 of file keyviewer.h.

std::string description (  )  const [virtual]

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

Implements policies.

Definition at line 102 of file keyviewer.h.

bool fetchAllLines ( std::list< std::string > &  output  )  [virtual, inherited]
See also:
cxxtls::Viewer::fetchAllLines().

Reimplemented in DirectoryViewer.

Definition at line 723 of file viewer.cxx.

int handle_event ( CursorWindow::input_event const *  e,
size_t  index,
ViewerManager vm 
) [virtual]

This is a no-op for the key viewer.

Implements policies.

Definition at line 55 of file keyviewer.cxx.

Here is the call graph for this function:

void handle_resize ( CursorWindow::row_col const &  new_size  )  [virtual]

This method is optional -- it will be invoked to tell you what the current viewport size is. If you dont' care, don't implement this method. If you do care, you'll want to save the size for later use. You might want to define this function if want to re-architect the strings_ array based on available screen space.

Note -- do not delete or add strings_ in this method.

Reimplemented from policies.

Definition at line 48 of file keyviewer.cxx.

std::auto_ptr< std::list< std::string > > help_text (  )  [virtual]

return true if this item should be displayed bold

This function returns the help text specific to this application. The ListViewer help method will first present the user with the return values from this function then it will present ListViewer specific help, then it will present ViewerManager specific help.

Implements policies.

Definition at line 83 of file keyviewer.cxx.

bool is_marked ( size_t  index  )  [virtual]

Is this item marked? Never returns true.

Implements policies.

Definition at line 44 of file keyviewer.cxx.

bool is_special ( size_t  index  )  [virtual, inherited]

Reimplemented in DirectoryViewer.

Definition at line 42 of file viewer.cxx.


Member Data Documentation

std::string app_name = "KeyViewer" [static]

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

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

Definition at line 91 of file keyviewer.h.

std::vector<std::string> strings_ [inherited]

items to display in the ListViewer

Definition at line 309 of file viewer.h.

std::string title_ [inherited]

title of list display viewer

Definition at line 310 of file viewer.h.


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