Changeset d70dc1c4 in mainline for uspace/app/uidemo/uidemo.c
- Timestamp:
- 2021-01-06T10:06:42Z (3 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7020d1f
- Parents:
- e037cf37
- git-author:
- Jiri Svoboda <jiri@…> (2021-01-05 18:06:37)
- git-committer:
- Jiri Svoboda <jiri@…> (2021-01-06 10:06:42)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/uidemo/uidemo.c
re037cf37 rd70dc1c4 62 62 }; 63 63 64 static void checkbox_switched(ui_checkbox_t *, void *, bool); 65 66 static ui_checkbox_cb_t checkbox_cb = { 67 .switched = checkbox_switched 68 }; 69 64 70 /** Window close button was clicked. 65 71 * … … 91 97 } else { 92 98 rc = ui_entry_set_text(demo->entry, "Cancel pressed"); 99 if (rc != EOK) 100 printf("Error changing entry text.\n"); 101 (void) ui_entry_paint(demo->entry); 102 } 103 } 104 105 /** Check box was switched. 106 * 107 * @param checkbox Check box 108 * @param arg Argument (demo) 109 */ 110 static void checkbox_switched(ui_checkbox_t *checkbox, void *arg, bool enable) 111 { 112 ui_demo_t *demo = (ui_demo_t *) arg; 113 errno_t rc; 114 115 if (enable) { 116 rc = ui_entry_set_text(demo->entry, "Checked"); 117 if (rc != EOK) 118 printf("Error changing entry text.\n"); 119 (void) ui_entry_paint(demo->entry); 120 } else { 121 rc = ui_entry_set_text(demo->entry, "Unchecked"); 93 122 if (rc != EOK) 94 123 printf("Error changing entry text.\n"); … … 124 153 params.rect.p0.y = 0; 125 154 params.rect.p1.x = 220; 126 params.rect.p1.y = 180;155 params.rect.p1.y = 220; 127 156 128 157 memset((void *) &demo, 0, sizeof(demo)); … … 258 287 259 288 rc = ui_fixed_add(demo.fixed, ui_image_ctl(demo.image)); 289 if (rc != EOK) { 290 printf("Error adding control to layout.\n"); 291 return rc; 292 } 293 294 rc = ui_checkbox_create(ui_res, "Check me", &demo.checkbox); 295 if (rc != EOK) { 296 printf("Error creating check box.\n"); 297 return rc; 298 } 299 300 ui_checkbox_set_cb(demo.checkbox, &checkbox_cb, (void *) &demo); 301 302 rect.p0.x = 15; 303 rect.p0.y = 180; 304 rect.p1.x = 140; 305 rect.p1.y = 200; 306 ui_checkbox_set_rect(demo.checkbox, &rect); 307 308 rc = ui_fixed_add(demo.fixed, ui_checkbox_ctl(demo.checkbox)); 260 309 if (rc != EOK) { 261 310 printf("Error adding control to layout.\n");
Note:
See TracChangeset
for help on using the changeset viewer.