Changeset b71c0fc in mainline for uspace/app/uidemo/uidemo.c


Ignore:
Timestamp:
2020-11-07T16:07:22Z (4 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/app/uidemo/uidemo.c

    rfa01c05 rb71c0fc  
    3434
    3535#include <gfx/coord.h>
    36 #include <io/pos_event.h>
    3736#include <stdio.h>
    3837#include <str.h>
     
    4342#include <ui/resource.h>
    4443#include <ui/ui.h>
    45 #include <ui/wdecor.h>
    4644#include <ui/window.h>
    4745#include "uidemo.h"
    4846
    4947static void wnd_close(ui_window_t *, void *);
    50 static errno_t wnd_paint(ui_window_t *, void *);
    51 static void wnd_pos(ui_window_t *, void *, pos_event_t *pos);
    5248
    5349static ui_window_cb_t window_cb = {
    54         .close = wnd_close,
    55         .paint = wnd_paint,
    56         .pos = wnd_pos
     50        .close = wnd_close
    5751};
    5852
     
    7367
    7468        ui_quit(demo->ui);
    75 }
    76 
    77 /** Window paint request.
    78  *
    79  * @param window Window
    80  * @param arg Argument (demo)
    81  * @return EOK on success or an error code
    82  */
    83 static errno_t wnd_paint(ui_window_t *window, void *arg)
    84 {
    85         ui_demo_t *demo = (ui_demo_t *) arg;
    86         errno_t rc;
    87 
    88         /* Let window paint its background */
    89         rc = ui_window_def_paint(window);
    90         if (rc != EOK)
    91                 return rc;
    92 
    93         return ui_fixed_paint(demo->fixed);
    94 }
    95 
    96 /** Window position event.
    97  *
    98  * @param window Window
    99  * @param arg Argument (demo)
    100  */
    101 static void wnd_pos(ui_window_t *window, void *arg, pos_event_t *event)
    102 {
    103         ui_demo_t *demo = (ui_demo_t *) arg;
    104 
    105         /* Make sure we don't process events until fully initialized */
    106         if (demo->fixed == NULL)
    107                 return;
    108 
    109         ui_fixed_pos_event(demo->fixed, event);
    11069}
    11170
     
    240199        }
    241200
     201        ui_window_add(window, ui_fixed_ctl(demo.fixed));
     202
    242203        rc = ui_window_paint(window);
    243204        if (rc != EOK) {
     
    248209        ui_run(ui);
    249210
    250         ui_fixed_destroy(demo.fixed);
    251211        ui_window_destroy(window);
    252212        ui_destroy(ui);
Note: See TracChangeset for help on using the changeset viewer.