implemented labled switch
This commit is contained in:
@@ -25,17 +25,22 @@ impl ObjectSubclass for LabledSwitch {
|
||||
|
||||
fn class_init(klass: &mut Self::Class) {
|
||||
klass.bind_template();
|
||||
klass.set_layout_manager_type::<gtk::BoxLayout>();
|
||||
}
|
||||
|
||||
fn instance_init(obj: &InitializingObject<Self>) {
|
||||
obj.init_template();
|
||||
}
|
||||
}
|
||||
|
||||
#[glib::derived_properties]
|
||||
impl ObjectImpl for LabledSwitch {
|
||||
fn constructed(&self) {
|
||||
self.parent_constructed();
|
||||
|
||||
// let a = LayoutManager:: ;
|
||||
|
||||
// self.obj().set_layout_manager(a);
|
||||
|
||||
let l: &Label = self.label_obj.as_ref();
|
||||
self.obj().bind_property("label_text", l, "label").sync_create().build();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,13 @@ use gtk::{glib, CompositeTemplate};
|
||||
#[template(resource = "/org/foxarmy/learn-hieroglyph/guessing/setup/ui.xml")]
|
||||
pub struct GuessingSetupScene {
|
||||
#[template_child]
|
||||
pub question_label: TemplateChild<LabledSwitch>,
|
||||
pub hiragana_enable: TemplateChild<LabledSwitch>,
|
||||
#[template_child]
|
||||
pub katakana_enable: TemplateChild<LabledSwitch>,
|
||||
#[template_child]
|
||||
pub ktr_enable: TemplateChild<LabledSwitch>,
|
||||
#[template_child]
|
||||
pub rtk_enable: TemplateChild<LabledSwitch>,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
@@ -31,6 +37,8 @@ impl ObjectSubclass for GuessingSetupScene {
|
||||
impl ObjectImpl for GuessingSetupScene {
|
||||
fn constructed(&self) {
|
||||
self.parent_constructed();
|
||||
|
||||
//TODO: tie switches to settings and make "start" button
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user