Implement Widget::draw for TextInput
This commit is contained in:
parent
954d6349a8
commit
e914888f57
16 changed files with 381 additions and 339 deletions
|
|
@ -2,7 +2,7 @@ use crate::backend::{self, Backend};
|
|||
use crate::{Primitive, Vector};
|
||||
use iced_native::layout;
|
||||
use iced_native::renderer;
|
||||
use iced_native::{Element, Font, Rectangle};
|
||||
use iced_native::{Element, Font, Point, Rectangle, Size};
|
||||
|
||||
pub use iced_native::renderer::Style;
|
||||
|
||||
|
|
@ -91,6 +91,40 @@ where
|
|||
{
|
||||
type Font = Font;
|
||||
|
||||
fn default_size(&self) -> u16 {
|
||||
self.backend().default_size()
|
||||
}
|
||||
|
||||
fn measure(
|
||||
&self,
|
||||
content: &str,
|
||||
size: u16,
|
||||
font: Font,
|
||||
bounds: Size,
|
||||
) -> (f32, f32) {
|
||||
self.backend()
|
||||
.measure(content, f32::from(size), font, bounds)
|
||||
}
|
||||
|
||||
fn hit_test(
|
||||
&self,
|
||||
content: &str,
|
||||
size: f32,
|
||||
font: Font,
|
||||
bounds: Size,
|
||||
point: Point,
|
||||
nearest_only: bool,
|
||||
) -> Option<renderer::text::Hit> {
|
||||
self.backend().hit_test(
|
||||
content,
|
||||
size,
|
||||
font,
|
||||
bounds,
|
||||
point,
|
||||
nearest_only,
|
||||
)
|
||||
}
|
||||
|
||||
fn fill_text(&mut self, text: renderer::text::Section<'_, Self::Font>) {
|
||||
self.primitives.push(Primitive::Text {
|
||||
content: text.content.to_string(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue