#include <text_layout.h>

Public Member Functions | |
| bool | handle_key (const config::key &k) |
| Handle the given keypress. | |
| void | dispatch_mouse (short id, int x, int y, int z, mmask_t bstate) |
| void | set_fragment (fragment *f) |
| Change the fragment being displayed in this layout widget. | |
| void | append_fragment (fragment *f) |
| Append the given fragment to the current fragment. | |
| int | width_request () |
| Return the requested width of this widget. | |
| int | height_request (int w) |
| Return the requested height of this widget given its width, by running the fragment-layout algorithm. | |
| bool | get_cursorvisible () |
| Return true iff the cursor is visible in this widget. | |
| point | get_cursorloc () |
| Return the location of the cursor in this widget. | |
| bool | focus_me () |
| Return true iff this widget should be given focus. | |
| void | paint (const style &st) |
| Paint this widget. | |
| void | line_down () |
| Move the view one line down. | |
| void | line_up () |
| Move the view one line up. | |
| void | move_to_top () |
| Move the view to the top of the widget. | |
| void | move_to_bottom () |
| Move the view to the bottom of the widget. | |
| void | page_down () |
| Move a page forward. | |
| void | page_up () |
| Move a page back. | |
| void | search_for (const std::wstring &s, bool search_forwards) |
| Search either forwards or backwards for the string s. | |
| void | scroll (bool dir) |
| Page based on a scrollbar signal. | |
| ~text_layout () | |
| Delete the root fragment. | |
Static Public Member Functions | |
| static util::ref_ptr< text_layout > | create () |
| Create an empty text_layout. | |
| static util::ref_ptr< text_layout > | create (fragment *f) |
| Create a text_layout with the given root fragment. | |
| static void | init_bindings () |
Public Attributes | |
| sigc::signal2< void, int, int > | location_changed |
| A signal that is called whenever the "location" of the view within the text changes. | |
Static Public Attributes | |
| static config::keybindings * | bindings |
Protected Member Functions | |
| text_layout (fragment *f) | |
The text to display is composed of a tree of "fragments". A fragment stores some amount of text; at any time, it can be formatted to a particular width. The main layout mechanisms provided are flowboxes and clipboxes: flowboxes word-wrap their contents to a particular width, while clipboxes clip their contents to a particular width. These boxes can be nested, if the user feels like it for some reason or other, although some nestings are non-sensical (for instance, placing a flowbox inside a smaller flowbox is likely to lead to really ugly text).
This provides some primitive layout mechanisms; higher-level layouts can be expressed in terms of these.
| cwidget::widgets::text_layout::~text_layout | ( | ) |
Delete the root fragment.
| static util::ref_ptr<text_layout> cwidget::widgets::text_layout::create | ( | ) | [inline, static] |
Create an empty text_layout.
| static util::ref_ptr<text_layout> cwidget::widgets::text_layout::create | ( | fragment * | f | ) | [inline, static] |
Create a text_layout with the given root fragment.
All fragments are implicitly placed within a clipbox of width equal to the width of this widget.
| bool cwidget::widgets::text_layout::handle_key | ( | const config::key & | k | ) | [virtual] |
Handle the given keypress.
Returns true if the keystroke was "consumed" by this widget.
Reimplemented from cwidget::widgets::widget.
References cwidget::widgets::widget::handle_key(), line_down(), line_up(), move_to_bottom(), move_to_top(), page_down(), and page_up().
| void cwidget::widgets::text_layout::set_fragment | ( | fragment * | f | ) |
| void cwidget::widgets::text_layout::append_fragment | ( | fragment * | f | ) |
Append the given fragment to the current fragment.
| int cwidget::widgets::text_layout::width_request | ( | ) | [virtual] |
Return the requested width of this widget.
The requested width will be the largest possible width of any line.
Implements cwidget::widgets::widget.
References cwidget::fragment::max_width().
| bool cwidget::widgets::text_layout::get_cursorvisible | ( | ) | [virtual] |
| point cwidget::widgets::text_layout::get_cursorloc | ( | ) | [virtual] |
Return the location of the cursor in this widget.
The cursor is always located in the upper-left-hand corner.
Implements cwidget::widgets::widget.
| bool cwidget::widgets::text_layout::focus_me | ( | ) | [virtual] |
Return true iff this widget should be given focus.
This widget can get focus if it can scroll: ie, if its contents take up more lines than it was allocated.
Reimplemented from cwidget::widgets::widget.
References cwidget::fragment_contents::size().
| void cwidget::widgets::text_layout::paint | ( | const style & | st | ) | [virtual] |
Paint this widget.
Paint by refreshing the contents [if necessary], then drawing, starting from the current line.
Implements cwidget::widgets::widget.
References cwidget::fragment_contents::size().
| void cwidget::widgets::text_layout::line_down | ( | ) |
Move the view one line down.
References cwidget::fragment_contents::size().
Referenced by handle_key().
| void cwidget::widgets::text_layout::line_up | ( | ) |
| void cwidget::widgets::text_layout::move_to_top | ( | ) |
| void cwidget::widgets::text_layout::move_to_bottom | ( | ) |
Move the view to the bottom of the widget.
References cwidget::fragment_contents::size().
Referenced by handle_key().
| void cwidget::widgets::text_layout::page_down | ( | ) |
Move a page forward.
References cwidget::fragment_contents::size().
Referenced by handle_key(), and scroll().
| void cwidget::widgets::text_layout::page_up | ( | ) |
| void cwidget::widgets::text_layout::search_for | ( | const std::wstring & | s, | |
| bool | search_forwards | |||
| ) |
Search either forwards or backwards for the string s.
The search will start on either the next or the previous line from the top of the screen.
| void cwidget::widgets::text_layout::scroll | ( | bool | dir | ) |
Page based on a scrollbar signal.
| dir | the direction to page: if true, call page_up(); else call page_down(). |
References page_down(), and page_up().
1.5.6