improv: get window control icons from icon theme
This commit is contained in:
parent
5474232796
commit
1e5828e01c
6 changed files with 31 additions and 51 deletions
|
|
@ -1,3 +0,0 @@
|
|||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M5 4.00299C4.73478 4.00299 4.48043 4.10835 4.29289 4.29588C4.10536 4.48342 4 4.73777 4 5.00299C4.00006 5.26819 4.10545 5.5225 4.293 5.70999L6.586 8.00299L4.293 10.296C4.10545 10.4835 4.00006 10.7378 4 11.003C4 11.2682 4.10536 11.5226 4.29289 11.7101C4.48043 11.8976 4.73478 12.003 5 12.003C5.26519 12.0029 5.51951 11.8975 5.707 11.71L8 9.41699L10.283 11.7C10.3762 11.7959 10.4877 11.8721 10.6108 11.9241C10.734 11.9762 10.8663 12.003 11 12.003C11.2652 12.003 11.5196 11.8976 11.7071 11.7101C11.8946 11.5226 12 11.2682 12 11.003C11.9999 10.7378 11.8945 10.4835 11.707 10.296L9.414 8.00299L11.697 5.71999C11.7929 5.6268 11.8691 5.51534 11.9211 5.39218C11.9732 5.26903 12 5.13669 12 5.00299C12 4.73777 11.8946 4.48342 11.7071 4.29588C11.5196 4.10835 11.2652 4.00299 11 4.00299C10.7348 4.00305 10.4805 4.10844 10.293 4.29599L8 6.58899L5.717 4.30599C5.71369 4.30263 5.71036 4.2993 5.707 4.29599C5.51951 4.10844 5.26519 4.00305 5 4.00299Z" fill="#232323"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1 KiB |
|
|
@ -1,4 +0,0 @@
|
|||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M4 12H8L6.5 10.5L7.78947 9.15789C7.78947 9.15789 8.26316 8.68421 7.78947 8.21053C7.31579 7.73684 6.8421 8.21053 6.8421 8.21053L5.5 9.5L4 8V12Z" fill="#232323"/>
|
||||
<path d="M12 4H8L9.5 5.5L8.21053 6.84211C8.21053 6.84211 7.73684 7.31579 8.21053 7.78947C8.68421 8.26316 9.1579 7.78947 9.1579 7.78947L10.5 6.5L12 8V4Z" fill="#232323"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 443 B |
|
|
@ -1,3 +0,0 @@
|
|||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 10V12H12V10H4Z" fill="#232323"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 188 B |
|
|
@ -8,6 +8,7 @@ use iced::advanced::widget::{self, Operation, OperationOutputWrapper};
|
|||
use iced::advanced::{overlay, renderer};
|
||||
use iced::advanced::{Clipboard, Shell};
|
||||
use iced::{event, mouse, Event, Point, Rectangle, Size};
|
||||
use iced_core::Renderer;
|
||||
|
||||
pub(super) struct Overlay<'a, 'b, Message> {
|
||||
pub(super) content: &'b mut Element<'a, Message>,
|
||||
|
|
@ -80,15 +81,17 @@ where
|
|||
layout: Layout<'_>,
|
||||
cursor: mouse::Cursor,
|
||||
) {
|
||||
self.content.as_widget().draw(
|
||||
self.tree,
|
||||
renderer,
|
||||
theme,
|
||||
style,
|
||||
layout,
|
||||
cursor,
|
||||
&layout.bounds(),
|
||||
);
|
||||
renderer.with_layer(layout.bounds(), |renderer| {
|
||||
self.content.as_widget().draw(
|
||||
self.tree,
|
||||
renderer,
|
||||
theme,
|
||||
style,
|
||||
layout,
|
||||
cursor,
|
||||
&layout.bounds(),
|
||||
);
|
||||
})
|
||||
}
|
||||
|
||||
fn operate(
|
||||
|
|
|
|||
|
|
@ -350,8 +350,8 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
|
|||
|
||||
/// Creates the widget for window controls.
|
||||
fn window_controls(&mut self) -> Element<'a, Message> {
|
||||
let icon = |icon_bytes, size, on_press| {
|
||||
widget::icon::from_svg_bytes(icon_bytes)
|
||||
let icon = |name, size, on_press| {
|
||||
widget::icon::from_name(name)
|
||||
.symbolic(true)
|
||||
.apply(widget::button::icon)
|
||||
.style(crate::theme::Button::HeaderBar)
|
||||
|
|
@ -368,27 +368,21 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
|
|||
};
|
||||
|
||||
widget::row::with_capacity(3)
|
||||
.push_maybe(self.on_minimize.take().map(|m| {
|
||||
icon(
|
||||
&include_bytes!("../../res/icons/window-minimize-symbolic.svg")[..],
|
||||
16,
|
||||
m,
|
||||
)
|
||||
}))
|
||||
.push_maybe(self.on_maximize.take().map(|m| {
|
||||
icon(
|
||||
&include_bytes!("../../res/icons/window-maximize-symbolic.svg")[..],
|
||||
16,
|
||||
m,
|
||||
)
|
||||
}))
|
||||
.push_maybe(self.on_close.take().map(|m| {
|
||||
icon(
|
||||
&include_bytes!("../../res/icons/window-close-symbolic.svg")[..],
|
||||
16,
|
||||
m,
|
||||
)
|
||||
}))
|
||||
.push_maybe(
|
||||
self.on_minimize
|
||||
.take()
|
||||
.map(|m| icon("window-minimize-symbolic", 16, m)),
|
||||
)
|
||||
.push_maybe(
|
||||
self.on_maximize
|
||||
.take()
|
||||
.map(|m| icon("window-maximize-symbolic", 16, m)),
|
||||
)
|
||||
.push_maybe(
|
||||
self.on_close
|
||||
.take()
|
||||
.map(|m| icon("window-close-symbolic", 16, m)),
|
||||
)
|
||||
.spacing(spacing)
|
||||
.apply(widget::container)
|
||||
.height(Length::Fill)
|
||||
|
|
|
|||
|
|
@ -46,15 +46,8 @@ where
|
|||
button::text(&action.description).on_press(action.message.clone())
|
||||
}))
|
||||
.push(
|
||||
button::icon(
|
||||
//TODO: include this in one place
|
||||
icon::from_svg_bytes(
|
||||
&include_bytes!("../../../res/icons/window-close-symbolic.svg")[..],
|
||||
)
|
||||
.symbolic(true),
|
||||
)
|
||||
.icon_size(16)
|
||||
.on_press(ToastMessage(toast.id).into()),
|
||||
button::icon(icon::from_name("window-close-symbolic"))
|
||||
.on_press(ToastMessage(toast.id).into()),
|
||||
)
|
||||
.align_items(iced::Alignment::Center)
|
||||
.spacing(space_xxs),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue