Commit graph

95 commits

Author SHA1 Message Date
Héctor Ramón Jiménez
70164f68a6 Fix text selection with touch events in TextInput 2020-12-15 06:48:12 +01:00
Héctor Ramón Jiménez
3bdf931925 Turn Touch into a touch::Event enum 2020-12-15 06:38:46 +01:00
Héctor Ramón Jiménez
09110a93b0 Merge branch 'ios-support-wip' into feature/touch-support 2020-12-15 06:13:19 +01:00
Héctor Ramón Jiménez
01322f69a4 Use recently stabilized intra-doc links
See RFC: https://github.com/rust-lang/rfcs/blob/master/text/1946-intra-rustdoc-links.md
2020-11-26 02:05:43 +01:00
Héctor Ramón Jiménez
d612bf5678 Rename keyboard::ModifiersState to Modifiers 2020-11-26 02:05:42 +01:00
Héctor Ramón Jiménez
1d23db1866 Track keyboard modifiers in text_input 2020-11-25 04:10:23 +01:00
Zak
d275a4ed32 This PR fixes a bug with select all (CMD + A on MacOS) when using a text_input.
Previous behaviour: when selecting all (CMD + A) would delete the current text inside the input and replace the content with just the letter 'a'.

Now we check if the logo key (modifier key) has been pressed before checking any other key and save it to the state level. This way we can prevent any text being deleted when using the select all shortcut or text being entered at all when a modifier key is pressed (this behaviour matches other text input behaviour i.e text inputs in the browser etc...).
2020-11-25 03:57:18 +01:00
Héctor Ramón Jiménez
140bea352e Disable dragging in TextInput after double click
When using a trackpad, mouse move events may happen between the
press/release events. This was incorrectly triggering selection dragging in
the `TextInput` widget.

Eventually, we should implement proper word-aware selection dragging.
2020-11-19 02:45:47 +01:00
Héctor Ramón Jiménez
df712f9ccf Implement flexible TextInput::draw helper 2020-11-17 05:13:06 +01:00
Héctor Ramón Jiménez
bf6c65b5ad Implement event capturing for TextInput 2020-11-12 01:11:09 +01:00
Héctor Ramón Jiménez
3f968b8c87 Make Widget::on_event return an event::Status 2020-11-12 00:09:52 +01:00
Héctor Ramón Jiménez
1a2cb2f35b Split focus and unfocus methods in text_input 2020-11-09 20:32:58 +01:00
Paul Delafosse
f7d67598cb Add textinput focus method 2020-11-09 20:32:50 +01:00
Héctor Ramón Jiménez
d328b07b39 Introduce viewport to Widget::draw
This should eventually allow us to only generate primitives that are
visible.
2020-10-28 06:21:07 +01:00
Héctor Ramón Jiménez
d7a5e54455 Require Clone for Message early when needed
Prior to this change, the widgets that needed a `Clone` bound on `Message` to
implement the `Widget` trait could be created with a non-cloneable `Message`.

As a consequence, the compiler complained only when actually trying to use the
`Widget` trait. Normally, this happens when trying to `push` the widget in a
container or turn it into an `Element`.

Furthermore, the compiler error in this case does not mention `Message` nor the
`Clone` bound, but instead complains about a missing `From` implementation.
Thus, it can easily cause confusion!

This change introduces `Clone` bounds in the main implementation of the
widgets that need it to properly implement the `Widget` trait. As a
result, the compiler complains early when trying to create one of these widgets
with a non-cloneable `Message` and explicitly mentions that the `Message` needs
to implement `Clone`.
2020-10-17 08:10:30 +02:00
Héctor Ramón Jiménez
4ab9992bf8 Unfocus TextInput when Escape key is pressed 2020-07-30 00:52:02 +02:00
Héctor Ramón Jiménez
55d2c5886f Introduce state method to TextInput 2020-07-24 19:20:46 +02:00
Héctor Ramón Jiménez
a1210c9dae Improve safety of Cursor::selection 2020-07-11 00:00:14 +02:00
Héctor Ramón Jiménez
dfeb3db003 Use default_font_size for TextInput widget 2020-07-06 23:58:15 +02:00
bansheerubber
5260b3072a implemented hecrj's suggestion 2020-06-08 10:00:25 -07:00
bansheerubber
19c07da86f fixed formatting 2020-06-05 09:57:18 -07:00
bansheerubber
98cf9c455a added move_cursor_to 2020-06-05 09:19:46 -07:00
bansheerubber
0d119aa731 added value to move_cursor_to_end 2020-06-05 09:13:49 -07:00
bansheerubber
6a2c73d0e0 sketch of move_cursor_to commands 2020-06-05 08:58:34 -07:00
Imbris
490a437b2f Make Font an associated type of text_input::Renderer 2020-05-29 15:37:25 -04:00
Héctor Ramón Jiménez
bb9ccc4f62 Remove inconsistent input module in iced_native 2020-04-30 05:04:45 +02:00
Héctor Ramón Jiménez
e55cd9652e Split Input mouse event by ButtonState 2020-04-30 04:53:15 +02:00
Héctor Ramón Jiménez
e139aae143 Split Input keyboard event by ButtonState 2020-04-30 04:34:29 +02:00
Héctor Ramón Jiménez
5e47238489 Rename leftover TextInputWidget to Marker 2020-04-13 04:38:35 +02:00
Olivier Pinon
f7d7ab1ba9 Remove unnecessary 'static lifetime on Renderer 2020-04-12 00:57:44 +02:00
FabianLars
6ca97788b2 implement ctrl + del on text-input 2020-04-06 15:22:52 +02:00
Héctor Ramón Jiménez
c114be034a Fix typo in text_input::Renderer::draw docs 2020-04-02 03:44:14 +02:00
Michael Swan
4ca54836a8 Add Ctrl+Backspace text field behaviour 2020-03-30 22:37:28 -05:00
Héctor Ramón Jiménez
d07304fb85 Hash type ids in Widget::hash_layout impls 2020-03-30 17:28:55 +02:00
Théo Gaillard
0539cd1b85
refactor: remove not mandatory static lifetime 2020-03-30 06:39:10 +08:00
Héctor Ramón Jiménez
30f02345a8 Implement Renderer::find_cursor_position 2020-03-25 13:57:02 +01:00
Héctor Ramón Jiménez
d6914d79a1 Rename is_pressed to is_dragging in text_input 2020-03-24 21:48:54 +01:00
Héctor Ramón Jiménez
5e6970b615 Improve docs of text_input::State::cursor 2020-03-24 21:47:43 +01:00
Héctor Ramón Jiménez
6791c0b208 Remove commented code in text_input 2020-03-24 21:46:20 +01:00
Héctor Ramón Jiménez
6c47a40730 Create text_input::Editor to hold editing logic 2020-03-24 20:51:22 +01:00
Héctor Ramón Jiménez
28382a47d3 Move Value to its own module 2020-03-24 20:36:33 +01:00
Héctor Ramón Jiménez
6b89dd7db9 Improve text_input::cursor API 2020-03-24 20:23:31 +01:00
Héctor Ramón Jiménez
7cb1452d29 Convert mouse::State into mouse::Click 2020-03-24 19:03:17 +01:00
Héctor Ramón Jiménez
d3572e1b81 Turn Touch into a struct and add finger id 2020-03-19 12:17:16 +01:00
Sebastian Imlay
e19a07d400 Added initial touch events to support iOS 2020-03-18 11:26:53 -07:00
FabianLars
b632dce0da fixed panic on pasting into non updating input 2020-03-14 10:51:36 +01:00
FabianLars
731e6752eb keep cursor inside value boundaries more reliable 2020-03-13 17:54:02 +01:00
FabianLars
767096b9bb disable word selection if is_secure == true 2020-02-27 12:13:47 +01:00
FabianLars
0d8d236be6 More selection actions: (Ctrl +) Shift + Left/Right, Shift + Home/End 2020-02-25 17:03:52 +01:00
FabianLars
c47e30e960 double click fixed 2020-02-24 20:10:20 +01:00