Changeset 8009dc27 in mainline for uspace/lib/ui/src/pbutton.c
- Timestamp:
- 2020-10-31T01:03:26Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4df6607
- Parents:
- f03d1308
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/src/pbutton.c
rf03d1308 r8009dc27 42 42 #include <stdlib.h> 43 43 #include <str.h> 44 #include <ui/control.h> 44 45 #include <ui/paint.h> 45 46 #include <ui/pbutton.h> … … 53 54 }; 54 55 56 static ui_evclaim_t ui_pbutton_ctl_pos_event(void *, pos_event_t *); 57 58 /** Push button control ops */ 59 ui_control_ops_t ui_pbutton_ops = { 60 .pos_event = ui_pbutton_ctl_pos_event 61 }; 62 55 63 /** Create new push button. 56 64 * … … 64 72 { 65 73 ui_pbutton_t *pbutton; 74 errno_t rc; 66 75 67 76 pbutton = calloc(1, sizeof(ui_pbutton_t)); … … 69 78 return ENOMEM; 70 79 80 rc = ui_control_new(&ui_pbutton_ops, (void *) pbutton, 81 &pbutton->control); 82 if (rc != EOK) { 83 free(pbutton); 84 return rc; 85 } 86 71 87 pbutton->caption = str_dup(caption); 72 88 if (pbutton->caption == NULL) { 89 ui_control_delete(pbutton->control); 73 90 free(pbutton); 74 91 return ENOMEM; … … 89 106 return; 90 107 108 ui_control_delete(pbutton->control); 91 109 free(pbutton); 110 } 111 112 /** Get base control from push button. 113 * 114 * @param pbutton Push button 115 * @return Control 116 */ 117 ui_control_t *ui_pbutton_ctl(ui_pbutton_t *pbutton) 118 { 119 return pbutton->control; 92 120 } 93 121 … … 388 416 } 389 417 418 /** Handle push button control position event. 419 * 420 * @param arg Argument (ui_pbutton_t *) 421 * @param pos_event Position event 422 * @return @c ui_claimed iff the event is claimed 423 */ 424 ui_evclaim_t ui_pbutton_ctl_pos_event(void *arg, pos_event_t *event) 425 { 426 ui_pbutton_t *pbutton = (ui_pbutton_t *) arg; 427 428 return ui_pbutton_pos_event(pbutton, event); 429 } 430 390 431 /** @} 391 432 */
Note:
See TracChangeset
for help on using the changeset viewer.