=pod

=head1 NAME

Fl::CheckButton - Button with a Check Box

=head1 Synopsis

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

=head1 Description

The Fl::CheckButton class represents a button with a visible "checkmark" to
show its status.

=for html <center><img src="http://www.fltk.org/doc-1.3/Fl_Check_Button.png" /></center>

Buttons generate callbacks when they are clicked by the user. You control
exactly when and how by changing the values for C<type()> and C<when()>.

The Fl::CheckButton subclass displays its "ON" state by showing a checkmark
rather than drawing itself as pushed in.

=head1 Methods

Fl::CheckButton inherits from Fl::LightButton which in turns inherits from
Fl::Button and Fl::Widget. On top of that, it exposes the following methods...

=cut

#include <FL/Fl_Check_Button.H>

MODULE = Fl::CheckButton        PACKAGE = Fl::CheckButton         PREFIX = Fl_

PROTOTYPES: DISABLE

=pod

=head2 new(...)

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

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

The default box type is FL_NO_BOX, which draws the label without a box to the
right of the checkmark.

The C<selection_color()> sets the color of the  checkmark. The default is
FL_FOREGROUND_COLOR (usually black).

You can use C<down_box()> to chane the box type of the checkmark. Default is
FL_DOWN_BOX.

The destructor removes the button.

=cut

Fl_Check_Button *
Fl_Check_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_Check_Button(x,y,w,h,label);
        OUTPUT:
            RETVAL

void
Fl_Check_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::CheckButton", "Fl::LightButton");

=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
