/*
-----------------------------------------------------------------------------
This source file is part of OpenSpace3D
For the latest info, see http://www.openspace3d.com

Copyright (c) 2011 I-maginer

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA, or go to
http://www.gnu.org/copyleft/lesser.txt
-----------------------------------------------------------------------------
*/

#ifndef _SCOL_EMBEDDED_WEB_NAVIGATOR_V8_CONTEXT_
#define _SCOL_EMBEDDED_WEB_NAVIGATOR_V8_CONTEXT_

#include "embeddedWebNavigatorPrerequisites.h"

/** \defgroup grpWebNavigatorJSBinding Web navigator JavaScript binding reflexives functions
 *  Callbacks related to browser JavaScript binding
 *  @{
 */
/** @} */

/** \ingroup grpWebNavigatorJSBinding
 * \brief WebNavigatorCbOnJSBinding : Called for adding values to a frame's JavaScript 'window' object.
 *
 * <b>Prototype:</b> TODO OBJWEBNAVIGATORSCOL
 * \param OBJWEBNAVIGATORSCOL : The object on which we want to catch the event
 * \param fun [OBJWEBNAVIGATORSCOL u0] u1 : Scol function to call
 * \param u0 : Optionnal user parameter
 *
 * \return OBJWEBNAVIGATORSCOL : Web navigator object if success
 */
int WebNavigatorCbOnJSBinding(mmachine m);

/** \ingroup grpWebNavigatorJSBinding
 * \brief WebNavigatorCbOnExternalCall : Called when a javascript external called is performed
 *
 * <b>Prototype:</b> fun [ObjWebNavigator fun [ObjWebNavigator u0 S [S r1 ]] u1 u0] ObjWebNavigator
 * \param OBJWEBNAVIGATORSCOL : The object on which we want to catch the event
 * \param fun [ObjWebNavigator u0 S [S r1 ]] u1 : Scol function to call
 * \param u0 : Optionnal user parameter
 *
 * \return OBJWEBNAVIGATORSCOL : Web navigator object if success
 */
int WebNavigatorCbOnExternalCall(mmachine m);

/**
 * Execute the WEB_NAVIGATOR_JS_ON_EXTERNAL_CALL_CB reflexive function
 * \param m : Current machine
 * \param hwnd : Main scol window
 * \param msg : Window message
 * \param wParam : WebNavigator pointer
 * \param lParam : data pointer
 * \param ret : user parameter
 */
int FireWebNavigatorReflexiveOnExternalCall(mmachine m, ScolWindowHandle hwnd, unsigned int msg, UINT wParam, LONG lParam, int* ret);

/** \ingroup grpWebNavigatorJSBinding
 * \brief WebNavigatorCbOnExternalCallStr : Called when a javascript external called is performed
 *
 * <b>Prototype:</b> fun [ObjWebNavigator fun [ObjWebNavigator u0 S [S r1]] S u0] ObjWebNavigator
 * \param OBJWEBNAVIGATORSCOL : The object on which we want to catch the event
 * \param fun [ObjWebNavigator u0 S [S r1]] S : Scol function to call, must return a scol string as result
 * \param u0 : Optionnal user parameter
 *
 * \return OBJWEBNAVIGATORSCOL : Web navigator object if success
 */
int WebNavigatorCbOnExternalCallStr(mmachine m);

/**
 * Execute the WEB_NAVIGATOR_JS_ON_EXTERNAL_CALL_STR_CB reflexive function
 * \param m : Current machine
 * \param hwnd : Main scol window
 * \param msg : Window message
 * \param wParam : WebNavigator pointer
 * \param lParam : data pointer
 * \param ret : user parameter
 */
int FireWebNavigatorReflexiveOnExternalCallStr(mmachine m, ScolWindowHandle hwnd, unsigned int msg, UINT wParam, LONG lParam, int* ret);


// Everything inside _cond and _endcond is ignored by doxygen
//! \cond

/**
 * \brief Load the WebNavigatorJSBinding package in Scol virtual machine
 * \param mmachine : the scol machine
 */
int LoadWebNavigatorJSBinding(mmachine m);

//! \endcond

#endif
