diff --git a/src/components/mod.rs b/src/components/mod.rs index 24e9074..d7f7fbe 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -3,4 +3,5 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ pub mod app; +pub mod sidebar; pub mod window; diff --git a/src/components/sidebar/imp.rs b/src/components/sidebar/imp.rs new file mode 100644 index 0000000..cc41ea5 --- /dev/null +++ b/src/components/sidebar/imp.rs @@ -0,0 +1,30 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +use gtk::prelude::*; +use gtk::subclass::prelude::*; +use gtk::CompositeTemplate; + +#[derive(Default, CompositeTemplate)] +#[template(file = "./sidebar.ui")] +pub struct EchidnaSidebar {} + +#[glib::object_subclass] +impl ObjectSubclass for EchidnaSidebar { + const NAME: &'static str = "EchidnaSidebar"; + type Type = super::EchidnaSidebar; + type ParentType = gtk::Box; + + fn class_init(klass: &mut Self::Class) { + Self::bind_template(klass); + } + + fn instance_init(obj: &glib::subclass::InitializingObject) { + obj.init_template(); + } +} + +impl ObjectImpl for EchidnaSidebar {} +impl WidgetImpl for EchidnaSidebar {} +impl BoxImpl for EchidnaSidebar {} diff --git a/src/components/sidebar/mod.rs b/src/components/sidebar/mod.rs new file mode 100644 index 0000000..25b3ef2 --- /dev/null +++ b/src/components/sidebar/mod.rs @@ -0,0 +1,13 @@ +pub mod imp; + +glib::wrapper! { + pub struct EchidnaSidebar(ObjectSubclass) + @extends gtk::Box, gtk::Widget, + @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable; +} + +impl EchidnaSidebar { + pub fn new() -> Self { + glib::Object::new(&[]).expect("Failed to create 'EchidnaSidebar' component.") + } +} diff --git a/src/components/sidebar/sidebar.ui b/src/components/sidebar/sidebar.ui new file mode 100644 index 0000000..0d59946 --- /dev/null +++ b/src/components/sidebar/sidebar.ui @@ -0,0 +1,68 @@ + + + + + + \ No newline at end of file