mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 01:25:27 +00:00
begin multi-driver page client implementation
This commit is contained in:
parent
df8dea9534
commit
0c08a0fb2f
39 changed files with 741 additions and 1712 deletions
|
|
@ -1,57 +0,0 @@
|
|||
mod control;
|
||||
mod form;
|
||||
mod title;
|
||||
mod widget;
|
||||
|
||||
use control::Control;
|
||||
use form::Form;
|
||||
use gtk::{gio::SimpleAction, glib::uuid_string_random};
|
||||
use std::rc::Rc;
|
||||
use title::Title;
|
||||
use widget::Widget;
|
||||
|
||||
pub struct Titan {
|
||||
// Components
|
||||
pub widget: Rc<Widget>,
|
||||
}
|
||||
|
||||
impl Titan {
|
||||
// Constructors
|
||||
|
||||
/// Build new `Self`
|
||||
pub fn build(
|
||||
titan: super::super::client::response::input::Titan,
|
||||
callback: impl Fn(Result<super::super::client::Response, ()>) + 'static,
|
||||
) -> Self {
|
||||
// Init local actions
|
||||
let action_update = SimpleAction::new(&uuid_string_random(), None);
|
||||
let action_send = SimpleAction::new(&uuid_string_random(), None);
|
||||
|
||||
// Init components
|
||||
let control = Rc::new(Control::build(action_send.clone()));
|
||||
let form = Rc::new(Form::build(action_update.clone()));
|
||||
let title = Rc::new(Title::build(None)); // @TODO
|
||||
|
||||
// Init widget
|
||||
let widget = Rc::new(Widget::build(
|
||||
&title.widget.label,
|
||||
&form.widget.text_view,
|
||||
&control.widget.g_box,
|
||||
));
|
||||
|
||||
// Init events
|
||||
action_update.connect_activate({
|
||||
let control = control.clone();
|
||||
let form = form.clone();
|
||||
move |_, _| control.update(Some(form.widget.size()))
|
||||
});
|
||||
|
||||
action_send.connect_activate({
|
||||
// @TODO let form = form.clone();
|
||||
move |_, _| callback(todo!()) // @TODO input data
|
||||
});
|
||||
|
||||
// Return activated struct
|
||||
Self { widget }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue