/*
 * This file was generated automatically by ExtUtils::ParseXS version 3.44 from the
 * contents of Button.xs. Do not edit this file, edit Button.xs instead.
 *
 *    ANY CHANGES MADE HERE WILL BE LOST!
 *
 */

#line 1 "Button.xs"
    /*
    ###########################################################################
    # (@)PACKAGE:Win32::GUI::Button
    #
    # $Id: Button.xs,v 1.8 2006/03/16 21:11:11 robertemay Exp $
    #
    ###########################################################################
    */

#include "GUI.h"

void 
Button_onPreCreate(NOTXSPROC LPPERLWIN32GUI_CREATESTRUCT perlcs) {

    perlcs->cs.lpszClass = "BUTTON";
    perlcs->cs.style = WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON;
}

BOOL
Button_onParseOption(NOTXSPROC char *option, SV* value, LPPERLWIN32GUI_CREATESTRUCT perlcs) {

    BOOL retval = TRUE;

    if(strcmp(option, "-align") == 0) {
        // BS_CENTER is BS_LEFT | BS_RIGHT
        if(strcmp(SvPV_nolen(value), "left") == 0) {
            SwitchBit(perlcs->cs.style, BS_RIGHT, 0);
            SwitchBit(perlcs->cs.style, BS_LEFT, 1);
        } else if(strcmp(SvPV_nolen(value), "center") == 0) {
            SwitchBit(perlcs->cs.style, BS_LEFT,  1);
            SwitchBit(perlcs->cs.style, BS_RIGHT, 1);
        } else if(strcmp(SvPV_nolen(value), "right") == 0) {
            SwitchBit(perlcs->cs.style, BS_LEFT, 0);
            SwitchBit(perlcs->cs.style, BS_RIGHT, 1);
        } else {
            W32G_WARN("Win32::GUI: Invalid value for -align!");
        }
    } else if(strcmp(option, "-valign") == 0) {
        if(strcmp(SvPV_nolen(value), "top") == 0) {
            SwitchBit(perlcs->cs.style, BS_TOP, 1);
            SwitchBit(perlcs->cs.style, BS_BOTTOM, 0);
        } else if(strcmp(SvPV_nolen(value), "center") == 0) {
            SwitchBit(perlcs->cs.style, BS_TOP, 1);
            SwitchBit(perlcs->cs.style, BS_BOTTOM, 1);
        } else if(strcmp(SvPV_nolen(value), "bottom") == 0) {
            SwitchBit(perlcs->cs.style, BS_TOP, 0);
            SwitchBit(perlcs->cs.style, BS_BOTTOM, 1);
        } else {
            W32G_WARN("Win32::GUI: Invalid value for -valign!");
        }
    } else if(strcmp(option, "-ok") == 0) {
        if(SvIV(value) != 0) {
            perlcs->cs.hMenu = (HMENU) IDOK;
        }
    } else if(strcmp(option, "-cancel") == 0) {
        if(SvIV(value) != 0) {
            perlcs->cs.hMenu = (HMENU) IDCANCEL;
        }
    } else if BitmaskOptionValue("-3state",      perlcs->cs.style, BS_3STATE)
    } else if BitmaskOptionValue("-default",     perlcs->cs.style, BS_DEFPUSHBUTTON)
    } else if BitmaskOptionValue("-flat",        perlcs->cs.style, BS_FLAT)
    } else if BitmaskOptionValue("-multiline",   perlcs->cs.style, BS_MULTILINE)
    } else if BitmaskOptionValue("-notify",      perlcs->cs.style, BS_NOTIFY)
    } else if BitmaskOptionValue("-pushlike",    perlcs->cs.style, BS_PUSHLIKE)
    } else if BitmaskOptionValue("-rightbutton", perlcs->cs.style, BS_RIGHTBUTTON)
    } else if(strcmp(option, "-bitmap") == 0 || strcmp(option, "-picture") == 0) {
        SwitchBit(perlcs->cs.style, BS_BITMAP, 1);
        perlcs->hImageList = (HIMAGELIST) handle_From(NOTXSCALL value);
    } else if(strcmp(option, "-icon") == 0) {
        SwitchBit(perlcs->cs.style, BS_ICON, 1);
        perlcs->hImageList = (HIMAGELIST) handle_From(NOTXSCALL value);
    } else if BitmaskOptionValueMask("-checked", perlcs->dwFlags, PERLWIN32GUI_CHECKED )
    } else retval = FALSE;

    return retval;
}

void
Button_onPostCreate(NOTXSPROC HWND myhandle, LPPERLWIN32GUI_CREATESTRUCT perlcs) {

    if(perlcs->hImageList != NULL) {
        if(perlcs->cs.style & BS_ICON) 
            SendMessage( myhandle, BM_SETIMAGE, (WPARAM) IMAGE_ICON, (LPARAM) perlcs->hImageList);
        else 
            SendMessage( myhandle, BM_SETIMAGE, (WPARAM) IMAGE_BITMAP, (LPARAM) perlcs->hImageList);
    }
}

BOOL
Button_onParseEvent(NOTXSPROC char *name, int* eventID) {

    BOOL retval = TRUE;

         if Parse_Event("GotFocus",   PERLWIN32GUI_NEM_GOTFOCUS)
    else if Parse_Event("LostFocus",  PERLWIN32GUI_NEM_LOSTFOCUS)
    else if Parse_Event("DblClick",   PERLWIN32GUI_NEM_DBLCLICK)
    else if Parse_Event("Click",      PERLWIN32GUI_NEM_CLICK)
    else if Parse_Event("Anonymous",  PERLWIN32GUI_NEM_CONTROL1)
    else if Parse_Event("Disable",    PERLWIN32GUI_NEM_CONTROL2)
    else if Parse_Event("Push",       PERLWIN32GUI_NEM_CONTROL3)
    else retval = FALSE;

    return retval;
}

int
Button_onEvent (NOTXSPROC LPPERLWIN32GUI_USERDATA perlud, UINT uMsg, WPARAM wParam, LPARAM lParam) {

    int PerlResult = 1;

    if ( uMsg == WM_COMMAND ) {

        switch(HIWORD(wParam)) {
        case BN_SETFOCUS:
            /*
             * (@)EVENT:GotFocus()
             * Sent when the control is activated.
             * (@)APPLIES_TO:Button, Checkbox, RadioButton
             */
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_GOTFOCUS, "GotFocus", -1 );
            break;
        case BN_KILLFOCUS:
            /*
             * (@)EVENT:LostFocus()
             * Sent when the control is deactivated.
             * (@)APPLIES_TO:Button, Checkbox, RadioButton
             */ 
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_LOSTFOCUS, "LostFocus", -1 );
            break;
        case BN_CLICKED:
            /*
             * (@)EVENT:Click()
             * Sent when the control is selected (eg.
             * the button pushed, the checkbox checked, etc.).
             * (@)APPLIES_TO:Button, Checkbox, RadioButton
             */ 
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CLICK, "Click", -1 );
            break;
        case BN_DBLCLK:
            /*
             * (@)EVENT:DblClick()
             * Sent when the user double clicks on the control.
             * (@)APPLIES_TO:Button, Checkbox, RadioButton
             */ 
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_DBLCLICK, "DblClick", -1 );
            break;
        case BN_DISABLE:
            /*
             * (@)EVENT:Disable()
             * Sent when the button is disabled
             * (@)APPLIES_TO:Button, Checkbox, RadioButton
             */ 
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL2, "Disable", -1 );
            break;
        case BN_PUSHED:
        case BN_UNPUSHED:
            /*
             * (@)EVENT:Push(State)
             * Sent when the state button change.
             * (@)APPLIES_TO:Button, Checkbox, RadioButton
             */ 
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL3, "Push", 
                                 PERLWIN32GUI_ARGTYPE_INT, (HIWORD(wParam) == BN_PUSHED),
                                 -1 );
            break;

        default:
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL1, "Anonymous",
                PERLWIN32GUI_ARGTYPE_INT, HIWORD(wParam),
                -1 );
            break;

        }
    }

    return PerlResult;
}


    /*
    ###########################################################################
    # (@)PACKAGE:Win32::GUI::Checkbox
    ###########################################################################
    */

void 
Checkbox_onPreCreate(NOTXSPROC LPPERLWIN32GUI_CREATESTRUCT perlcs) {

    perlcs->cs.lpszClass = "BUTTON";
    perlcs->cs.style = WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX;
}

BOOL
Checkbox_onParseOption(NOTXSPROC char *option, SV* value, LPPERLWIN32GUI_CREATESTRUCT perlcs) {
    return Button_onParseOption (NOTXSCALL option, value, perlcs);
}

void
Checkbox_onPostCreate(NOTXSPROC HWND myhandle, LPPERLWIN32GUI_CREATESTRUCT perlcs) {

    if(perlcs->dwFlagsMask & PERLWIN32GUI_CHECKED) {
        if(perlcs->dwFlags & PERLWIN32GUI_CHECKED) 
            SendMessage(myhandle, BM_SETCHECK, (WPARAM) BST_CHECKED, (LPARAM) 0);
        else 
            SendMessage(myhandle, BM_SETCHECK, (WPARAM) BST_UNCHECKED, (LPARAM) 0);
    }
}

BOOL
Checkbox_onParseEvent(NOTXSPROC char *name, int* eventID) {
    
    return Button_onParseEvent(NOTXSCALL name, eventID);
}

int
Checkbox_onEvent (NOTXSPROC LPPERLWIN32GUI_USERDATA perlud, UINT uMsg, WPARAM wParam, LPARAM lParam) {

    return Button_onEvent (NOTXSCALL perlud, uMsg, wParam, lParam);
}

    /*
    ###########################################################################
    # (@)PACKAGE:Win32::GUI::RadioButton
    ###########################################################################
    */

void 
RadioButton_onPreCreate(NOTXSPROC LPPERLWIN32GUI_CREATESTRUCT perlcs) {

    perlcs->cs.lpszClass = "BUTTON";
    perlcs->cs.style = WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON;
}

BOOL
RadioButton_onParseOption(NOTXSPROC char *option, SV* value, LPPERLWIN32GUI_CREATESTRUCT perlcs) {
    return Button_onParseOption (NOTXSCALL option, value, perlcs);
}

void
RadioButton_onPostCreate(NOTXSPROC HWND myhandle, LPPERLWIN32GUI_CREATESTRUCT perlcs) {

    Checkbox_onPostCreate (NOTXSCALL myhandle, perlcs);
}

BOOL
RadioButton_onParseEvent(NOTXSPROC char *name, int* eventID) {

    return Button_onParseEvent(NOTXSCALL name, eventID);
}

int
RadioButton_onEvent (NOTXSPROC LPPERLWIN32GUI_USERDATA perlud, UINT uMsg, WPARAM wParam, LPARAM lParam) {

    return Button_onEvent (NOTXSCALL perlud, uMsg, wParam, lParam);
}

    /*
    ###########################################################################
    # (@)PACKAGE:Win32::GUI::Groupbox
    ###########################################################################
    */

void 
Groupbox_onPreCreate(NOTXSPROC LPPERLWIN32GUI_CREATESTRUCT perlcs) {

    perlcs->cs.lpszClass = "BUTTON";
    perlcs->cs.style = WS_VISIBLE | WS_CHILD | BS_GROUPBOX;
}

BOOL
Groupbox_onParseOption(NOTXSPROC char *option, SV* value, LPPERLWIN32GUI_CREATESTRUCT perlcs) {
    return FALSE;
}

void
Groupbox_onPostCreate(NOTXSPROC HWND myhandle, LPPERLWIN32GUI_CREATESTRUCT perlcs) {

}

BOOL
Groupbox_onParseEvent(NOTXSPROC char *name, int* eventID) {
    return FALSE;
}

int
Groupbox_onEvent (NOTXSPROC LPPERLWIN32GUI_USERDATA perlud, UINT uMsg, WPARAM wParam, LPARAM lParam) {

    int PerlResult = 1;

    return PerlResult;
}

    /*
    ###########################################################################
    # (@)PACKAGE:Win32::GUI::Button
    ###########################################################################
    */

#line 309 "Button.c"
#ifndef PERL_UNUSED_VAR
#  define PERL_UNUSED_VAR(var) if (0) var = var
#endif

#ifndef dVAR
#  define dVAR		dNOOP
#endif


/* This stuff is not part of the API! You have been warned. */
#ifndef PERL_VERSION_DECIMAL
#  define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
#endif
#ifndef PERL_DECIMAL_VERSION
#  define PERL_DECIMAL_VERSION \
	  PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
#endif
#ifndef PERL_VERSION_GE
#  define PERL_VERSION_GE(r,v,s) \
	  (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
#endif
#ifndef PERL_VERSION_LE
#  define PERL_VERSION_LE(r,v,s) \
	  (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
#endif

/* XS_INTERNAL is the explicit static-linkage variant of the default
 * XS macro.
 *
 * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
 * "STATIC", ie. it exports XSUB symbols. You probably don't want that
 * for anything but the BOOT XSUB.
 *
 * See XSUB.h in core!
 */


/* TODO: This might be compatible further back than 5.10.0. */
#if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
#  undef XS_EXTERNAL
#  undef XS_INTERNAL
#  if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
#    define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
#    define XS_INTERNAL(name) STATIC XSPROTO(name)
#  endif
#  if defined(__SYMBIAN32__)
#    define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
#    define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
#  endif
#  ifndef XS_EXTERNAL
#    if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
#      define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
#      define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
#    else
#      ifdef __cplusplus
#        define XS_EXTERNAL(name) extern "C" XSPROTO(name)
#        define XS_INTERNAL(name) static XSPROTO(name)
#      else
#        define XS_EXTERNAL(name) XSPROTO(name)
#        define XS_INTERNAL(name) STATIC XSPROTO(name)
#      endif
#    endif
#  endif
#endif

/* perl >= 5.10.0 && perl <= 5.15.1 */


/* The XS_EXTERNAL macro is used for functions that must not be static
 * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
 * macro defined, the best we can do is assume XS is the same.
 * Dito for XS_INTERNAL.
 */
#ifndef XS_EXTERNAL
#  define XS_EXTERNAL(name) XS(name)
#endif
#ifndef XS_INTERNAL
#  define XS_INTERNAL(name) XS(name)
#endif

/* Now, finally, after all this mess, we want an ExtUtils::ParseXS
 * internal macro that we're free to redefine for varying linkage due
 * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
 * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
 */

#undef XS_EUPXS
#if defined(PERL_EUPXS_ALWAYS_EXPORT)
#  define XS_EUPXS(name) XS_EXTERNAL(name)
#else
   /* default to internal */
#  define XS_EUPXS(name) XS_INTERNAL(name)
#endif

#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)

/* prototype to pass -Wmissing-prototypes */
STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params);

STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params)
{
    const GV *const gv = CvGV(cv);

    PERL_ARGS_ASSERT_CROAK_XS_USAGE;

    if (gv) {
        const char *const gvname = GvNAME(gv);
        const HV *const stash = GvSTASH(gv);
        const char *const hvname = stash ? HvNAME(stash) : NULL;

        if (hvname)
	    Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
        else
	    Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
    } else {
        /* Pants. I don't think that it should be possible to get here. */
	Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
    }
}
#undef  PERL_ARGS_ASSERT_CROAK_XS_USAGE

#define croak_xs_usage        S_croak_xs_usage

#endif

/* NOTE: the prototype of newXSproto() is different in versions of perls,
 * so we define a portable version of newXSproto()
 */
#ifdef newXS_flags
#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
#else
#define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
#endif /* !defined(newXS_flags) */

#if PERL_VERSION_LE(5, 21, 5)
#  define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
#else
#  define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
#endif

#line 453 "Button.c"
#pragma message( "*** PACKAGE Win32::GUI::Button..." )

XS_EUPXS(XS_Win32__GUI__Button_Click); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Button_Click)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    {
	HWND	handle;
	LRESULT	RETVAL;
	dXSTARG;

    if(SvROK(ST(0))) {
        SV** out=hv_fetch((HV*)SvRV(ST(0)), "-handle", 7, 0);
        if(out != NULL)
            handle = INT2PTR(HWND,SvIV(*out));
        else
            handle = NULL;
    } else
       handle = INT2PTR(HWND,SvIV(ST(0)))
;
#line 316 "Button.xs"
    RETVAL = SendMessage(handle, BM_CLICK, 0, 0);
#line 479 "Button.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Button_GetImage); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Button_GetImage)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, type");
    {
	HWND	handle;
	WPARAM	type = (WPARAM)SvUV(ST(1))
;
	LRESULT	RETVAL;
	dXSTARG;

    if(SvROK(ST(0))) {
        SV** out=hv_fetch((HV*)SvRV(ST(0)), "-handle", 7, 0);
        if(out != NULL)
            handle = INT2PTR(HWND,SvIV(*out));
        else
            handle = NULL;
    } else
       handle = INT2PTR(HWND,SvIV(ST(0)))
;
#line 331 "Button.xs"
    RETVAL = SendMessage(handle, BM_GETIMAGE, type, 0);
#line 511 "Button.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Button_SetImage); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Button_SetImage)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, icon");
    {
	HWND	handle;
	HICON	icon;
	LRESULT	RETVAL;
	dXSTARG;

    if(SvROK(ST(0))) {
        SV** out=hv_fetch((HV*)SvRV(ST(0)), "-handle", 7, 0);
        if(out != NULL)
            handle = INT2PTR(HWND,SvIV(*out));
        else
            handle = NULL;
    } else
       handle = INT2PTR(HWND,SvIV(ST(0)))
;

    if(SvROK(ST(1))) {
        SV** out=hv_fetch((HV*)SvRV(ST(1)), "-handle", 7, 0);
        if(out != NULL)
            icon = INT2PTR(HICON,SvIV(*out));
        else
            icon = NULL;
    } else
       icon = INT2PTR(HICON,SvIV(ST(1)))
;
#line 345 "Button.xs"
    WPARAM type = (sv_isobject(ST(1)) && sv_derived_from(ST(1), "Win32::GUI::Icon") ? IMAGE_ICON : IMAGE_BITMAP);
    RETVAL = SendMessage(handle, BM_SETIMAGE, type, (LPARAM) icon);
#line 553 "Button.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

#pragma message( "*** PACKAGE Win32::GUI::RadioButton..." )

XS_EUPXS(XS_Win32__GUI__RadioButton_GetCheck); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__RadioButton_GetCheck)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    {
	HWND	handle;
	LRESULT	RETVAL;
	dXSTARG;

    if(SvROK(ST(0))) {
        SV** out=hv_fetch((HV*)SvRV(ST(0)), "-handle", 7, 0);
        if(out != NULL)
            handle = INT2PTR(HWND,SvIV(*out));
        else
            handle = NULL;
    } else
       handle = INT2PTR(HWND,SvIV(ST(0)))
;
#line 377 "Button.xs"
    RETVAL = SendMessage(handle, BM_GETCHECK, 0, 0);
#line 585 "Button.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__RadioButton_SetCheck); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__RadioButton_SetCheck)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items < 1 || items > 2)
       croak_xs_usage(cv,  "handle, value=1");
    {
	HWND	handle;
	WPARAM	value;
	LRESULT	RETVAL;
	dXSTARG;

    if(SvROK(ST(0))) {
        SV** out=hv_fetch((HV*)SvRV(ST(0)), "-handle", 7, 0);
        if(out != NULL)
            handle = INT2PTR(HWND,SvIV(*out));
        else
            handle = NULL;
    } else
       handle = INT2PTR(HWND,SvIV(ST(0)))
;

	if (items < 2)
	    value = 1;
	else {
	    value = (WPARAM)SvUV(ST(1))
;
	}
#line 394 "Button.xs"
    RETVAL = SendMessage(handle, BM_SETCHECK, value, 0);
#line 624 "Button.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__RadioButton_Checked); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__RadioButton_Checked)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items < 1 || items > 2)
       croak_xs_usage(cv,  "handle, value=0");
    {
	HWND	handle;
	WPARAM	value;
	LRESULT	RETVAL;
	dXSTARG;

    if(SvROK(ST(0))) {
        SV** out=hv_fetch((HV*)SvRV(ST(0)), "-handle", 7, 0);
        if(out != NULL)
            handle = INT2PTR(HWND,SvIV(*out));
        else
            handle = NULL;
    } else
       handle = INT2PTR(HWND,SvIV(ST(0)))
;

	if (items < 2)
	    value = 0;
	else {
	    value = (WPARAM)SvUV(ST(1))
;
	}
#line 414 "Button.xs"
    if(items > 1)         
        RETVAL = SendMessage(handle, BM_SETCHECK, value, 0);
    else
        RETVAL = SendMessage(handle, BM_GETCHECK, 0, 0);
#line 666 "Button.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

#pragma message( "*** PACKAGE Win32::GUI::Checkbox..." )
#pragma message( "*** PACKAGE Win32::GUI::Groupbox..." )
#ifdef __cplusplus
extern "C"
#endif
XS_EXTERNAL(boot_Win32__GUI__Button); /* prototype to pass -Wmissing-prototypes */
XS_EXTERNAL(boot_Win32__GUI__Button)
{
#if PERL_VERSION_LE(5, 21, 5)
    dVAR; dXSARGS;
#else
    dVAR; dXSBOOTARGSXSAPIVERCHK;
#endif
#if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */
    char* file = __FILE__;
#else
    const char* file = __FILE__;
#endif

    PERL_UNUSED_VAR(file);

    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(items); /* -W */
#if PERL_VERSION_LE(5, 21, 5)
    XS_VERSION_BOOTCHECK;
#  ifdef XS_APIVERSION_BOOTCHECK
    XS_APIVERSION_BOOTCHECK;
#  endif
#endif

    {
        CV * cv;

        cv = newXS_deffile("Win32::GUI::Button::Click", XS_Win32__GUI__Button_Click);
        XSANY.any_i32 = 0;
        cv = newXS_deffile("Win32::GUI::Checkbox::Click", XS_Win32__GUI__Button_Click);
        XSANY.any_i32 = 2;
        cv = newXS_deffile("Win32::GUI::RadioButton::Click", XS_Win32__GUI__Button_Click);
        XSANY.any_i32 = 1;
        newXS_deffile("Win32::GUI::Button::GetImage", XS_Win32__GUI__Button_GetImage);
        newXS_deffile("Win32::GUI::Button::SetImage", XS_Win32__GUI__Button_SetImage);
        cv = newXS_deffile("Win32::GUI::Checkbox::GetCheck", XS_Win32__GUI__RadioButton_GetCheck);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Win32::GUI::RadioButton::GetCheck", XS_Win32__GUI__RadioButton_GetCheck);
        XSANY.any_i32 = 0;
        cv = newXS_deffile("Win32::GUI::Checkbox::SetCheck", XS_Win32__GUI__RadioButton_SetCheck);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Win32::GUI::RadioButton::SetCheck", XS_Win32__GUI__RadioButton_SetCheck);
        XSANY.any_i32 = 0;
        cv = newXS_deffile("Win32::GUI::Checkbox::Checked", XS_Win32__GUI__RadioButton_Checked);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Win32::GUI::RadioButton::Checked", XS_Win32__GUI__RadioButton_Checked);
        XSANY.any_i32 = 0;
    }
#if PERL_VERSION_LE(5, 21, 5)
#  if PERL_VERSION_GE(5, 9, 0)
    if (PL_unitcheckav)
        call_list(PL_scopestack_ix, PL_unitcheckav);
#  endif
    XSRETURN_YES;
#else
    Perl_xs_boot_epilog(aTHX_ ax);
#endif
}

