cwidget::widgets::pager Class Reference

A widget that displays text. More...

#include <pager.h>

Inheritance diagram for cwidget::widgets::pager:

cwidget::widgets::widget cwidget::widgets::file_pager List of all members.

Public Types

typedef std::vector< std::wstring
>::size_type 
line_count
typedef int col_count

Public Member Functions

virtual ~pager ()
 Destroy this pager.
virtual void set_text (const char *text, std::string::size_type len, const char *encoding=NULL)
 Set the text to the given memory region.
virtual void set_text (const std::string &s, const char *encoding=NULL)
 Change the displayed text.
virtual void set_text (const std::wstring &s)
 Change the displayed text.
void scroll_up (line_count nlines)
 Scroll the screen up by the given number of lines.
void scroll_down (line_count nlines)
 Scroll the screen down by the given number of lines.
void scroll_right (col_count ncols)
 Scroll the screen right by the given number of columns.
void scroll_left (col_count ncols)
 Scroll the screen left by the given number of columns.
void scroll_top ()
 Scroll to the top of the screen.
void scroll_bottom ()
 Scroll to the bottom of the screen.
void scroll_page (bool dir)
 Scroll by a page in the given direction.
void search_for (const std::wstring &s)
 Find the next line containing the given string.
void search_back_for (const std::wstring &s)
 Find the previous line containing the given string.
std::wstring get_last_search ()
 Return the last string which the user searched for.
line_count get_first_line ()
line_count get_num_lines ()
col_count get_first_column ()
col_count get_num_columns ()
void do_line_signal ()
 Emits a signal describing the verical location of the display within the text.
void do_column_signal ()
 Emits a signal describing the horizontal location of the display within the text.
virtual bool handle_key (const config::key &k)
 Handles a keypress in this widget.
virtual void dispatch_mouse (short id, int x, int y, int z, mmask_t bstate)
virtual bool focus_me ()
virtual void paint (const style &st)
 Display this widget.
int width_request ()
int height_request (int w)
 Calculate the desired height of the widget, given its width.
bool get_cursorvisible ()
point get_cursorloc ()

Static Public Member Functions

static util::ref_ptr< pagercreate (const char *text, int len, const char *encoding=NULL)
 Create a pager from the given memory region.
static util::ref_ptr< pagercreate (const std::string &s, const char *encoding=NULL)
 Create a pager from a string.
static util::ref_ptr< pagercreate (const std::wstring &s)
 Create a pager from a wide character string.
static void init_bindings ()

Public Attributes

sigc::signal2< void, int,
int > 
line_changed
 Announces that the user has scrolled vertically.
sigc::signal2< void, int,
int > 
column_changed
 Announces that the user has scrolled horizontally.

Static Public Attributes

static config::keybindings * bindings = NULL

Protected Member Functions

 pager (const char *text, int len, const char *encoding=NULL)
 pager (const std::string &s, const char *encoding=NULL)
 pager (const std::wstring &s)

Detailed Description

A widget that displays text.

The text is displayed as-is, without wrapping or formatting. Tab stops are placed at 8-character intervals. The user can scroll up, down, left and right using the standard keybindings.


Member Function Documentation

static util::ref_ptr<pager> cwidget::widgets::pager::create const std::wstring &  s  )  [inline, static]
 

Create a pager from a wide character string.

Parameters:
s the text to display

static util::ref_ptr<pager> cwidget::widgets::pager::create const std::string &  s,
const char *  encoding = NULL
[inline, static]
 

Create a pager from a string.

Parameters:
s the text to display
encoding the encoding of s, or NULL to use LC_CTYPE

Reimplemented in cwidget::widgets::file_pager.

static util::ref_ptr<pager> cwidget::widgets::pager::create const char *  text,
int  len,
const char *  encoding = NULL
[inline, static]
 

Create a pager from the given memory region.

Parameters:
text the text to display
len the length of the buffer
encoding the encoding of text, or NULL to use LC_CTYPE

Reimplemented in cwidget::widgets::file_pager.

bool cwidget::widgets::pager::handle_key const config::key k  )  [virtual]
 

Handles a keypress in this widget.

Parameters:
k the key that was pressed (see keybindings.h).
Returns:
true if the key was consumed; if false is returned, further processing of the key will be performed.

Reimplemented from cwidget::widgets::widget.

int cwidget::widgets::pager::height_request int  w  )  [virtual]
 

Calculate the desired height of the widget, given its width.

Parameters:
width the width of this widget
Returns:
the desired height

Implements cwidget::widgets::widget.

void cwidget::widgets::pager::paint const style st  )  [virtual]
 

Display this widget.

Parameters:
st the style environment in which the widget is to be displayed.

Implements cwidget::widgets::widget.

void cwidget::widgets::pager::scroll_page bool  dir  ) 
 

Scroll by a page in the given direction.

Parameters:
dir if true, scroll a page up; otherwise, scroll a page down.

void cwidget::widgets::pager::search_back_for const std::wstring &  s  )  [inline]
 

Find the previous line containing the given string.

Parameters:
s the string to search for

void cwidget::widgets::pager::search_for const std::wstring &  s  )  [inline]
 

Find the next line containing the given string.

Parameters:
s the string to search for

virtual void cwidget::widgets::pager::set_text const std::wstring &  s  )  [virtual]
 

Change the displayed text.

Parameters:
s the text to display

virtual void cwidget::widgets::pager::set_text const std::string &  s,
const char *  encoding = NULL
[virtual]
 

Change the displayed text.

Parameters:
s the text to display
encoding the encoding of s, or NULL to use LC_CTYPE

virtual void cwidget::widgets::pager::set_text const char *  text,
std::string::size_type  len,
const char *  encoding = NULL
[virtual]
 

Set the text to the given memory region.

Parameters:
text the text to display
len the length of the buffer
encoding the encoding of text, or NULL to use LC_CTYPE

int cwidget::widgets::pager::width_request  )  [virtual]
 

Returns:
the desired width of the widget.

Implements cwidget::widgets::widget.


The documentation for this class was generated from the following files:
Generated on Mon Feb 16 01:16:31 2009 for cwidget by  doxygen 1.4.6