|
|
@ -111,11 +111,10 @@ pub fn menu_button<R>( |
|
|
|
/// Returns `None` if the menu is not open.
|
|
|
|
pub fn menu_image_button<R>( |
|
|
|
ui: &mut Ui, |
|
|
|
texture_id: TextureId, |
|
|
|
image_size: impl Into<Vec2>, |
|
|
|
image_button: ImageButton, |
|
|
|
add_contents: impl FnOnce(&mut Ui) -> R, |
|
|
|
) -> InnerResponse<Option<R>> { |
|
|
|
stationary_menu_image_impl(ui, texture_id, image_size, Box::new(add_contents)) |
|
|
|
stationary_menu_image_impl(ui, image_button, Box::new(add_contents)) |
|
|
|
} |
|
|
|
|
|
|
|
/// Construct a nested sub menu in another menu.
|
|
|
@ -202,14 +201,13 @@ fn stationary_menu_impl<'c, R>( |
|
|
|
/// Responds to primary clicks.
|
|
|
|
fn stationary_menu_image_impl<'c, R>( |
|
|
|
ui: &mut Ui, |
|
|
|
texture_id: TextureId, |
|
|
|
image_size: impl Into<Vec2>, |
|
|
|
image_button: ImageButton, |
|
|
|
add_contents: Box<dyn FnOnce(&mut Ui) -> R + 'c>, |
|
|
|
) -> InnerResponse<Option<R>> { |
|
|
|
let bar_id = ui.id(); |
|
|
|
|
|
|
|
let mut bar_state = BarState::load(ui.ctx(), bar_id); |
|
|
|
let button_response = ui.add(ImageButton::new(texture_id, image_size)); |
|
|
|
let button_response = ui.add(image_button); |
|
|
|
let inner = bar_state.bar_menu(&button_response, add_contents); |
|
|
|
|
|
|
|
bar_state.store(ui.ctx(), bar_id); |
|
|
|