|
|
|
IHTMLPainter Interface |
|
IID_IHTMLPainter |
{3050F6A6-98B5-11CF-BB82-00AA00BDCE0B} |
|
This custom interface provides methods to MSHTML so that it can draw a rendering behavior.
|
|
Methods in VTable order |
|
|
IUnknown Methods |
Description |
|
QueryInterface |
Returns pointers to supported interfaces. |
|
AddRef |
Increments reference count. |
|
Release |
Decrements reference count. |
|
IHTMLPainter Methods |
Description |
|
Draw |
Called by MSHTML to render a behavior in the browser's client area. |
|
OnResize |
Called by MSHTML when an element containing a rendering behavior is resized. |
|
GetPainterInfo |
Called by MSHTML to retrieve information about the needs and functionality of a rendering behavior. |
|
HitTestPoint |
Called by MSHTML to retrieve a value that specifies whether a point is contained in a rendering behavior. |
|
ITMLPainter interface implementation |
$IID_IHTMLPainter = GUID$("{3050F6A6-98B5-11CF-BB82-00AA00BDCE0B}")
TYPE HTML_PAINTER_INFO
lFlags AS LONG
lZOrder AS LONG
iiDrawObject AS GUID
rcExpand AS RECT
END TYPE
' ****************************************************************************************
' IHTMLPainter interface virtual table
' ****************************************************************************************
TYPE IHTMLPainterVtbl
' IUnknown methods
pQueryInterface AS DWORD ' // QueryInterface method
pAddRef AS DWORD ' // AddRef method
pRelease AS DWORD ' // Release method
' IHTMLPainter method
pDraw AS DWORD ' // Draw method
pOnResize AS DWORD ' // OnResize method
pGetPainterInfo AS DWORD ' // GetPainterInfo method
pHitTestPoint AS DWORD ' // HitTestPoint method
' Custom data
pVtblAddr AS DWORD ' // Address of the virtual table
cRef AS DWORD ' // Reference count
END TYPE
' ****************************************************************************************
' ****************************************************************************************
' Builds the IHTMLPainter Virtual Table
' Returns a cookie that is a pointer to a IHTMLPainterVtbl structure.
' ****************************************************************************************
FUNCTION IHTMLPainter_BuildVtbl () AS DWORD
LOCAL pVtbl AS IHTMLPainterVtbl PTR
LOCAL pUnk AS IHTMLPainterVtbl PTR
pVtbl = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, SIZEOF(@pVtbl))
IF pVtbl = 0 THEN EXIT FUNCTION
@pVtbl.pQueryInterface = CODEPTR(IHTMLPainter_QueryInterface)
@pVtbl.pAddRef = CODEPTR(IHTMLPainter_AddRef)
@pVtbl.pRelease = CODEPTR(IHTMLPainter_Release)
@pVtbl.pDraw = CODEPTR(IHTMLPainter_Draw)
@pVtbl.pOnResize = CODEPTR(IHTMLPainter_OnResize)
@pVtbl.pGetPainterInfo = CODEPTR(IHTMLPainter_GetPainterInfo)
@pVtbl.pHitTestPoint = CODEPTR(IHTMLPainter_HitTestPoint)
@pVtbl.pVtblAddr = pVtbl
@pVtbl.cRef = 1
pUnk = VARPTR(@pVtbl.pVtblAddr)
FUNCTION = pUnk
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IHTMLPainter_QueryInterface method
' Returns the IUnknown of our class and increments the reference counter.
' ****************************************************************************************
FUNCTION IHTMLPainter_QueryInterface (BYVAL pCookie AS IHTMLPainterVtbl PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
IF riid = $IID_IHTMLPainter THEN
ppvObj = pCookie
INCR @@pCookie.cRef
FUNCTION = %S_OK
ELSE
FUNCTION = %E_NOINTERFACE
END IF
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IHTMLPainter_IUnknown_AddRef method
' Increments the reference counter.
' ****************************************************************************************
FUNCTION IHTMLPainter_AddRef (BYVAL pCookie AS IHTMLPainterVtbl PTR) AS DWORD
INCR @@pCookie.cRef
FUNCTION = @@pCookie.cRef
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IHTMLPainter_IUnknown_Release method
' Releases our class if there is only a reference to him and decrements the reference counter.
' ****************************************************************************************
FUNCTION IHTMLPainter_Release (BYVAL pCookie AS IHTMLPainterVtbl PTR) AS DWORD
DECR @@pCookie.cRef
FUNCTION = @@pCookie.cRef
IF @@pCookie.cRef = 0 THEN
IF ISTRUE @@pCookie.pVtblAddr THEN
HeapFree(GetProcessHeap(), 0, BYVAL @@pCookie.pVtblAddr)
END IF
END IF
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Called by MSHTML to render a behavior in the browser's client area.
' ****************************************************************************************
FUNCTION IHTMLPainter_Draw ( _
BYVAL pCookie AS IHTMLPainterVtbl PTR _
, BYREF rcBounds AS RECT _
, BYREF rcUpdate AS RECT _
, BYVAL lDrawFlags AS LONG _
, BYVAL hdc AS DWORD _
, BYVAL pvDrawObject AS DWORD _
) AS LONG
' Put your code here
' FUNCTION = %S_OK or an error value
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Called by MSHTML when an element containing a rendering behavior is resized.
' ****************************************************************************************
FUNCTION IHTMLPainter_OnResize ( _
BYVAL pCookie AS IHTMLPainterVtbl PTR _
, BYREF psize AS apiSIZE _
) AS LONG
' Put your code here
' FUNCTION = %S_OK or an error value
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Called by MSHTML to retrieve information about the needs and functionality of a
' rendering behavior.
' ****************************************************************************************
FUNCTION IHTMLPainter_GetPainterInfo ( _
BYVAL pCookie AS IHTMLPainterVtbl PTR _
, BYREF pinfo AS HTML_PAINTER_INFO _
) AS LONG
' Put your code here
' FUNCTION = %S_OK or an error value
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Called by MSHTML to retrieve a value that specifies whether a point is contained in a
' rendering behavior.
' ****************************************************************************************
FUNCTION IHTMLPainter_HitTestPoint ( _
BYVAL pCookie AS IHTMLPainterVtbl PTR _
, BYREF pt AS POINTAPI _
, BYVAL pbHit AS LONG _
, BYREF plPartID AS LONG _
) AS LONG
' Put your code here
' FUNCTION = %S_OK or an error value
END FUNCTION
' ****************************************************************************************
|
Page last updated on Monday, 03 April 2006 19:57:56 +0200