Changeset 966a27d3 in mainline for uspace/app/nav/panel.c


Ignore:
Timestamp:
2021-10-22T07:45:13Z (2 years ago)
Author:
Jiri Svoboda <jiri@…>
Children:
8922b76
Parents:
2651dc5
git-author:
Jiri Svoboda <jiri@…> (2021-10-21 17:44:55)
git-committer:
Jiri Svoboda <jiri@…> (2021-10-22 07:45:13)
Message:

Activating panel using the mouse

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/nav/panel.c

    r2651dc5 r966a27d3  
    142142        ui_control_delete(panel->control);
    143143        free(panel);
     144}
     145
     146/** Set panel callbacks.
     147 *
     148 * @param panel Panel
     149 * @param cb Callbacks
     150 * @param arg Argument to callback functions
     151 */
     152void panel_set_cb(panel_t *panel, panel_cb_t *cb, void *arg)
     153{
     154        panel->cb = cb;
     155        panel->cb_arg = arg;
    144156}
    145157
     
    311323ui_evclaim_t panel_pos_event(panel_t *panel, pos_event_t *event)
    312324{
    313         return ui_unclaimed;
     325        gfx_coord2_t pos;
     326
     327        pos.x = event->hpos;
     328        pos.y = event->vpos;
     329        if (!gfx_pix_inside_rect(&pos, &panel->rect))
     330                return ui_unclaimed;
     331
     332        if (!panel->active) {
     333                panel_activate_req(panel);
     334        }
     335
     336        return ui_claimed;
    314337}
    315338
     
    11141137}
    11151138
     1139/** Request panel activation.
     1140 *
     1141 * Call back to request panel activation.
     1142 *
     1143 * @param panel Panel
     1144 */
     1145void panel_activate_req(panel_t *panel)
     1146{
     1147        if (panel->cb != NULL && panel->cb->activate_req != NULL)
     1148                panel->cb->activate_req(panel->cb_arg, panel);
     1149}
     1150
    11161151/** @}
    11171152 */
Note: See TracChangeset for help on using the changeset viewer.