summaryrefslogtreecommitdiffstats
path: root/src/ui/types.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/types.rs')
-rw-r--r--src/ui/types.rs61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/ui/types.rs b/src/ui/types.rs
new file mode 100644
index 0000000..d032ae9
--- /dev/null
+++ b/src/ui/types.rs
@@ -0,0 +1,61 @@
+/*
+ * meli - ui crate.
+ *
+ * Copyright 2017-2018 Manos Pitsidianakis
+ *
+ * This file is part of meli.
+ *
+ * meli 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.
+ *
+ * meli 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 meli. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+use crate::ui::Key;
+use std;
+use std::fmt;
+use std::thread;
+
+#[derive(Debug)]
+pub enum StatusEvent {
+ DisplayMessage(String),
+ BufClear,
+ BufSet(String),
+}
+
+/// `ThreadEvent` encapsulates all of the possible values we need to transfer between our threads
+/// to the main process.
+#[derive(Debug)]
+pub enum ThreadEvent {
+ Input(Key),
+ UIEvent(UIEvent),
+}
+#[derive(Debug)]
+pub enum UIEvent {
+ Input(Key),
+ Resize,
+}
+
+pub enum UIMode {
+ Normal,
+}
+
+impl fmt::Display for UIMode {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(
+ f,
+ "{}",
+ match *self {
+ UIMode::Normal => "NORMAL",
+ }
+ )
+ }
+}