This function processes a text hit action (i.e. any operation on text performed using a pointing device such as a mouse). Depending on the hit parameters and current text selection state, this action may result in a new cursor position or updated boundaries of the text selection.
This function should be used after a texflow area is rendered by calling the txTextDraw function with its flags parameter set to instruct D-Type Unicode Text Module to generate text flows and frames.
Parameter | Description |
---|---|
text_doc |
Handle of the associated text document instance. |
hit_type |
Type of hit action. Can be one of the following: TX_HIT_RELEASE -3 /* Mouse button released */ TX_HIT_MOVE -2 /* Mouse move */ TX_HIT_NORMAL 0 /* Normal mouse button click */ TX_HIT_DOUBLE 1 /* Double mouse button click - selects a word (but only looks for the space character to find the word boundaries) */ TX_HIT_TRIPLE 4 /* Triple mouse button click - selects a paragraph (by looking for the newline character to find the paragraph boundaries) */ TX_HIT_SHIFT 2 /* Mouse button click with the Shift key */ TX_HIT_CTRL 3 /* Mouse button click with the Ctrl key */ TX_HIT_ALT 5 /* Mouse button click with the Alt key */ TX_HIT_CTRLALT 6 /* Mouse button click with the Ctrl+Alt key */ |
x |
The x coordinate of the mouse on the screen (in pixels). |
y |
The y coordinate of the mouse on the screen (in pixels). |
extent |
A pointer to the DT_RECT_SLONG structure that will receive a rectangle describing the smallest enclosing box of the screen area that needs to be repainted following a text selection action. |
reserved |
Reserved for future use. Must be set to 0. |
If a portion of the screen area needs to be repainted, the return value is 1. If no portion of the screen area needs to be repainted, the return value is 2. In this case all members of the DT_RECT_SLONG structure will be set to 0.
If the function was not successful (e.g. invalid input parameters), the return value is 0.
This function can be called when the user clicks or moves a mouse pointer inside (or outside) a textflow area. When called, the function will interpret the mouse action as required. This may result in a cursor movement, selection highlighting or any other text selection action that a mouse action can invoke. However, the developer does not need to know what operation, if any, was invoked.
The extent returned by this function is a rectangle that describes the smallest enclosing box of the screen area that needs to be repainted following a text selection action. After that, the txTextDraw function can be called again in order to repaint the area defined by extent.
D-Type Unicode Text Module is capable of supporting multiple (non-contiguous) text selections. For backward compatibility reasons, this feature is disabled by default. See the description of the txTextSetParams function for details on how to enable multiple (non-contiguous) text selections. A new non-contiguous text selection is initiated when the hit_type parameter is set to TX_HIT_CTRL (mouse button click with the Ctrl key) and updated as the mouse moves, which requires one or more subsequent TX_HIT_MOVE (mouse move) actions.