/* wvtbl.h
 *
 * $Id: wvtbi.h 1.1 1994/11/02 01:58:16 jglasser Exp $
 */
#include <windows.h>
#include "wvtb.h"

#ifndef WIN32
#define GETWINDOWID(hwnd)		GetWindowWord(hwnd, GWW_ID)
#define SETWINDOWPOINTER(hwnd, name, p)	SetWindowWord(hwnd, 0, (WORD)p)
#define GETWINDOWPOINTER(hwnd, name)	((name)GetWindowWord(hwnd, 0))
#define ALLOCWINDOWPOINTER(name, size)	((name)LocalAlloc(LPTR, size))
#define FREEWINDOWPOINTER(p)		LocalFree((HLOCAL)p)
#else
#define GETWINDOWID(hwnd)		GetWindowLong(hwnd, GWL_ID)
#define SETWINDOWPOINTER(hwnd, name, p)	SetWindowLong(hwnd, 0, (LONG) p)
#define GETWINDOWPOINTER(hwnd, name)	((name)GetWindowLong(hwnd, 0))
#define ALLOCWINDOWPOINTER(name, size)	((name)LocalAlloc(LPTR, size))
#define FREEWINDOWPOINTER(p)		LocalFree((HLOCAL)p)
#endif

typedef struct tagTBBMINFO {		/* info for recreating the bitmaps */
    int nButtons;
    HINSTANCE hInst;
    WORD wID;
    HBITMAP hbm;
} TBBMINFO, NEAR *PTBBMINFO;

typedef struct tagTBHDR {             /* instance data for toolbar window */
    int nSysColorChanges;
    PTBBUTTON pCaptureButton;
    HWND hdlgCust;
    HWND hwndCommand;
    int nBitmaps;
    PTBBMINFO pBitmaps;
    int iNumButtons;
    TBBUTTON Buttons[1];
} TBHDR, NEAR *PTBHDR;


extern HBITMAP FAR PASCAL SelectBM(HDC hDC, PTBHDR pTBState, int nButton);

extern void FAR PASCAL DrawButton(HDC hdc, int x, int y, int dx, int dy,
      PTBHDR pTBState, PTBBUTTON ptButton);

extern int FAR PASCAL TBHitTest(PTBHDR pTBState, int xPos, int yPos);

extern int FAR PASCAL PositionFromID(PTBHDR pTBState, int id);

extern void FAR PASCAL BuildButtonTemplates(void);

void FAR PASCAL TBInputStruct(PTBHDR pTBState, LPTBBUTTON pButtonInt, LPTBBUTTON pButtonExt);

void FAR PASCAL TBOutputStruct(PTBHDR pTBState, LPTBBUTTON pButtonInt, LPTBBUTTON pButtonExt);
