
///////////////////////////////////////////////////////////////////////////////
// Copyright 1995 by Potomac Software, Inc. Use of this material is subject to
// the terms and conditions of the software license agreement.

#ifndef __WLAPIDLG_H__
#define __WLAPIDLG_H__

#include <windows.h>

#define BM_UP					0x1
#define BM_SEL					0x2
#define BM_FOCUS				0x4
#define BM_DISABLED				0x8 

#define _ISUP(x)				(((x) & BM_UP) != 0)
#define _ISSEL(x)				(((x) & BM_SEL) != 0)
#define _ISFOCUS(x)				(((x) & BM_FOCUS) != 0)
#define _ISDISABLED(x)			(((x) & BM_DISABLED) != 0)

#define _SETUP(x)				((x) |= BM_UP)
#define _SETSEL(x)				((x) |= BM_SEL)
#define _SETFOCUS(x)			((x) |= BM_FOCUS)
#define _SETDISABLED(x)			((x) |= BM_DISABLED) 

#define APIDLG_BITMAP_UP		500
#define APIDLG_BITMAP_SEL		600
#define APIDLG_BITMAP_FOCUS		700
#define APIDLG_BITMAP_DISABLED	800

#define MAX_FORMDATA			1024
#define MAX_HTMLBUF				1024

#ifdef __cplusplus 
extern "C" {
#endif 

///////////////////////////////////////////////////////////////////////////////
// Entry points into DLL that contain dialogs for WEBLIB API test apps.

BOOL WINAPI ApiDlgSubclass4GL(HWND hWnd4GL,UINT nMsg);
BOOL WINAPI ApiDlgUnsubclass4GL(HWND hWnd4GL);

void WINAPI ApiDlgGetFontInfo4GL(HFONT hFont,LPSTR lpszFont,int cbFont,int *nPointSize); 
void WINAPI ApiDlgFreeFont4GL(HFONT hFont);
HFONT WINAPI ApiDlgCreateFont4GL(LPSTR lpszFont,int nPointSize);

HINSTANCE WINAPI GetApiDlgDLLInstance();
BOOL WINAPI ApiDlgNotifyOnWindowDestroy(HWND hwndNotify,UINT nMsg);
BOOL WINAPI ApiDlgLogging(LPSTR lpszLogFile,UINT cbLogFile,BOOL *bLogging);

// Browser

BOOL WINAPI ApiDlgConnectBrowser(BOOL *bStart,BOOL *bSend,BOOL *bPost);
BOOL WINAPI ApiDlgDisconnectBrowser(BOOL *bExit); 

BOOL WINAPI ApiDlgGetWindowInfo(DWORD *dwWindow);
BOOL WINAPI ApiDlgListWindows(BOOL *bFirst);

BOOL WINAPI ApiDlgCloseWindow(DWORD *dwWindow);
BOOL WINAPI ApiDlgActivateWindow(DWORD *dwWindow);
 
BOOL WINAPI ApiDlgSetWindowPos(DWORD *dwWindow,DWORD *dwX, DWORD *dwY,DWORD *dwWidth,
	DWORD *dwHeight); 
	
BOOL WINAPI ApiDlgShowWindow(DWORD *dwWindow,UINT *nShow);

BOOL WINAPI ApiDlgShowFile(LPSTR lpszFile,UINT cbFile,LPSTR lpszMIME,UINT cbMIME,
	BOOL *bNotify,LPSTR lpszURL,UINT cbURL,DWORD *dwWindow);
	
BOOL WINAPI ApiDlgOpenURL(BOOL *bBackground,BOOL *bNoDocCache,BOOL *bNoImageCache,
	BOOL *bNotify,LPSTR lpszURL,UINT cbURL,DWORD *dwWindow); 
BOOL WINAPI ApiDlgSaveURL(BOOL *bBackground,BOOL *bNoDocCache,BOOL *bNoImageCache,
	BOOL *bNotify,LPSTR lpszURL,UINT cbURL,LPSTR lpszFile,UINT cbFile,DWORD *dwWindow);
	
BOOL WINAPI ApiDlgPostFormData(LPSTR lpszFormData,UINT cbFormData,LPSTR lpszMIME,
	UINT cbMIME,BOOL *bNotify,LPSTR lpszURL,UINT cbURL,DWORD *dwWindow);
BOOL WINAPI ApiDlgSaveFormData(LPSTR lpszFile,UINT cbFile,LPSTR lpszFormData,
	UINT cbFormData,LPSTR lpszMIME,UINT cbMIME,BOOL *bNotify,LPSTR lpszURL,UINT cbURL,
		DWORD *dwWindow); 
		
BOOL WINAPI ApiDlgCancel(DWORD *dwTrx);

BOOL WINAPI ApiDlgRegisterProtocol(LPSTR lpszProtocol,UINT cbProtocol);
BOOL WINAPI ApiDlgUnregisterProtocol(LPSTR lpszProtocol,UINT cbProtocol);

BOOL WINAPI ApiDlgRegisterViewer(LPSTR lpszMIME,UINT cbMIME,BOOL *bQueryViewer,
	BOOL *bShellExec,BOOL *bViewDocFile);
BOOL WINAPI ApiDlgUnregisterViewer(LPSTR lpszMIME,UINT cbMIME);
	
BOOL WINAPI ApiDlgRegisterWindowChange(DWORD *dwWindow);
BOOL WINAPI ApiDlgUnregisterWindowChange(DWORD *dwWindow);
	
BOOL WINAPI ApiDlgParseAnchor(LPSTR lpszAbsURL,UINT cbAbsURL,LPSTR lpszRelURL,UINT cbRelURL);

BOOL WINAPI ApiDlgGetVersion(UINT *nMajor,UINT *nMinor);

BOOL WINAPI ApiDlgQueryFile(LPSTR lpszFile,UINT cbFile);

BOOL WINAPI ApiDlgSetNotifyMethod(BOOL *bPost);

BOOL WINAPI ApiDlgGetTransactionWindow(DWORD *dwTrx);

BOOL WINAPI ApiDlgSetFileName(LPSTR lpszFile,UINT cbFile);

// Toolbar

BOOL WINAPI ApiDlgCreateToolbar(LPSTR lpszMenu,UINT cbMenu);

BOOL WINAPI ApiDlgAddToolbarButton(UINT *nID,int *nIdx,LPSTR lpszText,UINT cbText,
	int *nBitmapStyle,int *nBitmapMask);
BOOL WINAPI ApiDlgRemoveToolbarButton(UINT *nID);

BOOL WINAPI ApiDlgIsToolbarButtonVisible(UINT *nID);
BOOL WINAPI ApiDlgShowToolbarButton(UINT *nID,BOOL *bShow);

BOOL WINAPI ApiDlgIsToolbarButtonEnabled(UINT *nID);
BOOL WINAPI ApiDlgEnableToolbarButton(UINT *nID,BOOL *bEnable); 

BOOL WINAPI ApiDlgGetToolbarText(UINT *nID);
BOOL WINAPI ApiDlgSetToolbarText(UINT *nID,LPSTR lpszText,UINT cbText);

BOOL WINAPI ApiDlgGetToolbarFont(BOOL *bToolbar);
BOOL WINAPI ApiDlgSetToolbarFont(LPSTR lpszFont,UINT cbFont,int *nPointSize,BOOL *bToolbar);

BOOL WINAPI ApiDlgSetToolbarBkgnd(int *nRed,int *nGreen,int *nBlue); 

BOOL WINAPI ApiDlgGetToolbarTextColor(BOOL *bToolbar);
BOOL WINAPI ApiDlgSetToolbarTextColor(int *nRed,int *nGreen,int *nBlue,BOOL *bToolbar);
		
// HTML parser

BOOL WINAPI ApiDlgHtmlParse(LPSTR lpszFile,UINT cbFile,LPSTR lpszBuf,UINT cbBuf,
	BOOL *bAttr,BOOL *bClosing); 
	
BOOL WINAPI ApiDlgHtmlGetSibling(UINT *nRel); 

BOOL WINAPI ApiDlgHtmlExtractTagAttr(LPSTR lpszAttr,UINT cbAttr); 

BOOL WINAPI ApiDlgHtmlFindText(LPSTR lpszText,UINT cbText);
BOOL WINAPI ApiDlgHtmlFindSpecial(LPSTR lpszText,UINT cbText);
BOOL WINAPI ApiDlgHtmlFindComment(LPSTR lpszText,UINT cbText);

BOOL WINAPI ApiDlgHtmlFindTagAttr(LPSTR lpszAttr,UINT cbAttr,LPSTR lpszValue,
	UINT cbValue,UINT *nTag); 
BOOL WINAPI ApiDlgHtmlFindTagType(UINT *nTag);
BOOL WINAPI ApiDlgHtmlFindTagName(LPSTR lpszTag,UINT cbTag);

BOOL WINAPI ApiDlgHtmlEnumFindText(LPSTR lpszText,UINT cbText);
BOOL WINAPI ApiDlgHtmlEnumFindSpecial(LPSTR lpszText,UINT cbText);
BOOL WINAPI ApiDlgHtmlEnumFindComment(LPSTR lpszText,UINT cbText);

BOOL WINAPI ApiDlgHtmlEnumFindTagAttr(LPSTR lpszAttr,UINT cbAttr,LPSTR lpszValue,
	UINT cbValue,UINT *nTag); 
BOOL WINAPI ApiDlgHtmlEnumFindTagType(UINT *nTag);
BOOL WINAPI ApiDlgHtmlEnumFindTagName(LPSTR lpszTag,UINT cbTag);

// Utilities
	
void WINAPI ApiDlgAccessFormData(LPSTR lpszFormData);
BOOL WINAPI ApiDlgAppendFormData(LPSTR lpszData,UINT cbData,LPSTR lpszName,UINT cbName);

BOOL WINAPI ApiDlgParseAbsoluteURL(LPSTR lpszURL,UINT cbURL);

#ifdef __cplusplus 
}
#endif

#endif
