pits and exits

This commit is contained in:
2019-06-05 22:01:24 +02:00
parent ad9cad533f
commit b0cfa3f9aa
3 changed files with 84 additions and 22 deletions

View File

@@ -1,16 +1,19 @@
use super::*;
/// A wrapper around gtk::ListBox for Pawns
#[derive(Debug,Clone)]
pub struct PawnList {
inner: gtk::ListBox,
}
impl PawnList {
/// Initialize from the given existing ListBox
pub fn init(inner: gtk::ListBox) -> Self {
PawnList{ inner }
}
/// Adds a Pawn to the list
pub fn add(&self, pawn: &Pawn) {
let row = gtk::ListBoxRow::new();
row.add(pawn.as_ref());
@@ -18,12 +21,14 @@ impl PawnList {
}
}
/// Application data related to a Pawn
#[derive(Debug,Clone)]
pub struct PawnData {
pub name: String,
pub position: Option<String>, // Content of label from CellWidget
}
/// A wrapper widget for pawns.
#[derive(Debug, Clone)]
pub struct Pawn {
data: PawnData,