summaryrefslogtreecommitdiff
path: root/schist_desktop_gui
diff options
context:
space:
mode:
authorJoe Carstairs <jcarstairs@scottlogic.com>2025-07-28 14:33:46 +0100
committerJoe Carstairs <jcarstairs@scottlogic.com>2025-07-28 15:58:10 +0100
commit6531d6783cb5943564c452e3368b3b68ef0b0b0b (patch)
treee70e2758470df504d74cb5a9373b6269d56ee1b4 /schist_desktop_gui
parent365c4b1974fb1d3361e97f64584a4f31bae98160 (diff)
task-010: adds Hello, world!
Diffstat (limited to 'schist_desktop_gui')
-rw-r--r--schist_desktop_gui/Cargo.toml1
-rw-r--r--schist_desktop_gui/src/config.rs8
-rw-r--r--schist_desktop_gui/src/main.rs20
-rw-r--r--schist_desktop_gui/src/message.rs3
-rw-r--r--schist_desktop_gui/src/settings.rs7
-rw-r--r--schist_desktop_gui/src/state.rs18
-rw-r--r--schist_desktop_gui/src/theme.rs7
-rw-r--r--schist_desktop_gui/src/view.rs7
-rw-r--r--schist_desktop_gui/src/window_settings.rs7
9 files changed, 76 insertions, 2 deletions
diff --git a/schist_desktop_gui/Cargo.toml b/schist_desktop_gui/Cargo.toml
index a8d887f..75072e7 100644
--- a/schist_desktop_gui/Cargo.toml
+++ b/schist_desktop_gui/Cargo.toml
@@ -3,3 +3,4 @@ name = "schist_desktop_gui"
edition = "2021"
[dependencies]
+iced = { workspace = true }
diff --git a/schist_desktop_gui/src/config.rs b/schist_desktop_gui/src/config.rs
new file mode 100644
index 0000000..cab9eba
--- /dev/null
+++ b/schist_desktop_gui/src/config.rs
@@ -0,0 +1,8 @@
+#[derive(Clone)]
+pub struct Config {}
+
+impl Default for Config {
+ fn default() -> Self {
+ Self {}
+ }
+}
diff --git a/schist_desktop_gui/src/main.rs b/schist_desktop_gui/src/main.rs
index f79c691..b836453 100644
--- a/schist_desktop_gui/src/main.rs
+++ b/schist_desktop_gui/src/main.rs
@@ -1,2 +1,18 @@
-fn main() {
-}
+mod config;
+mod message;
+mod settings;
+mod state;
+mod theme;
+mod window_settings;
+mod view;
+
+use crate::{config::Config, settings::make_settings, state::State, theme::make_theme, window_settings::make_window_settings, view::view};
+
+fn main() -> iced::Result {
+ let config = Config::default();
+ iced::application("Schist", State::update, view)
+ .settings(make_settings(&config.clone()))
+ .theme(|state: &State| make_theme(state))
+ .window(make_window_settings(&config.clone()))
+ .run()
+} \ No newline at end of file
diff --git a/schist_desktop_gui/src/message.rs b/schist_desktop_gui/src/message.rs
new file mode 100644
index 0000000..10f734b
--- /dev/null
+++ b/schist_desktop_gui/src/message.rs
@@ -0,0 +1,3 @@
+#[derive(Debug)]
+pub enum Message {
+}
diff --git a/schist_desktop_gui/src/settings.rs b/schist_desktop_gui/src/settings.rs
new file mode 100644
index 0000000..37fb8ca
--- /dev/null
+++ b/schist_desktop_gui/src/settings.rs
@@ -0,0 +1,7 @@
+use iced::Settings;
+
+use crate::config::Config;
+
+pub fn make_settings(_config: &Config) -> Settings {
+ Settings::default()
+} \ No newline at end of file
diff --git a/schist_desktop_gui/src/state.rs b/schist_desktop_gui/src/state.rs
new file mode 100644
index 0000000..0183104
--- /dev/null
+++ b/schist_desktop_gui/src/state.rs
@@ -0,0 +1,18 @@
+use crate::message::Message;
+
+pub struct State {
+ pub greeting: String,
+}
+
+impl State {
+ pub fn update(&mut self, _message: Message) {
+ }
+}
+
+impl Default for State {
+ fn default() -> Self {
+ Self {
+ greeting: String::from("Hello, world!"),
+ }
+ }
+}
diff --git a/schist_desktop_gui/src/theme.rs b/schist_desktop_gui/src/theme.rs
new file mode 100644
index 0000000..695ff8a
--- /dev/null
+++ b/schist_desktop_gui/src/theme.rs
@@ -0,0 +1,7 @@
+use iced::Theme;
+
+use crate::state::State;
+
+pub fn make_theme(_state: &State) -> Theme {
+ Theme::GruvboxDark
+} \ No newline at end of file
diff --git a/schist_desktop_gui/src/view.rs b/schist_desktop_gui/src/view.rs
new file mode 100644
index 0000000..7d169b5
--- /dev/null
+++ b/schist_desktop_gui/src/view.rs
@@ -0,0 +1,7 @@
+use iced::widget::{column, Column};
+
+use crate::{message::Message, state::State};
+
+pub fn view(state: &State) -> Column<Message> {
+ column![iced::widget::text(state.greeting.clone())]
+}
diff --git a/schist_desktop_gui/src/window_settings.rs b/schist_desktop_gui/src/window_settings.rs
new file mode 100644
index 0000000..cd71d09
--- /dev/null
+++ b/schist_desktop_gui/src/window_settings.rs
@@ -0,0 +1,7 @@
+use iced::window::Settings;
+
+use crate::config::Config;
+
+pub fn make_window_settings(_config: &Config) -> Settings {
+ Settings::default()
+} \ No newline at end of file