Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Add an Example of Creating a Custom Widget #165

Open
bvinc opened this issue Apr 14, 2018 · 4 comments
Open

Add an Example of Creating a Custom Widget #165

bvinc opened this issue Apr 14, 2018 · 4 comments

Comments

@bvinc
Copy link

bvinc commented Apr 14, 2018

I would love to see an example of writing a custom widget, for example: A new widget that derives from DrawingArea and implements Scrollable. Information on how to do this seems to be disjointed and hard to find.

@mmstick
Copy link
Contributor

mmstick commented Jan 9, 2019

This would be identical to any other trait from a Rust library. Create a new type consisting of a collection of widgets relevant for your type, and implement the two traits for that type.

@nicholasbishop
Copy link

Could you clarify what the "two traits" are?

@john01dav
Copy link

john01dav commented May 19, 2020

@mmstick I'm also wondering what the "two traits" are. I've seen WidgetNameExt traits in the existing widgets, but that's only 1 trait, and it's not even the same one for each widget.

@zzeroo
Copy link
Contributor

zzeroo commented Sep 14, 2020

Here is a blog post about that topic: https://www.figuiere.net/technotes/notes/tn002/
@bvinc maybe this example covers your needs https://gtk-rs.org/docs/src/glib/subclass/types.rs.html#195-224

Gtk-rs examples cover that question, too:

I think the issue can be closed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants