| 2448 | } |
| 2449 | |
| 2450 | LfClickableItemState _lf_image_button_loc(LfTexture img, const char* file, int32_t line) { |
| 2451 | // Retrieving the property data of the button |
| 2452 | LfUIElementProps props = get_props_for(state.theme.button_props); |
| 2453 | float padding = props.padding; |
| 2454 | float margin_left = props.margin_left, margin_right = props.margin_right, |
| 2455 | margin_top = props.margin_top, margin_bottom = props.margin_bottom; |
| 2456 | |
| 2457 | LfColor color = props.color; |
| 2458 | LfColor text_color = state.theme.button_props.text_color; |
| 2459 | LfFont font = get_current_font(); |
| 2460 | |
| 2461 | // If the button does not fit onto the current div, advance to the next line |
| 2462 | next_line_on_overflow( |
| 2463 | (vec2s){img.width + padding * 2.0f, |
| 2464 | img.height + padding * 2.0f}, |
| 2465 | state.div_props.border_width); |
| 2466 | |
| 2467 | // Advancing the position pointer by the margins |
| 2468 | state.pos_ptr.x += margin_left; |
| 2469 | state.pos_ptr.y += margin_top; |
| 2470 | |
| 2471 | // Rendering the button |
| 2472 | LfClickableItemState ret = button(file, line, state.pos_ptr, (vec2s){img.width + padding * 2, img.height + padding * 2}, |
| 2473 | props, color, props.border_width, true, true); |
| 2474 | |
| 2475 | LfColor imageColor = LF_WHITE; |
| 2476 | lf_image_render((vec2s){state.pos_ptr.x + padding, state.pos_ptr.y + padding}, imageColor, img, LF_NO_COLOR, 0, props.corner_radius); |
| 2477 | |
| 2478 | // Advancing the position pointer by the width of the button |
| 2479 | state.pos_ptr.x += img.width + margin_right + padding * 2.0f; |
| 2480 | state.pos_ptr.y -= margin_top; |
| 2481 | |
| 2482 | return ret; |
| 2483 | } |
| 2484 | |
| 2485 | LfClickableItemState _lf_image_button_fixed_loc(LfTexture img, float width, float height, const char* file, int32_t line) { |
| 2486 | // Retrieving the property data of the button |
nothing calls this directly
no test coverage detected