Changeset 06a61fc in mainline


Ignore:
Timestamp:
2023-10-02T09:19:56Z (15 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b2261af0
Parents:
be0ec50
git-author:
Jiri Svoboda <jiri@…> (2023-10-01 09:19:27)
git-committer:
Jiri Svoboda <jiri@…> (2023-10-02 09:19:56)
Message:

Start menu (WIP)

It's not starting anything yet.

Location:
uspace/app/taskbar
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/taskbar/meson.build

    rbe0ec50 r06a61fc  
    11#
    2 # Copyright (c) 2022 Jiri Svoboda
     2# Copyright (c) 2023 Jiri Svoboda
    33# All rights reserved.
    44#
     
    3232        'main.c',
    3333        'taskbar.c',
     34        'tbsmenu.c',
    3435        'wndlist.c',
    3536)
     
    3839        'clock.c',
    3940        'taskbar.c',
     41        'tbsmenu.c',
    4042        'wndlist.c',
    4143        'test/clock.c',
    4244        'test/main.c',
    4345        'test/taskbar.c',
     46        'test/tbsmenu.c',
    4447        'test/wndlist.c',
    4548)
  • uspace/app/taskbar/taskbar.c

    rbe0ec50 r06a61fc  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3939#include <str.h>
    4040#include <ui/fixed.h>
    41 #include <ui/label.h>
    4241#include <ui/resource.h>
    4342#include <ui/ui.h>
     
    4645#include "clock.h"
    4746#include "taskbar.h"
     47#include "tbsmenu.h"
    4848#include "wndlist.h"
    4949
     
    9898        gfx_rect_t scr_rect;
    9999        gfx_rect_t rect;
    100         ui_resource_t *ui_res;
    101100        errno_t rc;
    102101
     
    161160
    162161        ui_window_set_cb(taskbar->window, &window_cb, (void *)taskbar);
    163         ui_res = ui_window_get_res(taskbar->window);
    164162
    165163        rc = ui_fixed_create(&taskbar->fixed);
     
    169167        }
    170168
    171         rc = ui_label_create(ui_res, "HelenOS", &taskbar->label);
    172         if (rc != EOK) {
    173                 printf("Error creating label.\n");
    174                 goto error;
    175         }
    176 
    177         ui_window_get_app_rect(taskbar->window, &rect);
    178         if (ui_is_textmode(taskbar->ui)) {
    179                 rect.p0.x += 1;
    180         } else {
    181                 rect.p0.x += 10;
    182         }
    183         ui_label_set_rect(taskbar->label, &rect);
    184         ui_label_set_halign(taskbar->label, gfx_halign_left);
    185         ui_label_set_valign(taskbar->label, gfx_valign_center);
    186 
    187         rc = ui_fixed_add(taskbar->fixed, ui_label_ctl(taskbar->label));
    188         if (rc != EOK) {
    189                 printf("Error adding control to layout.\n");
    190                 ui_label_destroy(taskbar->label);
    191                 goto error;
    192         }
     169        rc = tbsmenu_create(taskbar->window, taskbar->fixed, &taskbar->tbsmenu);
     170        if (rc != EOK) {
     171                printf("Error creating start menu.\n");
     172                goto error;
     173        }
     174
     175        if (ui_is_textmode(taskbar->ui)) {
     176                rect.p0.x = params.rect.p0.x + 1;
     177                rect.p0.y = 0;
     178                rect.p1.x = params.rect.p0.x + 9;
     179                rect.p1.y = 1;
     180        } else {
     181                rect.p0.x = params.rect.p0.x + 5;
     182                rect.p0.y = 4;
     183                rect.p1.x = params.rect.p0.x + 84;
     184                rect.p1.y = 32 - 4;
     185        }
     186
     187        tbsmenu_set_rect(taskbar->tbsmenu, &rect);
    193188
    194189        rc = wndlist_create(taskbar->window, taskbar->fixed, &taskbar->wndlist);
     
    199194
    200195        if (ui_is_textmode(taskbar->ui)) {
    201                 rect.p0.x = params.rect.p0.x + 9;
     196                rect.p0.x = params.rect.p0.x + 10;
    202197                rect.p0.y = 0;
    203198                rect.p1.x = params.rect.p1.x - 10;
     
    257252        if (taskbar->wndlist != NULL)
    258253                wndlist_destroy(taskbar->wndlist);
     254        if (taskbar->tbsmenu != NULL)
     255                tbsmenu_destroy(taskbar->tbsmenu);
    259256        if (taskbar->window != NULL)
    260257                ui_window_destroy(taskbar->window);
     
    270267        ui_fixed_remove(taskbar->fixed, taskbar_clock_ctl(taskbar->clock));
    271268        taskbar_clock_destroy(taskbar->clock);
     269        wndlist_destroy(taskbar->wndlist);
     270        tbsmenu_destroy(taskbar->tbsmenu);
    272271        ui_window_destroy(taskbar->window);
    273272        ui_destroy(taskbar->ui);
  • uspace/app/taskbar/test/main.c

    rbe0ec50 r06a61fc  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3333PCUT_IMPORT(clock);
    3434PCUT_IMPORT(taskbar);
     35PCUT_IMPORT(tbsmenu);
    3536PCUT_IMPORT(wndlist);
    3637
  • uspace/app/taskbar/types/taskbar.h

    rbe0ec50 r06a61fc  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    4343#include <ui/window.h>
    4444#include "clock.h"
     45#include "tbsmenu.h"
    4546#include "wndlist.h"
    4647
     
    5354        /** Fixed layout */
    5455        ui_fixed_t *fixed;
    55         ui_label_t *label;
     56        /** Start menu */
     57        tbsmenu_t *tbsmenu;
    5658        /** Window list */
    5759        wndlist_t *wndlist;
  • uspace/app/taskbar/types/wndlist.h

    rbe0ec50 r06a61fc  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    6969        ui_window_t *window;
    7070
    71         /** Layout to which we add window buttoons */
     71        /** Layout to which we add window buttons */
    7272        ui_fixed_t *fixed;
    7373
  • uspace/app/taskbar/wndlist.c

    rbe0ec50 r06a61fc  
    4545#include <ui/ui.h>
    4646#include <ui/window.h>
    47 #include "clock.h"
    4847#include "wndlist.h"
    4948
     
    8584 * @param window Containing window
    8685 * @param fixed Fixed layout to which buttons will be added
    87  * @param wndmgt Window management service
    8886 * @param rwndlist Place to store pointer to new window list
    8987 * @return @c EOK on success or an error code
     
    178176}
    179177
    180 /** Destroy task bar window list. */
     178/** Destroy task bar window list.
     179 *
     180 * @param wndlist Window list
     181 */
    181182void wndlist_destroy(wndlist_t *wndlist)
    182183{
     
    469470}
    470471
    471 /** Compute and set window list entry rectangle.
    472  *
    473  * Compute rectangle for window list entry and set it.
     472/** Unpaint window list entry.
    474473 *
    475474 * @param entry Window list entry
Note: See TracChangeset for help on using the changeset viewer.