Add functions for checking if back/forward/stop/reload actions are currently available for a given browser window.

svn path=/trunk/netsurf/; revision=6827
This commit is contained in:
Michael Drake 2009-03-23 22:22:30 +00:00
parent 972cd147aa
commit 0a7e10819b
2 changed files with 64 additions and 5 deletions

View File

@ -2798,3 +2798,57 @@ void browser_window_page_drag_start(struct browser_window *bw, int x, int y)
gui_window_scroll_start(bw->window); gui_window_scroll_start(bw->window);
} }
/**
* Check availability of Back action for a given browser window
*
* \param bw browser window
* \return true if Back action is available
*/
bool browser_window_back_available(struct browser_window *bw)
{
return (bw && bw->history && history_back_available(bw->history));
}
/**
* Check availability of Forward action for a given browser window
*
* \param bw browser window
* \return true if Forward action is available
*/
bool browser_window_forward_available(struct browser_window *bw)
{
return (bw && bw->history && history_forward_available(bw->history));
}
/**
* Check availability of Reload action for a given browser window
*
* \param bw browser window
* \return true if Reload action is available
*/
bool browser_window_reload_available(struct browser_window *bw)
{
return (bw && bw->current_content && !bw->loading_content);
}
/**
* Check availability of Stop action for a given browser window
*
* \param bw browser window
* \return true if Stop action is available
*/
bool browser_window_stop_available(struct browser_window *bw)
{
return (bw && (bw->loading_content ||
(bw->current_content &&
(bw->current_content->status != CONTENT_STATUS_DONE))));
}

View File

@ -250,6 +250,11 @@ void browser_form_submit(struct browser_window *bw, struct browser_window *targe
void browser_window_redraw_rect(struct browser_window *bw, int x, int y, void browser_window_redraw_rect(struct browser_window *bw, int x, int y,
int width, int height); int width, int height);
bool browser_window_back_available(struct browser_window *bw);
bool browser_window_forward_available(struct browser_window *bw);
bool browser_window_reload_available(struct browser_window *bw);
bool browser_window_stop_available(struct browser_window *bw);
/* In platform specific hotlist.c. */ /* In platform specific hotlist.c. */
void hotlist_visited(struct content *content); void hotlist_visited(struct content *content);