Commit graph

238 commits

Author SHA1 Message Date
Emil Ernerfeldt
d6233de9dc Small improvements to the demo (add source code links etc) 2021-03-07 19:51:07 +01:00
Emil Ernerfeldt
cd4c07e09a Output events when widgets gain keyboard focus
Part of https://github.com/emilk/egui/issues/167
2021-03-07 19:45:20 +01:00
Emil Ernerfeldt
9c8439d053 Add some helper functions to Response 2021-03-06 10:48:39 +01:00
Emil Ernerfeldt
f793ac7f3e [demo] Remove dead code 2021-02-28 20:11:37 +01:00
Emil Ernerfeldt
1fb3b43dfc [demo] Improve painting demo slightly 2021-02-28 19:50:47 +01:00
Emil Ernerfeldt
84cc227f11 eframe: always provide a texture allocator 2021-02-28 19:09:48 +01:00
Emil Ernerfeldt
d3fd51d6a4 Add Response::changed(): see if e.g. text was entered or slider dragged 2021-02-28 17:24:07 +01:00
Emil Ernerfeldt
5f6a468812 Add Context::set_pixels_per_point to control the scale of the UI 2021-02-21 11:23:33 +01:00
Emil Ernerfeldt
ebc2486d22 Slider: use a DragValue for the value, and implement suffix/prefix 2021-02-20 18:29:09 +01:00
Emil Ernerfeldt
4e041185f1 Add module special_emojis with apple, linux, windows & github logos 2021-02-20 16:09:00 +01:00
Emil Ernerfeldt
6354709fe1 [demo] Link to the egui docs from the widget gallery 2021-02-20 12:07:15 +01:00
Emil Ernerfeldt
040553da78 impl<F> Widget for F where F: FnOnce(&mut Ui) -> Response
This enables functions that return `impl Widget`, so that you can
create a widget by just returning a lambda from a function.

For instance: `ui.add(toggle(bool))` (instead of `toggle(ui, bool)`)
2021-02-20 12:02:38 +01:00
Emil Ernerfeldt
6fe70e685b Simplify and unify colors of selectable widgets 2021-02-20 11:28:00 +01:00
Emil Ernerfeldt
21c99e1130 Add Ui::hyperlink_to 2021-02-20 09:26:58 +01:00
Emil Ernerfeldt
9e38674d13 [demo] Alwyas start with widget gallery 2021-02-20 09:19:40 +01:00
Emil Ernerfeldt
0f13fff24b Assign default colors to plot lines if not explicitly set 2021-02-18 18:59:59 +01:00
Emil Ernerfeldt
a19140ec67 A simple 2D plot library 2021-02-17 22:54:10 +01:00
Emil Ernerfeldt
7dad76b913 Use explicit epaint over paint alias (re-export)
egui reexports the `epaint` crate both under its original name
and under the alias `paint` (for historical reasons)
2021-02-14 10:53:39 +01:00
Emil Ernerfeldt
6d255cd179 Use explicit emath to math alias
egui exports `emath` under its original name AND under the alias `math`
(for historical reasons).
2021-02-14 10:44:46 +01:00
Emil Ernerfeldt
c376d0bb7e [emath] RectTransform: transforms Pos2 from one Rect to another
Very useful for transforming coordinate systems, e.g. for painting
2021-02-14 10:33:44 +01:00
Emil Ernerfeldt
dbc6a620cd Control the maximum egui web canvas size with App::max_size_points 2021-02-12 17:58:02 +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
df4c0257c0 Add Ui functions for doing manual layout ("put this widget here") 2021-02-07 13:48:55 +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
xue-blood
ce14fa860b
Speed up fractal_clock painting (#152)
clip unwatchable line before drawing
2021-02-06 16:59:46 +01:00
Emil Ernerfeldt
26f966563a Add Grid::max_col_width 2021-02-06 16:54:38 +01:00
Emil Ernerfeldt
2d9d06dbff [emath] Use const values for Vec2::ZERO, Rect::EVERYTHING etc 2021-02-05 10:11:39 +01:00
Emil Ernerfeldt
0f37b009d6 Add TextEdit::hint_text for showing a weak hint text when empty 2021-02-03 21:06:50 +01:00
Lucas Walter
4e7e128b2b
Spelling ui_resouce -> ui_resource (#156) 2021-02-03 20:04:57 +01:00
Emil Ernerfeldt
af3195f086 Add ctx.set_visuals() 2021-02-03 19:38:50 +01:00
Emil Ernerfeldt
a19fd7b780 Add light mode 2021-02-03 19:30:58 +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
ca886ea998 Add ui.visuals() as short for ui.style().visuals 2021-02-03 00:20:39 +01:00
Emil Ernerfeldt
01fca2f31c Add Ui::spacing() and Ui::spacing_mut() as shortcuts 2021-02-01 16:56:29 +01:00
Emil Ernerfeldt
e529bd3ea4 [demo] Make syntect an optional dependency
Adds a whopping 1.4 MB to the WASM
2021-01-31 16:52:26 +01:00
Emil Ernerfeldt
16d66bd22d Replace markdown editor with new 'EasyMark' markup language 2021-01-31 16:42:32 +01:00
Emil Ernerfeldt
6029a438a2 Add a VERY experimental markdown viewer 2021-01-27 20:14:53 +01:00
Emil Ernerfeldt
b493bc6efc Wrap tesselated output in struct ClippedMesh(Rect, Mesh) 2021-01-25 21:43:17 +01:00
Emil Ernerfeldt
75fa77e040 Rename Triangles to Mesh 2021-01-25 21:23:24 +01:00
Emil Ernerfeldt
63e4ff4382 [demo] Move layout demo to own window 2021-01-25 20:52:47 +01:00
Emil Ernerfeldt
749419c9fd [demo] Improve scroll demo and move to own window 2021-01-25 20:52:31 +01:00
Emil Ernerfeldt
5e3a89bf00 [demo] Move slider demo to own window 2021-01-25 20:14:39 +01:00
Emil Ernerfeldt
6d57a24f35 Add Slider::clamp_to_range(bool) 2021-01-25 19:55:08 +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
e2217ff63a [style] Fade out windows on close 2021-01-20 00:31:43 +01:00
Emil Ernerfeldt
29bb7c9f9d egui_demo_lib 0.8.1: export ColorTest 2021-01-19 17:13:29 +01:00
Emil Ernerfeldt
31b7eda51e Rename Egui to egui
Also update iamges in README.md
2021-01-17 14:48:59 +01:00
Emil Ernerfeldt
07f1b074ca [grid] Allow putting a separator in a grid 2021-01-16 11:48:30 +01:00
Emil Ernerfeldt
620e43d483 New sleeker visual style
Remove a lot of borders, remove transparency, simplify and unify.
2021-01-15 22:23:08 +01:00
Emil Ernerfeldt
b1157ee642 [grid] Option to set spacing 2021-01-15 21:17:56 +01:00
Emil Ernerfeldt
480c6db37f [grid] Set default row height to interact_size.y
It is what we use for horizontal layouts, and makes sense.
2021-01-15 21:17:56 +01:00
Emil Ernerfeldt
03c9cda89b [grid] Ensure the contents of each grid cell is aligned left+center 2021-01-15 21:17:56 +01:00
Emil Ernerfeldt
641a302e0a [grid] Add optional minimal row height 2021-01-15 18:30:09 +01:00
Emil Ernerfeldt
6f814b9516 [demo] Add collapsing header to widget gallery 2021-01-15 18:30:09 +01:00
Emil Ernerfeldt
73d16eb771 Use Grid to add labels to the color picker sliders
Also improve the color preview in the color picker
2021-01-13 23:09:23 +01:00
Emil Ernerfeldt
6d8a766614 [style] Slightly expand buttons when hovering and interacting 2021-01-13 22:08:35 +01:00
Emil Ernerfeldt
5e7ad40c8d [demo] Center the "(source code)" hyperlinks 2021-01-11 23:50:50 +01:00
Emil Ernerfeldt
1c5cdd8575 [demo] Add separator, hyperlink and SelectableLabel to widget gallery 2021-01-11 21:07:17 +01:00
Emil Ernerfeldt
0b10fa5c29
Grid layout and widget gallery (#106)
* Wrap Layout and Region into a new struct Placer

* [egui] Add a simple grid layout

* Refactor CollapsingHeader code (simplify header painting)

* Fix: allow putting a CollapsingHeader inside of a grid layout

* [demo] Add a widget gallery

Closes https://github.com/emilk/egui/issues/88

* Add optional striped grid background
2021-01-11 20:58:36 +01:00
Emil Ernerfeldt
d0c3bd0d8f [demo] Persist which demo windows are open 2021-01-10 21:00:17 +01:00
Emil Ernerfeldt
26d576f510 Break out mod paint into new crate epaint 2021-01-10 15:42:46 +01:00
Emil Ernerfeldt
fb2317c993 Rename PaintCmd to Shape 2021-01-10 11:43:01 +01:00
Emil Ernerfeldt
a0b0f36d29 Move egui/math into new crate emath 2021-01-10 11:37:47 +01:00
Emil Ernerfeldt
aee1474b6e Move align.rs into mod math 2021-01-10 10:54:34 +01:00
Emil Ernerfeldt
72ed94fcb3 Add helper struct Align2 2021-01-10 10:51:16 +01:00
Emil Ernerfeldt
d895285482 [demo] Window options window: add checkbox to toggle close button 2021-01-10 10:43:49 +01:00
Emil Ernerfeldt
e105719d34 [demo] Add test of pixel perfect rendering to color test 2021-01-07 19:25:39 +01:00
Emil Ernerfeldt
5ef9f35d1e [epi] Simplify TextureAllocator interface 2021-01-07 16:29:58 +01:00
Emil Ernerfeldt
b4871e2aef Add ui.allocate_at_least and ui.allocate_exact_size 2021-01-06 11:03:29 +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
cbe0de83ee Add a window options demo 2021-01-03 00:12:54 +01:00
Emil Ernerfeldt
a905c884e8 Add widget egui::reset_button 2021-01-02 23:28:10 +01:00
Emil Ernerfeldt
029a85c1fc Move Color32 constants from mod color to struct Color32 2021-01-02 17:18:41 +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
14a96ca5d0 Add a dummy warm-up frame to the demo app to pre-cache emojis 2021-01-02 14:42:43 +01:00
Emil Ernerfeldt
1690db0f0c demo tweaks 2021-01-02 12:00:14 +01:00
Emil Ernerfeldt
b3d1016507 [demo] Move backend into an optional panel of WrapApp 2021-01-02 01:01:01 +01:00
Emil Ernerfeldt
3e0bedd96d [demo] Move color test to WrapApp 2021-01-02 00:13:34 +01:00
Emil Ernerfeldt
4848c171eb [demo] Move Fractal Clock to WrapApp 2021-01-02 00:12:45 +01:00
Emil Ernerfeldt
b1022d01c1 Rename epi::App::ui to epi::App::update 2021-01-01 20:22:18 +01:00
Emil Ernerfeldt
defad4ed51 Merge example_web into egui_demo_lib 2021-01-01 17:11:05 +01:00
Emil Ernerfeldt
375e317547 Move http fetch api from eframe to epi 2021-01-01 14:54:26 +01:00
Emil Ernerfeldt
d7459bc13d Move egui::app into new epi crate 2020-12-29 14:15:46 +01:00
Emil Ernerfeldt
6953dc7d5d Split out the Egui demo code to new crate egui_demo_lib 2020-12-29 13:40:11 +01:00