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

#line 1 "Listbox.xs"
    /*
    ###########################################################################
    # (@)PACKAGE:Win32::GUI::Listbox
    #
    # $Id: Listbox.xs,v 1.6 2006/03/16 21:31:42 robertemay Exp $
    #
    ###########################################################################
    */

#include "GUI.h"

void Listbox_onPreCreate(NOTXSPROC LPPERLWIN32GUI_CREATESTRUCT perlcs) {

    perlcs->cs.lpszClass = "LISTBOX";
    perlcs->cs.style = WS_VISIBLE | WS_CHILD | LBS_NOTIFY;
    perlcs->cs.dwExStyle = WS_EX_CLIENTEDGE;
}

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

    BOOL retval = TRUE;

    if(strcmp(option, "-multisel") == 0) {
        if(SvIV(value) == 0) {
            SwitchBit(perlcs->cs.style, LBS_MULTIPLESEL, 0);
            SwitchBit(perlcs->cs.style, LBS_EXTENDEDSEL, 0);
        } else if(SvIV(value) == 1) {
            SwitchBit(perlcs->cs.style, LBS_MULTIPLESEL, 1);
            SwitchBit(perlcs->cs.style, LBS_EXTENDEDSEL, 0);
        } else if(SvIV(value) == 2) {
            SwitchBit(perlcs->cs.style, LBS_MULTIPLESEL, 1);
            SwitchBit(perlcs->cs.style, LBS_EXTENDEDSEL, 1);
        } else {
            if(PL_dowarn) warn("Win32::GUI: Invalid value for -multisel!");
        }
    } else if BitmaskOptionValue("-sort",             perlcs->cs.style, LBS_SORT)
    } else if BitmaskOptionValue("-multicolumn",      perlcs->cs.style, LBS_MULTICOLUMN)
    } else if BitmaskOptionValue("-nointegralheight", perlcs->cs.style, LBS_NOINTEGRALHEIGHT)
    } else if BitmaskOptionValue("-noredraw",         perlcs->cs.style, LBS_NOREDRAW)
    } else if BitmaskOptionValue("-notify",           perlcs->cs.style, LBS_NOTIFY)
    } else if BitmaskOptionValue("-usetabstop",       perlcs->cs.style, LBS_USETABSTOPS)
    } else if BitmaskOptionValue("-disablenoscroll",  perlcs->cs.style, LBS_DISABLENOSCROLL)
    } else retval = FALSE;

    return retval;
}

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

BOOL
Listbox_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("SelCancel",  PERLWIN32GUI_NEM_CONTROL2)    
    else if Parse_Event("SelChange",  PERLWIN32GUI_NEM_CONTROL3)    
    else retval = FALSE;

    return retval;
}

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

    int PerlResult = 1;

    if ( uMsg == WM_COMMAND ) {

        switch(HIWORD(wParam)) {
        case LBN_SETFOCUS:
            /*
             * (@)EVENT:GotFocus()
             * Sent when the control is activated.
             * (@)APPLIES_TO:Listbox
             */
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_GOTFOCUS, "GotFocus", -1 );
            break;
        case LBN_KILLFOCUS:
            /*
             * (@)EVENT:LostFocus()
             * Sent when the control is deactivated.
             * (@)APPLIES_TO:Listbox
             */
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_LOSTFOCUS, "LostFocus", -1 );
            break;
        case LBN_SELCHANGE:
            /*
             * (@)EVENT:Click()
             * DEPRECATED use SelChange event.
             * (@)APPLIES_TO:Listbox
             */
             // TODO: Click but not change ?
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CLICK, "Click", -1 );
            /*
             * (@)EVENT:SelChange()
             * (@)APPLIES_TO:Listbox
             */
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL3, "SelChange", -1 );
            break;
        case LBN_DBLCLK:
            /*
             * (@)EVENT:DblClick()
             * Sent when the user double clicks on the control.
             * (@)APPLIES_TO:Listbox
             */
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_DBLCLICK, "DblClick", -1 );
            break;
        case LBN_SELCANCEL:
            /*
             * (@)EVENT:SelCancel()
             * Sent when the user cancels the selection in a Listbox. 
             * (@)APPLIES_TO:Listbox
             */
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL2, "SelCancel", -1 );
            break;       
        default:
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL1, "Anonymous", 
                PERLWIN32GUI_ARGTYPE_INT, HIWORD(wParam),
                -1 );
            break;
        }

    }

    return PerlResult;
}

#line 146 "Listbox.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 290 "Listbox.c"
#pragma message( "*** PACKAGE Win32::GUI::Listbox..." )

XS_EUPXS(XS_Win32__GUI__Listbox_AddFile); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_AddFile)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, string");
    {
	HWND	handle;
	LPCTSTR	string = (LPCTSTR)SvPV_nolen(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 150 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_ADDFILE, 0, (LPARAM) string);
#line 317 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_AddString); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_AddString)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, string");
    {
	HWND	handle;
	LPCTSTR	string = (LPCTSTR)SvPV_nolen(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 162 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_ADDSTRING, 0, (LPARAM) string);
#line 349 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_DeleteString); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_DeleteString)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items != 2)
       croak_xs_usage(cv,  "handle, index");
    {
	HWND	handle;
	int	index = (int)SvIV(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 177 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_DELETESTRING, (WPARAM) index, 0);
#line 382 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_Dir); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_Dir)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "handle, string, flag");
    {
	HWND	handle;
	LPCTSTR	string = (LPCTSTR)SvPV_nolen(ST(1))
;
	UINT	flag = (UINT)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 190 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_DIR, (WPARAM) flag, (LPARAM) string);
#line 416 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_FindString); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_FindString)
{
    dVAR; dXSARGS;
    if (items < 2 || items > 3)
       croak_xs_usage(cv,  "handle, string, index=-1");
    {
	HWND	handle;
	LPCTSTR	string = (LPCTSTR)SvPV_nolen(ST(1))
;
	long	index;
	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 < 3)
	    index = -1;
	else {
	    index = (long)SvIV(ST(2))
;
	}
#line 203 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_FINDSTRING, (WPARAM) index, (LPARAM) string);
#line 456 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_FindStringExact); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_FindStringExact)
{
    dVAR; dXSARGS;
    if (items < 2 || items > 3)
       croak_xs_usage(cv,  "handle, string, index=-1");
    {
	HWND	handle;
	LPCTSTR	string = (LPCTSTR)SvPV_nolen(ST(1))
;
	long	index;
	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 < 3)
	    index = -1;
	else {
	    index = (long)SvIV(ST(2))
;
	}
#line 216 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_FINDSTRINGEXACT, (WPARAM) index, (LPARAM) string);
#line 496 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_GetAnchorIndex); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_GetAnchorIndex)
{
    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 227 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_GETANCHORINDEX, (WPARAM) 0, (LPARAM) 0);
#line 526 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_GetCaretIndex); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_GetCaretIndex)
{
    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 238 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_GETCARETINDEX, (WPARAM) 0, (LPARAM) 0);
#line 556 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_GetCount); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_GetCount)
{
    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 252 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_GETCOUNT, (WPARAM) 0, (LPARAM) 0);
#line 587 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_GetCurSel); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_GetCurSel)
{
    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 267 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_GETCURSEL, (WPARAM) 0, (LPARAM) 0);
#line 618 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_GetHorizontalExtent); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_GetHorizontalExtent)
{
    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 278 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_GETHORIZONTALEXTENT, (WPARAM) 0, (LPARAM) 0);
#line 648 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_GetItemHeight); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_GetItemHeight)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, index");
    {
	HWND	handle;
	int	index = (int)SvIV(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 292 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_GETITEMHEIGHT, (WPARAM) index, (LPARAM) 0);
#line 680 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_GetItemRect); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_GetItemRect)
{
    dVAR; dXSARGS;
    if (items < 2 || items > 3)
       croak_xs_usage(cv,  "handle, index, code=LVIR_BOUNDS");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	HWND	handle;
	int	index = (int)SvIV(ST(1))
;
	int	code;
#line 305 "Listbox.xs"
    RECT rect;
#line 703 "Listbox.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 < 3)
	    code = LVIR_BOUNDS;
	else {
	    code = (int)SvIV(ST(2))
;
	}
#line 307 "Listbox.xs"
    if (SendMessage(handle, LB_GETITEMRECT, (WPARAM) index, (LPARAM) &rect) != LB_ERR) {
        EXTEND(SP, 4);
        XST_mIV(0, rect.left);
        XST_mIV(1, rect.top);
        XST_mIV(2, rect.right);
        XST_mIV(3, rect.bottom);
        XSRETURN(4);
    }
    else
        XSRETURN_UNDEF;
#line 732 "Listbox.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Win32__GUI__Listbox_GetLocale); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_GetLocale)
{
    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 325 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_GETLOCALE, (WPARAM) 0, (LPARAM) 0);
#line 761 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_GetSel); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_GetSel)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, index");
    {
	HWND	handle;
	int	index = (int)SvIV(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 337 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_GETSEL, (WPARAM) index, (LPARAM) 0);
#line 793 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_GetSelCount); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_GetSelCount)
{
    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 351 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_GETSELCOUNT, 0, 0);
#line 824 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_GetSelItems); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_GetSelItems)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	HWND	handle;
#line 366 "Listbox.xs"
    LRESULT count;
    LRESULT lresult;
    LPINT selitems;
    int i;
#line 848 "Listbox.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 371 "Listbox.xs"
    count = SendMessage(handle, LB_GETSELCOUNT, 0, 0);
    if(count > 0) {
        selitems = (LPINT) safemalloc(sizeof(INT)*count);
        lresult = SendMessage(handle, LB_GETSELITEMS, (WPARAM) count, (LPARAM) selitems);
        if(lresult == -1) {
            safefree(selitems);
            XSRETURN_UNDEF;
        } else {
            EXTEND(SP, lresult);
            for(i=0; i<lresult; i++) {
                XST_mIV(i, (long) selitems[i]);
            }
            safefree(selitems);
            XSRETURN(lresult);
        }
    } else {
        XSRETURN_UNDEF;
    }
#line 878 "Listbox.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Win32__GUI__Listbox_GetText); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_GetText)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items != 2)
       croak_xs_usage(cv,  "handle, index");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	HWND	handle;
	WPARAM	index = (WPARAM)SvUV(ST(1))
;
#line 401 "Listbox.xs"
    STRLEN cbString;
    char *szString;
#line 901 "Listbox.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 404 "Listbox.xs"
    cbString = SendMessage(handle, LB_GETTEXTLEN, index, 0);
    if(cbString != LB_ERR) {
        szString = (char *) safemalloc(cbString+1);
        if(SendMessage(handle, LB_GETTEXT, index, (LPARAM) (LPCTSTR) szString) != LB_ERR) {
            EXTEND(SP, 1);
            XST_mPV(0, szString);
            safefree(szString);
            XSRETURN(1);
        } else {
            safefree(szString);
            XSRETURN_UNDEF;
        }
    } else {
        XSRETURN_UNDEF;
    }
#line 928 "Listbox.c"
	PUTBACK;
	return;
    }
}


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


XS_EUPXS(XS_Win32__GUI__Listbox_GetTopIndex); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_GetTopIndex)
{
    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 439 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_GETTOPINDEX, 0, 0);
#line 989 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_InsertString); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_InsertString)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items < 2 || items > 3)
       croak_xs_usage(cv,  "handle, string, index=-1");
    {
	HWND	handle;
	LPCTSTR	string = (LPCTSTR)SvPV_nolen(ST(1))
;
	long	index;
	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 < 3)
	    index = -1;
	else {
	    index = (long)SvIV(ST(2))
;
	}
#line 458 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_INSERTSTRING, (WPARAM) index, (LPARAM) string);
#line 1030 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_ItemFromPoint); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_ItemFromPoint)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "handle, x, y");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	HWND	handle;
	UINT	x = (UINT)SvUV(ST(1))
;
	UINT	y = (UINT)SvUV(ST(2))
;
#line 471 "Listbox.xs"
    LRESULT lresult;
#line 1054 "Listbox.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 473 "Listbox.xs"
    lresult = SendMessage(handle, LB_ITEMFROMPOINT, 0, (LPARAM) MAKELPARAM(x, y));
    if(GIMME == G_ARRAY) {
        EXTEND(SP, 2);
        XST_mIV(0, (long) LOWORD(lresult));
        if(HIWORD(lresult) == 0)
            XST_mIV(1, 1);
        else
            XST_mIV(1, 0);
        XSRETURN(2);
    } else {
        XSRETURN_IV((long) LOWORD(lresult));
    }
#line 1078 "Listbox.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Win32__GUI__Listbox_ResetContent); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_ResetContent)
{
    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 496 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_RESETCONTENT, (WPARAM) 0, (LPARAM) 0);
#line 1108 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_SelectString); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_SelectString)
{
    dVAR; dXSARGS;
    if (items < 2 || items > 3)
       croak_xs_usage(cv,  "handle, string, index=-1");
    {
	HWND	handle;
	LPCTSTR	string = (LPCTSTR)SvPV_nolen(ST(1))
;
	long	index;
	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 < 3)
	    index = -1;
	else {
	    index = (long)SvIV(ST(2))
;
	}
#line 509 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_SELECTSTRING, (WPARAM) index, (LPARAM) string);
#line 1148 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_SelItemRange); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_SelItemRange)
{
    dVAR; dXSARGS;
    if (items < 3 || items > 4)
       croak_xs_usage(cv,  "handle, first, last, flag=TRUE");
    {
	HWND	handle;
	int	first = (int)SvIV(ST(1))
;
	int	last = (int)SvIV(ST(2))
;
	BOOL	flag;
	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 < 4)
	    flag = TRUE;
	else {
	    flag = (BOOL)SvIV(ST(3))
;
	}
#line 523 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_SELITEMRANGE, (WPARAM) flag, (LPARAM) MAKELPARAM(first, last));
#line 1190 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_SelItemRangeEx); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_SelItemRangeEx)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "handle, first, last");
    {
	HWND	handle;
	int	first = (int)SvIV(ST(1))
;
	int	last = (int)SvIV(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 536 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_SELITEMRANGEEX, (WPARAM) first, (LPARAM) last);
#line 1224 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_SetAnchorIndex); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_SetAnchorIndex)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, index");
    {
	HWND	handle;
	int	index = (int)SvIV(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 548 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_SETANCHORINDEX, (WPARAM) index, (LPARAM) 0);
#line 1256 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_SetCaretIndex); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_SetCaretIndex)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, index");
    {
	HWND	handle;
	int	index = (int)SvIV(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 560 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_SETCARETINDEX, (WPARAM) index, (LPARAM) 0);
#line 1288 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_SetColumnWidth); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_SetColumnWidth)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, index");
    {
	HWND	handle;
	int	index = (int)SvIV(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 572 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_SETCOLUMNWIDTH, (WPARAM) index, (LPARAM) 0);
#line 1320 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_SetCount); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_SetCount)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, index");
    {
	HWND	handle;
	int	index = (int)SvIV(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 584 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_SETCOUNT, (WPARAM) index, (LPARAM) 0);
#line 1352 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_SetCurSel); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_SetCurSel)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items != 2)
       croak_xs_usage(cv,  "handle, index");
    {
	HWND	handle;
	int	index = (int)SvIV(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 601 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_SETCURSEL, (WPARAM) index, (LPARAM) 0);
#line 1385 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_SetHorizontalExtent); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_SetHorizontalExtent)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, index");
    {
	HWND	handle;
	int	index = (int)SvIV(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 613 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_SETHORIZONTALEXTENT, (WPARAM) index, (LPARAM) 0);
#line 1417 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_SetItemHeight); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_SetItemHeight)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "handle, index, cy");
    {
	HWND	handle;
	int	index = (int)SvIV(ST(1))
;
	int	cy = (int)SvIV(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 628 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_SETITEMHEIGHT, (WPARAM) index, (LPARAM) MAKELPARAM(cy, 0));
#line 1451 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_SetLocal); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_SetLocal)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, index");
    {
	HWND	handle;
	int	index = (int)SvIV(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 640 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_SETLOCALE, (WPARAM) index, (LPARAM) 0 );
#line 1483 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_SetSel); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_SetSel)
{
    dVAR; dXSARGS;
    if (items < 2 || items > 3)
       croak_xs_usage(cv,  "handle, index, flag=TRUE");
    {
	HWND	handle;
	int	index = (int)SvIV(ST(1))
;
	BOOL	flag;
	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 < 3)
	    flag = TRUE;
	else {
	    flag = (BOOL)SvIV(ST(2))
;
	}
#line 653 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_SETSEL, (WPARAM) flag, (LPARAM) index );
#line 1523 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_SetTabStops); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_SetTabStops)
{
    dVAR; dXSARGS;
    if (items < 2)
       croak_xs_usage(cv,  "handle, tab, ...");
    {
	HWND	handle;
	UINT	tab = (UINT)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 665 "Listbox.xs"
    DWORD * pBuf = (DWORD *) safemalloc((items-1) * sizeof(DWORD));
    for (int i = 1; i < items; i++)
        pBuf[i-1] = (DWORD)SvIV(ST(i));
    RETVAL = SendMessage(handle, LB_SETTABSTOPS, items-1, (LPARAM) pBuf);
    safefree(pBuf);
#line 1559 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_SetTopIndex); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_SetTopIndex)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, index");
    {
	HWND	handle;
	int	index = (int)SvIV(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 681 "Listbox.xs"
    RETVAL = SendMessage(handle, LB_SETTOPINDEX, (WPARAM) index, (LPARAM) 0 );
#line 1591 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_Add); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_Add)
{
    dVAR; dXSARGS;
    if (items < 1)
       croak_xs_usage(cv,  "handle, ...");
    {
	HWND	handle;
#line 696 "Listbox.xs"
    int i;
#line 1609 "Listbox.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 698 "Listbox.xs"
    for(i = 1; i < items; i++) {
        SendMessage(handle, LB_ADDSTRING, 0, (LPARAM) (LPCTSTR) SvPV_nolen(ST(i)));
    }
#line 1624 "Listbox.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Win32__GUI__Listbox_ItemHeight); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_ItemHeight)
{
    dVAR; dXSARGS;
    if (items < 1 || items > 2)
       croak_xs_usage(cv,  "handle, height=-1");
    {
	HWND	handle;
	long	height;
	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)
	    height = -1;
	else {
	    height = (long)SvIV(ST(1))
;
	}
#line 710 "Listbox.xs"
    if(items == 1) {
        RETVAL = SendMessage(handle, LB_GETITEMHEIGHT, 0, 0);
    } else {
        RETVAL = SendMessage(handle, LB_SETITEMHEIGHT, 0, MAKELPARAM(height, 0));
    }
#line 1664 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__Listbox_FirstVisibleItem); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__Listbox_FirstVisibleItem)
{
    dVAR; dXSARGS;
    if (items < 1 || items > 2)
       croak_xs_usage(cv,  "handle, index=-1");
    {
	HWND	handle;
	long	index;
	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)
	    index = -1;
	else {
	    index = (long)SvIV(ST(1))
;
	}
#line 726 "Listbox.xs"
    if(items == 1)
        RETVAL = SendMessage(handle, LB_GETTOPINDEX, 0, 0);
    else
        RETVAL = SendMessage(handle, LB_SETTOPINDEX, (WPARAM) index, 0);
#line 1705 "Listbox.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

#ifdef __cplusplus
extern "C"
#endif
XS_EXTERNAL(boot_Win32__GUI__Listbox); /* prototype to pass -Wmissing-prototypes */
XS_EXTERNAL(boot_Win32__GUI__Listbox)
{
#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::Listbox::AddFile", XS_Win32__GUI__Listbox_AddFile);
        newXS_deffile("Win32::GUI::Listbox::AddString", XS_Win32__GUI__Listbox_AddString);
        cv = newXS_deffile("Win32::GUI::Listbox::DeleteString", XS_Win32__GUI__Listbox_DeleteString);
        XSANY.any_i32 = 0;
        cv = newXS_deffile("Win32::GUI::Listbox::RemoveItem", XS_Win32__GUI__Listbox_DeleteString);
        XSANY.any_i32 = 1;
        newXS_deffile("Win32::GUI::Listbox::Dir", XS_Win32__GUI__Listbox_Dir);
        newXS_deffile("Win32::GUI::Listbox::FindString", XS_Win32__GUI__Listbox_FindString);
        newXS_deffile("Win32::GUI::Listbox::FindStringExact", XS_Win32__GUI__Listbox_FindStringExact);
        newXS_deffile("Win32::GUI::Listbox::GetAnchorIndex", XS_Win32__GUI__Listbox_GetAnchorIndex);
        newXS_deffile("Win32::GUI::Listbox::GetCaretIndex", XS_Win32__GUI__Listbox_GetCaretIndex);
        cv = newXS_deffile("Win32::GUI::Listbox::Count", XS_Win32__GUI__Listbox_GetCount);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Win32::GUI::Listbox::GetCount", XS_Win32__GUI__Listbox_GetCount);
        XSANY.any_i32 = 0;
        cv = newXS_deffile("Win32::GUI::Listbox::GetCurSel", XS_Win32__GUI__Listbox_GetCurSel);
        XSANY.any_i32 = 0;
        cv = newXS_deffile("Win32::GUI::Listbox::ListIndex", XS_Win32__GUI__Listbox_GetCurSel);
        XSANY.any_i32 = 2;
        cv = newXS_deffile("Win32::GUI::Listbox::SelectedItem", XS_Win32__GUI__Listbox_GetCurSel);
        XSANY.any_i32 = 1;
        newXS_deffile("Win32::GUI::Listbox::GetHorizontalExtent", XS_Win32__GUI__Listbox_GetHorizontalExtent);
        newXS_deffile("Win32::GUI::Listbox::GetItemHeight", XS_Win32__GUI__Listbox_GetItemHeight);
        newXS_deffile("Win32::GUI::Listbox::GetItemRect", XS_Win32__GUI__Listbox_GetItemRect);
        newXS_deffile("Win32::GUI::Listbox::GetLocale", XS_Win32__GUI__Listbox_GetLocale);
        newXS_deffile("Win32::GUI::Listbox::GetSel", XS_Win32__GUI__Listbox_GetSel);
        cv = newXS_deffile("Win32::GUI::Listbox::GetSelCount", XS_Win32__GUI__Listbox_GetSelCount);
        XSANY.any_i32 = 0;
        cv = newXS_deffile("Win32::GUI::Listbox::SelectCount", XS_Win32__GUI__Listbox_GetSelCount);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Win32::GUI::Listbox::GetSelItems", XS_Win32__GUI__Listbox_GetSelItems);
        XSANY.any_i32 = 0;
        cv = newXS_deffile("Win32::GUI::Listbox::SelectedItems", XS_Win32__GUI__Listbox_GetSelItems);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Win32::GUI::Listbox::GetString", XS_Win32__GUI__Listbox_GetText);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Win32::GUI::Listbox::GetText", XS_Win32__GUI__Listbox_GetText);
        XSANY.any_i32 = 0;
        newXS_deffile("Win32::GUI::Listbox::GetTextLen", XS_Win32__GUI__Listbox_GetTextLen);
        newXS_deffile("Win32::GUI::Listbox::GetTopIndex", XS_Win32__GUI__Listbox_GetTopIndex);
        cv = newXS_deffile("Win32::GUI::Listbox::InsertItem", XS_Win32__GUI__Listbox_InsertString);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Win32::GUI::Listbox::InsertString", XS_Win32__GUI__Listbox_InsertString);
        XSANY.any_i32 = 0;
        newXS_deffile("Win32::GUI::Listbox::ItemFromPoint", XS_Win32__GUI__Listbox_ItemFromPoint);
        cv = newXS_deffile("Win32::GUI::Listbox::Clear", XS_Win32__GUI__Listbox_ResetContent);
        XSANY.any_i32 = 2;
        cv = newXS_deffile("Win32::GUI::Listbox::Reset", XS_Win32__GUI__Listbox_ResetContent);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Win32::GUI::Listbox::ResetContent", XS_Win32__GUI__Listbox_ResetContent);
        XSANY.any_i32 = 0;
        newXS_deffile("Win32::GUI::Listbox::SelectString", XS_Win32__GUI__Listbox_SelectString);
        newXS_deffile("Win32::GUI::Listbox::SelItemRange", XS_Win32__GUI__Listbox_SelItemRange);
        newXS_deffile("Win32::GUI::Listbox::SelItemRangeEx", XS_Win32__GUI__Listbox_SelItemRangeEx);
        newXS_deffile("Win32::GUI::Listbox::SetAnchorIndex", XS_Win32__GUI__Listbox_SetAnchorIndex);
        newXS_deffile("Win32::GUI::Listbox::SetCaretIndex", XS_Win32__GUI__Listbox_SetCaretIndex);
        newXS_deffile("Win32::GUI::Listbox::SetColumnWidth", XS_Win32__GUI__Listbox_SetColumnWidth);
        newXS_deffile("Win32::GUI::Listbox::SetCount", XS_Win32__GUI__Listbox_SetCount);
        cv = newXS_deffile("Win32::GUI::Listbox::Select", XS_Win32__GUI__Listbox_SetCurSel);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Win32::GUI::Listbox::SetCurSel", XS_Win32__GUI__Listbox_SetCurSel);
        XSANY.any_i32 = 0;
        newXS_deffile("Win32::GUI::Listbox::SetHorizontalExtent", XS_Win32__GUI__Listbox_SetHorizontalExtent);
        newXS_deffile("Win32::GUI::Listbox::SetItemHeight", XS_Win32__GUI__Listbox_SetItemHeight);
        newXS_deffile("Win32::GUI::Listbox::SetLocal", XS_Win32__GUI__Listbox_SetLocal);
        newXS_deffile("Win32::GUI::Listbox::SetSel", XS_Win32__GUI__Listbox_SetSel);
        newXS_deffile("Win32::GUI::Listbox::SetTabStops", XS_Win32__GUI__Listbox_SetTabStops);
        newXS_deffile("Win32::GUI::Listbox::SetTopIndex", XS_Win32__GUI__Listbox_SetTopIndex);
        newXS_deffile("Win32::GUI::Listbox::Add", XS_Win32__GUI__Listbox_Add);
        newXS_deffile("Win32::GUI::Listbox::ItemHeight", XS_Win32__GUI__Listbox_ItemHeight);
        newXS_deffile("Win32::GUI::Listbox::FirstVisibleItem", XS_Win32__GUI__Listbox_FirstVisibleItem);
#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
}

