Warning
This is pre-ALPHA work in progress software
GBW is a cross-platform GTK 4 widget that makes available an embedded browser engine of your choice:
- MsWebview2 (ALPHA)
- Webkit (in progress) - discussion
- Chromium (in progress)
GBW is developed with the gtkmm 4 C++ library. More language bindings are on the roadmap.
// gtkmm headers MUST be included first
#include <gtkmm/applicationwindow.h>
#include "Gbw_widget.hh"
class Application : public Gtk::ApplicationWindow {
public:
Application() : browser() {
browser.ready().connect([this] {
auto gbw = browser.api().core;
gbw->Navigate(L"https://www.gtk.org/");
});
set_title("Example GBW application");
set_default_size(1000, 900);
set_child(browser);
};
private:
gbw::Gbw_widget browser;
};
#ifdef _WIN32
int CALLBACK WinMain(_In_ HINSTANCE /*hInstance*/,
_In_ HINSTANCE /*hPrevInstance*/, _In_ LPSTR /*lpCmdLine*/,
_In_ int /*nCmdShow*/) {
#else
int main() {
#endif
auto app = Gtk::Application::create("org.gbw.example");
return app->make_window_and_run<Application>(0, nullptr);
};At this ALPHA stage, only MsWebview2 for Windows browser engine option is available.
You will need MSys2 installed, and then proceed from a MSys2 UCRT bash terminal:
# Install Msys2 system dependencies
pacman -Suy # Do this twice for a fresh install to update the core
pacman -S mingw-w64-ucrt-x86_64-clang-tools-extra
pacman -S mingw-w64-ucrt-x86_64-cmake
pacman -S mingw-w64-ucrt-x86_64-gtkmm-4.0
pacman -S git
# Clone the GBW repository
git clone https://github.com/citkane/gtk-browser-widget.git
cd gtk-browser-widget
# Use the installer script
source installer.sh
## Answer the prompts to select your build
packages_install
generate
build
install
run
- MsWebview2
- Webkit (todo)
- Chromium (todo)
Please fork this repository and submit pull requests against the development branch.
Development notes:
GBW wants to uncomplicate and unboilerplate the embedded browser app development experience. What it does:
- Starts a browser engine instance,
- presents a browser window in a new top level
Gtk:Window - pseudo-embeds the window into the
gbw::Gbw_widgetinstance, - provides to the developer a full API of their chosen web engine
From there, it is the developer's prerogative to plumb up their GTK application to the browser API in a way that suits their logic. GBW is not a framework, but rather a simple tool.
Plugins optionally extend GBW to provide functionallity for common usage patterns.
Provides an easy to consume interface that binds native callback functions to browser-side javascript functions.
GBW is developed in C++, but will provide bindings for other GTK supported languages:
- C
- C# (via Gir.Core)
- JavaScript
- Python
- Perl
- Rust
- Vala
