pdfSetMouseUpWinCbk

Set a callback function for mouse button-up events with window coordinates.
void pdfSetMouseUpWinCbk(PDFViewerHandle viewer, void (*cbk)(void *data, int button, int shift, int winX, int winY), void *data)
This function sets a callback which will be called when the user releases a mouse button.

The function will be called with five arguments:

Window coordinates can be converted to PDF coordinates with pdfConvertWindowToPDFCoords2.

This callback is similar to pdfSetMouseUpCbk, except that (a) it is called with window coordinates instead of PDF coordinates, and (b) it will be called even if the mouse is clicked outside of a PDF page.

IMPORTANT: In order to receive pdfSetMouseMoveWinCbk and pdfSetMouseUpWinCbk callbacks when the mouse is outside the XpdfViewer window (not just outside the PDF pages), you must call SetCapture in the pdfSetMouseDownWinCbk callback. See the example below.

C:
void mouseDownWinCbk(void *data, int button, int shift, int winX, int winY) { Context *myContext = (Context *)data; int pg; double x, y; pdfConvertWindowToPDFCoords2(viewer, winX, winY, &pg, &x, &y); /* ... use pg, x, y ... */ /* capture the mouse so we receive Move and Up events outside the window */ SetCapture(pdfGetWindowHandle(viewer)); } void mouseUpWinCbk(void *data, int button, int shift, int winX, int winY) { Context *myContext = (Context *)data; int pg; double x, y; /* release the capture that was initiated in the Down callback */ ReleaseCapture(); pdfConvertWindowToPDFCoords2(viewer, winX, winY, &pg, &x, &y); /* ... use pg, x, y ... */ } void mouseMoveWinCbk(void *data, int button, int shift, int winX, int winY) { Context *myContext = (Context *)data; int pg; double x, y; pdfConvertWindowToPDFCoords2(viewer, winX, winY, &pg, &x, &y); /* ... use pg, x, y ... */ } .... pdfSetMouseDownWinCbk(viewer, &mouseDownWinCbk, &myContext); pdfSetMouseUpWinCbk(viewer, &mouseDownWinCbk, &myContext); pdfSetMouseMoveWinCbk(viewer, &mouseDownWinCbk, &myContext);
pdfSetMouseDownWinCbk
pdfSetMouseDoubleClickWinCbk
pdfSetMouseMoveWinCbk
pdfConvertWindowToPDFCoords2
pdfSetMouseUpCbk