A widget that displays text. More...
#include <pager.h>
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< pager > | create (const char *text, int len, const char *encoding=NULL) |
| Create a pager from the given memory region. | |
| static util::ref_ptr< pager > | create (const std::string &s, const char *encoding=NULL) |
| Create a pager from a string. | |
| static util::ref_ptr< pager > | create (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) | |
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.
| cwidget::widgets::pager::~pager | ( | ) | [virtual] |
Destroy this pager.
| static util::ref_ptr<pager> cwidget::widgets::pager::create | ( | const std::wstring & | s | ) | [inline, static] |
Create a pager from a wide character string.
| 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.
| 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.
| 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.
| std::wstring cwidget::widgets::pager::get_last_search | ( | ) | [inline] |
Return the last string which the user searched for.
| bool cwidget::widgets::pager::handle_key | ( | const config::key & | k | ) | [virtual] |
Handles a keypress in this widget.
| k | the key that was pressed (see keybindings.h). |
Reimplemented from cwidget::widgets::widget.
References cwidget::config::keybindings::key_matches(), scroll_bottom(), scroll_down(), scroll_left(), scroll_right(), scroll_top(), and scroll_up().
| int cwidget::widgets::pager::height_request | ( | int | width | ) | [virtual] |
Calculate the desired height of the widget, given its width.
| width | the width of this widget |
Implements cwidget::widgets::widget.
| void cwidget::widgets::pager::paint | ( | const style & | st | ) | [virtual] |
Display this widget.
| st | the style environment in which the widget is to be displayed. |
Implements cwidget::widgets::widget.
| void cwidget::widgets::pager::scroll_bottom | ( | ) |
Scroll to the bottom of the screen.
References do_line_signal(), and cwidget::toplevel::update().
Referenced by handle_key().
| void cwidget::widgets::pager::scroll_down | ( | line_count | nlines | ) |
Scroll the screen down by the given number of lines.
References do_line_signal(), and cwidget::toplevel::update().
Referenced by handle_key(), and scroll_page().
| void cwidget::widgets::pager::scroll_left | ( | col_count | ncols | ) |
Scroll the screen left by the given number of columns.
References do_column_signal(), and cwidget::toplevel::update().
Referenced by handle_key().
| void cwidget::widgets::pager::scroll_page | ( | bool | dir | ) |
Scroll by a page in the given direction.
| dir | if true, scroll a page up; otherwise, scroll a page down. |
References scroll_down(), and scroll_up().
| void cwidget::widgets::pager::scroll_right | ( | col_count | ncols | ) |
Scroll the screen right by the given number of columns.
References do_column_signal(), and cwidget::toplevel::update().
Referenced by handle_key().
| void cwidget::widgets::pager::scroll_top | ( | ) |
Scroll to the top of the screen.
References do_line_signal(), and cwidget::toplevel::update().
Referenced by handle_key().
| void cwidget::widgets::pager::scroll_up | ( | line_count | nlines | ) |
Scroll the screen up by the given number of lines.
References do_line_signal(), and cwidget::toplevel::update().
Referenced by handle_key(), and scroll_page().
| void cwidget::widgets::pager::search_back_for | ( | const std::wstring & | s | ) | [inline] |
Find the previous line containing the given string.
| 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.
| s | the string to search for |
| virtual void cwidget::widgets::pager::set_text | ( | const std::wstring & | s | ) | [virtual] |
Change the displayed text.
| 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.
| 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.
| 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] |
Implements cwidget::widgets::widget.
| sigc::signal2<void, int, int> cwidget::widgets::pager::column_changed |
Announces that the user has scrolled horizontally.
Referenced by do_column_signal().
| sigc::signal2<void, int, int> cwidget::widgets::pager::line_changed |
Announces that the user has scrolled vertically.
Referenced by do_line_signal().
1.6.2