gpui: Implement dynamic window control elements (#30828)
Allows setting element as window control elements which consist of `Drag`, `Close`, `Max`, or `Min`. This allows you to implement dynamically sized elements that control the platform window, this is used for areas such as the title bar. Currently only implemented for Windows. Release Notes: - N/A
This commit is contained in:
parent
d9efa2860f
commit
ca3f46588a
11 changed files with 129 additions and 96 deletions
|
@ -36,7 +36,7 @@ use crate::{
|
|||
ForegroundExecutor, GlyphId, GpuSpecs, ImageSource, Keymap, LineLayout, Pixels, PlatformInput,
|
||||
Point, RenderGlyphParams, RenderImage, RenderImageParams, RenderSvgParams, ScaledPixels, Scene,
|
||||
ShapedGlyph, ShapedRun, SharedString, Size, SvgRenderer, SvgSize, Task, TaskLabel, Window,
|
||||
hash, point, px, size,
|
||||
WindowControlArea, hash, point, px, size,
|
||||
};
|
||||
use anyhow::Result;
|
||||
use async_task::Runnable;
|
||||
|
@ -436,6 +436,7 @@ pub(crate) trait PlatformWindow: HasWindowHandle + HasDisplayHandle {
|
|||
fn on_resize(&self, callback: Box<dyn FnMut(Size<Pixels>, f32)>);
|
||||
fn on_moved(&self, callback: Box<dyn FnMut()>);
|
||||
fn on_should_close(&self, callback: Box<dyn FnMut() -> bool>);
|
||||
fn on_hit_test_window_control(&self, callback: Box<dyn FnMut() -> Option<WindowControlArea>>);
|
||||
fn on_close(&self, callback: Box<dyn FnOnce()>);
|
||||
fn on_appearance_changed(&self, callback: Box<dyn FnMut()>);
|
||||
fn draw(&self, scene: &Scene);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue