I’m trying to create a way in my application for users to style GTK widgets through CSS. I’ve reached the border
property, and was wondering how I can create one in GTK.
Specifically, I was looking at how I can achieve this through GTK with Rust bindings.
GtkFrame seems to be what I’m looking for. (although I haven’t seen any mention of setting the border radius except through CSS, I believe it’s only possible to do so at compile time, which is a problem for me)
Since the GtkLabel
I’m trying to apply a border to is already set as the child of a GtkBox
, I can’t simply append()
the GtkFrame
instead of the GtkLabel
- I have to “replace” it.
This is my current code:
if border_style != "none" {
let frame = gtk::Frame::new(None);
frame.set_label_widget(Some(self));
// how do I replace self with frame in self's parent?
}
Maybe a GtkFrame isn’t the proper way of adding a border to a widget? I’ve also seen GtkBorder
but the properties looked identical to a GtkFrame
.
Summary: I’m trying to apply a (styled) border to GTK Widgets, can’t figure out how to properly do it. The widgets are already attached to a parent.