mirror of
https://github.com/webui-dev/webui.git
synced 2024-09-11 22:17:13 +03:00
feat: expose get_best_browser to C and C++ api
This commit is contained in:
parent
2a5f0c98fb
commit
a4168b9b19
@ -192,6 +192,19 @@ WEBUI_EXPORT size_t webui_get_new_window_id(void);
|
||||
*/
|
||||
WEBUI_EXPORT size_t webui_bind(size_t window, const char* element, void (*func)(webui_event_t* e));
|
||||
|
||||
/**
|
||||
* @brief Get the "best" browser to be used. If running "webui::show()"
|
||||
* or passing AnyBrowser to "webui::show_browser()", this function will
|
||||
* return the same browser that will be used.
|
||||
*
|
||||
* @param window The window number
|
||||
*
|
||||
* @return Returns the best browser to be used.
|
||||
*
|
||||
* @example size_t browser = webui_get_best_browser(myWindow);
|
||||
*/
|
||||
WEBUI_EXPORT size_t webui_get_best_browser(size_t window);
|
||||
|
||||
/**
|
||||
* @brief Show a window using embedded HTML, or a file. If the window is already
|
||||
* open, it will be refreshed.
|
||||
|
@ -181,6 +181,8 @@ class window {
|
||||
// Get the ID of the last child process spawned by the browser.
|
||||
size_t get_child_process_id() const { return webui_get_child_process_id(webui_window); }
|
||||
|
||||
size_t get_best_browser() const { return webui_get_best_browser(webui_window); }
|
||||
|
||||
// Set the web-server root folder path for this specific window.
|
||||
bool set_root_folder(const std::string_view path) const {
|
||||
return webui_set_root_folder(webui_window, path.data());
|
||||
|
@ -1167,6 +1167,12 @@ size_t webui_bind(size_t window, const char* element, void( * func)(webui_event_
|
||||
return cb_index;
|
||||
}
|
||||
|
||||
size_t webui_get_best_browser(size_t window) {
|
||||
// This just exposes the existing function
|
||||
_webui_window_t * win = _webui_core.wins[window];
|
||||
return _webui_find_the_best_browser(win);
|
||||
}
|
||||
|
||||
const char* webui_get_string_at(webui_event_t* e, size_t index) {
|
||||
|
||||
#ifdef WEBUI_LOG
|
||||
|
Loading…
Reference in New Issue
Block a user