use ui_rs::{UiModel, UiActions};
use ui_rs::ui::*;
+use entity::collection::{Model as Collection};
#[derive(UiModel, UiActions, Default)]
struct NewNotebookDialog {
- name: UiString
+ name: UiString,
+ groups: UiList<Collection>
}
pub fn new_notebook_dialog<T>(parent: &UiObject<T>) {
a.margin(10);
a.columnspacing(10);
a.rowspacing(10);
+ a.def_hexpand(true);
+ a.def_hfill(true);
+ a.def_vfill(true);
+ a.fill(true);
}, |obj| {
-
+ obj.grid_row(|obj| {
+ obj.rlabel_builder().label("Group").create();
+ obj.dropdown_builder::<Collection>().value(&data.groups).create();
+ });
+ obj.grid_row(|obj| {
+ obj.rlabel_builder().label("Name").create();
+ obj.textfield_builder().value(&data.name).create();
+ });
});
}).show();
}
\ No newline at end of file
obj->window = wdata;
// Dialog UI
- ui_grid(obj, .margin = 10, .columnspacing = 10, .rowspacing = 10, .def_vfill = TRUE, .fill = TRUE) {
+ ui_grid(obj, .margin = 10, .columnspacing = 10, .rowspacing = 10, .def_vfill = TRUE, .def_hexpand = TRUE, .def_hfill = TRUE, .fill = TRUE) {
ui_rlabel(obj, .label = "Group");
- ui_dropdown(obj, .list = wdata->groups, .getvalue = nnd_group_value, .hfill = TRUE, .hexpand = TRUE);
+ ui_dropdown(obj, .list = wdata->groups, .getvalue = nnd_group_value);
ui_newline(obj);
ui_newline(obj);
ui_rlabel(obj, .label = "Name");
- ui_textfield(obj, .value = wdata->notebook_name, .hfill = TRUE, .hexpand = TRUE);
+ ui_textfield(obj, .value = wdata->notebook_name, .hfill = TRUE);
}
// Dialog Data
self
}
+ pub fn def_hexpand(&mut self, value: bool) -> &mut Self {
+ unsafe {
+ ui_container_args_set_def_hexpand(self.args, value as c_int);
+ }
+ self
+ }
+
+ pub fn def_vexpand(&mut self, value: bool) -> &mut Self {
+ unsafe {
+ ui_container_args_set_def_vexpand(self.args, value as c_int);
+ }
+ self
+ }
+
+ pub fn def_hfill(&mut self, value: bool) -> &mut Self {
+ unsafe {
+ ui_container_args_set_def_hfill(self.args, value as c_int);
+ }
+ self
+ }
+
+ pub fn def_vfill(&mut self, value: bool) -> &mut Self {
+ unsafe {
+ ui_container_args_set_def_vfill(self.args, value as c_int);
+ }
+ self
+ }
+
pub fn name(&mut self, value: &str) -> &mut Self {
let cstr = CString::new(value).unwrap();
unsafe {
fn ui_container_args_set_margin_top(args: *mut UiContainerArgs, value: c_int);
fn ui_container_args_set_margin_bottom(args: *mut UiContainerArgs, value: c_int);
fn ui_container_args_set_colspan(args: *mut UiContainerArgs, value: c_int);
+ fn ui_container_args_set_def_hexpand(args: *mut UiContainerArgs, value: c_int);
+ fn ui_container_args_set_def_vexpand(args: *mut UiContainerArgs, value: c_int);
+ fn ui_container_args_set_def_hfill(args: *mut UiContainerArgs, value: c_int);
+ fn ui_container_args_set_def_vfill(args: *mut UiContainerArgs, value: c_int);
fn ui_container_args_set_rowspan(args: *mut UiContainerArgs, value: c_int);
fn ui_container_args_set_name(args: *mut UiContainerArgs, name: *const c_char);
fn ui_container_args_set_style_class(args: *mut UiContainerArgs, classname: *const c_char);
self
}
- pub fn value(&mut self, value: &toolkit::UiString) {
+ pub fn value(&mut self, value: &toolkit::UiString) -> &mut Self {
unsafe {
ui_textfield_args_set_value(self.args, value.ptr);
}
+ self
}
pub fn onactivate<F>(&mut self, f: F) -> &mut Self