mirror of
https://github.com/webui-dev/webui.git
synced 2024-09-11 22:17:13 +03:00
Updated C++ wrapper
This commit is contained in:
parent
3377718469
commit
9200ac3b65
@ -233,6 +233,35 @@ namespace webui {
|
||||
void set_runtime(unsigned int runtime) const {
|
||||
webui_set_runtime(webui_window, runtime);
|
||||
}
|
||||
|
||||
// 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());
|
||||
}
|
||||
|
||||
// Set a custom handler to serve files.
|
||||
void set_file_handler(const void* (*handler)(const char* filename, int* length)) const {
|
||||
webui_set_file_handler(webui_window, handler);
|
||||
}
|
||||
|
||||
// Set the web browser profile to use. An empty `name` and `path` means the default user profile. Need to be called before `webui_show()`.
|
||||
void set_profile(const std::string_view name = {""}, const std::string_view path = {""}) const {
|
||||
webui_set_profile(webui_window, name.data(), path.data());
|
||||
}
|
||||
|
||||
// Get the full current URL
|
||||
std::string_view get_url() const {
|
||||
return std::string_view{webui_get_url(webui_window)};
|
||||
}
|
||||
|
||||
// Get process id (The web browser may create another process for the window)
|
||||
size_t get_child_process_id() const {
|
||||
return webui_get_child_process_id(webui_window);
|
||||
}
|
||||
|
||||
size_t get_parent_process_id() const {
|
||||
return webui_get_parent_process_id(webui_window);
|
||||
}
|
||||
};
|
||||
|
||||
// Wait until all opened windows get closed.
|
||||
@ -264,6 +293,11 @@ namespace webui {
|
||||
inline void free(void* ptr) {
|
||||
webui_free(ptr);
|
||||
}
|
||||
|
||||
// Set the web-server root folder path for all windows.
|
||||
inline bool set_default_root_folder(const std::string_view path){
|
||||
return webui_set_default_root_folder(path.data());
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _WEBUI_HPP */
|
||||
|
Loading…
Reference in New Issue
Block a user