void widget_mouse_press(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_press(child); return; } else{ if(child->action & WIDGET_MOVEABLE) control->action |= WIDGET_MOVING; set_widget_mouse_press_event(child); return; } } } if(control->action & WIDGET_MOVEABLE){ if(widget_rect_contains(control)) control->action |= WIDGET_MOVING; } set_widget_mouse_press_event(control); }
/** * 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(); }