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

#line 1 "MDI.xs"
    /*
    ###########################################################################
    # Win32::GUI Mutiple Document Interface
    #
    # $Id: MDI.xs,v 1.4 2010/04/08 21:26:48 jwgui Exp $
    #
    ###########################################################################
    */

#include "GUI.h"

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

void 
MDIFrame_onPreCreate(NOTXSPROC LPPERLWIN32GUI_CREATESTRUCT perlcs) {

    perlcs->cs.lpszClass = "PerlWin32GUI_MDIFrame";
    perlcs->cs.style     = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
    perlcs->dwPlStyle    = PERLWIN32GUI_MDIFRAME;
}

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

    return Window_onParseOption(NOTXSCALL option, value, perlcs);
}

void 
MDIFrame_onPostCreate(NOTXSPROC HWND myhandle, LPPERLWIN32GUI_CREATESTRUCT perlcs) {

    Window_onPostCreate(NOTXSCALL myhandle, perlcs);
}

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

    return Window_onParseEvent(NOTXSCALL name, eventID);
}

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

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

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

void
MDIClient_onPreCreate(NOTXSPROC LPPERLWIN32GUI_CREATESTRUCT perlcs) {

    static CLIENTCREATESTRUCT ccs;

    perlcs->cs.lpszClass = "MDICLIENT";
    perlcs->cs.style = WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL;
  
    perlcs->cs.lpCreateParams = &ccs;
    ccs.idFirstChild = 5000;
    ccs.hWindowMenu  = 0;
}

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

    BOOL retval = TRUE;

    if(perlcs->cs.lpCreateParams != NULL) {
        LPCLIENTCREATESTRUCT ccs = (LPCLIENTCREATESTRUCT) perlcs->cs.lpCreateParams;

        if(strcmp(option, "-firstchild") == 0) {
            ccs->idFirstChild = (UINT)SvIV(value);
        } else if(strcmp(option, "-windowmenu") == 0) {
            ccs->hWindowMenu = handle_From(NOTXSCALL value);
        } else retval = FALSE;
    } else retval = FALSE;

    return retval;
}

void
MDIClient_onPostCreate(NOTXSPROC HWND myhandle, LPPERLWIN32GUI_CREATESTRUCT perlcs) {

    // Register Client handler into parent data
    if (perlcs->hvParent != NULL) {
        LPPERLWIN32GUI_USERDATA parentud;
        parentud = (LPPERLWIN32GUI_USERDATA) GetWindowLongPtr(perlcs->cs.hwndParent, GWLP_USERDATA);

        if (parentud->dwPlStyle & PERLWIN32GUI_MDIFRAME &&
            !(parentud->dwPlStyle & PERLWIN32GUI_HAVECHILDWINDOW)) {
            parentud->dwPlStyle |= PERLWIN32GUI_HAVECHILDWINDOW;
            parentud->dwData = PTR2IV(myhandle);
        }
    }
}

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

int
MDIClient_onEvent (NOTXSPROC LPPERLWIN32GUI_USERDATA perlud, UINT uMsg, WPARAM wParam, LPARAM lParam) {
    return 1;
}

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

void 
MDIChild_onPreCreate(NOTXSPROC LPPERLWIN32GUI_CREATESTRUCT perlcs) {

    perlcs->cs.lpszClass = "PerlWin32GUI_MDIChild";
    perlcs->cs.lpszName  = "Untitled";
    perlcs->cs.style     = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
    perlcs->cs.dwExStyle = WS_EX_MDICHILD;
    perlcs->cs.x         = CW_USEDEFAULT;
    perlcs->cs.y         = CW_USEDEFAULT;
    perlcs->cs.cx        = CW_USEDEFAULT;
    perlcs->cs.cy        = CW_USEDEFAULT;
    perlcs->dwPlStyle    = PERLWIN32GUI_MDICHILD; 
}

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

    return Window_onParseOption(NOTXSCALL option, value, perlcs);
}

void 
MDIChild_onPostCreate(NOTXSPROC HWND myhandle, LPPERLWIN32GUI_CREATESTRUCT perlcs) {

    Window_onPostCreate(NOTXSCALL myhandle, perlcs);
}

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

    BOOL retval = TRUE;

         if Parse_Event("Deactivate", PERLWIN32GUI_NEM_CONTROL1)
    else if Parse_Event("Activate",   PERLWIN32GUI_NEM_CONTROL2)
    else if Parse_Event("Terminate",  PERLWIN32GUI_NEM_CONTROL3)
    else if Parse_Event("Minimize",   PERLWIN32GUI_NEM_CONTROL4)
    else if Parse_Event("Maximize",   PERLWIN32GUI_NEM_CONTROL5)
    else if Parse_Event("Resize",     PERLWIN32GUI_NEM_CONTROL6)
    else if Parse_Event("Scroll",     PERLWIN32GUI_NEM_CONTROL7)
    else if Parse_Event("GotFocus",   PERLWIN32GUI_NEM_GOTFOCUS)
    else retval = FALSE;

    return retval;
}

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

    int PerlResult = 1;

    switch (uMsg) {

    case WM_MDIACTIVATE :

        if( perlud->dwData == PTR2IV(wParam) ) {
            /*
             * (@)EVENT:Deactivate()
             * Sent when the window is deactivated.
             * (@)APPLIES_TO:MDIChild
             */  
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL1, "Deactivate", -1 );
        } else {
            /*
             * (@)EVENT:Activate()
             * Sent when the window is activated.
             * (@)APPLIES_TO:MDIChild
             */ 
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL2, "Activate", -1 );
        }        
        break;

    case WM_SETFOCUS:

        PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_GOTFOCUS, "GotFocus", -1 );
        // Force SetFocus on first child if not handle
        if ( !(perlud->dwPlStyle & PERLWIN32GUI_EVENTHANDLING) ) {
            HWND child = GetWindow(INT2PTR(HWND, perlud->dwData), GW_CHILD);
            if (child) {
                SetFocus(child);
            }
        }
        PerlResult = 1; // Always go to default child procedure
        break;

    case WM_SYSCOMMAND:

        switch(wParam & 0xFFF0) {
        case SC_CLOSE:
            /*
             * (@)EVENT:Terminate()
             * Sent when the window is closed.
             * The event should return -1 to terminate the interaction
             * and return control to the perl script; see Dialog().
             * (@)APPLIES_TO:Window, DialogBox
             */
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL3, "Terminate", -1 );
            break;
        case SC_MINIMIZE:
            /*
             * (@)EVENT:Minimize()
             * Sent when the window is minimized.
             * (@)APPLIES_TO:Window, DialogBox
             */ 
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL4, "Minimize", -1 );
            break;
        case SC_MAXIMIZE:
            /*
             * (@)EVENT:Maximize()
             * Sent when the window is maximized.
             * (@)APPLIES_TO:Window, DialogBox
             */
            PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL5, "Maximize", -1 );
            PerlResult = 1; // Always go to default child procedure
            break;
        }
        break;

    case WM_SIZE:

        /*
         * (@)EVENT:Resize()
         * Sent when the window is resized.
         * (@)APPLIES_TO:Window, DialogBox
         */
        PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL6, "Resize", -1 );
        PerlResult = 1; // Always go to default child procedure
        break;

    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
         *
         * Related messages: WM_HSCROLL, WM_VSCROLL
         * (@)APPLIES_TO:Window, DialogBox
         */
        PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL7, "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 282 "MDI.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 426 "MDI.c"
#pragma message( "*** PACKAGE Win32::GUI::MDIFrame..." )
#pragma message( "*** PACKAGE Win32::GUI::MDIClient..." )

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

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

    if(SvROK(ST(1))) {
        SV** out=hv_fetch((HV*)SvRV(ST(1)), "-handle", 7, 0);
        if(out != NULL)
            child = INT2PTR(HWND,SvIV(*out));
        else
            child = NULL;
    } else
       child = INT2PTR(HWND,SvIV(ST(1)))
;
#line 298 "MDI.xs"
    RETVAL = SendMessage(handle, WM_MDIACTIVATE, (WPARAM) child, 0);
#line 463 "MDI.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__MDIClient_Cascade); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__MDIClient_Cascade)
{
    dVAR; dXSARGS;
    if (items < 1 || items > 2)
       croak_xs_usage(cv,  "handle, flag=MDITILE_SKIPDISABLED");
    {
	HWND	handle;
	UINT	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 < 2)
	    flag = MDITILE_SKIPDISABLED;
	else {
	    flag = (UINT)SvUV(ST(1))
;
	}
#line 310 "MDI.xs"
    RETVAL = SendMessage(handle, WM_MDICASCADE, (WPARAM) flag, 0);
#line 501 "MDI.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


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

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

    if(SvROK(ST(1))) {
        SV** out=hv_fetch((HV*)SvRV(ST(1)), "-handle", 7, 0);
        if(out != NULL)
            child = INT2PTR(HWND,SvIV(*out));
        else
            child = NULL;
    } else
       child = INT2PTR(HWND,SvIV(ST(1)))
;
#line 322 "MDI.xs"
    RETVAL = SendMessage(handle, WM_MDIDESTROY, (WPARAM) child, 0);
#line 542 "MDI.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__MDIClient_GetActive); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__MDIClient_GetActive)
{
    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 333 "MDI.xs"
    RETVAL = (HWND) SendMessage(handle, WM_MDIGETACTIVE, 0, 0);
#line 572 "MDI.c"
	XSprePUSH;
	PUSHi(PTR2IV(RETVAL));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__MDIClient_IconArrange); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__MDIClient_IconArrange)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, child");
    {
	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 344 "MDI.xs"
    RETVAL = SendMessage(handle, WM_MDIICONARRANGE, 0, 0);
#line 602 "MDI.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


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

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

    if(SvROK(ST(1))) {
        SV** out=hv_fetch((HV*)SvRV(ST(1)), "-handle", 7, 0);
        if(out != NULL)
            child = INT2PTR(HWND,SvIV(*out));
        else
            child = NULL;
    } else
       child = INT2PTR(HWND,SvIV(ST(1)))
;
#line 356 "MDI.xs"
    RETVAL = SendMessage(handle, WM_MDIMAXIMIZE, (WPARAM) child, 0);
#line 643 "MDI.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__MDIClient_Next); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__MDIClient_Next)
{
    dVAR; dXSARGS;
    if (items < 1 || items > 2)
       croak_xs_usage(cv,  "handle, child=(HWND)NULL");
    {
	HWND	handle;
	HWND	child;
	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)
	    child = (HWND)NULL;
	else {
    if(SvROK(ST(1))) {
	SV** out=hv_fetch((HV*)SvRV(ST(1)), "-handle", 7, 0);
	if(out != NULL)
	    child = INT2PTR(HWND,SvIV(*out));
	else
	    child = NULL;
    } else
       child = INT2PTR(HWND,SvIV(ST(1)))
;
	}
#line 368 "MDI.xs"
    RETVAL = SendMessage(handle, WM_MDINEXT, (WPARAM) child, 0);
#line 688 "MDI.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__MDIClient_Previous); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__MDIClient_Previous)
{
    dVAR; dXSARGS;
    if (items < 1 || items > 2)
       croak_xs_usage(cv,  "handle, child=(HWND)NULL");
    {
	HWND	handle;
	HWND	child;
	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)
	    child = (HWND)NULL;
	else {
    if(SvROK(ST(1))) {
	SV** out=hv_fetch((HV*)SvRV(ST(1)), "-handle", 7, 0);
	if(out != NULL)
	    child = INT2PTR(HWND,SvIV(*out));
	else
	    child = NULL;
    } else
       child = INT2PTR(HWND,SvIV(ST(1)))
;
	}
#line 380 "MDI.xs"
    RETVAL = SendMessage(handle, WM_MDINEXT, (WPARAM) child, 1);
#line 733 "MDI.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__MDIClient_RefreshMenu); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__MDIClient_RefreshMenu)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    {
	HWND	handle;
#line 391 "MDI.xs"
    HWND frame;
#line 751 "MDI.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 393 "MDI.xs"
    frame = (HWND) SendMessage(handle, WM_MDIREFRESHMENU, 0, 0);
    if (frame != NULL)
        RETVAL = DrawMenuBar(frame);
    else
        RETVAL = FALSE;
#line 770 "MDI.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


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

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

    if(SvROK(ST(1))) {
        SV** out=hv_fetch((HV*)SvRV(ST(1)), "-handle", 7, 0);
        if(out != NULL)
            child = INT2PTR(HWND,SvIV(*out));
        else
            child = NULL;
    } else
       child = INT2PTR(HWND,SvIV(ST(1)))
;
#line 409 "MDI.xs"
    RETVAL = SendMessage(handle, WM_MDIRESTORE, (WPARAM) child, 0);
#line 811 "MDI.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Win32__GUI__MDIClient_Tile); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Win32__GUI__MDIClient_Tile)
{
    dVAR; dXSARGS;
    if (items < 1 || items > 2)
       croak_xs_usage(cv,  "handle, flag=MDITILE_HORIZONTAL");
    {
	HWND	handle;
	UINT	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 < 2)
	    flag = MDITILE_HORIZONTAL;
	else {
	    flag = (UINT)SvUV(ST(1))
;
	}
#line 428 "MDI.xs"
    RETVAL = SendMessage(handle, WM_MDITILE, (WPARAM) flag, 0);
#line 849 "MDI.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

#pragma message( "*** PACKAGE Win32::GUI::MDIChild..." )
#ifdef __cplusplus
extern "C" {
#endif
XS_EXTERNAL(boot_Win32__GUI__MDI); /* prototype to pass -Wmissing-prototypes */
XS_EXTERNAL(boot_Win32__GUI__MDI)
{
#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::MDIClient::Activate", XS_Win32__GUI__MDIClient_Activate);
        newXS_deffile("Win32::GUI::MDIClient::Cascade", XS_Win32__GUI__MDIClient_Cascade);
        newXS_deffile("Win32::GUI::MDIClient::Close", XS_Win32__GUI__MDIClient_Close);
        newXS_deffile("Win32::GUI::MDIClient::GetActive", XS_Win32__GUI__MDIClient_GetActive);
        newXS_deffile("Win32::GUI::MDIClient::IconArrange", XS_Win32__GUI__MDIClient_IconArrange);
        newXS_deffile("Win32::GUI::MDIClient::Maximize", XS_Win32__GUI__MDIClient_Maximize);
        newXS_deffile("Win32::GUI::MDIClient::Next", XS_Win32__GUI__MDIClient_Next);
        newXS_deffile("Win32::GUI::MDIClient::Previous", XS_Win32__GUI__MDIClient_Previous);
        newXS_deffile("Win32::GUI::MDIClient::RefreshMenu", XS_Win32__GUI__MDIClient_RefreshMenu);
        newXS_deffile("Win32::GUI::MDIClient::Restore", XS_Win32__GUI__MDIClient_Restore);
        newXS_deffile("Win32::GUI::MDIClient::Tile", XS_Win32__GUI__MDIClient_Tile);
#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
