Skip to content

Commit

Permalink
Remove deprecated functions (#3692)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk authored Dec 8, 2023
1 parent b1721a3 commit 8d4de86
Show file tree
Hide file tree
Showing 20 changed files with 4 additions and 192 deletions.
7 changes: 0 additions & 7 deletions crates/egui/src/containers/area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`]
Expand Down
30 changes: 0 additions & 30 deletions crates/egui/src/containers/collapsing_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 0 additions & 6 deletions crates/egui/src/containers/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 0 additions & 9 deletions crates/egui/src/containers/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`]
Expand Down
10 changes: 0 additions & 10 deletions crates/egui/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 0 additions & 9 deletions crates/egui/src/data/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 0 additions & 8 deletions crates/egui/src/data/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 0 additions & 5 deletions crates/egui/src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
17 changes: 1 addition & 16 deletions crates/egui/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,

// ------------------------------------------
Expand Down Expand Up @@ -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)]
Expand Down
10 changes: 0 additions & 10 deletions crates/egui/src/painter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion crates/egui/src/util/id_type_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
5 changes: 0 additions & 5 deletions crates/egui/src/widgets/text_edit/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 1 addition & 9 deletions crates/egui_extras/src/image.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(deprecated)]

use egui::{mutex::Mutex, TextureFilter, TextureOptions};
use egui::{mutex::Mutex, TextureOptions};

#[cfg(feature = "svg")]
pub use usvg::FitTo;
Expand Down Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions crates/egui_extras/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 0 additions & 5 deletions crates/egui_glow/src/painter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
14 changes: 0 additions & 14 deletions crates/egui_plot/src/items/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
18 changes: 0 additions & 18 deletions crates/egui_plot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 0 additions & 7 deletions crates/emath/src/rect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 0 additions & 11 deletions crates/epaint/src/shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 1 addition & 7 deletions crates/epaint/src/stroke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit 8d4de86

Please sign in to comment.