Simon Hausmann
babfd17813
Add support for copy & paste in TextInput
2020-09-23 11:46:38 +02:00
Simon Hausmann
8f63c0dc53
Fix character input handling with modifiers
...
For a sequence of pressing and releasing Ctrl+C, winit sends up press, character input
and release.
We're not interested in
processing the character input when control, alt or logo are pressed.
2020-09-23 11:31:13 +02:00
Simon Hausmann
7238e0d01c
Minor TextInput cleanup
...
Treat the cursor and anchor positions as usize within functions, only store it
as i32 in the Property<>.
2020-09-23 11:02:50 +02:00
Simon Hausmann
fe079c644e
Simplify byte offset vs. char index handling in the font code
...
Use char_indices() already for string_to_glyphs.
2020-09-22 18:47:15 +02:00
Simon Hausmann
49edd69a3a
Fix multi-byte handling hit testing
...
Return a byte offset within the string for the hit test in TextInput.
2020-09-22 18:43:00 +02:00
Simon Hausmann
adfadd12fa
TextInput cleanup
...
Reduce the amount of char vs. byte offset fiddling
2020-09-22 18:29:21 +02:00
Olivier Goffart
fa55c1f015
Flickable: properly grab the mouse
...
otherwise the Flickable think the mouse stay pressed forever if it is released while outside of it.
2020-09-22 17:39:51 +02:00
Simon Hausmann
722fce61f2
Add support for selecting text with the mouse to TextInput
2020-09-22 15:37:54 +02:00
Simon Hausmann
141224bf28
Minor fixes for entering text in TextInput
...
Delete any selected text and update anchor and cursor after insertion.
2020-09-22 15:35:40 +02:00
Simon Hausmann
7e5b6843a4
Fix crash on start-up of rusttest2
...
Mysteriously the path tesselation of hello.60 fails with Lyon 0.16.0, so pin
it to the previous release.
Reported also in nical/lyon#607
2020-09-22 14:24:40 +02:00
Simon Hausmann
bf970b3ace
Fix build without rtti
2020-09-22 13:59:03 +02:00
Olivier Goffart
2ee861365c
Flickable: expose the viewport property as viewport_*
...
The code generator forward that the the viewport
2020-09-22 13:52:27 +02:00
Simon Hausmann
30987dd588
Add missing docs
2020-09-21 20:28:17 +02:00
Simon Hausmann
4f25b0942f
Draw text selections
2020-09-21 18:43:59 +02:00
Simon Hausmann
4a6a617ca5
Add logic for selection handling by cursor keys and shift
...
The mouse handling is still missing as well as the selection rendering.
2020-09-21 15:12:27 +02:00
Simon Hausmann
e3eeb5e23d
Don't let backspace at the beginning of text delete it
2020-09-21 15:04:20 +02:00
Simon Hausmann
19c53c6b19
Fix C++ build
...
Add missing #[repr(C)]
2020-09-21 14:58:16 +02:00
Simon Hausmann
bb81c99ddb
Add support for keyboard modifiers in the internal key event
2020-09-21 14:30:16 +02:00
Simon Hausmann
b857eb4671
Add an accepted signal to TextInput and LineEdit
2020-09-21 13:18:53 +02:00
Simon Hausmann
34eae40814
Allow moving the text cursor to the end of the input
2020-09-21 13:15:53 +02:00
Simon Hausmann
083cdd6653
Added a crude backspace and delete handler in TextInput
2020-09-18 18:18:44 +02:00
Simon Hausmann
ade78875ea
Fix TextInput::move_cursor to respect character boundaries
2020-09-18 18:13:31 +02:00
Simon Hausmann
6bcbf082ff
Fix backspace handling
...
On macOS at least, backspace triggers a character input event as well as
key down/release -- the key_* handlers trigger as well as
doCommandBySelector. We're not interested in backspace as an input
character though. More generally, let's exclude control characters. This
could be extended in the future to more categories.
2020-09-18 18:03:16 +02:00
Simon Hausmann
0d751e6627
Render a text cursor for TextInput items
...
It doesn't look quite perfect yet, but it's a start.
2020-09-18 17:58:14 +02:00
Simon Hausmann
d819541ea3
Fix build
2020-09-18 16:41:37 +02:00
Simon Hausmann
2da84fee46
Add a boilerplate TextInput item
2020-09-18 16:34:24 +02:00
Simon Hausmann
3f438ec3f6
Fix wasm build
2020-09-18 16:29:32 +02:00
Simon Hausmann
39fabdee9e
Pass a window reference to Item::key_event
...
Similar to the input_event.
2020-09-18 16:22:00 +02:00
Simon Hausmann
7053aee0c8
Pass the ComponentWindow to ItemVTable::input_event
2020-09-18 16:18:48 +02:00
Simon Hausmann
eeee4794b6
Remove the rest of the RenderingCache wrapper
2020-09-17 13:06:23 +02:00
Simon Hausmann
5080971af8
Replace the hand-made allocator for the rendering cache with a 3rdparty crate
...
Less code to maintain :)
2020-09-17 11:41:14 +02:00
Simon Hausmann
ad77896312
Change the way Text's default color is implemented
...
Instead of via an item constructor, implement support for default
bindings in the compiler.
2020-09-16 13:41:18 +02:00
Simon Hausmann
1d6af1da09
Prospective CI build fix
...
Try to ensure that the C functions in items.rs are included in the binary.
2020-09-16 08:38:30 +02:00
Simon Hausmann
625cb6c6b8
Add a constructor to Text and let the color default to black
...
We really shouldn't require specifying a color for every Text {} element just in order
to see *some* text.
For Rectangle OTOH transparent is a good default (and thus for Color), hence
this change just to Text.
Right now the constructor bit is also a bit repetitive, this could
perhaps be folded into BuiltinItem to generate the ffi, default impl and
forward to an init function if it exists.
2020-09-16 08:20:13 +02:00
Simon Hausmann
dd8e487acc
Fix discrepancy between Text layout info and rendering
...
The layout_info() would calculate the text metrics based on a different effective pixel
size compared to the rendering.
2020-09-15 16:15:26 +02:00
Simon Hausmann
79ba5d9de8
Provide a window reference in various ItemVTable functions
...
Access to the window, in particular the scale factor, will be needed in a few places.
2020-09-15 15:55:47 +02:00
Simon Hausmann
37e550e540
Fix inconsistency in Font API
...
Have just one height() function in the fontkit and canvas version.
2020-09-15 12:28:30 +02:00
Olivier Goffart
4a0a65f113
C++ model that can be changed
2020-09-15 12:18:36 +02:00
Simon Hausmann
546818ee55
Add key event data structures and event function boiler plate
2020-09-15 11:16:55 +02:00
Simon Hausmann
0924519734
Add some missing docs to the input module
...
Now we can require docs.
2020-09-15 11:16:00 +02:00
Olivier Goffart
0d8a38577d
Todo example: make the "add todo" button do something
2020-09-14 16:38:45 +02:00
Olivier Goffart
4de2e57175
Use a Model trait in the rust backend
2020-09-14 14:02:34 +02:00
Simon Hausmann
26ae1bfdb2
Add From<String> and Into<String> for SharedString
2020-09-14 08:49:41 +02:00
Simon Hausmann
5713ea83f3
Minor doc fix
...
SharedArray holds elements, not a string :-)
2020-09-09 22:10:47 +02:00
Simon Hausmann
3c2172d043
Use new-style intra-crate rust-doc links instead of relying on .html links
2020-09-09 18:53:59 +02:00
Simon Hausmann
9ecaf11eed
Various additions to the Rust Color API
...
As discussed in the most recent API review.
2020-09-09 18:53:59 +02:00
Olivier Goffart
8761ca80a3
Add SharedArray::push and adjust a bit the API
2020-09-09 18:47:15 +02:00
Olivier Goffart
42aa91e3eb
Support for signal with arguments in the interpreter
2020-09-09 11:27:58 +02:00
Simon Hausmann
3bf5d68508
Tweak Rust SharedString docs a bit
2020-09-09 08:15:06 +02:00
Simon Hausmann
da913ae917
Minor doc tweaks for SharedString
2020-09-08 22:58:49 +02:00