mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 21:30:03 -04:00
Use Rust edition 2024 (#7280)
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
use egui::{
|
||||
Color32, Context, Pos2, Rect, Ui,
|
||||
containers::{Frame, Window},
|
||||
emath, epaint,
|
||||
epaint::PathStroke,
|
||||
hex_color, lerp, pos2, remap, vec2, Color32, Context, Pos2, Rect, Ui,
|
||||
hex_color, lerp, pos2, remap, vec2,
|
||||
};
|
||||
|
||||
#[derive(Default)]
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
use super::About;
|
||||
use crate::is_mobile;
|
||||
use crate::Demo;
|
||||
use crate::View as _;
|
||||
use crate::is_mobile;
|
||||
use egui::containers::menu;
|
||||
use egui::style::StyleModifier;
|
||||
use egui::{Context, Modifiers, ScrollArea, Ui};
|
||||
@@ -370,7 +370,7 @@ fn file_menu_button(ui: &mut Ui) {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{demo::demo_app_windows::DemoGroups, Demo as _};
|
||||
use crate::{Demo as _, demo::demo_app_windows::DemoGroups};
|
||||
|
||||
use egui_kittest::kittest::{NodeT as _, Queryable as _};
|
||||
use egui_kittest::{Harness, SnapshotOptions, SnapshotResults};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use egui::{vec2, Color32, Context, Frame, Id, Ui, Window};
|
||||
use egui::{Color32, Context, Frame, Id, Ui, Window, vec2};
|
||||
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use super::{Demo, View};
|
||||
|
||||
use egui::{
|
||||
vec2, Align, Align2, Checkbox, CollapsingHeader, Color32, ComboBox, Context, FontId, Resize,
|
||||
RichText, Sense, Slider, Stroke, TextFormat, TextStyle, Ui, Vec2, Window,
|
||||
Align, Align2, Checkbox, CollapsingHeader, Color32, ComboBox, Context, FontId, Resize,
|
||||
RichText, Sense, Slider, Stroke, TextFormat, TextStyle, Ui, Vec2, Window, vec2,
|
||||
};
|
||||
|
||||
/// Showcase some ui code
|
||||
|
||||
@@ -162,10 +162,10 @@ impl crate::View for Modals {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::demo::modals::Modals;
|
||||
use crate::Demo as _;
|
||||
use egui::accesskit::Role;
|
||||
use crate::demo::modals::Modals;
|
||||
use egui::Key;
|
||||
use egui::accesskit::Role;
|
||||
use egui_kittest::kittest::Queryable as _;
|
||||
use egui_kittest::{Harness, SnapshotResults};
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use egui::{
|
||||
Color32, Frame, Pos2, Rect, Sense, Stroke, Vec2,
|
||||
emath::{RectTransform, Rot2},
|
||||
vec2, Color32, Frame, Pos2, Rect, Sense, Stroke, Vec2,
|
||||
vec2,
|
||||
};
|
||||
|
||||
pub struct MultiTouch {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use egui::{
|
||||
emath,
|
||||
Color32, Context, Frame, Grid, Pos2, Rect, Sense, Shape, Stroke, StrokeKind, Ui, Vec2,
|
||||
Widget as _, Window, emath,
|
||||
epaint::{self, CubicBezierShape, PathShape, QuadraticBezierShape},
|
||||
pos2, Color32, Context, Frame, Grid, Pos2, Rect, Sense, Shape, Stroke, StrokeKind, Ui, Vec2,
|
||||
Widget as _, Window,
|
||||
pos2,
|
||||
};
|
||||
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use egui::{emath, vec2, Color32, Context, Frame, Pos2, Rect, Sense, Stroke, Ui, Window};
|
||||
use egui::{Color32, Context, Frame, Pos2, Rect, Sense, Stroke, Ui, Window, emath, vec2};
|
||||
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use crate::rust_view_ui;
|
||||
use egui::color_picker::{color_picker_color32, Alpha};
|
||||
use egui::color_picker::{Alpha, color_picker_color32};
|
||||
use egui::containers::menu::{MenuConfig, SubMenuButton};
|
||||
use egui::{
|
||||
include_image, Align, Align2, ComboBox, Frame, Id, Layout, Popup, PopupCloseBehavior,
|
||||
RectAlign, RichText, Tooltip, Ui, UiBuilder,
|
||||
Align, Align2, ComboBox, Frame, Id, Layout, Popup, PopupCloseBehavior, RectAlign, RichText,
|
||||
Tooltip, Ui, UiBuilder, include_image,
|
||||
};
|
||||
|
||||
/// Showcase [`Popup`].
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use egui::{
|
||||
pos2, scroll_area::ScrollBarVisibility, Align, Align2, Color32, DragValue, NumExt as _, Rect,
|
||||
ScrollArea, Sense, Slider, TextStyle, TextWrapMode, Ui, Vec2, Widget as _,
|
||||
Align, Align2, Color32, DragValue, NumExt as _, Rect, ScrollArea, Sense, Slider, TextStyle,
|
||||
TextWrapMode, Ui, Vec2, Widget as _, pos2, scroll_area::ScrollBarVisibility,
|
||||
};
|
||||
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use egui::{style::HandleShape, Slider, SliderClamping, SliderOrientation, Ui};
|
||||
use egui::{Slider, SliderClamping, SliderOrientation, Ui, style::HandleShape};
|
||||
|
||||
/// Showcase sliders
|
||||
#[derive(PartialEq)]
|
||||
|
||||
@@ -330,7 +330,9 @@ fn expanding_content(ui: &mut egui::Ui) {
|
||||
}
|
||||
|
||||
fn long_text(row_index: usize) -> String {
|
||||
format!("Row {row_index} has some long text that you may want to clip, or it will take up too much horizontal space!")
|
||||
format!(
|
||||
"Row {row_index} has some long text that you may want to clip, or it will take up too much horizontal space!"
|
||||
)
|
||||
}
|
||||
|
||||
fn thick_row(row_index: usize) -> bool {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use egui::{vec2, Align, Direction, Layout, Resize, Slider, Ui};
|
||||
use egui::{Align, Direction, Layout, Resize, Slider, Ui, vec2};
|
||||
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
use egui::{
|
||||
Color32, Pos2, Rect, Sense, StrokeKind, Vec2,
|
||||
emath::{GuiRounding as _, TSTransform},
|
||||
epaint::{self, RectShape},
|
||||
vec2, Color32, Pos2, Rect, Sense, StrokeKind, Vec2,
|
||||
vec2,
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
|
||||
@@ -113,9 +113,9 @@ impl crate::View for TextEditDemo {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use egui::{accesskit, CentralPanel, Key, Modifiers};
|
||||
use egui_kittest::kittest::Queryable as _;
|
||||
use egui::{CentralPanel, Key, Modifiers, accesskit};
|
||||
use egui_kittest::Harness;
|
||||
use egui_kittest::kittest::Queryable as _;
|
||||
|
||||
#[test]
|
||||
pub fn should_type() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use egui::{util::undoer::Undoer, Button};
|
||||
use egui::{Button, util::undoer::Undoer};
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use egui::{
|
||||
text::CCursorRange, Key, KeyboardShortcut, Modifiers, ScrollArea, TextBuffer, TextEdit, Ui,
|
||||
Key, KeyboardShortcut, Modifiers, ScrollArea, TextBuffer, TextEdit, Ui, text::CCursorRange,
|
||||
};
|
||||
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::easy_mark_parser as easy_mark;
|
||||
use egui::{
|
||||
vec2, Align, Align2, Hyperlink, Layout, Response, RichText, Sense, Separator, Shape, TextStyle,
|
||||
Ui,
|
||||
Align, Align2, Hyperlink, Layout, Response, RichText, Sense, Separator, Shape, TextStyle, Ui,
|
||||
vec2,
|
||||
};
|
||||
|
||||
/// Parse and display a VERY simple and small subset of Markdown.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use egui::{
|
||||
emath::GuiRounding as _, epaint, lerp, pos2, vec2, widgets::color_picker::show_color, Align2,
|
||||
Color32, FontId, Image, Mesh, Pos2, Rect, Response, Rgba, RichText, Sense, Shape, Stroke,
|
||||
TextureHandle, TextureOptions, Ui, Vec2,
|
||||
Align2, Color32, FontId, Image, Mesh, Pos2, Rect, Response, Rgba, RichText, Sense, Shape,
|
||||
Stroke, TextureHandle, TextureOptions, Ui, Vec2, emath::GuiRounding as _, epaint, lerp, pos2,
|
||||
vec2, widgets::color_picker::show_color,
|
||||
};
|
||||
|
||||
const GRADIENT_SIZE: Vec2 = vec2(256.0, 18.0);
|
||||
@@ -722,8 +722,8 @@ fn mul_color_gamma(left: Color32, right: Color32) -> Color32 {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::ColorTest;
|
||||
use egui_kittest::kittest::Queryable as _;
|
||||
use egui_kittest::SnapshotResults;
|
||||
use egui_kittest::kittest::Queryable as _;
|
||||
|
||||
#[test]
|
||||
pub fn rendering_test() {
|
||||
|
||||
Reference in New Issue
Block a user