#include <text_layout.h>
Inheritance diagram for cwidget::widgets::text_layout:
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 () |
The cursor is always located in the upper-left-hand corner. | |
bool | focus_me () |
This widget can get focus if it can scroll: ie, if its contents take up more lines than it was allocated. | |
void | paint (const style &st) |
Paint by refreshing the contents [if necessary], then drawing, starting from the current line. | |
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.
|
Append the given fragment to the current fragment.
|
|
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. |
|
Handle the given keypress. Returns true if the keystroke was "consumed" by this widget. Reimplemented from cwidget::widgets::widget. |
|
Page based on a scrollbar signal.
|
|
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. |
|
Return the requested width of this widget. The requested width will be the largest possible width of any line. Implements cwidget::widgets::widget. |