1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40:06 -04:00

Remove things that have been deprecated for over a year (#7099)

Removes all things that were marked `#[deprecated]` more than 12 months
ago
This commit is contained in:
Emil Ernerfeldt
2025-05-28 09:47:15 +02:00
committed by GitHub
parent 2cf6a3a9a6
commit 92fea8a18f
15 changed files with 21 additions and 399 deletions

View File

@@ -513,14 +513,6 @@ impl ScrollArea {
self
}
/// Turn on/off scrolling on the horizontal/vertical axes.
#[deprecated = "Renamed to `scroll`"]
#[inline]
pub fn scroll2(mut self, direction_enabled: impl Into<Vec2b>) -> Self {
self.direction_enabled = direction_enabled.into();
self
}
/// Control the scrolling behavior.
///
/// * If `true` (default), the scroll area will respond to user scrolling.

View File

@@ -376,14 +376,6 @@ impl<'open> Window<'open> {
self
}
/// Enable/disable horizontal/vertical scrolling. `false` by default.
#[deprecated = "Renamed to `scroll`"]
#[inline]
pub fn scroll2(mut self, scroll: impl Into<Vec2b>) -> Self {
self.scroll = self.scroll.scroll(scroll);
self
}
/// Enable/disable horizontal scrolling. `false` by default.
#[inline]
pub fn hscroll(mut self, hscroll: bool) -> Self {

View File

@@ -2,14 +2,13 @@
use std::{borrow::Cow, cell::RefCell, panic::Location, sync::Arc, time::Duration};
use emath::GuiRounding as _;
use emath::{GuiRounding as _, OrderedFloat};
use epaint::{
emath::{self, TSTransform},
mutex::RwLock,
stats::PaintStats,
tessellator,
text::{FontInsert, FontPriority, Fonts},
util::OrderedFloat,
vec2, ClippedPrimitive, ClippedShape, Color32, ImageData, ImageDelta, Pos2, Rect, StrokeKind,
TessellationOptions, TextureAtlas, TextureId, Vec2,
};
@@ -1231,13 +1230,6 @@ impl Context {
.map(|widget_rect| self.get_response(widget_rect))
}
/// Returns `true` if the widget with the given `Id` contains the pointer.
#[deprecated = "Use Response.contains_pointer or Context::read_response instead"]
pub fn widget_contains_pointer(&self, id: Id) -> bool {
self.read_response(id)
.is_some_and(|response| response.contains_pointer())
}
/// Do all interaction for an existing widget, without (re-)registering it.
pub(crate) fn get_response(&self, widget_rect: WidgetRect) -> Response {
use response::Flags;
@@ -2740,21 +2732,6 @@ impl Context {
.map(|t| t.inverse())
}
/// Move all the graphics at the given layer.
///
/// Is used to implement drag-and-drop preview.
///
/// This only applied to the existing graphics at the layer, not to new graphics added later.
///
/// For a persistent transform, use [`Self::set_transform_layer`] instead.
#[deprecated = "Use `transform_layer_shapes` instead"]
pub fn translate_layer(&self, layer_id: LayerId, delta: Vec2) {
if delta != Vec2::ZERO {
let transform = emath::TSTransform::from_translation(delta);
self.transform_layer_shapes(layer_id, transform);
}
}
/// Transform all the graphics at the given layer.
///
/// Is used to implement drag-and-drop preview.

View File

@@ -592,7 +592,7 @@ pub const NUM_POINTER_BUTTONS: usize = 5;
/// State of the modifier keys. These must be fed to egui.
///
/// The best way to compare [`Modifiers`] is by using [`Modifiers::matches`].
/// The best way to compare [`Modifiers`] is by using [`Modifiers::matches_logically`] or [`Modifiers::matches_exact`].
///
/// NOTE: For cross-platform uses, ALT+SHIFT is a bad combination of modifiers
/// as on mac that is how you type special characters,
@@ -775,8 +775,8 @@ impl Modifiers {
/// ```
/// # use egui::Modifiers;
/// # let pressed_modifiers = Modifiers::default();
/// if pressed_modifiers.matches(Modifiers::ALT | Modifiers::SHIFT) {
/// // Alt and Shift are pressed, and nothing else
/// if pressed_modifiers.matches_logically(Modifiers::ALT | Modifiers::SHIFT) {
/// // Alt and Shift are pressed, but not ctrl/command
/// }
/// ```
///
@@ -817,7 +817,7 @@ impl Modifiers {
/// ```
/// # use egui::Modifiers;
/// # let pressed_modifiers = Modifiers::default();
/// if pressed_modifiers.matches(Modifiers::ALT | Modifiers::SHIFT) {
/// if pressed_modifiers.matches_exact(Modifiers::ALT | Modifiers::SHIFT) {
/// // Alt and Shift are pressed, and nothing else
/// }
/// ```
@@ -825,13 +825,13 @@ impl Modifiers {
/// ## Behavior:
/// ```
/// # use egui::Modifiers;
/// assert!(Modifiers::CTRL.matches(Modifiers::CTRL));
/// assert!(!Modifiers::CTRL.matches(Modifiers::CTRL | Modifiers::SHIFT));
/// assert!(!(Modifiers::CTRL | Modifiers::SHIFT).matches(Modifiers::CTRL));
/// assert!((Modifiers::CTRL | Modifiers::COMMAND).matches(Modifiers::CTRL));
/// assert!((Modifiers::CTRL | Modifiers::COMMAND).matches(Modifiers::COMMAND));
/// assert!((Modifiers::MAC_CMD | Modifiers::COMMAND).matches(Modifiers::COMMAND));
/// assert!(!Modifiers::COMMAND.matches(Modifiers::MAC_CMD));
/// assert!(Modifiers::CTRL.matches_exact(Modifiers::CTRL));
/// assert!(!Modifiers::CTRL.matches_exact(Modifiers::CTRL | Modifiers::SHIFT));
/// assert!(!(Modifiers::CTRL | Modifiers::SHIFT).matches_exact(Modifiers::CTRL));
/// assert!((Modifiers::CTRL | Modifiers::COMMAND).matches_exact(Modifiers::CTRL));
/// assert!((Modifiers::CTRL | Modifiers::COMMAND).matches_exact(Modifiers::COMMAND));
/// assert!((Modifiers::MAC_CMD | Modifiers::COMMAND).matches_exact(Modifiers::COMMAND));
/// assert!(!Modifiers::COMMAND.matches_exact(Modifiers::MAC_CMD));
/// ```
pub fn matches_exact(&self, pattern: Self) -> bool {
// alt and shift must always match the pattern:
@@ -842,11 +842,6 @@ impl Modifiers {
self.cmd_ctrl_matches(pattern)
}
#[deprecated = "Renamed `matches_exact`, but maybe you want to use `matches_logically` instead"]
pub fn matches(&self, pattern: Self) -> bool {
self.matches_exact(pattern)
}
/// Checks only cmd/ctrl, not alt/shift.
///
/// `self` here are the currently pressed modifiers,

View File

@@ -993,59 +993,6 @@ impl Memory {
self.focus_mut().focused_widget = None;
}
/// Is any widget being dragged?
#[deprecated = "Use `Context::dragged_id` instead"]
#[inline(always)]
pub fn is_anything_being_dragged(&self) -> bool {
self.interaction().potential_drag_id.is_some()
}
/// Is this specific widget being dragged?
///
/// A widget that sense both clicks and drags is only marked as "dragged"
/// when the mouse has moved a bit, but `is_being_dragged` will return true immediately.
#[deprecated = "Use `Context::is_being_dragged` instead"]
#[inline(always)]
pub fn is_being_dragged(&self, id: Id) -> bool {
self.interaction().potential_drag_id == Some(id)
}
/// Get the id of the widget being dragged, if any.
///
/// Note that this is set as soon as the mouse is pressed,
/// so the widget may not yet be marked as "dragged",
/// as that can only happen after the mouse has moved a bit
/// (at least if the widget is interesated in both clicks and drags).
#[deprecated = "Use `Context::dragged_id` instead"]
#[inline(always)]
pub fn dragged_id(&self) -> Option<Id> {
self.interaction().potential_drag_id
}
/// Set which widget is being dragged.
#[inline(always)]
#[deprecated = "Use `Context::set_dragged_id` instead"]
pub fn set_dragged_id(&mut self, id: Id) {
self.interaction_mut().potential_drag_id = Some(id);
}
/// Stop dragging any widget.
#[inline(always)]
#[deprecated = "Use `Context::stop_dragging` instead"]
pub fn stop_dragging(&mut self) {
self.interaction_mut().potential_drag_id = None;
}
/// Is something else being dragged?
///
/// Returns true if we are dragging something, but not the given widget.
#[inline(always)]
#[deprecated = "Use `Context::dragging_something_else` instead"]
pub fn dragging_something_else(&self, not_this: Id) -> bool {
let drag_id = self.interaction().potential_drag_id;
drag_id.is_some() && drag_id != Some(not_this)
}
/// Forget window positions, sizes etc.
/// Can be used to auto-layout windows.
pub fn reset_areas(&mut self) {

View File

@@ -582,16 +582,6 @@ impl Painter {
));
}
}
#[deprecated = "Use `Painter::galley` or `Painter::galley_with_override_text_color` instead"]
#[inline]
pub fn galley_with_color(&self, pos: Pos2, galley: Arc<Galley>, text_color: Color32) {
if !galley.is_empty() {
self.add(Shape::galley_with_override_text_color(
pos, galley, text_color,
));
}
}
}
fn tint_shape_towards(shape: &mut Shape, target: Color32) {

View File

@@ -395,19 +395,6 @@ impl Response {
self.drag_stopped() && self.ctx.input(|i| i.pointer.button_released(button))
}
/// The widget was being dragged, but now it has been released.
#[inline]
#[deprecated = "Renamed 'drag_stopped'"]
pub fn drag_released(&self) -> bool {
self.drag_stopped()
}
/// The widget was being dragged by the button, but now it has been released.
#[deprecated = "Renamed 'drag_stopped_by'"]
pub fn drag_released_by(&self, button: PointerButton) -> bool {
self.drag_stopped_by(button)
}
/// If dragged, how many points were we dragged and in what direction?
#[inline]
pub fn drag_delta(&self) -> Vec2 {

View File

@@ -23,11 +23,4 @@ pub struct TextEditOutput {
pub cursor_range: Option<CCursorRange>,
}
impl TextEditOutput {
#[deprecated = "Renamed `self.galley_pos`"]
pub fn text_draw_pos(&self) -> crate::Pos2 {
self.galley_pos
}
}
// TODO(emilk): add `output.paint` and `output.store` and split out that code from `TextEdit::show`.