cwidget  0.5.17
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
cwidget::widgets::file_pager Class Reference

Load a file from disk; it's assumed to be ASCII for now. More...

#include <pager.h>

Inheritance diagram for cwidget::widgets::file_pager:
cwidget::widgets::pager cwidget::widgets::widget

Public Member Functions

void load_file (const std::string &filename, const char *encoding=NULL)
 Loads the given file into the pager. More...
 
void load_file (const std::wstring &filename, const char *encoding)
 Attempts to convert the string to a multibyte representation and then load it; a nonconvertible string is treated as any other load failure would be. More...
 
void load_file (const std::wstring &filename)
 Attempts to convert the string to a multibyte representation and then load it; a nonconvertible string is treated as any other load failure would be. More...
 
- Public Member Functions inherited from cwidget::widgets::pager
virtual ~pager ()
 Destroy this pager. More...
 
virtual void set_text (const char *text, std::string::size_type len, const char *encoding=NULL)
 Set the text to the given memory region. More...
 
virtual void set_text (const std::string &s, const char *encoding=NULL)
 Change the displayed text. More...
 
virtual void set_text (const std::wstring &s)
 Change the displayed text. More...
 
void scroll_up (line_count nlines)
 Scroll the screen up by the given number of lines. More...
 
void scroll_down (line_count nlines)
 Scroll the screen down by the given number of lines. More...
 
void scroll_right (col_count ncols)
 Scroll the screen right by the given number of columns. More...
 
void scroll_left (col_count ncols)
 Scroll the screen left by the given number of columns. More...
 
void scroll_top ()
 Scroll to the top of the screen. More...
 
void scroll_bottom ()
 Scroll to the bottom of the screen. More...
 
void scroll_page (bool dir)
 Scroll by a page in the given direction. More...
 
void search_for (const std::wstring &s)
 Find the next line containing the given string. More...
 
void search_back_for (const std::wstring &s)
 Find the previous line containing the given string. More...
 
std::wstring get_last_search ()
 Return the last string which the user searched for. More...
 
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. More...
 
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. More...
 
int width_request ()
 
int height_request (int w)
 Calculate the desired height of the widget, given its width. More...
 
bool get_cursorvisible ()
 
point get_cursorloc ()
 
- Public Member Functions inherited from cwidget::widgets::widget
void incref ()
 
void decref ()
 
void show ()
 
virtual void show_all ()
 
void hide ()
 
void toggle_visible ()
 
void set_visible (bool _visible)
 
bool dispatch_key (const config::key &k)
 
void alloc_size (int x, int y, int w, int h)
 Set the size and location in the parent of this widget. More...
 
bool get_isfocussed ()
 
void set_owner (container *w)
 
void display (const style &st)
 Display this widget in the given style environment. More...
 
int timeout (int msecs)
 
virtual void destroy ()
 Destroys the visible representation of this widget and disconnects it from any children that it may have.
 
util::ref_ptr< containerget_owner ()
 
int get_startx ()
 
int get_starty ()
 
int get_width ()
 
int get_height ()
 
bool get_visible ()
 
void sync ()
 
int scroll (int n=1)
 
int addch (chtype ch)
 
int mvaddch (int y, int x, chtype ch)
 
int add_wch (wchar_t wch)
 
int add_wch (const cchar_t *cch)
 
int mvadd_wch (int y, int x, wchar_t wch)
 
int mvadd_wch (int y, int x, const cchar_t *cch)
 
int addstr (const char *str)
 
int addnstr (const char *str, int n)
 
int mvaddstr (int y, int x, const char *str)
 
int mvaddnstr (int y, int x, const char *str, int n)
 
int addstr (const wchar_t *str)
 
int addnstr (const wchar_t *str, int n)
 
int mvaddstr (int y, int x, const wchar_t *str)
 
int mvaddnstr (int y, int x, const wchar_t *str, int n)
 
int addstr (const std::wstring &str)
 
int addnstr (const std::wstring &str, int n)
 
int mvaddstr (int y, int x, const std::wstring &str)
 
int mvaddnstr (int y, int x, const std::wstring &str, int n)
 
int addstr (const wchstring &str)
 
int addnstr (const wchstring &str, int n)
 
int mvaddstr (int y, int x, const wchstring &str)
 
int mvaddnstr (int y, int x, const wchstring &str, int n)
 
int addstr (const chstring &str)
 
int addnstr (const chstring &str, int n)
 
int mvaddstr (int y, int x, const chstring &str)
 
int mvaddnstr (int y, int x, const chstring &str, int n)
 
int attroff (int attrs)
 
int attron (int attrs)
 
int attrset (int attrs)
 
void bkgdset (const chtype ch)
 
int bkgd (const chtype ch)
 
chtype getbkgd ()
 
int border (chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br)
 
int box (chtype verch, chtype horch)
 
int hline (chtype ch, int n)
 
int vline (chtype ch, int n)
 
int mvhline (int y, int x, chtype ch, int n)
 
int mvvline (int y, int x, chtype ch, int n)
 
int delch ()
 
int mvdelch (int y, int x)
 
int deleteln ()
 
int insdelln (int n)
 
int insertln ()
 
int echochar (chtype ch)
 
int move (int y, int x)
 
void getyx (int &y, int &x)
 
void getbegyx (int &y, int &x)
 
void getmaxyx (int &y, int &x)
 
int getmaxy ()
 
int getmaxx ()
 
void show_string_as_progbar (int x, int y, const std::wstring &s, const style &st1, const style &st2, int size1, int totalsize)
 
void display_header (std::wstring s, const style &st)
 
void display_status (std::wstring s, const style &st)
 
int erase ()
 
int clear ()
 
int clrtobot ()
 
int clrtoeol ()
 
int keypad (bool bf)
 
int meta (bool bf)
 
bool enclose (int y, int x)
 
void set_opaque (bool opaque)
 Enable or disable clearing the background before displaying the widget. More...
 
void set_bg_style (const style &new_style)
 Update this widget's basic style to the given value. More...
 
void apply_style (const style &st)
 Set the display attributes of our associated window directly from the given style. More...
 
key_connection connect_key (const std::string &key, config::keybindings *bindings, const sigc::slot0< void > &slot)
 
key_connection connect_key_post (const std::string &key, config::keybindings *bindings, const sigc::slot0< void > &slot)
 
void disconnect_key (key_connection c)
 
void disconnect_key_post (key_connection c)
 

Static Public Member Functions

static util::ref_ptr< file_pagercreate ()
 
static util::ref_ptr< file_pagercreate (const std::string &filename, const char *encoding=NULL)
 
static util::ref_ptr< file_pagercreate (const std::wstring &filename, const char *encoding=NULL)
 Attempts to convert the string to a multibyte representation and then load it; a nonconvertible string is treated as any other load failure would be.
 
static util::ref_ptr< file_pagercreate (const char *text, int len, const char *encoding=NULL)
 
- Static Public Member Functions inherited from cwidget::widgets::pager
static util::ref_ptr< pagercreate (const char *text, int len, const char *encoding=NULL)
 Create a pager from the given memory region. More...
 
static util::ref_ptr< pagercreate (const std::string &s, const char *encoding=NULL)
 Create a pager from a string. More...
 
static util::ref_ptr< pagercreate (const std::wstring &s)
 Create a pager from a wide character string. More...
 
static void init_bindings ()
 
- Static Public Member Functions inherited from cwidget::widgets::widget
static void handle_pending_deletes ()
 

Protected Member Functions

 file_pager (const std::string &filename, const char *encoding=NULL)
 
 file_pager (const std::wstring &filename, const char *encoding=NULL)
 
 file_pager (const char *text, int len, const char *encoding=NULL)
 
- Protected Member Functions inherited from cwidget::widgets::pager
 pager (const char *text, int len, const char *encoding=NULL)
 
 pager (const std::string &s, const char *encoding=NULL)
 
 pager (const std::wstring &s)
 
- Protected Member Functions inherited from cwidget::widgets::widget
cwindow get_win ()
 
void cleanup ()
 Handle cleanup when the reference count goes to 0. More...
 

Additional Inherited Members

- Public Types inherited from cwidget::widgets::pager
typedef std::vector< std::wstring >::size_type line_count
 
typedef int col_count
 
- Public Types inherited from cwidget::widgets::widget
typedef std::list< binding_connection >::iterator key_connection
 
- Public Attributes inherited from cwidget::widgets::pager
sigc::signal2< void, int, int > line_changed
 Announces that the user has scrolled vertically. More...
 
sigc::signal2< void, int, int > column_changed
 Announces that the user has scrolled horizontally. More...
 
- Public Attributes inherited from cwidget::widgets::widget
sigc::signal0< void > shown_sig
 
sigc::signal0< void > hidden_sig
 
sigc::signal0< void > destroyed
 
sigc::signal0< void > do_layout
 
sigc::signal0< void > focussed
 
sigc::signal0< void > unfocussed
 
- Static Public Attributes inherited from cwidget::widgets::pager
static config::keybindingsbindings =NULL
 

Detailed Description

Load a file from disk; it's assumed to be ASCII for now.

Member Function Documentation

◆ load_file() [1/3]

void cwidget::widgets::file_pager::load_file ( const std::string &  filename,
const char *  encoding = NULL 
)

Loads the given file into the pager.

Parameters
filenamethe name of the file to load
encodingthe encoding of the file's contents; if NULL, LC_CTYPE is used.

Referenced by cwidget::widgets::pager::height_request().

◆ load_file() [2/3]

void cwidget::widgets::file_pager::load_file ( const std::wstring &  filename,
const char *  encoding 
)

Attempts to convert the string to a multibyte representation and then load it; a nonconvertible string is treated as any other load failure would be.

Parameters
filenamethe name of the file to load
encodingthe encoding of the file's contents; if NULL, LC_CTYPE is used.

◆ load_file() [3/3]

void cwidget::widgets::file_pager::load_file ( const std::wstring &  filename)

Attempts to convert the string to a multibyte representation and then load it; a nonconvertible string is treated as any other load failure would be.

The file is assumed to contain text in the encoding specified by LC_CTYPE.

Parameters
filenamethe name of the file to load

The documentation for this class was generated from the following files: