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

#line 1 "UpDown.xs"
    /*
    ###########################################################################
    # (@)PACKAGE:Win32::GUI::UpDown
    #
    # $Id: UpDown.xs,v 1.5 2005/08/03 21:45:58 robertemay Exp $
    #
    ###########################################################################
    */

#include "GUI.h"

void 
UpDown_onPreCreate(NOTXSPROC LPPERLWIN32GUI_CREATESTRUCT perlcs) {

    perlcs->cs.lpszClass = UPDOWN_CLASS;
    perlcs->cs.style = WS_VISIBLE | WS_CHILD | UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ALIGNRIGHT;
}

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

    BOOL retval = FALSE;

    if(strcmp(option, "-align") == 0) {
        if(strcmp(SvPV_nolen(value), "left") == 0) {
            SwitchBit(perlcs->cs.style, UDS_ALIGNLEFT, 1);
            SwitchBit(perlcs->cs.style, UDS_ALIGNRIGHT, 0);
        } else if(strcmp(SvPV_nolen(value), "right") == 0) {
            SwitchBit(perlcs->cs.style, UDS_ALIGNLEFT, 0);
            SwitchBit(perlcs->cs.style, UDS_ALIGNRIGHT, 1);
        } else {
            W32G_WARN("Win32::GUI: Invalid value for -align!");
        }
    } else if BitmaskOptionValue("-nothousands", perlcs->cs.style, UDS_NOTHOUSANDS)
    } else if BitmaskOptionValue("-wrap", perlcs->cs.style, UDS_WRAP)
    } else if BitmaskOptionValue("-horizontal", perlcs->cs.style, UDS_HORZ)
    } else if BitmaskOptionValue("-autobuddy", perlcs->cs.style, UDS_AUTOBUDDY)
    } else if BitmaskOptionValue("-setbuddy", perlcs->cs.style, UDS_SETBUDDYINT)
    } else if BitmaskOptionValue("-arrowkeys", perlcs->cs.style, UDS_ARROWKEYS)
    } else retval = FALSE;

    return retval;
}

void 
UpDown_onPostCreate(NOTXSPROC HWND myhandle, LPPERLWIN32GUI_CREATESTRUCT perlcs) {
}

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

    BOOL retval = TRUE;

         if Parse_Event("Scroll",     PERLWIN32GUI_NEM_CONTROL1)
    else retval = FALSE;

    return retval;
}

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

    int PerlResult = 1;

    switch(uMsg) {
    case WM_HSCROLL:
    case WM_VSCROLL:

        /*
         * (@)EVENT:Scroll(SCROLLBAR, OPERATION, POSITION)
         * Sent when one of the window scrollbars is moved. SCROLLBAR identifies
         * which bar was moved, 0 for horizontal and 1 for vertical.
         *
         * OPERATION can be compared against one of the following constants:
         * SB_LINEUP, SB_LINELEFT, SB_LINEDOWN, SB_LINERIGHT, SB_PAGEUP
         * SB_PAGELEFT, SB_PAGEDOWN, SB_PAGERIGHT, SB_THUMBPOSITION,
         * SB_THUMBTRACK, SB_TOP, SB_LEFT, SB_BOTTOM, SB_RIGHT, SB_ENDSCROLL
         *
         * (@)APPLIES_TO:UpDown
         */
        PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL1, "Scroll",
                             PERLWIN32GUI_ARGTYPE_INT, (uMsg == WM_HSCROLL ? 0 : 1),
                             PERLWIN32GUI_ARGTYPE_INT, (int) LOWORD(wParam),
                             PERLWIN32GUI_ARGTYPE_INT, (int) HIWORD(wParam), -1 );
        break;
    }

    return PerlResult;
}

#line 101 "UpDown.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 245 "UpDown.c"
#pragma message( "*** PACKAGE Win32::GUI::UpDown..." )

XS_EUPXS(XS_Win32__GUI__UpDown_GetBase); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__UpDown_GetBase)
{
    dVAR; dXSARGS;
    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 106 "UpDown.xs"
    RETVAL = SendMessage(handle, UDM_GETBASE, 0, 0);
#line 270 "UpDown.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__UpDown_GetBuddy); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__UpDown_GetBuddy)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    {
	HWND	handle;
#line 117 "UpDown.xs"
    HWND oldbuddy;
#line 288 "UpDown.c"
	HWND	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 119 "UpDown.xs"
    oldbuddy = (HWND) SendMessage(handle, UDM_GETBUDDY, 0, 0);
    //RETVAL = (HV*) GetWindowLongPtr(oldbuddy, GWLP_USERDATA);
    RETVAL = oldbuddy;
#line 305 "UpDown.c"
	XSprePUSH;
	PUSHi(PTR2IV(RETVAL));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__UpDown_GetPos); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__UpDown_GetPos)
{
    dVAR; dXSARGS;
    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 132 "UpDown.xs"
    RETVAL = SendMessage(handle, UDM_GETPOS, 0, 0);
#line 335 "UpDown.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__UpDown_GetRange); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__UpDown_GetRange)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	HWND	handle;
#line 143 "UpDown.xs"
    LRESULT res;
#line 355 "UpDown.c"

    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 145 "UpDown.xs"
    res = SendMessage(handle, UDM_GETRANGE, 0, 0);
    EXTEND(SP, 2);
    XST_mIV(0, HIWORD(res));
    XST_mIV(1, LOWORD(res));
    XSRETURN(2);
#line 372 "UpDown.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Win32__GUI__UpDown_GetRange32); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__UpDown_GetRange32)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	HWND	handle;
#line 158 "UpDown.xs"
    LRESULT res;
    UINT start;
    UINT end;
#line 393 "UpDown.c"

    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 162 "UpDown.xs"
    res = SendMessage(handle, UDM_GETRANGE32, (WPARAM) &start, (LPARAM) &end);
    EXTEND(SP, 2);
    XST_mIV(0, start);
    XST_mIV(1, end);
    XSRETURN(2);
#line 410 "UpDown.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Win32__GUI__UpDown_SetBase); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__UpDown_SetBase)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, base");
    {
	HWND	handle;
	WPARAM	base = (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 181 "UpDown.xs"
    RETVAL = SendMessage(handle, UDM_SETBASE, base, 0);
#line 441 "UpDown.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__UpDown_SetBuddy); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__UpDown_SetBuddy)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, buddy");
    {
	HWND	handle;
	HWND	buddy;
#line 193 "UpDown.xs"
    HWND oldbuddy;
#line 460 "UpDown.c"
	HWND	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)
            buddy = INT2PTR(HWND,SvIV(*out));
        else
            buddy = NULL;
    } else
       buddy = INT2PTR(HWND,SvIV(ST(1)))
;
#line 195 "UpDown.xs"
    oldbuddy = (HWND) SendMessage(handle, UDM_SETBUDDY, (WPARAM) buddy, 0);
    RETVAL = oldbuddy;
#line 486 "UpDown.c"
	XSprePUSH;
	PUSHi(PTR2IV(RETVAL));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__UpDown_SetPos); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__UpDown_SetPos)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, pos");
    {
	HWND	handle;
	WPARAM	pos = (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 208 "UpDown.xs"
    RETVAL = SendMessage(handle, UDM_SETPOS, 0, (LPARAM) MAKELONG(pos, 0));
#line 518 "UpDown.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__UpDown_SetRange); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__UpDown_SetRange)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "handle, start, end");
    {
	HWND	handle;
	WPARAM	start = (WPARAM)SvUV(ST(1))
;
	WPARAM	end = (WPARAM)SvUV(ST(2))
;
	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 221 "UpDown.xs"
    RETVAL = SendMessage(handle, UDM_SETRANGE, 0, (LPARAM) MAKELONG(end, start));
#line 552 "UpDown.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__UpDown_SetRange32); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__UpDown_SetRange32)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "handle, start, end");
    {
	HWND	handle;
	WPARAM	start = (WPARAM)SvUV(ST(1))
;
	WPARAM	end = (WPARAM)SvUV(ST(2))
;
	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 234 "UpDown.xs"
    RETVAL = SendMessage(handle, UDM_SETRANGE32, start, (LPARAM) end);
#line 586 "UpDown.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__UpDown_Base); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__UpDown_Base)
{
    dVAR; dXSARGS;
    if (items < 1 || items > 2)
       croak_xs_usage(cv,  "handle, base=0");
    {
	HWND	handle;
	WPARAM	base;
	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)
	    base = 0;
	else {
	    base = (WPARAM)SvUV(ST(1))
;
	}
#line 253 "UpDown.xs"
    if(items == 1)
        RETVAL = SendMessage(handle, UDM_GETBASE, 0, 0);
    else
        RETVAL = SendMessage(handle, UDM_SETBASE, base, 0);
#line 627 "UpDown.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__UpDown_Buddy); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__UpDown_Buddy)
{
    dVAR; dXSARGS;
    if (items < 1 || items > 2)
       croak_xs_usage(cv,  "handle, buddy=NULL");
    {
	HWND	handle;
	HWND	buddy;
#line 268 "UpDown.xs"
    HWND oldbuddy;
#line 646 "UpDown.c"
	HWND	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)
	    buddy = NULL;
	else {
    if(SvROK(ST(1))) {
	SV** out=hv_fetch((HV*)SvRV(ST(1)), "-handle", 7, 0);
	if(out != NULL)
	    buddy = INT2PTR(HWND,SvIV(*out));
	else
	    buddy = NULL;
    } else
       buddy = INT2PTR(HWND,SvIV(ST(1)))
;
	}
#line 270 "UpDown.xs"
    if(items == 1) {
        oldbuddy = (HWND) SendMessage(handle, UDM_GETBUDDY, 0, 0);
        //RETVAL = (HV*) GetWindowLongPtr(oldbuddy, GWLP_USERDATA);
    } else {
        oldbuddy = (HWND) SendMessage(handle, UDM_SETBUDDY, (WPARAM) buddy, 0);
        //RETVAL = (HV*) GetWindowLongPtr(oldbuddy, GWLP_USERDATA);
    }
    RETVAL = oldbuddy;
#line 682 "UpDown.c"
	XSprePUSH;
	PUSHi(PTR2IV(RETVAL));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__UpDown_Pos); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__UpDown_Pos)
{
    dVAR; dXSARGS;
    if (items < 1 || items > 2)
       croak_xs_usage(cv,  "handle, pos=(short)-1");
    {
	HWND	handle;
	short	pos;
	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)
	    pos = (short)-1;
	else {
	    pos = (short)SvIV(ST(1))
;
	}
#line 290 "UpDown.xs"
    if(items == 1)
        RETVAL = SendMessage(handle, UDM_GETPOS, 0, 0);
    else
        RETVAL = SendMessage(handle, UDM_SETPOS, 0, (LPARAM) MAKELONG(pos, 0));
#line 723 "UpDown.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__UpDown_Range); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__UpDown_Range)
{
    dVAR; dXSARGS;
    if (items < 1 || items > 3)
       croak_xs_usage(cv,  "handle, min=(short)-1, max=(short)-1");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	HWND	handle;
	short	min;
	short	max;
#line 311 "UpDown.xs"
    LRESULT range;
#line 745 "UpDown.c"

    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)
	    min = (short)-1;
	else {
	    min = (short)SvIV(ST(1))
;
	}

	if (items < 3)
	    max = (short)-1;
	else {
	    max = (short)SvIV(ST(2))
;
	}
#line 313 "UpDown.xs"
    if(items == 1) {
        range = SendMessage(handle, UDM_GETRANGE, 0, 0);
        EXTEND(SP, 2);
        XST_mIV(0, HIWORD(range));
        XST_mIV(1, LOWORD(range));
        XSRETURN(2);
    } else {
        SendMessage(handle, UDM_SETRANGE, 0, (LPARAM) MAKELONG(max, min));
        XSRETURN_YES;
    }
#line 781 "UpDown.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Win32__GUI__UpDown_Range32); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__UpDown_Range32)
{
    dVAR; dXSARGS;
    if (items < 1 || items > 3)
       croak_xs_usage(cv,  "handle, min=(UINT)-1, max=(UINT)-1");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	HWND	handle;
	UINT	min;
	UINT	max;
#line 337 "UpDown.xs"
    UINT start;
    UINT end;
#line 803 "UpDown.c"

    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)
	    min = (UINT)-1;
	else {
	    min = (UINT)SvUV(ST(1))
;
	}

	if (items < 3)
	    max = (UINT)-1;
	else {
	    max = (UINT)SvUV(ST(2))
;
	}
#line 340 "UpDown.xs"
    if(items == 1) {
        SendMessage(handle, UDM_GETRANGE32, (WPARAM)&start, (LPARAM)&end);
        EXTEND(SP, 2);
        XST_mIV(0, start);
        XST_mIV(1, end);
        XSRETURN(2);
    } else {
        SendMessage(handle, UDM_SETRANGE32, (WPARAM) min, (LPARAM) max);
        XSRETURN_YES;
    }
#line 839 "UpDown.c"
	PUTBACK;
	return;
    }
}

#ifdef __cplusplus
extern "C"
#endif
XS_EXTERNAL(boot_Win32__GUI__UpDown); /* prototype to pass -Wmissing-prototypes */
XS_EXTERNAL(boot_Win32__GUI__UpDown)
{
#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

        newXS_deffile("Win32::GUI::UpDown::GetBase", XS_Win32__GUI__UpDown_GetBase);
        newXS_deffile("Win32::GUI::UpDown::GetBuddy", XS_Win32__GUI__UpDown_GetBuddy);
        newXS_deffile("Win32::GUI::UpDown::GetPos", XS_Win32__GUI__UpDown_GetPos);
        newXS_deffile("Win32::GUI::UpDown::GetRange", XS_Win32__GUI__UpDown_GetRange);
        newXS_deffile("Win32::GUI::UpDown::GetRange32", XS_Win32__GUI__UpDown_GetRange32);
        newXS_deffile("Win32::GUI::UpDown::SetBase", XS_Win32__GUI__UpDown_SetBase);
        newXS_deffile("Win32::GUI::UpDown::SetBuddy", XS_Win32__GUI__UpDown_SetBuddy);
        newXS_deffile("Win32::GUI::UpDown::SetPos", XS_Win32__GUI__UpDown_SetPos);
        newXS_deffile("Win32::GUI::UpDown::SetRange", XS_Win32__GUI__UpDown_SetRange);
        newXS_deffile("Win32::GUI::UpDown::SetRange32", XS_Win32__GUI__UpDown_SetRange32);
        newXS_deffile("Win32::GUI::UpDown::Base", XS_Win32__GUI__UpDown_Base);
        newXS_deffile("Win32::GUI::UpDown::Buddy", XS_Win32__GUI__UpDown_Buddy);
        newXS_deffile("Win32::GUI::UpDown::Pos", XS_Win32__GUI__UpDown_Pos);
        newXS_deffile("Win32::GUI::UpDown::Range", XS_Win32__GUI__UpDown_Range);
        newXS_deffile("Win32::GUI::UpDown::Range32", XS_Win32__GUI__UpDown_Range32);
#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
}

