1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 06:10:06 -04:00
Commit Graph

18 Commits

Author SHA1 Message Date
Cristian Dinu
ba12f9e81f Implement tabs as spaces
When we load a string in `TextEdit` we keep the tabs as they are.

Now depending on `tab_as_spaces` and `tab_size` properties of the
`TextEdit` we have the following situations:

- When `tab_as_spaces` is false, then when we press `TAB` a `TAB`
  char in added to the string.

- When `tab_as_spaces` is true, then when we press `TAB` a chunck
  of `tab_size` spaces is added to the string.

To config `tab_as_spaces` and `tab_size` to the values we want we
can use the folliwing helper functions:

- `TextEdit::tab_as_spaces()`
- `TextEdit::tab_size()`

Example usage:

```rust
ui.add(egui::TextEdit::multiline(&mut self.multiline_text_input)
    .tab_as_spaces(self.tab_as_spaces)
    .tab_size(self.tab_size));
```

Demo:
A better demo of this new functionality was implemented in the
misc widgets demo

What's left to do:
- Render actual `TAB` as a rect the size of `tab_size` spaces.

- Without default parameters values it seems a pain to implement.

  I need to think if it is possible to avoid API breaking changes
  for the font system. From my checks so far I need to pass at
  least `tab_size` to the fonts system to know how big the glyph
  for `TAB` will be.
2021-03-23 19:44:49 +02:00
Emil Ernerfeldt
ed0d406698 Improve misc documentation
Closes https://github.com/emilk/egui/issues/229
2021-03-21 17:13:58 +01:00
Emil Ernerfeldt
eaa1ed96ee Depcrecate ui.horizontal_for_text and ui.horizontal_wrapped_for_text
They just add unnecessary complexity at this point
2021-03-21 14:48:16 +01:00
Emil Ernerfeldt
017d602fe5 Rename "kb_focus" to just "focus" everywhere 2021-03-09 20:55:24 +01:00
Emil Ernerfeldt
f793ac7f3e [demo] Remove dead code 2021-02-28 20:11:37 +01:00
Emil Ernerfeldt
6377a4231f [demo] Refactor and minor cleanup 2021-02-07 17:04:03 +01:00
Emil Ernerfeldt
e82fb81f07 Replace (ret, response) tuples with new struct InnerResponse 2021-02-07 14:09:44 +01:00
Emil Ernerfeldt
bca722ddf8 Add ui.set_enabled(false) to disable all widgets in a Ui
Closes https://github.com/emilk/egui/issues/50
2021-02-07 10:55:45 +01:00
Emil Ernerfeldt
829455b347 Add ui.group(|ui| { … }) to visually group some widgets within a frame 2021-02-03 00:25:07 +01:00
Emil Ernerfeldt
5e3a89bf00 [demo] Move slider demo to own window 2021-01-25 20:14:39 +01:00
Emil Ernerfeldt
247026149c Multiple mouse button support (#135)
Add support for primary, secondary and middle mouse buttons. Also improve ability to click things in low FPS situations.

This introduces a lot of breaking changes:

    Backends/integrations now pass mouse events via the even stream.
    Response has an interface of mostly methods instead of public members.
    input.mouse is now input.pointer and has new interface.


* Rename 'mouse' to 'pointer' everywhere (pointer = mouse or touch)

* Make Response::clicked and Response::double_clicked into methods

* Remove Response::active and add dragged() and interact_pointer_pos()

* Support multiple mouse buttons

* Make PointerState interface all methods

* Make most members of Response private
2021-01-25 18:50:19 +01:00
Emil Ernerfeldt
9f4c31c0e0 Add Frame::group for putting a frame around some widgets
Closes https://github.com/emilk/egui/issues/125
2021-01-20 23:26:46 +01:00
Emil Ernerfeldt
5e7ad40c8d [demo] Center the "(source code)" hyperlinks 2021-01-11 23:50:50 +01:00
Emil Ernerfeldt
69d31a5e47 [eframe] Make persistence, http and time optional features
Saves on compile times.
2021-01-04 10:25:13 +01:00
Emil Ernerfeldt
10a23d18e1 Support additive colors in color picker 2021-01-03 18:16:12 +01:00
Emil Ernerfeldt
64dd186daf Deprecate color::srgba function. Use Color32::from_rgb etc instead. 2021-01-02 17:06:26 +01:00
Emil Ernerfeldt
73f3d8cf46 Rename Srgba to Color32 2021-01-02 17:02:18 +01:00
Emil Ernerfeldt
defad4ed51 Merge example_web into egui_demo_lib 2021-01-01 17:11:05 +01:00