/*
-----------------------------------------------------------------------------
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_DISPLAY_
#define _SCOL_EMBEDDED_WEB_NAVIGATOR_DISPLAY_

#include "embeddedWebNavigatorPrerequisites.h"

/** \defgroup grpWebNavigatorDisplay Web navigator display pages reflexives functions
 *  Callbacks related to browser display state
 *  @{
 */
/** @} */

/** \ingroup grpWebNavigatorDisplay
 * \brief WebNavigatorCbOnNavStateChange : Called when the navigation state has changed.
 *
 * <b>Prototype:</b> fun [ObjWebNavigator fun [ObjWebNavigator u0 I I] u1 u0] ObjWebNavigator
 * \param ObjWebNavigator : The object on which we want to catch the event
 * \param fun [ObjWebNavigator u0] u1 : Scol function to call
 * \param u0 : Optionnal user parameter
 *
 * \return ObjWebNavigator : Web navigator object if success
 */
int WebNavigatorCbOnNavStateChange(mmachine m);

/**
 * Execute the WEB_NAVIGATOR_DISPLAY_ON_NAV_STATE_CHANGE_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 FireWebNavigatorReflexiveOnNavStateChange(mmachine m, ScolWindowHandle hwnd, unsigned int msg, UINT wParam, LONG lParam, int* ret);

/** \ingroup grpWebNavigatorDisplay
 * \brief WebNavigatorCbOnAddressChange : Called when a frame's address has changed.
 *
 * <b>Prototype:</b> fun [ObjWebNavigator fun [ObjWebNavigator u0 S S] u1 u0] ObjWebNavigator
 * \param ObjWebNavigator : The object on which we want to catch the event
 * \param fun [ObjWebNavigator u0 S S] u1 : Scol function to call
 * \param u0 : Optionnal user parameter
 * \param S : The name of the frame on which the address changed
 * \param S : The new url
 *
 * \return ObjWebNavigator : Web navigator object if success
 */
int WebNavigatorCbOnAddressChange(mmachine m);

/**
 * Execute the WEB_NAVIGATOR_DISPLAY_ON_ADDRESS_CHANGE_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 FireWebNavigatorReflexiveOnAddressChange(mmachine m, ScolWindowHandle hwnd, unsigned int msg, UINT wParam, LONG lParam, int* ret);

/** \ingroup grpWebNavigatorDisplay
 * \brief WebNavigatorCbOnTitleChange : Called when the page title changes
 *
 * <b>Prototype:</b> fun [ObjWebNavigator fun [ObjWebNavigator u0 S] u1 u0] ObjWebNavigator
 * \param ObjWebNavigator : The object on which we want to catch the event
 * \param fun [ObjWebNavigator u0 S] u1 : Scol function to call
 * \param u0 : Optionnal user parameter
 * \param S : The new title
 *
 * \return ObjWebNavigator : Web navigator object if success
 */
int WebNavigatorCbOnTitleChange(mmachine m);

/**
 * Execute the WEB_NAVIGATOR_DISPLAY_ON_TITLE_CHANGE_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 FireWebNavigatorReflexiveOnTitleChange(mmachine m, ScolWindowHandle hwnd, unsigned int msg, UINT wParam, LONG lParam, int* ret);

/** \ingroup grpWebNavigatorDisplay
 * \brief WebNavigatorCbOnTooltip : Called when the browser is about to display a tooltip.
 * |text| contains the text that will be displayed in the tooltip. To handle the display of the
 * tooltip yourself return true. Otherwise, you can optionally modify |text|
 * and then return false to allow the browser to display the tooltip.
 *
 * <b>Prototype:</b> fun [ObjWebNavigator fun [ObjWebNavigator u0 S] u1 u0] ObjWebNavigator
 * \param ObjWebNavigator : The object on which we want to catch the event
 * \param fun [ObjWebNavigator u0 S] u1 : Scol function to call
 * \param u0 : Optionnal user parameter
 * \param S : Tooltip text
 *
 * \return ObjWebNavigator : Web navigator object if success
 */
int WebNavigatorCbOnTooltip(mmachine m);

/**
 * Execute the WEB_NAVIGATOR_DISPLAY_ON_TOOLTIP_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 FireWebNavigatorReflexiveOnTooltip(mmachine m, ScolWindowHandle hwnd, unsigned int msg, UINT wParam, LONG lParam, int* ret);

/** \ingroup grpWebNavigatorDisplay
 * \brief WebNavigatorCbOnStatusMessage : Called when the browser receives a status message.
 * |text| contains the text that will be displayed in the status message and |type| indicates the
 * status message type.
 *
 * <b>Prototype:</b> TODO OBJWEBNAVIGATORSCOL
 * \param ObjWebNavigator : The object on which we want to catch the event
 * \param fun [ObjWebNavigator u0] u1 : Scol function to call
 * \param u0 : Optionnal user parameter
 *
 * \return ObjWebNavigator : Web navigator object if success
 */
int WebNavigatorCbOnStatusMessage(mmachine m);

/**
 * Execute the WEB_NAVIGATOR_DISPLAY_ON_STATUS_MESSAGE_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 FireWebNavigatorReflexiveOnStatusMessage(mmachine m, ScolWindowHandle hwnd, unsigned int msg, UINT wParam, LONG lParam, int* ret);

/** \ingroup grpWebNavigatorDisplay
 * \brief WebNavigatorCbOnConsoleMessage : Called to display a console message.
 * Return true to stop the message from being output to the console.
 *
 * <b>Prototype:</b> fun [ObjWebNavigator fun [ObjWebNavigator u0 S S I] u1 u0] ObjWebNavigator
 * \param ObjWebNavigator : The object on which we want to catch the event
 * \param fun [ObjWebNavigator u0 S S I] u1 : Scol function to call
 * \param u0 : Optionnal user parameter
 * \param S : Message
 * \param S : Source file
 * \param I : File line
 *
 * \return ObjWebNavigator : Web navigator object if success
 */
int WebNavigatorCbOnConsoleMessage(mmachine m);

/**
 * Execute the WEB_NAVIGATOR_DISPLAY_ON_CONSOLE_MESSAGE_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 FireWebNavigatorReflexiveOnConsoleMessage(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 WebNavigatorDisplay package in Scol virtual machine
 * \param mmachine : the scol machine
 */
int LoadWebNavigatorDisplay(mmachine m);

//! \endcond

#endif
