Skip to content

Commit

Permalink
Remove all deprecated things
Browse files Browse the repository at this point in the history
  • Loading branch information
Gekkio committed Sep 18, 2019
1 parent f9db7db commit 4833811
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 223 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### Removed

- Various things that were deprecated in imgui-rs 0.2.0

## [0.2.1] - 2019-09-09

### Fixed
Expand Down
224 changes: 1 addition & 223 deletions src/legacy.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
#![allow(non_upper_case_globals)]
use bitflags::bitflags;
use std::os::raw::{c_char, c_int};

use crate::render::renderer::TextureId;
use crate::string::ImStr;
use crate::widget::color_editors::*;
use crate::widget::combo_box::*;
use crate::widget::image::{Image, ImageButton};
use crate::widget::menu::*;
use crate::widget::progress_bar::ProgressBar;
use crate::widget::selectable::*;
use crate::window::{Window, WindowFlags, WindowFocusedFlags};
use crate::{Id, Ui};

#[deprecated(since = "0.2.0", note = "use ColorEditFlags instead")]
pub type ImGuiColorEditFlags = ColorEditFlags;

#[deprecated(since = "0.2.0", note = "use ComboFlags instead")]
pub type ImGuiComboFlags = ComboBoxFlags;
use std::os::raw::c_int;

bitflags!(
/// Flags for igBeginDragDropSource(), igAcceptDragDropPayload()
Expand Down Expand Up @@ -133,9 +116,6 @@ bitflags!(
}
);

#[deprecated(since = "0.2.0", note = "use SelectableFlags instead")]
pub type ImGuiSelectableFlags = SelectableFlags;

bitflags!(
/// Flags for trees and collapsing headers
#[repr(C)]
Expand Down Expand Up @@ -173,205 +153,3 @@ bitflags!(
ImGuiTreeNodeFlags::NoAutoOpenOnLog.bits;
}
);

#[deprecated(since = "0.2.0", note = "use WindowFlags instead")]
pub type ImGuiWindowFlags = WindowFlags;

impl<'ui> Ui<'ui> {
#[deprecated(since = "0.2.0", note = "use imgui::Window::new(...) instead")]
pub fn window<'p>(&self, name: &'p ImStr) -> Window<'p> {
Window::new(name)
}
#[deprecated(since = "0.2.0", note = "use Ui::window_size instead")]
pub fn get_window_size(&self) -> [f32; 2] {
let size = unsafe { sys::igGetWindowSize_nonUDT2() };
size.into()
}
#[deprecated(since = "0.2.0", note = "use Ui::window_pos instead")]
pub fn get_window_pos(&self) -> [f32; 2] {
let size = unsafe { sys::igGetWindowPos_nonUDT2() };
size.into()
}
#[deprecated(since = "0.2.0", note = "use Ui::content_region_max instead")]
pub fn get_content_region_max(&self) -> [f32; 2] {
let size = unsafe { sys::igGetContentRegionMax_nonUDT2() };
size.into()
}
#[deprecated(since = "0.2.0", note = "use Ui::content_region_avail instead")]
pub fn get_content_region_avail(&self) -> [f32; 2] {
let size = unsafe { sys::igGetContentRegionAvail_nonUDT2() };
size.into()
}
#[deprecated(since = "0.2.0", note = "use Ui::window_content_region_min instead")]
pub fn get_window_content_region_min(&self) -> [f32; 2] {
let size = unsafe { sys::igGetWindowContentRegionMin_nonUDT2() };
size.into()
}
#[deprecated(since = "0.2.0", note = "use Ui::window_content_region_max instead")]
pub fn get_window_content_region_max(&self) -> [f32; 2] {
let size = unsafe { sys::igGetWindowContentRegionMax_nonUDT2() };
size.into()
}
#[deprecated(
since = "0.2.0",
note = "use Ui::is_window_focused(WindowFlags::RootWindow) instead"
)]
pub fn is_root_window_focused(&self) -> bool {
unsafe { sys::igIsWindowFocused(WindowFocusedFlags::ROOT_WINDOW.bits() as i32) }
}
#[deprecated(
since = "0.2.0",
note = "use Ui::is_window_focused(WindowFlags::ChildWindows) instead"
)]
pub fn is_child_window_focused(&self) -> bool {
unsafe { sys::igIsWindowFocused(WindowFocusedFlags::CHILD_WINDOWS.bits() as i32) }
}
}

impl<'ui> Ui<'ui> {
#[deprecated(since = "0.2.0", note = "use imgui::ProgressBar::new(...) instead")]
pub fn progress_bar<'p>(&self, fraction: f32) -> ProgressBar<'p> {
ProgressBar::new(fraction)
}
}

impl<'ui> Ui<'ui> {
#[deprecated(since = "0.2.0", note = "use imgui::ColorEdit::new(...) instead")]
pub fn color_edit<'p, V: Into<EditableColor<'p>>>(
&self,
label: &'p ImStr,
value: V,
) -> ColorEdit<'p> {
ColorEdit::new(label, value.into())
}
#[deprecated(since = "0.2.0", note = "use imgui::ColorPicker::new(...) instead")]
pub fn color_picker<'p, V: Into<EditableColor<'p>>>(
&self,
label: &'p ImStr,
value: V,
) -> ColorPicker<'p> {
ColorPicker::new(label, value.into())
}
#[deprecated(since = "0.2.0", note = "use imgui::ColorButton::new(...) instead")]
pub fn color_button<'p>(&self, desc_id: &'p ImStr, color: [f32; 4]) -> ColorButton<'p> {
ColorButton::new(desc_id, color.into())
}
}

impl<'ui> Ui<'ui> {
#[deprecated(since = "0.2.0", note = "use Ui::cursor_screen_pos instead")]
pub fn get_cursor_screen_pos(&self) -> [f32; 2] {
let size = unsafe { sys::igGetCursorScreenPos_nonUDT2() };
size.into()
}
#[deprecated(since = "0.2.0", note = "use Ui::cursor_pos instead")]
pub fn get_cursor_pos(&self) -> [f32; 2] {
let size = unsafe { sys::igGetCursorPos_nonUDT2() };
size.into()
}
#[deprecated(
since = "0.2.0",
note = "use Ui::text_line_height_with_spacing instead"
)]
pub fn get_text_line_height_with_spacing(&self) -> f32 {
unsafe { sys::igGetTextLineHeightWithSpacing() }
}
}

impl<'ui> Ui<'ui> {
#[deprecated(since = "0.2.0", note = "use Ui::current_column_index instead")]
pub fn get_column_index(&self) -> i32 {
unsafe { sys::igGetColumnIndex() }
}
#[deprecated(since = "0.2.0", note = "use Ui::column_offset instead")]
pub fn get_column_offset(&self, column_index: i32) -> f32 {
unsafe { sys::igGetColumnOffset(column_index) }
}
#[deprecated(since = "0.2.0", note = "use Ui::column_width instead")]
pub fn get_column_width(&self, column_index: i32) -> f32 {
unsafe { sys::igGetColumnWidth(column_index) }
}
#[deprecated(since = "0.2.0", note = "use Ui::column_count instead")]
pub fn get_columns_count(&self) -> i32 {
unsafe { sys::igGetColumnsCount() }
}
}

impl<'ui> Ui<'ui> {
#[deprecated(since = "0.2.0", note = "use Ui::push_id instead")]
pub fn with_id<'a, F, I>(&self, id: I, f: F)
where
F: FnOnce(),
I: Into<Id<'a>>,
{
let _token = self.push_id(id);
f();
}
}

impl<'ui> Ui<'ui> {
#[deprecated(since = "0.2.0", note = "use Ui::item_rect_size instead")]
pub fn get_item_rect_size(&self) -> [f32; 2] {
let size = unsafe { sys::igGetItemRectSize_nonUDT2() };
size.into()
}
}

impl<'ui> Ui<'ui> {
#[deprecated(since = "0.2.0", note = "use imgui::Image::new(...) instead")]
pub fn image(&self, texture: TextureId, size: [f32; 2]) -> Image {
Image::new(texture, size)
}
#[deprecated(since = "0.2.0", note = "use imgui::ImageButton::new(...) instead")]
pub fn image_button(&self, texture: TextureId, size: [f32; 2]) -> ImageButton {
ImageButton::new(texture, size)
}
}

impl<'ui> Ui<'ui> {
#[deprecated(
since = "0.2.0",
note = "use imgui::ComboBox::new(...), and either build_simple(), build_simple_string(), or custom rendering (e.g. selectables) instead"
)]
pub fn combo<'p, StringType: AsRef<ImStr> + ?Sized>(
&self,
label: &'p ImStr,
current_item: &mut i32,
items: &'p [&'p StringType],
height_in_items: i32,
) -> bool {
let items_inner: Vec<*const c_char> = items
.into_iter()
.map(|item| item.as_ref().as_ptr())
.collect();
unsafe {
sys::igCombo(
label.as_ptr(),
current_item,
items_inner.as_ptr() as *mut *const c_char,
items_inner.len() as i32,
height_in_items,
)
}
}
}

impl<'ui> Ui<'ui> {
#[deprecated(since = "0.2.0", note = "use imgui::Selectable::new(...) instead")]
pub fn selectable(
&self,
label: &ImStr,
selected: bool,
flags: SelectableFlags,
size: [f32; 2],
) -> bool {
unsafe { sys::igSelectable(label.as_ptr(), selected, flags.bits() as i32, size.into()) }
}
}

impl<'ui> Ui<'ui> {
#[deprecated(since = "0.2.0", note = "use imgui::MenuItem::new(...) instead")]
pub fn menu_item<'a>(&self, label: &'a ImStr) -> MenuItem<'a> {
MenuItem::new(label)
}
}

0 comments on commit 4833811

Please sign in to comment.