monorepo/fitnesstrax/app/src/views/mod.rs

46 lines
1.4 KiB
Rust

/*
Copyright 2023, Savanni D'Gerinel <savanni@luminescent-dreams.com>
This file is part of FitnessTrax.
FitnessTrax is free software: you can redistribute it and/or modify it under the terms of the GNU
General Public License as published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
FitnessTrax is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along with FitnessTrax. If not, see <https://www.gnu.org/licenses/>.
*/
use gtk::prelude::*;
mod day_detail_view;
pub use day_detail_view::DayDetailView;
mod historical_view;
pub use historical_view::HistoricalView;
mod placeholder_view;
pub use placeholder_view::PlaceholderView;
mod welcome_view;
pub use welcome_view::WelcomeView;
pub enum View {
Placeholder(PlaceholderView),
Welcome(WelcomeView),
Historical(HistoricalView),
}
impl View {
pub fn widget(&self) -> gtk::Widget {
match self {
View::Placeholder(widget) => widget.clone().upcast::<gtk::Widget>(),
View::Welcome(widget) => widget.clone().upcast::<gtk::Widget>(),
View::Historical(widget) => widget.clone().upcast::<gtk::Widget>(),
}
}
}