/** * handle_mouse_press(GLFWwindow * screen, int button, int pressed, int mods) * * @brief * @param screen * @param button * @param pressed * @param mods * @return void */ void handle_mouse_press(GLFWwindow * screen, int button, int pressed, int mods) { setcurrentscreen(getscreenid(screen)); widget_set_ui_click_event((int8)button, (int8)pressed); if(widget_check_focus()){ if(pressed == 1) widget_mouse_press(widget_get_focused()); else widget_mouse_release(widget_get_focused()); } else{ if(pressed == 1) widget_mouse_press(widget_get_uip()->root); else widget_mouse_release(widget_get_uip()->root); } resetcurrentscreen(); }
void widget_mouse_release(widget * control) { widget *child; int32 index = 0; for( index = control->shown.count -1; index >= 0; --index){ child = control->shown.data[index]; if(widget_rect_contains(child)){ if(child->shown.count){ widget_mouse_release(child); return; } else{ widget_set_release(child); return; } } } widget_set_release(control); }