1Curses::UI::Common(3) User Contributed Perl DocumentationCurses::UI::Common(3)
2
3
4
6 Curses::UI::Common - Common methods for Curses::UI
7
9 Curses::UI::Common - base class
10
12 package MyPackage;
13
14 use Curses::UI::Common;
15 use vars qw(@ISA);
16 @ISA = qw(Curses::UI::Common);
17
19 Curses::UI::Common is a collection of methods that is shared between
20 Curses::UI classes.
21
23 Various methods
24 · parent ( )
25
26 Returns the data member $this->{-parent}.
27
28 · root ( )
29
30 Returns the topmost -parent (the Curses::UI instance).
31
32 · delallwin ( )
33
34 This method will walk through all the data members of the class
35 intance. Each data member that is a Curses::Window descendant will
36 be removed.
37
38 · accessor ( NAME, [VALUE] )
39
40 If VALUE is set, the value for the data member $this->{NAME} will
41 be changed. The method will return the current value for data
42 member $this->{NAME}.
43
44 · keys_to_lowercase ( HASHREF )
45
46 All keys in the hash referred to by HASHREF will be converted to
47 lower case.
48
49 Text processing
50 split_to_lines ( TEXT )
51 This method will split TEXT into a list of separate lines. It
52 returns a reference to this list.
53
54 scrlength ( LINE )
55 Returns the screenlength of the string LINE. The difference with
56 the perl function length() is that this method will expand TAB
57 characters. It is exported by this class and it may be called as a
58 stand-alone routine.
59
60 text_dimension ( TEXT )
61 This method will return an array containing the width (the length
62 of the longest line) and the height (the number of lines) of the
63 TEXT.
64
65 text_wrap ( LINE, LENGTH, WORDWRAP )
66 WORDWRAP ( )
67 NO_WORDWRAP ( )
68 This method will wrap a line of text (LINE) to a given length
69 (LENGTH). If the WORDWRAP argument is true, wordwrap will be
70 enabled (this is the default for WORDWRAP). It will return a
71 reference to a list of wrapped lines. It is exported by this class
72 and it may be called as a stand-alone routine.
73
74 The WORDWRAP and NO_WORDWRAP routines will return the correct value
75 vor the WORDWRAP argument. These routines are exported by this
76 class.
77
78 Example:
79
80 $this->text_wrap($line, 50, NO_WORDWRAP);
81
82 Reading key input
83 CUI_ESCAPE ( )
84 CUI_TAB ( )
85 CUI_SPACE ( )
86 These are a couple of routines that are not defined by the Curses
87 module, but which might be useful anyway. These routines are
88 exported by this class.
89
90 get_key ( BLOCKTIME, CURSOR )
91 This method will try to read a key from the keyboard. It will
92 return the key pressed or -1 if no key was pressed. It is exported
93 by this class and it may be called as a stand-alone routine.
94
95 The BLOCKTIME argument can be used to set the curses halfdelay (the
96 time to wait before the routine decides that no key was pressed).
97 BLOCKTIME is given in tenths of seconds. The default is 0 (non-
98 blocking key read).
99
100 Example:
101
102 my $key = $this->get_key(5)
103
105 Curses::UI
106
108 Copyright (c) 2001-2002 Maurice Makaay. All rights reserved.
109
110 Maintained by Marcus Thiesen (marcus@cpan.thiesenweb.de)
111
112 This package is free software and is provided "as is" without express
113 or implied warranty. It may be used, redistributed and/or modified
114 under the same terms as perl itself.
115
116
117
118perl v5.30.0 2019-07-26 Curses::UI::Common(3)