mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-03 07:04:34 +00:00
Fix doc warnings during build
Add some docs for the text cursor blinker, which is public now due to the use in the rendering backends.
This commit is contained in:
parent
dc0a59a713
commit
c8065060c5
1 changed files with 8 additions and 0 deletions
|
@ -589,6 +589,8 @@ pub struct TextCursorBlinker {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TextCursorBlinker {
|
impl TextCursorBlinker {
|
||||||
|
/// Creates a new instance, wrapped in a Pin<Rc<_>> because the boolean property
|
||||||
|
/// the blinker properties uses the property system that requires pinning.
|
||||||
pub fn new() -> Pin<Rc<Self>> {
|
pub fn new() -> Pin<Rc<Self>> {
|
||||||
Rc::pin(Self {
|
Rc::pin(Self {
|
||||||
cursor_visible: Property::new(true),
|
cursor_visible: Property::new(true),
|
||||||
|
@ -596,6 +598,8 @@ impl TextCursorBlinker {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sets a binding on the provided property that will ensure that the property value
|
||||||
|
/// is true when the cursor should be shown and false if not.
|
||||||
pub fn set_binding(instance: Pin<Rc<TextCursorBlinker>>, prop: &Property<bool>) {
|
pub fn set_binding(instance: Pin<Rc<TextCursorBlinker>>, prop: &Property<bool>) {
|
||||||
instance.as_ref().cursor_visible.set(true);
|
instance.as_ref().cursor_visible.set(true);
|
||||||
// Re-start timer, in case.
|
// Re-start timer, in case.
|
||||||
|
@ -605,6 +609,8 @@ impl TextCursorBlinker {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Starts the blinking cursor timer that will toggle the cursor and update all bindings that
|
||||||
|
/// were installed on properties with set_binding call.
|
||||||
pub fn start(self: &Pin<Rc<Self>>) {
|
pub fn start(self: &Pin<Rc<Self>>) {
|
||||||
if self.cursor_blink_timer.running() {
|
if self.cursor_blink_timer.running() {
|
||||||
self.cursor_blink_timer.restart();
|
self.cursor_blink_timer.restart();
|
||||||
|
@ -629,6 +635,8 @@ impl TextCursorBlinker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Stops the blinking cursor timer. This is usually used for example when the window that contains
|
||||||
|
/// text editable elements looses the focus or is hidden.
|
||||||
pub fn stop(&self) {
|
pub fn stop(&self) {
|
||||||
self.cursor_blink_timer.stop()
|
self.cursor_blink_timer.stop()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue