Changeset 2f1be23 in mainline


Ignore:
Timestamp:
2026-05-13T17:54:45Z (10 hours ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Parents:
2866531
Message:

Implement UI progress bar.

Location:
uspace
Files:
5 added
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/uidemo/uidemo.c

    r2866531 r2f1be23  
    11/*
    2  * Copyright (c) 2024 Jiri Svoboda
     2 * Copyright (c) 2026 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    956956        }
    957957
     958        rc = ui_tab_create(demo.tabset, "Bars", &demo.tbars);
     959        if (rc != EOK) {
     960                printf("Error creating tab.\n");
     961                return rc;
     962        }
     963
    958964        rc = ui_fixed_add(demo.fixed, ui_tab_set_ctl(demo.tabset));
    959965        if (rc != EOK) {
     
    14281434
    14291435        ui_tab_add(demo.tlists, ui_fixed_ctl(demo.lfixed));
     1436
     1437        rc = ui_fixed_create(&demo.bars_fixed);
     1438        if (rc != EOK) {
     1439                printf("Error creating fixed layout.\n");
     1440                return rc;
     1441        }
     1442
     1443        rc = ui_progress_create(ui_res, 0, &demo.progress);
     1444        if (rc != EOK) {
     1445                printf("Error creating entry.\n");
     1446                return rc;
     1447        }
     1448
     1449        /* FIXME: Auto layout */
     1450        if (ui_is_textmode(ui)) {
     1451                rect.p0.x = 4;
     1452                rect.p0.y = 5;
     1453                rect.p1.x = 42;
     1454                rect.p1.y = 6;
     1455        } else {
     1456                rect.p0.x = 15;
     1457                rect.p0.y = 88;
     1458                rect.p1.x = 243;
     1459                rect.p1.y = 113;
     1460        }
     1461
     1462        ui_progress_set_rect(demo.progress, &rect);
     1463
     1464        rc = ui_fixed_add(demo.bars_fixed, ui_progress_ctl(demo.progress));
     1465        if (rc != EOK) {
     1466                printf("Error adding control to layout.\n");
     1467                return rc;
     1468        }
     1469
     1470        ui_tab_add(demo.tbars, ui_fixed_ctl(demo.bars_fixed));
    14301471
    14311472        ui_window_add(window, ui_fixed_ctl(demo.fixed));
  • uspace/app/uidemo/uidemo.h

    r2866531 r2f1be23  
    11/*
    2  * Copyright (c) 2023 Jiri Svoboda
     2 * Copyright (c) 2026 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    4646#include <ui/menubar.h>
    4747#include <ui/pbutton.h>
     48#include <ui/progress.h>
    4849#include <ui/rbutton.h>
    4950#include <ui/scrollbar.h>
     
    6162        ui_fixed_t *bfixed;
    6263        ui_fixed_t *lfixed;
     64        ui_fixed_t *bars_fixed;
    6365        ui_menu_bar_t *mbar;
    6466        ui_menu_t *mfile;
     
    6971        ui_tab_t *tbasic;
    7072        ui_tab_t *tlists;
     73        ui_tab_t *tbars;
    7174        ui_entry_t *entry;
    7275        ui_image_t *image;
     
    8386        ui_scrollbar_t *vscrollbar;
    8487        ui_list_t *list;
     88        ui_progress_t *progress;
    8589} ui_demo_t;
    8690
  • uspace/lib/ui/meson.build

    r2866531 r2f1be23  
    11#
    2 # Copyright (c) 2023 Jiri Svoboda
     2# Copyright (c) 2026 Jiri Svoboda
    33# All rights reserved.
    44#
     
    4949        'src/pbutton.c',
    5050        'src/popup.c',
     51        'src/progress.c',
    5152        'src/promptdialog.c',
    5253        'src/rbutton.c',
     
    8586        'test/popup.c',
    8687        'test/promptdialog.c',
     88        'test/progress.c',
    8789        'test/rbutton.c',
    8890        'test/resource.c',
Note: See TracChangeset for help on using the changeset viewer.