2 #include "chimara-glk-private.h"
4 extern GPrivate *glk_data_key;
8 * @linkval: Set to nonzero to initiate hyperlink mode. Set to zero to disengage.
10 * Use this function to create hyperlinks in a textbuffer. It sets the current stream
11 * to hyperlink mode, after which text will become a hyperlink until hyperlink mode
12 * is turned off. If the current stream does not write to a textbuffer window, this function
15 * You can request hyperlink events with glk_request_hyperlink_event() to react
16 * to clicks on the link.
19 glk_set_hyperlink(glui32 linkval)
21 ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key);
22 g_return_if_fail(glk_data->current_stream != NULL);
23 glk_set_hyperlink_stream(glk_data->current_stream, linkval);
28 * @str: The stream to set the hyperlink mode on.
29 * @linkval: Set to nonzero to initiate hyperlink mode. Set to zero to disengage.
31 * Use this function to create hyperlinks in a textbuffer. It sets a stream to a textbuffer
32 * window to hyperlink mode, after which text will become a hyperlink until hyperlink mode
33 * is turned off. Calling this function on a stream that does not write to a textbuffer does
36 * You can request hyperlink events with glk_request_hyperlink_event() to react
37 * to clicks on the link.
40 glk_set_hyperlink_stream(strid_t str, glui32 linkval)
42 g_return_if_fail(str != NULL);
43 g_return_if_fail(str->window != NULL);
44 g_return_if_fail(str->window->type == wintype_TextBuffer);
46 str->hyperlink_mode = (linkval != 0);
50 glk_request_hyperlink_event(winid_t win)
52 VALID_WINDOW(win, return);
53 g_return_if_fail(win != NULL);
54 g_return_if_fail(win->mouse_click_handler != 0);
55 g_return_if_fail(win->type != wintype_TextBuffer || win->type != wintype_TextGrid);
57 g_signal_handler_unblock( G_OBJECT(win->widget), win->mouse_click_handler );
61 glk_cancel_hyperlink_event(winid_t win)
63 VALID_WINDOW(win, return);
64 g_return_if_fail(win != NULL);
65 g_return_if_fail(win->mouse_click_handler != 0);
66 g_return_if_fail(win->type != wintype_TextBuffer || win->type != wintype_TextGrid);
68 g_signal_handler_block( G_OBJECT(win->widget), win->mouse_click_handler );
71 /* Internal function: General callback for signal button-release-event on a
72 * text buffer or text grid window. Used for detecting clicks on hyperlinks.
73 * Blocked when not in use.
76 on_window_button_release_event(GtkWidget *widget, GdkEventButton *event, winid_t win)
78 printf("Click on (%f,%f)\n", event->x, event->y);