{ =============================================================================
  Copyright 1995 by Potomac Software, Inc. Use of this material is subject to
  the terms and conditions of the software license agreement.
       
  WLAPIDLG.PAS: Contains Delphi declarations for WebLib (TM) Test App.         
  ============================================================================== }
  
unit WeblibApiDlg;

{ ========== INTERFACE ========== }

interface
	uses WinTypes;

{ ========== constants for working with bitmaps in WLAPIDLG.DLL ========== }

const 
	BM_UP = $1;
	BM_SEL = $2;
	BM_FOCUS = $4;
	BM_DISABLED = $8;

const 	
	APIDLG_BITMAP_UP = 500;
	APIDLG_BITMAP_SEL = 600;
	APIDLG_BITMAP_FOCUS = 700;
	APIDLG_BITMAP_DISABLED = 800;

{ ========== Entry points into DLL that contain dialogs for WEBLIB API test apps ========== }

{ ========== Convenience routines for interfacing with 4GLs ========== }

function ApiDlgSubclass4GL(hWnd4GL: HWnd;
	nMsg: Word) : Bool; far;
	
function ApiDlgUnsubclass4GL(hWnd4GL: HWnd) : Bool; far;

procedure ApiDlgGetFontInfo4GL(hFont: HFont;
	lpszFont: PChar;
	cbFont: Integer;
	var nPointSize: Integer); far; 

procedure ApiDlgFreeFont4GL(hFont: HFont); far ;

function ApiDlgCreateFont4GL(lpszFont: PChar;
	nPointSize: Integer) : HFont; far;
	
{ ========== Housekeeping ========== }

function GetApiDlgDLLInstance : THandle; far;

function ApiDlgNotifyOnWindowDestroy(hwndNotify : HWnd;
	nMsg: Word) : Bool; far;
	
function ApiDlgLogging(lpszLogFile: PChar;
	cbLogFile: Word;
	var bLogging: Bool) : Bool; far;

{ ========== Browser ========== }

function ApiDlgConnectBrowser(var bStart: Bool;
	var bSend: Bool;
	var bPost: Bool) : Bool; far;
	
function ApiDlgDisconnectBrowser(var bExit: Bool) : Bool; far; 

function ApiDlgGetWindowInfo(var dwWindow: LongInt) : Bool; far;
function ApiDlgListWindows(var bFirst: Bool) : Bool; far;

function ApiDlgCloseWindow(var dwWindow: LongInt) : Bool; far;
function ApiDlgActivateWindow(var dwWindow: LongInt) : Bool; far;
 
function ApiDlgSetWindowPos(var dwWindow: LongInt;
	var dwX: LongInt; 
	var dwY: LongInt;
	var dwWidth: LongInt;
	var dwHeight: LongInt) : Bool; far; 
	
function ApiDlgShowWindow(var dwWindow: LongInt;
	var nShow: Word) : Bool; far;

function ApiDlgShowFile(lpszFile: PChar;
	cbFile: Word;
	lpszMIME: PChar;
	cbMIME: Word;
	var bNotify: Bool;
	lpszURL: PChar;
	cbURL: Word;
	var dwWindow: LongInt) : Bool; far;
	
function ApiDlgOpenURL(var bBackground: Bool;
	var bNoDocCache: Bool;
	var bNoImageCache: Bool;
	var bNotify: Bool;
	lpszURL: PChar;
	cbURL: Word;
	var dwWindow: LongInt) : Bool; far; 
	
function ApiDlgSaveURL(var bBackground: Bool;
	var bNoDocCache: Bool;
	var bNoImageCache: Bool;
	var bNotify: Bool;
	lpszURL: PChar;
	cbURL: Word;
	lpszFile: PChar;
	cbFile: Word;
	var dwWindow: LongInt) : Bool; far;
	
function ApiDlgPostFormData(lpszFormData: PChar;
	cbFormData: Word;
	lpszMIME: PChar;
	cbMIME: Word;
	var bNotify: Bool;
	lpszURL: PChar;
	cbURL: Word;
	var dwWindow: LongInt) : Bool; far;
	
function ApiDlgSaveFormData(lpszFile: PChar;
	cbFile: Word;
	lpszFormData: PChar;
	cbFormData: Word;
	lpszMIME: PChar;
	cbMIME: Word;
	var bNotify: Bool;
	lpszURL: PChar;
	cbURL: Word;
	var dwWindow: LongInt) : Bool; far; 
		
function ApiDlgCancel(var dwTrx: LongInt) : Bool; far;

function ApiDlgRegisterProtocol(lpszProtocol: PChar;
	cbProtocol: Word) : Bool; far;

function ApiDlgUnregisterProtocol(lpszProtocol: PChar;
	cbProtocol: Word) : Bool; far;

function ApiDlgRegisterViewer(lpszMIME: PChar;
	cbMIME: Word;
	var bQueryViewer: Bool;
	var bShellExec: Bool;
	var bViewDocFile: Bool) : Bool; far;
	
function ApiDlgUnregisterViewer(lpszMIME: PChar;
	cbMIME: Word) : Bool; far;
	
function ApiDlgRegisterWindowChange(var dwWindow: LongInt) : Bool; far;
function ApiDlgUnregisterWindowChange(var dwWindow: LongInt) : Bool; far;
	
function ApiDlgParseAnchor(lpszAbsURL: PChar;
	cbAbsURL: Word;
	lpszRelURL: pChar;
	cbRelURL: Word) : Bool; far;

function ApiDlgGetVersion(var nMajor: Word;
	var nMinor: Word) : Bool; far;

function ApiDlgQueryFile(lpszFile: PChar;
	cbFile: Word) : Bool; far;

function ApiDlgSetNotifyMethod(var bPost: Bool) : Bool; far;

function ApiDlgGetTransactionWindow(var dwTrx: LongInt) : Bool; far;

function ApiDlgSetFileName(lpszFile: PChar;
	cbFile: Word) : Bool; far;

{ ========== Toolbar ========== }

function ApiDlgCreateToolbar(lpszMenu: PChar;
	cbMenu: Word) : Bool; far;

function ApiDlgAddToolbarButton(var nID: Word;
	var nIdx: Integer;
	lpszText: PChar;
	cbText: Word;
	var nBitmapStyle: Integer;
	var nBitmapMask: Integer) : Bool; far;
	
function ApiDlgRemoveToolbarButton(var nID: Word) : Bool; far;

function ApiDlgIsToolbarButtonVisible(var nID: Word) : Bool; far;

function ApiDlgShowToolbarButton(var nID: Word;
	var bShow: Bool) : Bool; far;

function ApiDlgIsToolbarButtonEnabled(var nID: Word) : Bool; far;

function ApiDlgEnableToolbarButton(var nID: Word;
	var bEnable: Bool) : Bool; far; 

function ApiDlgGetToolbarText(var nID: Word) : Bool; far;

function ApiDlgSetToolbarText(var nID: Word;
	lpszText: PChar;
	cbText: Word) : Bool; far;

function ApiDlgGetToolbarFont(var bToolbar: Bool) : Bool; far;

function ApiDlgSetToolbarFont(lpszFont: PChar;
	cbFont: Word;
	var nPointSize: Integer;
	var bToolbar: Bool) : Bool; far;

function ApiDlgSetToolbarBkgnd(var nRed: Integer;
	var nGreen: Integer;
	var nBlue: Integer) : Bool; far; 

function ApiDlgGetToolbarTextColor(var bToolbar: Bool) : Bool; far;

function ApiDlgSetToolbarTextColor(var nRed: Integer;
	var nGreen: Integer;
	var nBlue: Integer;
	var bToolbar: Bool) : Bool; far;
		
{ ========== HTML parser ========== }

function ApiDlgHtmlParse(lpszFile: PChar;
	cbFile: Word;
	lpszBuf: PChar;
	cbBuf: Word;
	var bAttr: Bool;
	var bClosing: Bool) : Bool; far; 
	
function ApiDlgHtmlGetSibling(var nRel: Word) : Bool; far; 

function ApiDlgHtmlExtractTagAttr(lpszAttr: PChar;
	cbAttr: Word) : Bool; far; 

function ApiDlgHtmlFindText(lpszText: PChar;
	cbText: Word) : Bool; far;
	
function ApiDlgHtmlFindSpecial(lpszText: PChar;
	cbText: Word) : Bool; far;
	
function ApiDlgHtmlFindComment(lpszText: PChar;
	cbText: Word) : Bool; far;

function ApiDlgHtmlFindTagAttr(lpszAttr: PChar;
	cbAttr: Word;
	lpszValue: PChar;
	cbValue: Word;
	var nTag: Word) : Bool; far; 
	
function ApiDlgHtmlFindTagType(var nTag: Word) : Bool; far;

function ApiDlgHtmlFindTagName(lpszTag: PChar;
	cbTag: Word) : Bool; far;

function ApiDlgHtmlEnumFindText(lpszText: PChar;
	cbText: Word) : Bool; far;
	
function ApiDlgHtmlEnumFindSpecial(lpszText: PChar;
	cbText: Word) : Bool; far;
	
function ApiDlgHtmlEnumFindComment(lpszText: PChar;
	cbText: Word) : Bool; far;

function ApiDlgHtmlEnumFindTagAttr(lpszAttr: PChar;
	cbAttr: Word;
	lpszValue: PChar;
	cbValue: Word;
	var nTag: Word) : Bool; far; 
	
function ApiDlgHtmlEnumFindTagType(var nTag: Word) : Bool; far;

function ApiDlgHtmlEnumFindTagName(lpszTag: PChar;
	cbTag: Word) : Bool; far;

{ ========== Utilities ========== }
	
procedure ApiDlgAccessFormData(lpszFormData: PChar); far;

function ApiDlgAppendFormData(lpszData: PChar;
	cbData: Word;
	lpszName: PChar;
	cbName: Word) : Bool; far;

function ApiDlgParseAbsoluteURL(lpszURL: PChar;
	cbURL: Word) : Bool; far;
	
{ ========== IMPLEMENTATION ========== }

implementation 

function ApiDlgSubclass4GL; external 'WLAPIDLG';
function ApiDlgUnsubclass4GL; external 'WLAPIDLG';
procedure ApiDlgGetFontInfo4GL; external 'WLAPIDLG';
procedure ApiDlgFreeFont4GL; external 'WLAPIDLG';
function ApiDlgCreateFont4GL; external 'WLAPIDLG';

function GetApiDlgDLLInstance; external 'WLAPIDLG';
function ApiDlgNotifyOnWindowDestroy; external 'WLAPIDLG';
function ApiDlgLogging; external 'WLAPIDLG';

function ApiDlgConnectBrowser; external 'WLAPIDLG';
function ApiDlgDisconnectBrowser; external 'WLAPIDLG';

function ApiDlgGetWindowInfo; external 'WLAPIDLG';
function ApiDlgListWindows; external 'WLAPIDLG';

function ApiDlgCloseWindow; external 'WLAPIDLG';
function ApiDlgActivateWindow; external 'WLAPIDLG';
function ApiDlgSetWindowPos; external 'WLAPIDLG';
function ApiDlgShowWindow; external 'WLAPIDLG';

function ApiDlgShowFile; external 'WLAPIDLG';
function ApiDlgOpenURL; external 'WLAPIDLG';
function ApiDlgSaveURL; external 'WLAPIDLG';
function ApiDlgPostFormData; external 'WLAPIDLG';
function ApiDlgSaveFormData; external 'WLAPIDLG';

function ApiDlgCancel; external 'WLAPIDLG';

function ApiDlgRegisterProtocol; external 'WLAPIDLG';
function ApiDlgUnregisterProtocol; external 'WLAPIDLG';
function ApiDlgRegisterViewer; external 'WLAPIDLG';
function ApiDlgUnregisterViewer; external 'WLAPIDLG';
function ApiDlgRegisterWindowChange; external 'WLAPIDLG';
function ApiDlgUnregisterWindowChange; external 'WLAPIDLG';

function ApiDlgParseAnchor; external 'WLAPIDLG';
function ApiDlgGetVersion; external 'WLAPIDLG';

function ApiDlgQueryFile; external 'WLAPIDLG';

function ApiDlgSetNotifyMethod; external 'WLAPIDLG';
function ApiDlgGetTransactionWindow; external 'WLAPIDLG';

function ApiDlgSetFileName; external 'WLAPIDLG';

function ApiDlgCreateToolbar; external 'WLAPIDLG';
function ApiDlgAddToolbarButton; external 'WLAPIDLG';
function ApiDlgRemoveToolbarButton; external 'WLAPIDLG';

function ApiDlgIsToolbarButtonVisible; external 'WLAPIDLG';
function ApiDlgShowToolbarButton; external 'WLAPIDLG';

function ApiDlgIsToolbarButtonEnabled; external 'WLAPIDLG';
function ApiDlgEnableToolbarButton; external 'WLAPIDLG';

function ApiDlgGetToolbarText; external 'WLAPIDLG';
function ApiDlgSetToolbarText; external 'WLAPIDLG';

function ApiDlgGetToolbarFont; external 'WLAPIDLG';
function ApiDlgSetToolbarFont; external 'WLAPIDLG';

function ApiDlgSetToolbarBkgnd; external 'WLAPIDLG';
function ApiDlgGetToolbarTextColor; external 'WLAPIDLG';
function ApiDlgSetToolbarTextColor; external 'WLAPIDLG';

function ApiDlgHtmlParse; external 'WLAPIDLG';
function ApiDlgHtmlGetSibling; external 'WLAPIDLG';

function ApiDlgHtmlExtractTagAttr; external 'WLAPIDLG';
function ApiDlgHtmlFindText; external 'WLAPIDLG';
function ApiDlgHtmlFindSpecial; external 'WLAPIDLG';
function ApiDlgHtmlFindComment; external 'WLAPIDLG';

function ApiDlgHtmlFindTagAttr; external 'WLAPIDLG';
function ApiDlgHtmlFindTagType; external 'WLAPIDLG';
function ApiDlgHtmlFindTagName; external 'WLAPIDLG';

function ApiDlgHtmlEnumFindText; external 'WLAPIDLG';
function ApiDlgHtmlEnumFindSpecial; external 'WLAPIDLG';
function ApiDlgHtmlEnumFindComment; external 'WLAPIDLG';

function ApiDlgHtmlEnumFindTagAttr; external 'WLAPIDLG';
function ApiDlgHtmlEnumFindTagType; external 'WLAPIDLG';
function ApiDlgHtmlEnumFindTagName; external 'WLAPIDLG';

procedure ApiDlgAccessFormData; external 'WLAPIDLG';
function ApiDlgAppendFormData; external 'WLAPIDLG';
function ApiDlgParseAbsoluteURL; external 'WLAPIDLG';

end.
