NAME

Curses::Toolkit::Widget::Button - a simple text button widget

VERSION

version 0.211

DESCRIPTION

The Curses::Toolkit::Widget::Button widget is a classical button widget, used to attach a function that is called when the button is pressed.

This widget cannot hold any widget. If you want a button with a specific widget, please use Curses::Toolkit::Widget::GenericButton, however it may use more space in your interface

Appearence

Standard theme :

< A Button >

With a border

+----------+
| A Button |
+----------+

CONSTRUCTOR

new

input : none
output : a Curses::Toolkit::Widget::Button

new_with_label

input : the text of the button
output : a Curses::Toolkit::Widget::Button

METHODS

set_text

Set the text of the entry

input  : STRING, the text
output : the button object

get_text

Get the text of the Button

input  : none
output : STRING, the Button text

draw

get_desired_space

Given a coordinate representing the available space, returns the space desired The Button desires the minimum size : text length plus the button brackets

input : a Curses::Toolkit::Object::Coordinates object
output : a Curses::Toolkit::Object::Coordinates object

get_minimum_space

Given a coordinate representing the available space, returns the minimum space required The Button requires the text length plus the button brackets

input : a Curses::Toolkit::Object::Coordinates object
output : a Curses::Toolkit::Object::Coordinates object

possible_signals

my @signals = keys $button->possible_signals();

returns the possible signals that can be used on ths widget. See Curses::Toolkit::Widget::signal_connect to bind signals to actions

input  : none
output : HASH, keys are signal names, values are signal classes

Theme related properties

To set/get a theme properties, you should do :

$button->set_theme_property(property_name => $property_value);
$value = $button->get_theme_property('property_name');

Here is the list of properties related to the window, that can be changed in the associated theme. See the Curses::Toolkit::Theme class used for the default (default class to look at is Curses::Toolkit::Theme::Default)

Don't forget to look at properties from the parent class, as these are also inherited from !

border_width (inherited)

The width of the border of the button.

Example : # set buttons to have a border of 1 $button->set_theme_property(border_width => 1 );

left_enclosing

The string to be displayed at the left of the button. Usually some enclosing characters.

Example : # set left enclosing $button->set_theme_property(left_enclosing => '< ' ); $button->set_theme_property(left_enclosing => '[ ' );

right_enclosing

The string to be displayed at the right of the button. Usually some enclosing characters.

Example : # set left enclosing $button->set_theme_property(left_enclosing => ' >' ); $button->set_theme_property(left_enclosing => ' ]' );

AUTHOR

Damien "dams" Krotkine

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Damien "dams" Krotkine.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.