mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-11 21:48:36 +00:00
Drop more legacy structs
This commit is contained in:
parent
7a80b1b3e6
commit
2c7ac89564
@ -42,8 +42,9 @@ pub use bindings::{
|
||||
ImGuiInputTextCallbackData, ImGuiInputTextCallbackData_DeleteChars,
|
||||
ImGuiInputTextCallbackData_HasSelection, ImGuiInputTextCallbackData_ImGuiInputTextCallbackData,
|
||||
ImGuiInputTextCallbackData_InsertChars, ImGuiInputTextCallbackData_destroy, ImGuiListClipper,
|
||||
ImGuiSizeCallback, ImGuiStorage, ImTextureID, ImU32, ImVec2, ImVec2_Simple, ImVec4,
|
||||
ImVec4_Simple, ImVector_ImFontPtr, ImVector_ImWchar, ImVector_char, ImWchar,
|
||||
ImGuiPayload, ImGuiSizeCallback, ImGuiStorage, ImGuiTextBuffer, ImGuiTextFilter, ImTextureID,
|
||||
ImU32, ImVec2, ImVec2_Simple, ImVec4, ImVec4_Simple, ImVector_ImFontPtr, ImVector_ImWchar,
|
||||
ImVector_char, ImWchar,
|
||||
};
|
||||
pub use legacy::*;
|
||||
|
||||
|
||||
@ -1,39 +1,7 @@
|
||||
use std::os::raw::{c_char, c_float, c_int, c_void};
|
||||
use std::slice;
|
||||
use std::os::raw::c_float;
|
||||
|
||||
use crate::enums::{ImGuiCol, ImGuiDir};
|
||||
use crate::{ImGuiID, ImGuiStorage, ImVec2, ImVec4};
|
||||
|
||||
/// Data payload for Drag and Drop operations
|
||||
#[repr(C)]
|
||||
pub struct ImGuiPayload {
|
||||
/// Data (copied and owned by dear imgui)
|
||||
pub data: *const c_void,
|
||||
/// Data size
|
||||
pub data_size: c_int,
|
||||
|
||||
/// Source item id
|
||||
source_id: ImGuiID,
|
||||
/// Source parent id (if available)
|
||||
source_parent_id: ImGuiID,
|
||||
/// Data timestamp
|
||||
data_frame_count: c_int,
|
||||
/// Data type tag (short user-supplied string)
|
||||
data_type: [c_char; 32 + 1],
|
||||
/// Set when AcceptDragDropPayload() was called and mouse has been hovering the target item (nb: handle overlapping drag targets)
|
||||
preview: bool,
|
||||
/// Set when AcceptDragDropPayload() was called and mouse button is released over the target item.
|
||||
delivery: bool,
|
||||
}
|
||||
|
||||
/// Callback data for size constraint callback
|
||||
#[repr(C)]
|
||||
pub struct ImGuiSizeCallbackData {
|
||||
pub user_data: *mut c_void,
|
||||
pub pos: ImVec2,
|
||||
pub current_size: ImVec2,
|
||||
pub desired_size: ImVec2,
|
||||
}
|
||||
use crate::{ImVec2, ImVec4};
|
||||
|
||||
/// Runtime data for styling/colors
|
||||
#[repr(C)]
|
||||
@ -122,141 +90,7 @@ pub struct ImGuiStyle {
|
||||
pub colors: [ImVec4; ImGuiCol::COUNT],
|
||||
}
|
||||
|
||||
/// Text buffer for logging/accumulating text
|
||||
#[repr(C)]
|
||||
pub struct ImGuiTextBuffer {
|
||||
pub buf: ImVector<c_char>,
|
||||
}
|
||||
|
||||
/// Parse and apply text filters
|
||||
#[repr(C)]
|
||||
pub struct ImGuiTextFilter {
|
||||
pub input_buf: [c_char; 256],
|
||||
pub filters: ImVector<TextRange>,
|
||||
pub count_grep: c_int,
|
||||
}
|
||||
|
||||
/// Lightweight vector struct
|
||||
#[repr(C)]
|
||||
pub struct ImVector<T> {
|
||||
pub size: c_int,
|
||||
pub capacity: c_int,
|
||||
pub data: *mut T,
|
||||
}
|
||||
|
||||
impl<T> ImVector<T> {
|
||||
pub unsafe fn as_slice(&self) -> &[T] {
|
||||
slice::from_raw_parts(self.data, self.size as usize)
|
||||
}
|
||||
}
|
||||
|
||||
/// ImGuiStorage key->value pair
|
||||
#[repr(C)]
|
||||
pub struct Pair {
|
||||
pub key: ImGuiID,
|
||||
pub value: PairValue,
|
||||
}
|
||||
|
||||
/// ImGuiStorage value union
|
||||
#[repr(C)]
|
||||
pub union PairValue {
|
||||
pub val_i: c_int,
|
||||
pub val_f: c_float,
|
||||
pub val_p: *mut c_void,
|
||||
}
|
||||
|
||||
/// ImGuiTextFilter text range
|
||||
#[repr(C)]
|
||||
pub struct TextRange {
|
||||
pub begin: *const c_char,
|
||||
pub end: *const c_char,
|
||||
}
|
||||
|
||||
// ImGuiStyle
|
||||
extern "C" {
|
||||
pub fn ImGuiStyle_ScaleAllSizes(this: *mut ImGuiStyle, scale_factor: c_float);
|
||||
}
|
||||
|
||||
// ImGuiTextFilter
|
||||
extern "C" {
|
||||
pub fn ImGuiTextFilter_Draw(
|
||||
this: *mut ImGuiTextFilter,
|
||||
label: *const c_char,
|
||||
width: c_float,
|
||||
) -> bool;
|
||||
pub fn ImGuiTextFilter_PassFilter(
|
||||
this: *mut ImGuiTextFilter,
|
||||
text: *const c_char,
|
||||
text_end: *const c_char,
|
||||
) -> bool;
|
||||
pub fn ImGuiTextFilter_Build(this: *mut ImGuiTextFilter);
|
||||
pub fn ImGuiTextFilter_Clear(this: *mut ImGuiTextFilter);
|
||||
pub fn ImGuiTextFilter_IsActive(this: *mut ImGuiTextFilter) -> bool;
|
||||
}
|
||||
|
||||
// TextRange
|
||||
extern "C" {
|
||||
pub fn TextRange_begin(this: *mut TextRange) -> *const c_char;
|
||||
pub fn TextRange_end(this: *mut TextRange) -> *const c_char;
|
||||
pub fn TextRange_empty(this: *mut TextRange) -> bool;
|
||||
pub fn TextRange_split(this: *mut TextRange, separator: c_char, out: *mut ImVector<TextRange>);
|
||||
}
|
||||
|
||||
// ImGuiTextBuffer
|
||||
extern "C" {
|
||||
pub fn ImGuiTextBuffer_begin(this: *mut ImGuiTextBuffer) -> *const c_char;
|
||||
pub fn ImGuiTextBuffer_end(this: *mut ImGuiTextBuffer) -> *const c_char;
|
||||
pub fn ImGuiTextBuffer_size(this: *mut ImGuiTextBuffer) -> c_int;
|
||||
pub fn ImGuiTextBuffer_empty(this: *mut ImGuiTextBuffer) -> bool;
|
||||
pub fn ImGuiTextBuffer_clear(this: *mut ImGuiTextBuffer);
|
||||
pub fn ImGuiTextBuffer_reserve(this: *mut ImGuiTextBuffer, capacity: c_int);
|
||||
pub fn ImGuiTextBuffer_c_str(this: *mut ImGuiTextBuffer) -> *const c_char;
|
||||
pub fn ImGuiTextBuffer_appendf(this: *mut ImGuiTextBuffer, fmt: *const c_char, ...);
|
||||
}
|
||||
|
||||
// ImGuiStorage
|
||||
extern "C" {
|
||||
pub fn ImGuiStorage_Clear(this: *mut ImGuiStorage);
|
||||
pub fn ImGuiStorage_GetInt(this: *mut ImGuiStorage, key: ImGuiID, default_val: c_int) -> c_int;
|
||||
pub fn ImGuiStorage_SetInt(this: *mut ImGuiStorage, key: ImGuiID, val: c_int);
|
||||
pub fn ImGuiStorage_GetBool(this: *mut ImGuiStorage, key: ImGuiID, default_val: bool) -> bool;
|
||||
pub fn ImGuiStorage_SetBool(this: *mut ImGuiStorage, key: ImGuiID, val: bool);
|
||||
pub fn ImGuiStorage_GetFloat(
|
||||
this: *mut ImGuiStorage,
|
||||
key: ImGuiID,
|
||||
default_val: c_float,
|
||||
) -> c_float;
|
||||
pub fn ImGuiStorage_SetFloat(this: *mut ImGuiStorage, key: ImGuiID, val: c_float);
|
||||
pub fn ImGuiStorage_GetVoidPtr(this: *mut ImGuiStorage, key: ImGuiID);
|
||||
pub fn ImGuiStorage_SetVoidPtr(this: *mut ImGuiStorage, key: ImGuiID, val: *mut c_void);
|
||||
pub fn ImGuiStorage_GetIntRef(
|
||||
this: *mut ImGuiStorage,
|
||||
key: ImGuiID,
|
||||
default_val: c_int,
|
||||
) -> *mut c_int;
|
||||
pub fn ImGuiStorage_GetBoolRef(
|
||||
this: *mut ImGuiStorage,
|
||||
key: ImGuiID,
|
||||
default_val: bool,
|
||||
) -> *mut bool;
|
||||
pub fn ImGuiStorage_GetFloatRef(
|
||||
this: *mut ImGuiStorage,
|
||||
key: ImGuiID,
|
||||
default_val: c_float,
|
||||
) -> *mut c_float;
|
||||
pub fn ImGuiStorage_GetVoidPtrRef(
|
||||
this: *mut ImGuiStorage,
|
||||
key: ImGuiID,
|
||||
default_val: *mut c_void,
|
||||
) -> *mut *mut c_void;
|
||||
pub fn ImGuiStorage_SetAllInt(this: *mut ImGuiStorage, val: c_int);
|
||||
pub fn ImGuiStorage_BuildSortByKey(this: *mut ImGuiStorage);
|
||||
}
|
||||
|
||||
// ImGuiPayload
|
||||
extern "C" {
|
||||
pub fn ImGuiPayload_Clear(this: *mut ImGuiPayload);
|
||||
pub fn ImGuiPayload_IsDataType(this: *mut ImGuiPayload, type_: *const c_char) -> bool;
|
||||
pub fn ImGuiPayload_IsPreview(this: *mut ImGuiPayload) -> bool;
|
||||
pub fn ImGuiPayload_IsDelivery(this: *mut ImGuiPayload) -> bool;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user