Add is_selectable to browser window API surface.

This commit is contained in:
Michael Drake 2014-10-18 18:53:50 +01:00
parent 8dea0fe894
commit 85fb1fd45d
2 changed files with 24 additions and 0 deletions

View File

@ -430,6 +430,22 @@ browser_editor_flags browser_window_get_editor_flags(struct browser_window *bw)
return ed_flags;
}
/* exported interface, documented in browser.h */
bool browser_window_can_select(struct browser_window *bw)
{
if (bw == NULL || bw->current_content == NULL)
return false;
/* TODO: We shouldn't have to know about specific content types
* here. There should be a content_is_selectable() call. */
if (content_get_type(bw->current_content) != CONTENT_HTML &&
content_get_type(bw->current_content) !=
CONTENT_TEXTPLAIN)
return false;
return true;
}
/* exported interface, documented in browser.h */
char * browser_window_get_selection(struct browser_window *bw)
{

View File

@ -453,6 +453,14 @@ struct browser_window * browser_window_get_root(struct browser_window *bw);
*/
browser_editor_flags browser_window_get_editor_flags(struct browser_window *bw);
/**
* Find out if given browser window content is selectable
*
* \param bw browser window to look at
* \return true iff browser window is selectable
*/
bool browser_window_can_select(struct browser_window *bw);
/**
* Get the current selection from a root browser window, ownership passed to
* caller, who must free() it.