parent
7a6d80cc8c
commit
a5f3881d59
|
|
@ -154,8 +154,7 @@ pub(crate) fn menu_ui<'c, R>(
|
||||||
set_menu_style(ui.style_mut());
|
set_menu_style(ui.style_mut());
|
||||||
|
|
||||||
let frame = Frame::menu(ui.style()).show(ui, |ui| {
|
let frame = Frame::menu(ui.style()).show(ui, |ui| {
|
||||||
const DEFAULT_MENU_WIDTH: f32 = 150.0; // TODO(emilk): add to ui.spacing
|
ui.set_max_width(ui.spacing().menu_width);
|
||||||
ui.set_max_width(DEFAULT_MENU_WIDTH);
|
|
||||||
ui.set_menu_state(Some(menu_state_arc.clone()));
|
ui.set_menu_state(Some(menu_state_arc.clone()));
|
||||||
ui.with_layout(Layout::top_down_justified(Align::LEFT), add_contents)
|
ui.with_layout(Layout::top_down_justified(Align::LEFT), add_contents)
|
||||||
.inner
|
.inner
|
||||||
|
|
|
||||||
|
|
@ -302,6 +302,9 @@ pub struct Spacing {
|
||||||
/// Width of a tooltip (`on_hover_ui`, `on_hover_text` etc).
|
/// Width of a tooltip (`on_hover_ui`, `on_hover_text` etc).
|
||||||
pub tooltip_width: f32,
|
pub tooltip_width: f32,
|
||||||
|
|
||||||
|
/// The default width of a menu.
|
||||||
|
pub menu_width: f32,
|
||||||
|
|
||||||
/// End indented regions with a horizontal line
|
/// End indented regions with a horizontal line
|
||||||
pub indent_ends_with_horizontal_line: bool,
|
pub indent_ends_with_horizontal_line: bool,
|
||||||
|
|
||||||
|
|
@ -1111,6 +1114,7 @@ impl Default for Spacing {
|
||||||
icon_width_inner: 8.0,
|
icon_width_inner: 8.0,
|
||||||
icon_spacing: 4.0,
|
icon_spacing: 4.0,
|
||||||
tooltip_width: 600.0,
|
tooltip_width: 600.0,
|
||||||
|
menu_width: 150.0,
|
||||||
combo_height: 200.0,
|
combo_height: 200.0,
|
||||||
scroll: Default::default(),
|
scroll: Default::default(),
|
||||||
indent_ends_with_horizontal_line: false,
|
indent_ends_with_horizontal_line: false,
|
||||||
|
|
@ -1458,6 +1462,7 @@ impl Spacing {
|
||||||
icon_width_inner,
|
icon_width_inner,
|
||||||
icon_spacing,
|
icon_spacing,
|
||||||
tooltip_width,
|
tooltip_width,
|
||||||
|
menu_width,
|
||||||
indent_ends_with_horizontal_line,
|
indent_ends_with_horizontal_line,
|
||||||
combo_height,
|
combo_height,
|
||||||
scroll,
|
scroll,
|
||||||
|
|
@ -1516,6 +1521,11 @@ impl Spacing {
|
||||||
ui.label("Tooltip wrap width");
|
ui.label("Tooltip wrap width");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ui.horizontal(|ui| {
|
||||||
|
ui.add(DragValue::new(menu_width).clamp_range(0.0..=1000.0));
|
||||||
|
ui.label("Default width of a menu");
|
||||||
|
});
|
||||||
|
|
||||||
ui.checkbox(
|
ui.checkbox(
|
||||||
indent_ends_with_horizontal_line,
|
indent_ends_with_horizontal_line,
|
||||||
"End indented regions with a horizontal separator",
|
"End indented regions with a horizontal separator",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue