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

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

#include "GUI.h"


void 
DateTime_onPreCreate(NOTXSPROC LPPERLWIN32GUI_CREATESTRUCT perlcs) {

    perlcs->cs.lpszClass = DATETIMEPICK_CLASS;
    perlcs->cs.style = WS_VISIBLE | WS_CHILD;
}

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

    BOOL retval = TRUE;

    if(strcmp(option, "-align") == 0) {
        if(strcmp(SvPV_nolen(value), "left") == 0) {
            SwitchBit(perlcs->cs.style, DTS_RIGHTALIGN, 0);
        } else if(strcmp(SvPV_nolen(value), "right") == 0) {
            SwitchBit(perlcs->cs.style, DTS_RIGHTALIGN, 1);
        } else {
            W32G_WARN("Win32::GUI: Invalid value for -align!");
        }
    } 
    else if(strcmp(option, "-format") == 0) {
        if(strcmp(SvPV_nolen(value), "shortdate") == 0) {
            SwitchBit(perlcs->cs.style, DTS_LONGDATEFORMAT,  0);
            SwitchBit(perlcs->cs.style, DTS_TIMEFORMAT,      0);
            SwitchBit(perlcs->cs.style, DTS_SHORTDATEFORMAT, 1);
        } else if(strcmp(SvPV_nolen(value), "longdate") == 0) {
            SwitchBit(perlcs->cs.style, DTS_TIMEFORMAT,      0);
            SwitchBit(perlcs->cs.style, DTS_SHORTDATEFORMAT, 0);
            SwitchBit(perlcs->cs.style, DTS_LONGDATEFORMAT,  1);
        } else if(strcmp(SvPV_nolen(value), "time") == 0) {
            SwitchBit(perlcs->cs.style, DTS_LONGDATEFORMAT,  0);
            SwitchBit(perlcs->cs.style, DTS_SHORTDATEFORMAT, 0);
            SwitchBit(perlcs->cs.style, DTS_TIMEFORMAT,      1);
        } else {
            W32G_WARN("Win32::GUI: Invalid value for -format!");
        }
    } else if BitmaskOptionValue("-shownone", perlcs->cs.style, DTS_SHOWNONE)
    } else if BitmaskOptionValue("-updown", perlcs->cs.style,   DTS_UPDOWN)
    } else retval = FALSE;

    return retval;
}

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

BOOL
DateTime_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("CloseUp",    PERLWIN32GUI_NEM_CONTROL1)
    else if Parse_Event("Change",     PERLWIN32GUI_NEM_CONTROL2)
    else if Parse_Event("DropDown",   PERLWIN32GUI_NEM_CONTROL3)
    else retval = FALSE;

    return retval;
}

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

    int PerlResult = 1;

    if ( uMsg == WM_NOTIFY ) {

        LPNMHDR notify = (LPNMHDR) lParam;
        switch(notify->code) {
        case DTN_CLOSEUP:
            /*
             * (@)EVENT:CloseUp()
             * Sent when the user closes the drop-down month calendar. .
             * (@)APPLIES_TO:DateTime
             */ 
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL1, "CloseUp", -1 );
            break;
        case DTN_DATETIMECHANGE:
            /*
             * (@)EVENT:Change()
             * Sent when the datetime change. .
             * (@)APPLIES_TO:DateTime
             */ 
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL2, "Change", -1 );
            break;
        case DTN_DROPDOWN:
            /*
             * (@)EVENT:DropDown()
             * Sent when the user activates the drop-down month calendar..
             * (@)APPLIES_TO:DateTime
             */ 
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL3, "DropDown", -1 );
            break;
        }
    }

    return PerlResult;
}



#line 127 "DateTime.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 271 "DateTime.c"
#pragma message( "*** PACKAGE Win32::GUI::DateTime..." )

XS_EUPXS(XS_Win32__GUI__DateTime_GetMonthCal); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__DateTime_GetMonthCal)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    {
	HWND	handle;
	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 131 "DateTime.xs"
    RETVAL = (HWND) DateTime_GetMonthCal(handle);
#line 296 "DateTime.c"
	XSprePUSH;
	PUSHi(PTR2IV(RETVAL));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__DateTime_GetMonthCalColor); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__DateTime_GetMonthCalColor)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, icolor");
    {
	HWND	handle;
	int	icolor = (int)SvIV(ST(1))
;
	COLORREF	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 152 "DateTime.xs"
    RETVAL = (COLORREF)DateTime_GetMonthCalColor(handle, icolor);
#line 328 "DateTime.c"
	XSprePUSH;
	PUSHi((IV) RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__DateTime_GetMonthCalFont); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__DateTime_GetMonthCalFont)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    {
	HWND	handle;
	HFONT	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 163 "DateTime.xs"
    RETVAL = (HFONT) DateTime_GetMonthCalFont(handle);
#line 358 "DateTime.c"
	XSprePUSH;
	PUSHi(PTR2IV(RETVAL));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__DateTime_GetSystemTime); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__DateTime_GetSystemTime)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	HWND	handle;
#line 180 "DateTime.xs"
    SYSTEMTIME st;
#line 379 "DateTime.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 182 "DateTime.xs"
    if(DateTime_GetSystemtime(handle, &st) == GDT_VALID) {
        EXTEND(SP, 8);
        XST_mIV(0, st.wYear);
        XST_mIV(1, st.wMonth);
        XST_mIV(2, st.wDay);
        XST_mIV(3, st.wDayOfWeek);
        XST_mIV(4, st.wHour);
        XST_mIV(5, st.wMinute);
        XST_mIV(6, st.wSecond);
        XST_mIV(7, st.wMilliseconds);
        XSRETURN(8);
    } else {
        XSRETURN_UNDEF;
    }
#line 405 "DateTime.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Win32__GUI__DateTime_SetFormat); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__DateTime_SetFormat)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items < 1 || items > 2)
       croak_xs_usage(cv,  "handle, format = NULL");
    {
	HWND	handle;
	LPCTSTR	format;
	BOOL	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)
	    format = NULL;
	else {
	    format = (LPCTSTR)SvPV_nolen(ST(1))
;
	}
#line 208 "DateTime.xs"
    RETVAL = DateTime_SetFormat(handle, format);
#line 443 "DateTime.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__DateTime_SetMonthCalColor); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__DateTime_SetMonthCalColor)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "handle, icolor, color");
    {
	HWND	handle;
	int	icolor = (int)SvIV(ST(1))
;
	COLORREF    color = SvCOLORREF(NOTXSCALL ST(2))
;
	HFONT	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 "DateTime.xs"
    RETVAL = (HFONT) DateTime_SetMonthCalColor(handle,icolor,color);
#line 477 "DateTime.c"
	XSprePUSH;
	PUSHi(PTR2IV(RETVAL));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__DateTime_SetMonthCalFont); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__DateTime_SetMonthCalFont)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "handle, font, flag");
    {
	HWND	handle;
	HFONT	font;
	BOOL	flag = (BOOL)SvIV(ST(2))
;
	HFONT	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)
            font = INT2PTR(HFONT,SvIV(*out));
        else
            font = NULL;
    } else
       font = INT2PTR(HFONT,SvIV(ST(1)))
;
#line 234 "DateTime.xs"
    RETVAL = (HFONT) DateTime_SetMonthCalFont(handle,font,MAKELONG(flag,0));
#line 520 "DateTime.c"
	XSprePUSH;
	PUSHi(PTR2IV(RETVAL));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__DateTime_SetSystemTime); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__DateTime_SetSystemTime)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items < 7 || items > 8)
       croak_xs_usage(cv,  "handle, year, mon, day, hour, min, sec, msec=0");
    {
	HWND	handle;
	int	year = (int)SvIV(ST(1))
;
	int	mon = (int)SvIV(ST(2))
;
	int	day = (int)SvIV(ST(3))
;
	int	hour = (int)SvIV(ST(4))
;
	int	min = (int)SvIV(ST(5))
;
	int	sec = (int)SvIV(ST(6))
;
	int	msec;
#line 257 "DateTime.xs"
    SYSTEMTIME st;
#line 552 "DateTime.c"
	BOOL	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 < 8)
	    msec = 0;
	else {
	    msec = (int)SvIV(ST(7))
;
	}
#line 259 "DateTime.xs"
    ZeroMemory(&st, sizeof(SYSTEMTIME));
    st.wYear   = year;
    st.wDay    = day;
    st.wMonth  = mon;
    st.wHour   = hour;
    st.wMinute = min;
    st.wSecond = sec;
    st.wMilliseconds = msec;

    RETVAL = DateTime_SetSystemtime(handle, GDT_VALID, &st);
#line 583 "DateTime.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__DateTime_GetDate); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__DateTime_GetDate)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	HWND	handle;
#line 283 "DateTime.xs"
    SYSTEMTIME st;
#line 603 "DateTime.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 285 "DateTime.xs"
    if(DateTime_GetSystemtime(handle, &st) == GDT_VALID) {
        EXTEND(SP, 3);
        XST_mIV(0, st.wDay);
        XST_mIV(1, st.wMonth);
        XST_mIV(2, st.wYear);
        XSRETURN(3);
    } else {
        XSRETURN_UNDEF;
    }
#line 624 "DateTime.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Win32__GUI__DateTime_SetDate); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__DateTime_SetDate)
{
    dVAR; dXSARGS;
    if (items != 4)
       croak_xs_usage(cv,  "handle, day, mon, year");
    {
	HWND	handle;
	int	day = (int)SvIV(ST(1))
;
	int	mon = (int)SvIV(ST(2))
;
	int	year = (int)SvIV(ST(3))
;
#line 305 "DateTime.xs"
    SYSTEMTIME st;
#line 647 "DateTime.c"
	BOOL	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 307 "DateTime.xs"
    ZeroMemory(&st, sizeof(SYSTEMTIME));
    st.wDay   = day;
    st.wMonth = mon;
    st.wYear  = year;
    RETVAL = DateTime_SetSystemtime(handle, GDT_VALID, &st);
#line 666 "DateTime.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__DateTime_GetTime); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__DateTime_GetTime)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	HWND	handle;
#line 323 "DateTime.xs"
    SYSTEMTIME st;
#line 686 "DateTime.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 325 "DateTime.xs"
    if(DateTime_GetSystemtime(handle, &st) == GDT_VALID) {
        EXTEND(SP, 4);
        XST_mIV(0, st.wHour);
        XST_mIV(1, st.wMinute);
        XST_mIV(2, st.wSecond);
        XST_mIV(3, st.wMilliseconds);
        XSRETURN(4);
    } else {
        XSRETURN_UNDEF;
    }
#line 708 "DateTime.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Win32__GUI__DateTime_SetTime); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__DateTime_SetTime)
{
    dVAR; dXSARGS;
    if (items < 4 || items > 5)
       croak_xs_usage(cv,  "handle, hour, min, sec, msec=0");
    {
	HWND	handle;
	int	hour = (int)SvIV(ST(1))
;
	int	min = (int)SvIV(ST(2))
;
	int	sec = (int)SvIV(ST(3))
;
	int	msec;
#line 348 "DateTime.xs"
    SYSTEMTIME st;
#line 732 "DateTime.c"
	BOOL	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 < 5)
	    msec = 0;
	else {
	    msec = (int)SvIV(ST(4))
;
	}
#line 350 "DateTime.xs"
    ZeroMemory(&st, sizeof(SYSTEMTIME));
    st.wHour   = hour;
    st.wMinute = min;
    st.wSecond = sec;
    st.wMilliseconds = msec;
    RETVAL = DateTime_SetSystemtime(handle, GDT_VALID, &st);
#line 759 "DateTime.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__DateTime_SetNone); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__DateTime_SetNone)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	HWND	handle;

    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 366 "DateTime.xs"
    DateTime_SetSystemtime(handle, GDT_NONE, NULL);
#line 789 "DateTime.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Win32__GUI__DateTime_IsNone); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__DateTime_IsNone)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    {
	HWND	handle;
#line 375 "DateTime.xs"
    SYSTEMTIME st;
#line 806 "DateTime.c"
	BOOL	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 "DateTime.xs"
    RETVAL = (DateTime_GetSystemtime(handle, &st) == GDT_NONE);
#line 821 "DateTime.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

#ifdef __cplusplus
extern "C" {
#endif
XS_EXTERNAL(boot_Win32__GUI__DateTime); /* prototype to pass -Wmissing-prototypes */
XS_EXTERNAL(boot_Win32__GUI__DateTime)
{
#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::DateTime::GetMonthCal", XS_Win32__GUI__DateTime_GetMonthCal);
        newXS_deffile("Win32::GUI::DateTime::GetMonthCalColor", XS_Win32__GUI__DateTime_GetMonthCalColor);
        newXS_deffile("Win32::GUI::DateTime::GetMonthCalFont", XS_Win32__GUI__DateTime_GetMonthCalFont);
        cv = newXS_deffile("Win32::GUI::DateTime::GetDateTime", XS_Win32__GUI__DateTime_GetSystemTime);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Win32::GUI::DateTime::GetSystemTime", XS_Win32__GUI__DateTime_GetSystemTime);
        XSANY.any_i32 = 0;
        cv = newXS_deffile("Win32::GUI::DateTime::Format", XS_Win32__GUI__DateTime_SetFormat);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Win32::GUI::DateTime::SetFormat", XS_Win32__GUI__DateTime_SetFormat);
        XSANY.any_i32 = 0;
        newXS_deffile("Win32::GUI::DateTime::SetMonthCalColor", XS_Win32__GUI__DateTime_SetMonthCalColor);
        newXS_deffile("Win32::GUI::DateTime::SetMonthCalFont", XS_Win32__GUI__DateTime_SetMonthCalFont);
        cv = newXS_deffile("Win32::GUI::DateTime::SetDateTime", XS_Win32__GUI__DateTime_SetSystemTime);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Win32::GUI::DateTime::SetSystemTime", XS_Win32__GUI__DateTime_SetSystemTime);
        XSANY.any_i32 = 0;
        newXS_deffile("Win32::GUI::DateTime::GetDate", XS_Win32__GUI__DateTime_GetDate);
        newXS_deffile("Win32::GUI::DateTime::SetDate", XS_Win32__GUI__DateTime_SetDate);
        newXS_deffile("Win32::GUI::DateTime::GetTime", XS_Win32__GUI__DateTime_GetTime);
        newXS_deffile("Win32::GUI::DateTime::SetTime", XS_Win32__GUI__DateTime_SetTime);
        newXS_deffile("Win32::GUI::DateTime::SetNone", XS_Win32__GUI__DateTime_SetNone);
        newXS_deffile("Win32::GUI::DateTime::IsNone", XS_Win32__GUI__DateTime_IsNone);
#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
}

#ifdef __cplusplus
}
#endif
