package Agar::Textbox; use strict; use Agar; 1; __END__ =head1 NAME Agar::Textbox - a text input widget =head1 SYNOPSIS use Agar; use Agar::Textbox; Agar::Textbox->new($parent); =head1 DESCRIPTION The AG_Textbox(3) widget implements single- or multi-line text edition. It provides a "string" binding which can be connected to a "C" string in a fixed-size buffer. It also provides a "text" binding which can be connected to a multilingual AG_TextElement(3). Technically AG_Textbox(3) is a simple container widget which embeds an AG_Editable(3) field with optional text labels and scrollbars. The core edition functionality is implemented in AG_Editable(3). =head1 INHERITANCE HIERARCHY L -> L -> B =head1 METHODS =over 4 =item B<$textbox = Agar::Textbox-Enew($parent, $label, [%options])> Allocate, initialize and attach a new Textbox. $label specifies a static text label to display next to the AG_Editable(3) field. Recognised options include: =over 4 =item C Multi-line mode. Newlines are entered literally. Horizontal and vertical scrollbars are created. =item C Enable word wrapping in multiline mode. =item C Password-style entry where characters are hidden. =item C Arrange for the widget to abandon its focus when the return key is pressed. =item C Make the string read-only. This has the same effect as disabling the widget generically via Agar::Widget(3), except that the textbox is not grayed out. =item C Restricts input to valid integers only. =item C Restricts input to valid floating-point numbers in decimal and scientific notation ("inf" and the Unicode symbol for Infinity may also be used). =item C Cause tabs to be entered literally into the string (by default, the tab key moves focus to the next widget). =item C By default, external changes to the contents of the buffer are allowed and handled in a safe manner (at some cost). C specifies that this textbox will access the buffer in an exclusive manner. This allows important optimizations. =item C Disable emacs-style function keys. =item C Disable traditional LATIN-1 key combinations. =item C Disable the standard right-click popup menu. =item C Allow the user to select different languages from the right-click popup menu (provided the widget is bound to an AG_TextElement(3). Z<> =back =item B<$textbox-EsizeHint($text)> Request that an initial geometry sufficient to hold the string $text in its entirety. =item B<$textbox-EsizeHintPixels($w,$h)> Request an explicit initial geometry of $w x $h pixels. =item B<$textbox-EsizeHintLines($numLines)> Request an that initial geometry sufficient to contain $numLines lines vertically. =item B<$pos = $textbox-EgetCursorPos()> Return the current position of the cursor in the buffer. =item B<$textbox-EsetCursorPos($pos)> Moves the cursor to $pos (if bounds checking allow it). =item B<$bool = $textbox-EgetFlag($option)> Return the current state of a named $option. =item B<$textbox-EsetFlag($option)> Enable the named $option. =item B<$textbox-EunsetFlag($option)> Disable the named $option. =item B<$text = $textbox-EgetString()> Return the contents of the textbox as text. =item B<$textbox-EsetString($text)> Set the contents to $text. =item B<$textbox-EclearString($text)> Clear the contents of the textbox. =item B<$integer = $textbox-EgetInt()> Return an integer representation of the contents of the textbox. =item B<$float = $textbox-EgetFloat()> Return a floating-point representation of the contents of the textbox. =back =head1 AUTHOR Mat Sutcliffe EFE Julien Nadeau Carriere EFE =head1 SEE ALSO L, L, L =cut