Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 214aefb in mainline for uspace/lib/ui/src/resource.c


Ignore:
Timestamp:
2021-04-09T22:41:22Z (8 months ago)
Author:
jxsvoboda <5887334+jxsvoboda@…>
Branches:
master
Children:
0262f16c
Parents:
b0858150
git-author:
Jiri Svoboda <jiri@…> (2021-03-27 22:52:09)
git-committer:
jxsvoboda <5887334+jxsvoboda@…> (2021-04-09 22:41:22)
Message:

UI menu (WIP)

File:
1 edited

Legend:

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

    rb0858150 r214aefb  
    6868        gfx_color_t *wnd_face_color = NULL;
    6969        gfx_color_t *wnd_text_color = NULL;
     70        gfx_color_t *wnd_sel_text_color = NULL;
     71        gfx_color_t *wnd_sel_text_bg_color = NULL;
    7072        gfx_color_t *wnd_frame_hi_color = NULL;
    7173        gfx_color_t *wnd_frame_sh_color = NULL;
     
    139141                goto error;
    140142
     143        rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &wnd_sel_text_color);
     144        if (rc != EOK)
     145                goto error;
     146
     147        rc = gfx_color_new_rgb_i16(0x5858, 0x6a6a, 0xc4c4,
     148            &wnd_sel_text_bg_color);
     149        if (rc != EOK)
     150                goto error;
     151
    141152        rc = gfx_color_new_rgb_i16(0x8888, 0x8888, 0x8888, &wnd_frame_hi_color);
    142153        if (rc != EOK)
     
    200211        resource->wnd_face_color = wnd_face_color;
    201212        resource->wnd_text_color = wnd_text_color;
     213        resource->wnd_sel_text_color = wnd_sel_text_color;
     214        resource->wnd_sel_text_bg_color = wnd_sel_text_bg_color;
    202215        resource->wnd_frame_hi_color = wnd_frame_hi_color;
    203216        resource->wnd_frame_sh_color = wnd_frame_sh_color;
     
    232245        if (wnd_text_color != NULL)
    233246                gfx_color_delete(wnd_text_color);
     247        if (wnd_sel_text_color != NULL)
     248                gfx_color_delete(wnd_sel_text_color);
     249        if (wnd_sel_text_bg_color != NULL)
     250                gfx_color_delete(wnd_sel_text_bg_color);
    234251        if (wnd_frame_hi_color != NULL)
    235252                gfx_color_delete(wnd_frame_hi_color);
     
    280297        gfx_color_delete(resource->wnd_face_color);
    281298        gfx_color_delete(resource->wnd_text_color);
     299        gfx_color_delete(resource->wnd_sel_text_color);
     300        gfx_color_delete(resource->wnd_sel_text_bg_color);
    282301        gfx_color_delete(resource->wnd_frame_hi_color);
    283302        gfx_color_delete(resource->wnd_frame_sh_color);
     
    299318}
    300319
     320/** Set UI resource expose callback.
     321 *
     322 * @param resource Resource
     323 * @param cb Callback
     324 * @param arg Callback argument
     325 */
     326void ui_resource_set_expose_cb(ui_resource_t *resource,
     327    ui_expose_cb_t cb, void *arg)
     328{
     329        resource->expose_cb = cb;
     330        resource->expose_arg = arg;
     331}
     332
     333/** Force UI repaint after an area has been exposed.
     334 *
     335 * This is called when a popup disappears, which could have exposed some
     336 * other UI elements. It causes complete repaint of the UI.
     337 *
     338 * NOTE Ideally we could specify the exposed rectangle and then limit
     339 * the repaint to just that. That would, however, require means of
     340 * actually clipping the repaint operation.
     341 */
     342void ui_resource_expose(ui_resource_t *resource)
     343{
     344        if (resource->expose_cb != NULL)
     345                resource->expose_cb(resource->expose_arg);
     346}
     347
    301348/** @}
    302349 */
Note: See TracChangeset for help on using the changeset viewer.