I am using gtk-rs to build an application and currently I am having some trouble adjusting the width of the buttons when using StackSwitcher. I have tried using CSS for this as the gtk-rs book seems to imply but I just get an error stating No property named width
. I have an example of my method for building the stack switcher below:
use gtk::prelude::*;
use gtk::{ApplicationWindow};
use gtk::StackTransitionType::SlideLeftRight;
pub fn home_box(window: &ApplicationWindow) {
let container = gtk::Box::new(gtk::Orientation::Vertical, 100);
window.set_child(Some(&container));
let stack = gtk::Stack::new();
stack.set_transition_type(SlideLeftRight);
stack.set_transition_duration(200);
let home_label = gtk::Label::new(Some("Home"));
stack.add_titled(&home_label, Option::<&str>::None, "Home");
let label1 = gtk::Label::new(Some("placeholder"));
stack.add_titled(&label1, Option::<&str>::None, "placeholder");
let label2 = gtk::Label::new(Some("placeholder2"));
stack.add_titled(&label2, Option::<&str>::None, "placeholder2");
let label3 = gtk::Label::new(Some("Settings"));
let opt: Option<&str> = Some("Settings");
stack.add_titled(&label3, opt, "Settings");
let stack_switcher = gtk::StackSwitcher::new();
stack_switcher.set_stack(Some(&stack));
container.append(&stack_switcher);
container.append(&stack);
window.present();
}
I would like to reduce the width of the buttons when using StackSwitcher
. I would also like to have the buttons be at the bottom of the screen and not at the top. Gernally speaking I would like to know how to customize the appearance of this widget.
You can set up the .stack-switcher as shown on the page.
Example