add ellpsis support to textview

This commit is contained in:
bunnie 2021-03-09 02:23:49 +08:00
parent 8b85d52587
commit a4a96c9c56
2 changed files with 5 additions and 0 deletions

View file

@ -68,6 +68,7 @@ pub struct TextView {
pub text: xous::String::<3072>,
pub cursor: Cursor,
pub insertion: Option<u32>, // this is the insertion point offset, if it's to be drawn, on the string
pub ellipsis: bool,
pub draw_border: bool,
pub clear_area: bool, // you almost always want this to be true
@ -96,6 +97,7 @@ impl TextView {
text: xous::String::<3072>::new(),
cursor: Cursor::new(0,0,0),
insertion: None,
ellipsis: false,
draw_border: true,
border_width: 1,
rounded_border: None,

View file

@ -116,6 +116,7 @@ fn xmain() -> ! {
s.as_str().unwrap(),
false,
None,
false,
blitstr::xor_char
);
//info!("GFX: string painted");
@ -130,6 +131,7 @@ fn xmain() -> ! {
s.as_str().unwrap(),
true,
None,
false,
blitstr::xor_char
);
},
@ -246,6 +248,7 @@ fn xmain() -> ! {
tv.text.as_str().unwrap(),
false,
tv.insertion,
tv.ellipsis,
paintfn
);
// translate the cursor return value back to canvas coordinates