pub struct TitleBar { /* private fields */ }Expand description
A title bar drawn by the app: what comes first, the title, the actions and the buttons of the window. A button shows only when it has a handler. A double click on the bar does the same as the maximize button.
It draws and calls back, and that is all. What the handlers do to the window is up to the app. It cannot drag the window nor hide the frame the system draws, because those belong to the platform layer, which offers neither yet: for now the system’s own bar stays above it.
use ravenrs_widgets::{IconButton, IconName, TitleBar, Ui};
let bar = TitleBar::new("Report.pdf")
.action(IconButton::new(IconName::Search).label("Search"))
.on_minimize(|| {})
.on_maximize(|| {})
.on_close(|| {});
let mut ui = Ui::new(bar, ravenrs_style::Theme::raven_dark());
ui.update();Implementations§
Source§impl TitleBar
impl TitleBar
Sourcepub fn leading(self, view: impl View + 'static) -> Self
pub fn leading(self, view: impl View + 'static) -> Self
Any view before the title, such as an icon or a menu.
Sourcepub fn action(self, view: impl View + 'static) -> Self
pub fn action(self, view: impl View + 'static) -> Self
Appends a view to the area between the title and the window’s buttons.
Sourcepub fn on_minimize(self, handler: impl Fn() + 'static) -> Self
pub fn on_minimize(self, handler: impl Fn() + 'static) -> Self
Shows the minimize button, which runs handler.
Sourcepub fn on_maximize(self, handler: impl Fn() + 'static) -> Self
pub fn on_maximize(self, handler: impl Fn() + 'static) -> Self
Shows the maximize button, which runs handler, as a double click on the bar does.
Sourcepub fn on_close(self, handler: impl Fn() + 'static) -> Self
pub fn on_close(self, handler: impl Fn() + 'static) -> Self
Shows the close button, which runs handler.
Called with the pointer’s place on a right click on the bar, for a menu of the window.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TitleBar
impl !Send for TitleBar
impl !Sync for TitleBar
impl !UnwindSafe for TitleBar
impl Freeze for TitleBar
impl Unpin for TitleBar
impl UnsafeUnpin for TitleBar
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
None keeps the content size.