1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 14:49:06 -04:00

Very wip textedit atoms / textedit split

This commit is contained in:
lucasmerlin
2025-07-03 20:00:30 +02:00
parent 378e22e6ec
commit 341c26267e
3 changed files with 1226 additions and 8 deletions

View File

@@ -7,9 +7,10 @@ use epaint::{
};
use crate::{
Align, Align2, Color32, Context, CursorIcon, Event, EventFilter, FontSelection, Id, ImeEvent,
Key, KeyboardShortcut, Margin, Modifiers, NumExt as _, Response, Sense, Shape, TextBuffer,
TextStyle, TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, WidgetWithState, epaint,
Align, Align2, Atom, AtomExt, AtomKind, AtomLayout, Atoms, Color32, Context, CursorIcon, Event,
EventFilter, FontSelection, Id, ImeEvent, Key, KeyboardShortcut, Margin, Modifiers,
NumExt as _, Response, Sense, Shape, TextBuffer, TextStyle, TextWrapMode, Ui, Vec2, Widget,
WidgetInfo, WidgetText, WidgetWithState, epaint,
os::OperatingSystem,
output::OutputEvent,
response, text_selection,
@@ -67,28 +68,24 @@ type LayouterFn<'t> = &'t mut dyn FnMut(&Ui, &dyn TextBuffer, f32) -> Arc<Galley
#[must_use = "You should put this widget in a ui with `ui.add(widget);`"]
pub struct TextEdit<'t> {
text: &'t mut dyn TextBuffer,
hint_text: WidgetText,
hint_text_font: Option<FontSelection>,
id: Option<Id>,
id_salt: Option<Id>,
font_selection: FontSelection,
text_color: Option<Color32>,
layouter: Option<LayouterFn<'t>>,
password: bool,
frame: bool,
margin: Margin,
multiline: bool,
interactive: bool,
desired_width: Option<f32>,
desired_height_rows: usize,
event_filter: EventFilter,
cursor_at_end: bool,
min_size: Vec2,
align: Align2,
clip_text: bool,
char_limit: usize,
return_key: Option<KeyboardShortcut>,
background_color: Option<Color32>,
layout: AtomLayout<'t>,
}
impl WidgetWithState for TextEdit<'_> {
@@ -148,6 +145,7 @@ impl<'t> TextEdit<'t> {
char_limit: usize::MAX,
return_key: Some(KeyboardShortcut::new(Modifiers::NONE, Key::Enter)),
background_color: None,
layout: AtomLayout::new(AtomKind::Custom(Id::new("egui::text_edit")).atom_grow(true)),
}
}

View File

@@ -2,6 +2,7 @@ mod builder;
mod output;
mod state;
mod text_buffer;
mod widget;
pub use {
crate::text_selection::TextCursorState, builder::TextEdit, output::TextEditOutput,

File diff suppressed because it is too large Load Diff