Merge branch 'main' into window_context_2
This commit is contained in:
commit
c52b6328b7
47 changed files with 3046 additions and 1772 deletions
|
@ -1389,6 +1389,9 @@ impl Pane {
|
|||
let detail = detail.clone();
|
||||
|
||||
let theme = cx.global::<Settings>().theme.clone();
|
||||
let mut tooltip_theme = theme.tooltip.clone();
|
||||
tooltip_theme.max_text_width = None;
|
||||
let tab_tooltip_text = item.tab_tooltip_text(cx).map(|a| a.to_string());
|
||||
|
||||
move |mouse_state, cx| {
|
||||
let tab_style =
|
||||
|
@ -1396,39 +1399,56 @@ impl Pane {
|
|||
let hovered = mouse_state.hovered();
|
||||
|
||||
enum Tab {}
|
||||
MouseEventHandler::<Tab, Pane>::new(ix, cx, |_, cx| {
|
||||
Self::render_tab::<Pane>(
|
||||
&item,
|
||||
pane.clone(),
|
||||
ix == 0,
|
||||
detail,
|
||||
hovered,
|
||||
tab_style,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
.on_down(MouseButton::Left, move |_, _, cx| {
|
||||
cx.dispatch_action(ActivateItem(ix));
|
||||
})
|
||||
.on_click(MouseButton::Middle, {
|
||||
let item = item.clone();
|
||||
let pane = pane.clone();
|
||||
move |_, _, cx| {
|
||||
cx.dispatch_action(CloseItemById {
|
||||
item_id: item.id(),
|
||||
pane: pane.clone(),
|
||||
})
|
||||
}
|
||||
})
|
||||
.on_down(MouseButton::Right, move |e, _, cx| {
|
||||
let item = item.clone();
|
||||
cx.dispatch_action(DeployTabContextMenu {
|
||||
position: e.position,
|
||||
item_id: item.id(),
|
||||
pane: pane.clone(),
|
||||
});
|
||||
})
|
||||
.boxed()
|
||||
let mouse_event_handler =
|
||||
MouseEventHandler::<Tab, Pane>::new(ix, cx, |_, cx| {
|
||||
Self::render_tab::<Pane>(
|
||||
&item,
|
||||
pane.clone(),
|
||||
ix == 0,
|
||||
detail,
|
||||
hovered,
|
||||
tab_style,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
.on_down(MouseButton::Left, move |_, _, cx| {
|
||||
cx.dispatch_action(ActivateItem(ix));
|
||||
})
|
||||
.on_click(MouseButton::Middle, {
|
||||
let item = item.clone();
|
||||
let pane = pane.clone();
|
||||
move |_, _, cx| {
|
||||
cx.dispatch_action(CloseItemById {
|
||||
item_id: item.id(),
|
||||
pane: pane.clone(),
|
||||
})
|
||||
}
|
||||
})
|
||||
.on_down(
|
||||
MouseButton::Right,
|
||||
move |e, _, cx| {
|
||||
let item = item.clone();
|
||||
cx.dispatch_action(DeployTabContextMenu {
|
||||
position: e.position,
|
||||
item_id: item.id(),
|
||||
pane: pane.clone(),
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
if let Some(tab_tooltip_text) = tab_tooltip_text {
|
||||
return mouse_event_handler
|
||||
.with_tooltip::<Self>(
|
||||
ix,
|
||||
tab_tooltip_text,
|
||||
None,
|
||||
tooltip_theme,
|
||||
cx,
|
||||
)
|
||||
.boxed();
|
||||
}
|
||||
|
||||
mouse_event_handler.boxed()
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue