=pod

=head1 NAME

Fl::ToggleButton - Button that Toggles On and Off

=head1 Synopsis

    use Fl;
    my $button = Fl::ToggleButton->new(0, 0, 100, 200, 'Hello, World!');
    $button->callback(sub {print q[It's dat boi]} );

=head1 Description

The Fl::ToggleButton class represents a button that needs to be clicked once
to toggle on and once more to toggle off.

The toggle button shows the "ON" state by drawing a pushed-in button.

=head1 Methods

Fl::RadioButton inherits from Fl::Button and Fl::Widget. On top of that, it
exposes the following methods...

=cut

#include <FL/Fl_Toggle_Button.H>

MODULE = Fl::ToggleButton     PACKAGE = Fl::ToggleButton  PREFIX = Fl_

PROTOTYPES: DISABLE

=pod

=head2 new(...)

    my $button_a = Fl::ToggleButton->new(0, 0, 250, 500, 'Important Stuff');
    my $button_b = Fl::ToggleButton->new(0, 0, 250, 500);

The constructor creates a new button using the given position, size, and
label.

The button's C<type()> is set to FL_TOGGLE_BUTTON by default.

The destructor removes the button.

=cut

Fl_Toggle_Button *
Fl_Toggle_Button::new( ... )
    CASE: (items == 5 || items == 6)
        CODE:
            /*(int x, int y, int w, int h, char * label = $0)*/
            char * label = "";
            int x = (int)SvIV(ST(1));
            int y = (int)SvIV(ST(2));
            int w = (int)SvIV(ST(3));
            int h = (int)SvIV(ST(4));
            if (items == 6) label = (char *)SvPV_nolen(ST(5));
            RETVAL = new Fl_Toggle_Button(x,y,w,h,label);
        OUTPUT:
            RETVAL

void
Fl_Toggle_Button::DESTROY()
    CODE:
        int refcount = SvREFCNT(SvRV(ST(0)));
        if (refcount == 1) {
            delete THIS;
        }
        else {
            SvREFCNT_dec(ST(0));
        }

MODULE = Fl        PACKAGE = Fl

BOOT:
    set_isa("Fl::ToggleButton", "Fl::Button");

=pod

=head1 LICENSE

Copyright (C) Sanko Robinson.

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

=head1 AUTHOR

Sanko Robinson E<lt>sanko@cpan.orgE<gt>

=cut
