]> uap-core.de Git - note.git/commitdiff
add UI for the new notebook dialog main
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Mon, 18 May 2026 20:34:09 +0000 (22:34 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Mon, 18 May 2026 20:34:09 +0000 (22:34 +0200)
application/src/newnotebook.rs
application/window.c
ui-rs/src/ui/container.rs
ui-rs/src/ui/text.rs

index e65ec9eba67ae91e3f83538db9d87809e749f35e..395501bff9ea974f47342e4d1578fb7437bc30dd 100644 (file)
 
 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>) {
@@ -53,8 +55,19 @@ 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
index 0f3e2b568720f5d580bb60faf7d02584db285af2..6aabbb53a0470c6aa7822565225be6fb3e0d58a7 100644 (file)
@@ -397,14 +397,14 @@ void action_notebook_add(UiEvent *event, void *userdata) {
     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
index 09941ab31d74a1d232ae09810d723cc87cd2f943..a3c7d015b8223052151c0f74f21540d238f28897 100644 (file)
@@ -246,6 +246,34 @@ impl<'a, T> ContainerBuilder<'a, T> {
         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 {
@@ -1143,6 +1171,10 @@ extern "C" {
     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);
index 8f3190009d0b865f7990dde101f17240c24fee25..1cd3ef344abd513a23e94a473191eafcc9a682ab 100644 (file)
@@ -516,10 +516,11 @@ impl<'a, T> TextFieldBuilder<'a, T> {
         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