Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ysdragon/webview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

WebView Logo

WebView

Create beautiful, cross-platform desktop apps with Ring and web technologies.

WebView is a powerful Ring library that allows you to create modern, cross-platform desktop applications using web technologies for the frontend, while using Ring as the backend. It provides a simple and intuitive API for building beautiful graphical user interfaces.

This project is made possible by the tiny webview library.

✨ Features

  • Cross-Platform: Build applications for Windows, macOS, Linux, and FreeBSD from a single codebase.
  • Modern UI: Use familiar web technologies to design your user interface.
  • Two-Way Binding: Seamlessly call Ring functions from JavaScript and vice-versa.
  • Easy to Use: A simple and clean API makes it easy to get started.

πŸš€ Getting Started

Follow these instructions to get the WebView library up and running on your system.

Prerequisites

  • Ring: Ensure you have Ring language version 1.24 or higher installed.

Installation

Click here for instructions on Linux

The compiled Linux library in this package requires GTK 4 and WebkitGTK 6.

  • Debian-based: sudo apt install libgtk-4-1 libwebkitgtk-6.0-4
  • Arch-based: sudo pacman -S gtk4 webkitgtk-6.0
  • Fedora: sudo dnf install gtk4 webkitgtk6.0
  • Void Linux: sudo xbps-install gtk4 libwebkitgtk60
  • Alpine Linux: sudo apk add webkit2gtk-6.0
Click here for instructions on Windows

The compiled Windows library in this package does not bundle any webview version with itself but rather uses the system-installed one.

The Microsoft Edge WebView2 runtime is required to be installed on the system for any version of Windows before Windows 11. To manually update or install the latest version, follow the steps here.

Click here for instructions on FreeBSD

The compiled FreeBSD library in this package requires WebKitGTK 6.

  • FreeBSD systems: sudo pkg install webkit2-gtk_60
Click here for instructions on macOS

The compiled macOS library in this package uses the built-in WebKit framework.

  • macOS systems: No additional dependencies required. The WebKit framework is included with macOS.
  • Install the library using RingPM:
    ringpm install webview from ysdragon

πŸ’» Usage

Creating a basic WebView application is straightforward. Here’s a simple example:

# Load the webview library
load "webview.ring"

# Create a new WebView instance.
oWebView = new WebView()

oWebView {
    # Set the title of the native window.
    setTitle("My First WebView App")

    # Set the size of the window (width, height, hint).
    # WEBVIEW_HINT_NONE allows the window to be resized.
    setSize(800, 600, WEBVIEW_HINT_NONE)

    # Load HTML content into the webview.
    setHtml(`<h1>Welcome to Ring WebView!</h1>`)

    # Run the main event loop. This will block until the window is closed.
    run()
}

# This message will be displayed after the webview window is closed.
see "Application Closed." + nl

This code snippet creates a window, sets its title and size, loads some HTML, and runs the application loop.

For more advanced examples, see the examples/ directory.

πŸ“š API Reference

For a detailed list of all available functions, classes, and methods, please refer to our API reference documentation.

πŸ“– Usage Guide

For practical examples and guides on how to use the library, check out our Usage Guide.

πŸ› οΈ Development

If you want to contribute to the development of Ring WebView or build it from source, follow these steps.

Prerequisites

  • CMake: Version 3.16 or higher.
  • C Compiler: A C compiler compatible with your platform (e.g., GCC, Clang, MSVC).
  • Ring: You need to have the Ring language source code available on your machine.

Build Steps

  1. Clone the Repository: Clone the WebView repository to your local machine.

    git clone https://github.com/ysdragon/webview.git --recursive

    NOTE: Skip this step if you have already installed the library using RingPM.

  2. Set the RING Environment Variable: Before running CMake, you must set the RING environment variable to point to the root directory of the Ring language source code.

    • Windows

      • Command Prompt
        set RING=X:\path\to\ring
      • PowerShell
        $env:RING = "X:\path\to\ring"
    • Unix

      export RING=/path/to/ring
  3. Configure with CMake: Create a build directory and run CMake from within it.

    mkdir build
    cd build
    cmake ..
  4. Build the Project: Compile the source code using the build toolchain configured by CMake (e.g., Make, Ninja).

    cmake --build .

The compiled library will be placed in the lib/<os>/<arch> directory.

🀝 Contributing

Contributions are welcome! If you have ideas for improvements or have found a bug, please open an issue or submit a pull request.

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Create beautiful, cross-platform desktop apps with Ring and web technologies

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •