Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/gui/widget.c

    r6d5e378 r10cb47e  
    3636#include "widget.h"
    3737
    38 void widget_init(widget_t *widget, widget_t *parent)
     38/** Link widget with parent and initialize default position and size. */
     39void widget_init(widget_t *widget, widget_t *parent, const void *data)
    3940{
    4041        link_initialize(&widget->link);
    4142        list_initialize(&widget->children);
     43       
    4244        if (parent) {
    4345                widget->parent = parent;
     
    4850                widget->window = NULL;
    4951        }
    50 
     52       
     53        widget->data = data;
     54       
    5155        widget->hpos = 0;
    5256        widget->vpos = 0;
    5357        widget->width = 0;
    5458        widget->height = 0;
    55 
     59       
    5660        widget->width_min = 0;
    5761        widget->height_min = 0;
     
    6266}
    6367
     68/** Change position and size of the widget. */
    6469void widget_modify(widget_t *widget, sysarg_t hpos, sysarg_t vpos,
    6570    sysarg_t width, sysarg_t height)
     
    7176}
    7277
     78/** Get custom client data */
     79const void *widget_get_data(widget_t *widget)
     80{
     81        return widget->data;
     82}
     83
     84/** Unlink widget from its parent. */
    7385void widget_deinit(widget_t *widget)
    7486{
    75         if (widget->parent) {
     87        if (widget->parent)
    7688                list_remove(&widget->link);
    77         }
    7889}
    7990
Note: See TracChangeset for help on using the changeset viewer.