Remove deprecated functions (#3692)

This commit is contained in:
Emil Ernerfeldt 2023-12-08 11:02:57 +01:00 committed by GitHub
parent b1721a3ce7
commit 8d4de866d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 4 additions and 192 deletions

View File

@ -173,13 +173,6 @@ impl Area {
self
}
#[deprecated = "Use `constrain_to` instead"]
#[inline]
pub fn drag_bounds(mut self, constrain_rect: Rect) -> Self {
self.constrain_rect = Some(constrain_rect);
self
}
/// Where the "root" of the area is.
///
/// For instance, if you set this to [`Align2::RIGHT_TOP`]

View File

@ -424,36 +424,6 @@ impl CollapsingHeader {
self
}
/// Can the [`CollapsingHeader`] be selected by clicking it? Default: `false`.
#[deprecated = "Use the more powerful egui::collapsing_header::CollapsingState::show_header"] // Deprecated in 2022-04-28, before egui 0.18
#[inline]
pub fn selectable(mut self, selectable: bool) -> Self {
self.selectable = selectable;
self
}
/// If you set this to 'true', the [`CollapsingHeader`] will be shown as selected.
///
/// Example:
/// ```
/// # egui::__run_test_ui(|ui| {
/// let mut selected = false;
/// let response = egui::CollapsingHeader::new("Select and open me")
/// .selectable(true)
/// .selected(selected)
/// .show(ui, |ui| ui.label("Body"));
/// if response.header_response.clicked() {
/// selected = true;
/// }
/// # });
/// ```
#[deprecated = "Use the more powerful egui::collapsing_header::CollapsingState::show_header"] // Deprecated in 2022-04-28, before egui 0.18
#[inline]
pub fn selected(mut self, selected: bool) -> Self {
self.selected = selected;
self
}
/// Should the [`CollapsingHeader`] show a background behind it? Default: `false`.
///
/// To show it behind all [`CollapsingHeader`] you can just use:

View File

@ -152,12 +152,6 @@ impl Frame {
self
}
#[deprecated = "Renamed inner_margin in egui 0.18"]
#[inline]
pub fn margin(self, margin: impl Into<Margin>) -> Self {
self.inner_margin(margin)
}
#[inline]
pub fn shadow(mut self, shadow: Shadow) -> Self {
self.shadow = shadow;

View File

@ -209,15 +209,6 @@ impl<'open> Window<'open> {
self
}
#[deprecated = "Use `constrain_to` instead"]
#[inline]
pub fn drag_bounds(mut self, constrain_rect: Rect) -> Self {
#![allow(deprecated)]
self.area = self.area.drag_bounds(constrain_rect);
self
}
/// Where the "root" of the window is.
///
/// For instance, if you set this to [`Align2::RIGHT_TOP`]

View File

@ -707,16 +707,6 @@ impl Context {
})
}
/// Read-write access to [`Fonts`].
#[inline]
#[deprecated = "This function will be removed"]
pub fn fonts_mut<R>(&self, writer: impl FnOnce(Option<&mut Fonts>) -> R) -> R {
self.write(move |ctx| {
let pixels_per_point = ctx.pixels_per_point();
writer(ctx.fonts.get_mut(&pixels_per_point.into()))
})
}
/// Read-only access to [`Options`].
#[inline]
pub fn options<R>(&self, reader: impl FnOnce(&Options) -> R) -> R {

View File

@ -572,15 +572,6 @@ impl Modifiers {
command: false,
};
#[deprecated = "Use `Modifiers::ALT | Modifiers::SHIFT` instead"]
pub const ALT_SHIFT: Self = Self {
alt: true,
ctrl: false,
shift: true,
mac_cmd: false,
command: false,
};
/// The Mac ⌘ Command key
pub const MAC_CMD: Self = Self {
alt: false,

View File

@ -111,14 +111,6 @@ pub struct PlatformOutput {
}
impl PlatformOutput {
/// Open the given url in a web browser.
///
/// If egui is running in a browser, the same tab will be reused.
#[deprecated = "Use Context::open_url instead"]
pub fn open_url(&mut self, url: impl ToString) {
self.open_url = Some(OpenUrl::same_tab(url));
}
/// This can be used by a text-to-speech system to describe the events (if any).
pub fn events_description(&self) -> String {
// only describe last event:

View File

@ -37,11 +37,6 @@ impl Id {
/// though obviously it will lead to a lot of collisions if you do use it!
pub const NULL: Self = Self(0);
#[deprecated = "Use Id::NULL"]
pub fn null() -> Self {
Self(0)
}
pub(crate) const fn background() -> Self {
Self(1)
}

View File

@ -39,7 +39,7 @@ pub struct Memory {
///
/// This will be saved between different program runs if you use the `persistence` feature.
///
/// To store a state common for all your widgets (a singleton), use [`Id::null`] as the key.
/// To store a state common for all your widgets (a singleton), use [`Id::NULL`] as the key.
pub data: crate::util::IdTypeMap,
// ------------------------------------------
@ -666,21 +666,6 @@ impl Memory {
}
}
/// Set an event filter for a widget.
///
/// You must first give focus to the widget before calling this.
#[deprecated = "Use set_focus_lock_filter instead"]
pub fn lock_focus(&mut self, id: Id, lock_focus: bool) {
self.set_focus_lock_filter(
id,
EventFilter {
tab: lock_focus,
arrows: lock_focus,
escape: false,
},
);
}
/// Give keyboard focus to a specific widget.
/// See also [`crate::Response::request_focus`].
#[inline(always)]

View File

@ -83,16 +83,6 @@ impl Painter {
pub(crate) fn set_invisible(&mut self) {
self.fade_to_color = Some(Color32::TRANSPARENT);
}
#[deprecated = "Use Painter::with_clip_rect"] // Deprecated in 2022-04-18, before egui 0.18
pub fn sub_region(&self, rect: Rect) -> Self {
Self {
ctx: self.ctx.clone(),
layer_id: self.layer_id,
clip_rect: rect.intersect(self.clip_rect),
fade_to_color: self.fade_to_color,
}
}
}
/// ## Accessors etc

View File

@ -318,7 +318,7 @@ use crate::Id;
///
/// Values can either be "persisted" (serializable) or "temporary" (cleared when egui is shut down).
///
/// You can store state using the key [`Id::null`]. The state will then only be identified by its type.
/// You can store state using the key [`Id::NULL`]. The state will then only be identified by its type.
///
/// ```
/// # use egui::{Id, util::IdTypeMap};

View File

@ -193,11 +193,6 @@ impl<'t> TextEdit<'t> {
self
}
#[deprecated = "Use .font(…) instead"]
pub fn text_style(self, text_style: TextStyle) -> Self {
self.font(text_style)
}
#[inline]
pub fn text_color(mut self, text_color: Color32) -> Self {
self.text_color = Some(text_color);

View File

@ -1,6 +1,6 @@
#![allow(deprecated)]
use egui::{mutex::Mutex, TextureFilter, TextureOptions};
use egui::{mutex::Mutex, TextureOptions};
#[cfg(feature = "svg")]
pub use usvg::FitTo;
@ -123,14 +123,6 @@ impl RetainedImage {
self
}
#[deprecated = "Use with_options instead"]
pub fn with_texture_filter(self, filter: TextureFilter) -> Self {
self.with_options(TextureOptions {
magnification: filter,
minification: filter,
})
}
/// The size of the image data (number of pixels wide/high).
pub fn size(&self) -> [usize; 2] {
self.size

View File

@ -278,11 +278,6 @@ impl<'a> TableBuilder<'a> {
self
}
#[deprecated = "Renamed to vscroll"]
pub fn scroll(self, vscroll: bool) -> Self {
self.vscroll(vscroll)
}
/// Enables scrolling the table's contents using mouse drag (default: `true`).
///
/// See [`ScrollArea::drag_to_scroll`] for more.

View File

@ -624,11 +624,6 @@ impl Painter {
self.textures.get(&texture_id).copied()
}
#[deprecated = "renamed 'texture'"]
pub fn get_texture(&self, texture_id: egui::TextureId) -> Option<glow::Texture> {
self.texture(texture_id)
}
#[allow(clippy::needless_pass_by_value)] // False positive
pub fn register_native_texture(&mut self, native: glow::Texture) -> egui::TextureId {
self.assert_not_destroyed();

View File

@ -574,20 +574,6 @@ impl Polygon {
self
}
#[deprecated = "Use `fill_color`."]
#[allow(unused, clippy::needless_pass_by_value)]
#[inline]
pub fn color(mut self, color: impl Into<Color32>) -> Self {
self
}
#[deprecated = "Use `fill_color`."]
#[allow(unused, clippy::needless_pass_by_value)]
#[inline]
pub fn fill_alpha(mut self, _alpha: impl Into<f32>) -> Self {
self
}
/// Fill color. Defaults to the stroke color with added transparency.
#[inline]
pub fn fill_color(mut self, color: impl Into<Color32>) -> Self {

View File

@ -1393,24 +1393,6 @@ impl PlotUi {
&self.response
}
/// Returns `true` if the plot area is currently hovered.
#[deprecated = "Use plot_ui.response().hovered()"]
pub fn plot_hovered(&self) -> bool {
self.response.hovered()
}
/// Returns `true` if the plot was clicked by the primary button.
#[deprecated = "Use plot_ui.response().clicked()"]
pub fn plot_clicked(&self) -> bool {
self.response.clicked()
}
/// Returns `true` if the plot was clicked by the secondary button.
#[deprecated = "Use plot_ui.response().secondary_clicked()"]
pub fn plot_secondary_clicked(&self) -> bool {
self.response.secondary_clicked()
}
/// The pointer position in plot coordinates. Independent of whether the pointer is in the plot area.
pub fn pointer_coordinate(&self) -> Option<PlotPoint> {
// We need to subtract the drag delta to keep in sync with the frame-delayed screen transform:

View File

@ -407,13 +407,6 @@ impl Rect {
inside_dist + outside_dist
}
/// Linearly interpolate so that `[0, 0]` is [`Self::min`] and
/// `[1, 1]` is [`Self::max`].
#[deprecated = "Use `lerp_inside` instead"]
pub fn lerp(&self, t: Vec2) -> Pos2 {
self.lerp_inside(t)
}
/// Linearly interpolate so that `[0, 0]` is [`Self::min`] and
/// `[1, 1]` is [`Self::max`].
pub fn lerp_inside(&self, t: Vec2) -> Pos2 {

View File

@ -622,17 +622,6 @@ impl Rounding {
}
}
#[inline]
#[deprecated = "Use Rounding::ZERO"]
pub fn none() -> Self {
Self {
nw: 0.0,
ne: 0.0,
sw: 0.0,
se: 0.0,
}
}
/// Do all corners have the same rounding?
#[inline]
pub fn is_same(&self) -> bool {

View File

@ -4,7 +4,7 @@ use super::*;
/// Describes the width and color of a line.
///
/// The default stroke is the same as [`Stroke::none`].
/// The default stroke is the same as [`Stroke::NONE`].
#[derive(Clone, Copy, Debug, Default, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct Stroke {
@ -19,12 +19,6 @@ impl Stroke {
color: Color32::TRANSPARENT,
};
#[deprecated = "Use Stroke::NONE instead"]
#[inline(always)]
pub fn none() -> Self {
Self::new(0.0, Color32::TRANSPARENT)
}
#[inline]
pub fn new(width: impl Into<f32>, color: impl Into<Color32>) -> Self {
Self {