/* * MIT License * * Copyright (c) 2017 Serge Zaitsev * Copyright (c) 2018 Thomas Chust * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef WEBVIEW_H #define WEBVIEW_H #if defined(_WIN32) #if defined(WEBVIEW_GTK) || defined(WEBVIEW_WINAPI) #define WEBVIEW_API __declspec(dllexport) #else #define WEBVIEW_API __declspec(dllimport) #endif #else #define WEBVIEW_API extern #endif #include typedef struct webview webview_t; typedef void (*webview_invoke_fn)(webview_t *w, const char *arg); typedef enum webview_dialog { WEBVIEW_DIALOG_TYPE_OPEN = 0, WEBVIEW_DIALOG_TYPE_SAVE = 1, WEBVIEW_DIALOG_TYPE_ALERT = 2 } webview_dialog_t; #define WEBVIEW_DIALOG_FLAG_FILE (0 << 0) #define WEBVIEW_DIALOG_FLAG_DIRECTORY (1 << 0) #define WEBVIEW_DIALOG_FLAG_INFO (1 << 1) #define WEBVIEW_DIALOG_FLAG_WARNING (2 << 1) #define WEBVIEW_DIALOG_FLAG_ERROR (3 << 1) #define WEBVIEW_DIALOG_FLAG_ALERT_MASK (3 << 1) typedef void (*webview_dispatch_fn)(webview_t *w, void *arg); WEBVIEW_API webview_t *webview_new(const char *title, const char *url, int width, int height, int resizable, int debug); WEBVIEW_API void webview_destroy(webview_t *w); WEBVIEW_API int webview_loop(webview_t *w, int blocking); WEBVIEW_API void webview_dispatch(webview_t *w, webview_dispatch_fn fn, void *arg); WEBVIEW_API void webview_terminate(webview_t *w); WEBVIEW_API void webview_set_title(webview_t *w, const char *title); WEBVIEW_API void webview_set_external_invoke_cb(webview_t *w, webview_invoke_fn external_invoke_cb); WEBVIEW_API void webview_set_fullscreen(webview_t *w, int fullscreen); WEBVIEW_API int webview_eval(webview_t *w, const char *js); WEBVIEW_API void webview_dialog(webview_t *w, webview_dialog_t dlgtype, int flags, const char *title, const char *arg, char *result, size_t resultsz); WEBVIEW_API void webview_print_log(const char *s); #endif /* WEBVIEW_H */