Skip to content

[FEATURE] Register Custom Widgets #52

Description

@Byson94

Description of the requested feature

Register custom widgets using gtk4-rs via the plugin API.

Regarding FFI Concern

Although a plain widget (like gtk4::Box) cannot pass across FFI safely, the underlying GtkWidget can as its #[repr(C)]. The plain widget can be converted into a raw C pointer and passed to ewwii, which it can then reconstruct.

This method preserves the properties and controllers attached to the widget. Which is ideal.

Proposed configuration syntax

A custom widget can be used like this:

Custom {
    name = "widget-name"
    # ... props
}

There is no clean way to register the widgets as MyProgress { .. } because ewwii uses a fixed list of widgets (WidgetNode). This pattern works because Custom can be just another widget in WidgetNode. If this is verbose for the developer writing the widget support plugin, they can use inject_nbcl to make a new component that wraps the custom widget.

Additional context

The custom widgets can also be required a specific structure that is similar to the EwwiiWidget trait system used currently in ewwii as of right now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions