Changeset 5de71df in mainline for uspace/app/uidemo/uidemo.c
- Timestamp:
- 2021-07-28T18:22:58Z (3 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dbb42c9
- Parents:
- a106037
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/uidemo/uidemo.c
ra106037 r5de71df 96 96 }; 97 97 98 /** Horizontal alignment selected by each radio button */ 99 static const gfx_halign_t uidemo_halign[3] = { 100 gfx_halign_left, 101 gfx_halign_center, 102 gfx_halign_right 103 }; 104 98 105 /** Window close button was clicked. 99 106 * … … 139 146 { 140 147 ui_demo_t *demo = (ui_demo_t *) arg; 141 errno_t rc; 142 143 if (enable) { 144 rc = ui_entry_set_text(demo->entry, "Checked"); 145 if (rc != EOK) 146 printf("Error changing entry text.\n"); 147 (void) ui_entry_paint(demo->entry); 148 } else { 149 rc = ui_entry_set_text(demo->entry, "Unchecked"); 150 if (rc != EOK) 151 printf("Error changing entry text.\n"); 152 (void) ui_entry_paint(demo->entry); 153 } 148 149 ui_entry_set_read_only(demo->entry, enable); 154 150 } 155 151 … … 163 159 { 164 160 ui_demo_t *demo = (ui_demo_t *) garg; 165 const char *text = (const char *) barg; 166 errno_t rc; 167 168 rc = ui_entry_set_text(demo->entry, text); 169 if (rc != EOK) 170 printf("Error changing entry text.\n"); 161 gfx_halign_t halign = *(gfx_halign_t *) barg; 162 163 ui_entry_set_halign(demo->entry, halign); 171 164 (void) ui_entry_paint(demo->entry); 172 165 } … … 578 571 } 579 572 580 rc = ui_checkbox_create(ui_res, " Check me", &demo.checkbox);573 rc = ui_checkbox_create(ui_res, "Read only", &demo.checkbox); 581 574 if (rc != EOK) { 582 575 printf("Error creating check box.\n"); … … 604 597 } 605 598 606 rc = ui_rbutton_create(demo.rbgroup, " Option 1", (void *) "First",607 &demo.rb 1);599 rc = ui_rbutton_create(demo.rbgroup, "Left", (void *) &uidemo_halign[0], 600 &demo.rbleft); 608 601 if (rc != EOK) { 609 602 printf("Error creating radio button.\n"); … … 618 611 rect.p1.x = 140; 619 612 rect.p1.y = 240; 620 ui_rbutton_set_rect(demo.rb 1, &rect);621 622 rc = ui_fixed_add(demo.fixed, ui_rbutton_ctl(demo.rb 1));623 if (rc != EOK) { 624 printf("Error adding control to layout.\n"); 625 return rc; 626 } 627 628 rc = ui_rbutton_create(demo.rbgroup, " Option 2", (void *) "Second",629 &demo.rb 2);613 ui_rbutton_set_rect(demo.rbleft, &rect); 614 615 rc = ui_fixed_add(demo.fixed, ui_rbutton_ctl(demo.rbleft)); 616 if (rc != EOK) { 617 printf("Error adding control to layout.\n"); 618 return rc; 619 } 620 621 rc = ui_rbutton_create(demo.rbgroup, "Center", (void *) &uidemo_halign[1], 622 &demo.rbcenter); 630 623 if (rc != EOK) { 631 624 printf("Error creating radio button.\n"); … … 637 630 rect.p1.x = 140; 638 631 rect.p1.y = 270; 639 ui_rbutton_set_rect(demo.rb2, &rect); 640 641 rc = ui_fixed_add(demo.fixed, ui_rbutton_ctl(demo.rb2)); 642 if (rc != EOK) { 643 printf("Error adding control to layout.\n"); 644 return rc; 645 } 646 647 rc = ui_rbutton_create(demo.rbgroup, "Option 3", (void *) "Third", 648 &demo.rb3); 632 ui_rbutton_set_rect(demo.rbcenter, &rect); 633 ui_rbutton_select(demo.rbcenter); 634 635 rc = ui_fixed_add(demo.fixed, ui_rbutton_ctl(demo.rbcenter)); 636 if (rc != EOK) { 637 printf("Error adding control to layout.\n"); 638 return rc; 639 } 640 641 rc = ui_rbutton_create(demo.rbgroup, "Right", (void *) &uidemo_halign[2], 642 &demo.rbright); 649 643 if (rc != EOK) { 650 644 printf("Error creating radio button.\n"); … … 656 650 rect.p1.x = 140; 657 651 rect.p1.y = 300; 658 ui_rbutton_set_rect(demo.rb 3, &rect);659 660 rc = ui_fixed_add(demo.fixed, ui_rbutton_ctl(demo.rb 3));652 ui_rbutton_set_rect(demo.rbright, &rect); 653 654 rc = ui_fixed_add(demo.fixed, ui_rbutton_ctl(demo.rbright)); 661 655 if (rc != EOK) { 662 656 printf("Error adding control to layout.\n");
Note:
See TracChangeset
for help on using the changeset viewer.