Changeset b71c0fc in mainline for uspace/lib/ui/src/fixed.c


Ignore:
Timestamp:
2020-11-07T16:07:22Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d55ab823
Parents:
fa01c05
Message:

Make fixed layout a UI control and hook it up to the window

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/src/fixed.c

    rfa01c05 rb71c0fc  
    4444#include "../private/fixed.h"
    4545
     46static void ui_fixed_ctl_destroy(void *);
     47static errno_t ui_fixed_ctl_paint(void *);
     48static ui_evclaim_t ui_fixed_ctl_pos_event(void *, pos_event_t *);
     49
     50/** Push button control ops */
     51ui_control_ops_t ui_fixed_ops = {
     52        .destroy = ui_fixed_ctl_destroy,
     53        .paint = ui_fixed_ctl_paint,
     54        .pos_event = ui_fixed_ctl_pos_event
     55};
     56
    4657/** Create new fixed layout.
    4758 *
     
    5263{
    5364        ui_fixed_t *fixed;
     65        errno_t rc;
    5466
    5567        fixed = calloc(1, sizeof(ui_fixed_t));
    5668        if (fixed == NULL)
    5769                return ENOMEM;
     70
     71        rc = ui_control_new(&ui_fixed_ops, (void *) fixed, &fixed->control);
     72        if (rc != EOK) {
     73                free(fixed);
     74                return rc;
     75        }
    5876
    5977        list_initialize(&fixed->elem);
     
    83101        }
    84102
     103        ui_control_delete(fixed->control);
    85104        free(fixed);
     105}
     106
     107/** Get base control from fixed layout.
     108 *
     109 * @param fixed Fixed layout
     110 * @return Control
     111 */
     112ui_control_t *ui_fixed_ctl(ui_fixed_t *fixed)
     113{
     114        return fixed->control;
    86115}
    87116
     
    203232}
    204233
     234/** Destroy fixed layout control.
     235 *
     236 * @param arg Argument (ui_fixed_t *)
     237 */
     238void ui_fixed_ctl_destroy(void *arg)
     239{
     240        ui_fixed_t *fixed = (ui_fixed_t *) arg;
     241
     242        ui_fixed_destroy(fixed);
     243}
     244
     245/** Paint fixed layout control.
     246 *
     247 * @param arg Argument (ui_fixed_t *)
     248 * @return EOK on success or an error code
     249 */
     250errno_t ui_fixed_ctl_paint(void *arg)
     251{
     252        ui_fixed_t *fixed = (ui_fixed_t *) arg;
     253
     254        return ui_fixed_paint(fixed);
     255}
     256
     257/** Handle fixed layout control position event.
     258 *
     259 * @param arg Argument (ui_fixed_t *)
     260 * @param pos_event Position event
     261 * @return @c ui_claimed iff the event is claimed
     262 */
     263ui_evclaim_t ui_fixed_ctl_pos_event(void *arg, pos_event_t *event)
     264{
     265        ui_fixed_t *fixed = (ui_fixed_t *) arg;
     266
     267        return ui_fixed_pos_event(fixed, event);
     268}
     269
    205270/** @}
    206271 */
Note: See TracChangeset for help on using the changeset viewer.