/* Copyright 2024, Savanni D'Gerinel This file is part of On the Grid. On the Grid 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. On the Grid 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 On the Grid. If not, see . */ // Game review consists of the board, some information about the players, the game tree, and any // commentary on the current move. This requires four major components, some of which are easier // than others. The game board has to be kept in sync with the game tree, so there's a // communication channel there. // // I'll get all of the information about the game from the core, and then render everything in the // UI. So this will be a heavy lift on the UI side. use glib::Object; use gtk::{prelude::*, subclass::prelude::*}; use crate::{components::Goban, CoreApi}; pub struct GameReviewPrivate {} impl Default for GameReviewPrivate { fn default() -> Self { Self {} } } #[glib::object_subclass] impl ObjectSubclass for GameReviewPrivate { const NAME: &'static str = "GameReview"; type Type = GameReview; type ParentType = gtk::Grid; } impl ObjectImpl for GameReviewPrivate {} impl WidgetImpl for GameReviewPrivate {} impl GridImpl for GameReviewPrivate {} glib::wrapper! { pub struct GameReview(ObjectSubclass) @extends gtk::Grid, gtk::Widget, @implements gtk::Accessible; } impl GameReview { pub fn new(api: CoreApi) -> Self { let s: Self = Object::builder().build(); let board = Goban::new(otg_core::Goban::default()); s.attach(&board, 0, 0, 2, 2); s.attach(>k::Label::new(Some("white player")), 0, 2, 1, 1); s.attach(>k::Label::new(Some("black player")), 0, 2, 1, 2); s.attach(>k::Label::new(Some("chat")), 1, 2, 2, 2); s } }