Debian Codegraph @

README

raw
1 NAME
2
3 Tickit::Console - build full-screen console-style applications
4
5 SYNOPSIS
6
7 my $console = Tickit::Console->new;
8
9 Tickit->new( root => $console )->run;
10
11 DESCRIPTION
12
13 A Tickit::Console instance is a subclass of Tickit::Widget::VBox
14 intended to help building a full-screen console-style application which
15 presents the user with one or more scrollable text areas, selectable as
16 tabs on a ribbon, with a text entry area at the bottom of the screen
17 for entering commands or other data. As a Tickit::Widget subclass it
18 can be added anywhere within a widget tree, though normally it would be
19 used as the root widget for a Tickit instance.
20
21 CONSTRUCTOR
22
23 new
24
25 $console = Tickit::Console->new( %args );
26
27 Returns a new instance of a Tickit::Console. Takes the following named
28 arguments:
29
30 on_line => CODE
31
32 Callback to invoke when a line of text is entered in the entry
33 widget.
34
35 $on_line->( $active_tab, $text );
36
37 tab_class => STRING
38
39 Optional. If set, gives a class name (which should be a subclass of
40 Tickit::Console::Tab) to construct newly-added tabs with. This
41 setting allows an application to provide new methods in tabs to
42 change behaviours.
43
44 timestamp_format, datestamp_format
45
46 Optional. If supplied, these will be stored as default values to pass
47 to the tab constructor in the add_tab method.
48
49 METHODS
50
51 add_tab
52
53 $tab = $console->add_tab( %args );
54
55 Adds a new tab to the console, and returns a Tickit::Console::Tab
56 object representing it.
57
58 Takes the following named arguments:
59
60 name => STRING
61
62 Name for the tab.
63
64 on_line => CODE
65
66 Optional. Provides a different callback to invoke when a line of text
67 is entered while this tab is active. Invoked the same way as above.
68
69 make_widget => CODE
70
71 Optional. Gives a piece of code used to construct the actual
72 Tickit::Widget used as this tab's child in the ribbon. A
73 Tickit::Widget::Scroller to hold the tab's content will be passed in
74 to this code, which should construct some sort of widget tree with
75 that inside it, and return it. This can be used to apply a decorative
76 frame, place the scroller in a split box or other layout along with
77 other widgets, or various other effects.
78
79 $tab_widget = $make_widget->( $scroller );
80
81 Any other named arguments are passed to the tab's constructor.
82
83 active_tab_index
84
85 $index = $console->active_tab_index;
86
87 active_tab
88
89 $tab = $console->active_tab;
90
91 remove_tab
92
93 $console->remove_tab( $tab_or_index );
94
95 move_tab
96
97 $console->move_tab( $tab_or_index, $delta );
98
99 activate_tab
100
101 $console->activate_tab( $tab_or_index );
102
103 next_tab
104
105 $console->next_tab;
106
107 prev_tab
108
109 $console->prev_tab;
110
111 These methods are all passed through to the underlying
112 Tickit::Widget::Tabbed object.
113
114 bind_key
115
116 $console->bind_key( $key, $code );
117
118 Installs a callback to invoke if the given key is pressed, overwriting
119 any previous callback for the same key. The code block is invoked as
120
121 $code->( $console, $key );
122
123 If $code is missing or undef, any existing callback is removed.
124
125 AUTHOR
126
127 Paul Evans <[email protected]>
128