mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-27 13:28:28 +00:00
Purge imgui-sys fully of legacy manual bindings
This commit is contained in:
parent
721bf46746
commit
c37bd8b1f9
2
imgui-examples/Cargo.lock
generated
2
imgui-examples/Cargo.lock
generated
@ -388,10 +388,8 @@ dependencies = [
|
|||||||
name = "imgui-sys"
|
name = "imgui-sys"
|
||||||
version = "0.0.24-pre"
|
version = "0.0.24-pre"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gfx 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gfx 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
2
imgui-glium-examples/Cargo.lock
generated
2
imgui-glium-examples/Cargo.lock
generated
@ -401,10 +401,8 @@ dependencies = [
|
|||||||
name = "imgui-sys"
|
name = "imgui-sys"
|
||||||
version = "0.0.24-pre"
|
version = "0.0.24-pre"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"glium 0.25.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"glium 0.25.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@ -14,10 +14,8 @@ build = "build.rs"
|
|||||||
travis-ci = { repository = "Gekkio/imgui-rs" }
|
travis-ci = { repository = "Gekkio/imgui-rs" }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bitflags = "1.0"
|
|
||||||
glium = { version = "0.25", default-features = false, optional = true }
|
glium = { version = "0.25", default-features = false, optional = true }
|
||||||
gfx = { version = "0.18", optional = true }
|
gfx = { version = "0.18", optional = true }
|
||||||
libc = "0.2"
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
cc = "1.0"
|
cc = "1.0"
|
||||||
|
|||||||
@ -1,28 +0,0 @@
|
|||||||
/// A primary data type
|
|
||||||
#[repr(C)]
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
|
||||||
pub enum ImGuiDataType {
|
|
||||||
/// `i32` (C data type `int`)
|
|
||||||
S32,
|
|
||||||
/// `u32` (C data type `unsigned int`)
|
|
||||||
U32,
|
|
||||||
/// `i64` (C data type `long long`, `__int64`)
|
|
||||||
S64,
|
|
||||||
/// `u64` (C data type `unsigned long long`, `unsigned __int64`)
|
|
||||||
U64,
|
|
||||||
/// `f32` (C data type `float`)
|
|
||||||
Float,
|
|
||||||
/// `f64` (C data type `double`)
|
|
||||||
Double,
|
|
||||||
}
|
|
||||||
impl ImGuiDataType {
|
|
||||||
/// All possible `ImGuiDataType` variants
|
|
||||||
pub const VARIANTS: [ImGuiDataType; 6] = [
|
|
||||||
ImGuiDataType::S32,
|
|
||||||
ImGuiDataType::U32,
|
|
||||||
ImGuiDataType::S64,
|
|
||||||
ImGuiDataType::U64,
|
|
||||||
ImGuiDataType::Float,
|
|
||||||
ImGuiDataType::Double,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@ -1,981 +0,0 @@
|
|||||||
#![allow(non_upper_case_globals)]
|
|
||||||
|
|
||||||
use crate::*;
|
|
||||||
use libc::size_t;
|
|
||||||
use std::os::raw::{c_char, c_double, c_float, c_int, c_uint, c_void};
|
|
||||||
|
|
||||||
// Context creation and access
|
|
||||||
extern "C" {
|
|
||||||
pub fn igCreateContext(shared_font_atlas: *mut ImFontAtlas) -> *mut ImGuiContext;
|
|
||||||
pub fn igDestroyContext(ctx: *mut ImGuiContext);
|
|
||||||
pub fn igGetCurrentContext() -> *mut ImGuiContext;
|
|
||||||
pub fn igSetCurrentContext(ctx: *mut ImGuiContext);
|
|
||||||
pub fn igDebugCheckVersionAndDataLayout(
|
|
||||||
version_str: *const c_char,
|
|
||||||
sz_io: size_t,
|
|
||||||
sz_style: size_t,
|
|
||||||
sz_vec2: size_t,
|
|
||||||
sz_vec4: size_t,
|
|
||||||
sz_drawvert: size_t,
|
|
||||||
) -> bool;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Main
|
|
||||||
extern "C" {
|
|
||||||
pub fn igGetStyle() -> *mut ImGuiStyle;
|
|
||||||
pub fn igNewFrame();
|
|
||||||
pub fn igEndFrame();
|
|
||||||
pub fn igRender();
|
|
||||||
pub fn igGetDrawData() -> *mut ImDrawData;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Demo, Debug, Information
|
|
||||||
extern "C" {
|
|
||||||
pub fn igShowAboutWindow(opened: *mut bool);
|
|
||||||
pub fn igShowDemoWindow(opened: *mut bool);
|
|
||||||
pub fn igShowMetricsWindow(opened: *mut bool);
|
|
||||||
pub fn igShowStyleEditor(style: *mut ImGuiStyle);
|
|
||||||
pub fn igShowStyleSelector(label: *const c_char) -> bool;
|
|
||||||
pub fn igShowFontSelector(label: *const c_char);
|
|
||||||
pub fn igShowUserGuide();
|
|
||||||
pub fn igGetVersion() -> *const c_char;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Styles
|
|
||||||
extern "C" {
|
|
||||||
pub fn igStyleColorsDark(dst: *mut ImGuiStyle);
|
|
||||||
pub fn igStyleColorsClassic(dst: *mut ImGuiStyle);
|
|
||||||
pub fn igStyleColorsLight(dst: *mut ImGuiStyle);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Windows
|
|
||||||
extern "C" {
|
|
||||||
pub fn igBegin(name: *const c_char, open: *mut bool, flags: ImGuiWindowFlags) -> bool;
|
|
||||||
pub fn igEnd();
|
|
||||||
pub fn igBeginChild(
|
|
||||||
str_id: *const c_char,
|
|
||||||
size: ImVec2,
|
|
||||||
border: bool,
|
|
||||||
flags: ImGuiWindowFlags,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igBeginChildID(id: ImGuiID, size: ImVec2, border: bool, flags: ImGuiWindowFlags)
|
|
||||||
-> bool;
|
|
||||||
pub fn igEndChild();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Windows Utilities
|
|
||||||
extern "C" {
|
|
||||||
pub fn igIsWindowAppearing() -> bool;
|
|
||||||
pub fn igIsWindowCollapsed() -> bool;
|
|
||||||
pub fn igIsWindowFocused(flags: ImGuiFocusedFlags) -> bool;
|
|
||||||
pub fn igIsWindowHovered(flags: ImGuiHoveredFlags) -> bool;
|
|
||||||
pub fn igGetWindowDrawList() -> *mut ImDrawList;
|
|
||||||
pub fn igGetWindowPos_nonUDT2() -> ImVec2;
|
|
||||||
pub fn igGetWindowSize_nonUDT2() -> ImVec2;
|
|
||||||
pub fn igGetWindowWidth() -> c_float;
|
|
||||||
pub fn igGetWindowHeight() -> c_float;
|
|
||||||
pub fn igGetContentRegionMax_nonUDT2() -> ImVec2;
|
|
||||||
pub fn igGetContentRegionAvail_nonUDT2() -> ImVec2;
|
|
||||||
pub fn igGetContentRegionAvailWidth() -> c_float;
|
|
||||||
pub fn igGetWindowContentRegionMin_nonUDT2() -> ImVec2;
|
|
||||||
pub fn igGetWindowContentRegionMax_nonUDT2() -> ImVec2;
|
|
||||||
pub fn igGetWindowContentRegionWidth() -> c_float;
|
|
||||||
|
|
||||||
pub fn igSetNextWindowPos(pos: ImVec2, cond: ImGuiCond, pivot: ImVec2);
|
|
||||||
pub fn igSetNextWindowSize(size: ImVec2, cond: ImGuiCond);
|
|
||||||
pub fn igSetNextWindowSizeConstraints(
|
|
||||||
size_min: ImVec2,
|
|
||||||
size_max: ImVec2,
|
|
||||||
custom_callback: ImGuiSizeCallback,
|
|
||||||
custom_callback_data: *mut c_void,
|
|
||||||
);
|
|
||||||
pub fn igSetNextWindowContentSize(size: ImVec2);
|
|
||||||
pub fn igSetNextWindowCollapsed(collapsed: bool, cond: ImGuiCond);
|
|
||||||
pub fn igSetNextWindowFocus();
|
|
||||||
pub fn igSetNextWindowBgAlpha(alpha: c_float);
|
|
||||||
pub fn igSetWindowPosVec2(pos: ImVec2, cond: ImGuiCond);
|
|
||||||
pub fn igSetWindowSizeVec2(size: ImVec2, cond: ImGuiCond);
|
|
||||||
pub fn igSetWindowCollapsedBool(collapsed: bool, cond: ImGuiCond);
|
|
||||||
pub fn igSetWindowFocus();
|
|
||||||
pub fn igSetWindowFontScale(scale: c_float);
|
|
||||||
pub fn igSetWindowPosStr(name: *const c_char, pos: ImVec2, cond: ImGuiCond);
|
|
||||||
pub fn igSetWindowSizeStr(name: *const c_char, size: ImVec2, cond: ImGuiCond);
|
|
||||||
pub fn igSetWindowCollapsedStr(name: *const c_char, collapsed: bool, cond: ImGuiCond);
|
|
||||||
pub fn igSetWindowFocusStr(name: *const c_char);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Windows scrolling
|
|
||||||
extern "C" {
|
|
||||||
pub fn igGetScrollX() -> c_float;
|
|
||||||
pub fn igGetScrollY() -> c_float;
|
|
||||||
pub fn igGetScrollMaxX() -> c_float;
|
|
||||||
pub fn igGetScrollMaxY() -> c_float;
|
|
||||||
pub fn igSetScrollX(scroll_x: c_float);
|
|
||||||
pub fn igSetScrollY(scroll_y: c_float);
|
|
||||||
pub fn igSetScrollHereY(center_y_ratio: c_float);
|
|
||||||
pub fn igSetScrollFromPosY(pos_y: c_float, center_y_ratio: c_float);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parameter stacks (shared)
|
|
||||||
extern "C" {
|
|
||||||
pub fn igPushFont(font: *mut ImFont);
|
|
||||||
pub fn igPopFont();
|
|
||||||
pub fn igPushStyleColorU32(idx: ImGuiCol, col: ImU32);
|
|
||||||
pub fn igPushStyleColor(idx: ImGuiCol, col: ImVec4);
|
|
||||||
pub fn igPopStyleColor(count: c_int);
|
|
||||||
pub fn igPopStyleVar(count: c_int);
|
|
||||||
pub fn igGetStyleColorVec4(idx: ImGuiCol) -> *const ImVec4;
|
|
||||||
pub fn igGetFont() -> *mut ImFont;
|
|
||||||
pub fn igGetFontSize() -> c_float;
|
|
||||||
pub fn igGetFontTexUvWhitePixel_nonUDT2() -> ImVec2;
|
|
||||||
pub fn igGetColorU32(idx: ImGuiCol, alpha_mul: c_float) -> ImU32;
|
|
||||||
pub fn igGetColorU32Vec(col: ImVec4) -> ImU32;
|
|
||||||
pub fn igGetColorU32U32(col: ImU32) -> ImU32;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parameter stack (current window)
|
|
||||||
extern "C" {
|
|
||||||
pub fn igPushItemWidth(item_width: c_float);
|
|
||||||
pub fn igPopItemWidth();
|
|
||||||
pub fn igCalcItemWidth() -> c_float;
|
|
||||||
pub fn igPushTextWrapPos(wrap_pos_x: c_float);
|
|
||||||
pub fn igPopTextWrapPos();
|
|
||||||
pub fn igPushAllowKeyboardFocus(allow_keyboard_focus: bool);
|
|
||||||
pub fn igPopAllowKeyboardFocus();
|
|
||||||
pub fn igPushButtonRepeat(repeat: bool);
|
|
||||||
pub fn igPopButtonRepeat();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cursor / Layout
|
|
||||||
extern "C" {
|
|
||||||
pub fn igSeparator();
|
|
||||||
pub fn igSameLine(pos_x: c_float, spacing_w: c_float);
|
|
||||||
pub fn igNewLine();
|
|
||||||
pub fn igSpacing();
|
|
||||||
pub fn igDummy(size: ImVec2);
|
|
||||||
pub fn igIndent(indent_w: c_float);
|
|
||||||
pub fn igUnindent(indent_w: c_float);
|
|
||||||
pub fn igBeginGroup();
|
|
||||||
pub fn igEndGroup();
|
|
||||||
pub fn igGetCursorPos_nonUDT2() -> ImVec2;
|
|
||||||
pub fn igGetCursorPosX() -> c_float;
|
|
||||||
pub fn igGetCursorPosY() -> c_float;
|
|
||||||
pub fn igSetCursorPos(local_pos: ImVec2);
|
|
||||||
pub fn igSetCursorPosX(x: c_float);
|
|
||||||
pub fn igSetCursorPosY(y: c_float);
|
|
||||||
pub fn igGetCursorStartPos_nonUDT2() -> ImVec2;
|
|
||||||
pub fn igGetCursorScreenPos_nonUDT2() -> ImVec2;
|
|
||||||
pub fn igSetCursorScreenPos(screen_pos: ImVec2);
|
|
||||||
pub fn igAlignTextToFramePadding();
|
|
||||||
pub fn igGetTextLineHeight() -> c_float;
|
|
||||||
pub fn igGetTextLineHeightWithSpacing() -> c_float;
|
|
||||||
pub fn igGetFrameHeight() -> c_float;
|
|
||||||
pub fn igGetFrameHeightWithSpacing() -> c_float;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ID stack/scopes
|
|
||||||
extern "C" {
|
|
||||||
pub fn igPushIDStr(str_id: *const c_char);
|
|
||||||
pub fn igPushIDRange(str_id_begin: *const c_char, str_id_end: *const c_char);
|
|
||||||
pub fn igPushIDPtr(ptr_id: *const c_void);
|
|
||||||
pub fn igPushIDInt(int_id: c_int);
|
|
||||||
pub fn igPopID();
|
|
||||||
pub fn igGetIDStr(str_id: *const c_char) -> ImGuiID;
|
|
||||||
pub fn igGetIDStrStr(str_id_begin: *const c_char, str_id_end: *const c_char) -> ImGuiID;
|
|
||||||
pub fn igGetIDPtr(ptr_id: *const c_void) -> ImGuiID;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Widgets: Text
|
|
||||||
extern "C" {
|
|
||||||
pub fn igTextUnformatted(text: *const c_char, text_end: *const c_char);
|
|
||||||
pub fn igText(fmt: *const c_char, ...);
|
|
||||||
pub fn igTextColored(col: ImVec4, fmt: *const c_char, ...);
|
|
||||||
pub fn igTextDisabled(fmt: *const c_char, ...);
|
|
||||||
pub fn igTextWrapped(fmt: *const c_char, ...);
|
|
||||||
pub fn igLabelText(label: *const c_char, fmt: *const c_char, ...);
|
|
||||||
pub fn igBulletText(fmt: *const c_char, ...);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Widgets: Main
|
|
||||||
extern "C" {
|
|
||||||
pub fn igButton(label: *const c_char, size: ImVec2) -> bool;
|
|
||||||
pub fn igSmallButton(label: *const c_char) -> bool;
|
|
||||||
pub fn igInvisibleButton(str_id: *const c_char, size: ImVec2) -> bool;
|
|
||||||
pub fn igArrowButton(str_id: *const c_char, dir: ImGuiDir) -> bool;
|
|
||||||
pub fn igImage(
|
|
||||||
user_texture_id: ImTextureID,
|
|
||||||
size: ImVec2,
|
|
||||||
uv0: ImVec2,
|
|
||||||
uv1: ImVec2,
|
|
||||||
tint_col: ImVec4,
|
|
||||||
border_col: ImVec4,
|
|
||||||
);
|
|
||||||
pub fn igImageButton(
|
|
||||||
user_texture_id: ImTextureID,
|
|
||||||
size: ImVec2,
|
|
||||||
uv0: ImVec2,
|
|
||||||
uv1: ImVec2,
|
|
||||||
frame_padding: c_int,
|
|
||||||
bg_col: ImVec4,
|
|
||||||
tint_col: ImVec4,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igCheckbox(label: *const c_char, v: *mut bool) -> bool;
|
|
||||||
pub fn igCheckboxFlags(label: *const c_char, flags: *mut c_uint, flags_value: c_uint) -> bool;
|
|
||||||
pub fn igRadioButtonBool(label: *const c_char, active: bool) -> bool;
|
|
||||||
pub fn igRadioButtonIntPtr(label: *const c_char, v: *mut c_int, v_button: c_int) -> bool;
|
|
||||||
pub fn igProgressBar(fraction: c_float, size_arg: ImVec2, overlay: *const c_char);
|
|
||||||
pub fn igBullet();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Widgets: Combo Box
|
|
||||||
extern "C" {
|
|
||||||
pub fn igBeginCombo(
|
|
||||||
label: *const c_char,
|
|
||||||
preview_value: *const c_char,
|
|
||||||
flags: ImGuiComboFlags,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igEndCombo();
|
|
||||||
pub fn igCombo(
|
|
||||||
label: *const c_char,
|
|
||||||
current_item: *mut c_int,
|
|
||||||
items: *const *const c_char,
|
|
||||||
items_count: c_int,
|
|
||||||
popup_max_height_in_items: c_int,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igComboStr(
|
|
||||||
label: *const c_char,
|
|
||||||
current_item: *mut c_int,
|
|
||||||
items_separated_by_zeros: *const c_char,
|
|
||||||
popup_max_height_in_items: c_int,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igComboFnPtr(
|
|
||||||
label: *const c_char,
|
|
||||||
current_item: *mut c_int,
|
|
||||||
items_getter: extern "C" fn(
|
|
||||||
data: *mut c_void,
|
|
||||||
idx: c_int,
|
|
||||||
out_text: *mut *const c_char,
|
|
||||||
) -> bool,
|
|
||||||
data: *mut c_void,
|
|
||||||
items_count: c_int,
|
|
||||||
popup_max_height_in_items: c_int,
|
|
||||||
) -> bool;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Widgets: Drags
|
|
||||||
extern "C" {
|
|
||||||
pub fn igDragFloat(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_float,
|
|
||||||
v_speed: c_float,
|
|
||||||
v_min: c_float,
|
|
||||||
v_max: c_float,
|
|
||||||
format: *const c_char,
|
|
||||||
power: c_float,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igDragFloat2(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_float,
|
|
||||||
v_speed: c_float,
|
|
||||||
v_min: c_float,
|
|
||||||
v_max: c_float,
|
|
||||||
format: *const c_char,
|
|
||||||
power: c_float,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igDragFloat3(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_float,
|
|
||||||
v_speed: c_float,
|
|
||||||
v_min: c_float,
|
|
||||||
v_max: c_float,
|
|
||||||
format: *const c_char,
|
|
||||||
power: c_float,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igDragFloat4(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_float,
|
|
||||||
v_speed: c_float,
|
|
||||||
v_min: c_float,
|
|
||||||
v_max: c_float,
|
|
||||||
format: *const c_char,
|
|
||||||
power: c_float,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igDragFloatRange2(
|
|
||||||
label: *const c_char,
|
|
||||||
v_current_min: *mut c_float,
|
|
||||||
v_current_max: *mut c_float,
|
|
||||||
v_speed: c_float,
|
|
||||||
v_min: c_float,
|
|
||||||
v_max: c_float,
|
|
||||||
format: *const c_char,
|
|
||||||
format_max: *const c_char,
|
|
||||||
power: c_float,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igDragInt(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_int,
|
|
||||||
v_speed: c_float,
|
|
||||||
v_min: c_int,
|
|
||||||
v_max: c_int,
|
|
||||||
format: *const c_char,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igDragInt2(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_int,
|
|
||||||
v_speed: c_float,
|
|
||||||
v_min: c_int,
|
|
||||||
v_max: c_int,
|
|
||||||
format: *const c_char,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igDragInt3(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_int,
|
|
||||||
v_speed: c_float,
|
|
||||||
v_min: c_int,
|
|
||||||
v_max: c_int,
|
|
||||||
format: *const c_char,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igDragInt4(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_int,
|
|
||||||
v_speed: c_float,
|
|
||||||
v_min: c_int,
|
|
||||||
v_max: c_int,
|
|
||||||
format: *const c_char,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igDragIntRange2(
|
|
||||||
label: *const c_char,
|
|
||||||
v_current_min: *mut c_int,
|
|
||||||
v_current_max: *mut c_int,
|
|
||||||
v_speed: c_float,
|
|
||||||
v_min: c_int,
|
|
||||||
v_max: c_int,
|
|
||||||
format: *const c_char,
|
|
||||||
format_max: *const c_char,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igDragScalar(
|
|
||||||
label: *const c_char,
|
|
||||||
data_type: ImGuiDataType,
|
|
||||||
v: *mut c_void,
|
|
||||||
v_speed: c_float,
|
|
||||||
v_min: *const c_void,
|
|
||||||
v_max: *const c_void,
|
|
||||||
format: *const c_char,
|
|
||||||
power: c_float,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igDragScalarN(
|
|
||||||
label: *const c_char,
|
|
||||||
data_type: ImGuiDataType,
|
|
||||||
v: *mut c_void,
|
|
||||||
components: c_int,
|
|
||||||
v_speed: c_float,
|
|
||||||
v_min: *const c_void,
|
|
||||||
v_max: *const c_void,
|
|
||||||
format: *const c_char,
|
|
||||||
power: c_float,
|
|
||||||
) -> bool;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Widgets: Sliders
|
|
||||||
extern "C" {
|
|
||||||
pub fn igSliderFloat(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_float,
|
|
||||||
v_min: c_float,
|
|
||||||
v_max: c_float,
|
|
||||||
format: *const c_char,
|
|
||||||
power: c_float,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igSliderFloat2(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_float,
|
|
||||||
v_min: c_float,
|
|
||||||
v_max: c_float,
|
|
||||||
format: *const c_char,
|
|
||||||
power: c_float,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igSliderFloat3(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_float,
|
|
||||||
v_min: c_float,
|
|
||||||
v_max: c_float,
|
|
||||||
format: *const c_char,
|
|
||||||
power: c_float,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igSliderFloat4(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_float,
|
|
||||||
v_min: c_float,
|
|
||||||
v_max: c_float,
|
|
||||||
format: *const c_char,
|
|
||||||
power: c_float,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igSliderAngle(
|
|
||||||
label: *const c_char,
|
|
||||||
v_rad: *mut c_float,
|
|
||||||
v_degrees_min: c_float,
|
|
||||||
v_degrees_max: c_float,
|
|
||||||
format: *const c_char,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igSliderInt(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_int,
|
|
||||||
v_min: c_int,
|
|
||||||
v_max: c_int,
|
|
||||||
format: *const c_char,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igSliderInt2(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_int,
|
|
||||||
v_min: c_int,
|
|
||||||
v_max: c_int,
|
|
||||||
format: *const c_char,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igSliderInt3(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_int,
|
|
||||||
v_min: c_int,
|
|
||||||
v_max: c_int,
|
|
||||||
format: *const c_char,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igSliderInt4(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_int,
|
|
||||||
v_min: c_int,
|
|
||||||
v_max: c_int,
|
|
||||||
format: *const c_char,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igSliderScalar(
|
|
||||||
label: *const c_char,
|
|
||||||
data_type: ImGuiDataType,
|
|
||||||
v: *mut c_void,
|
|
||||||
v_min: *const c_void,
|
|
||||||
v_max: *const c_void,
|
|
||||||
format: *const c_char,
|
|
||||||
power: c_float,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igSliderScalarN(
|
|
||||||
label: *const c_char,
|
|
||||||
data_type: ImGuiDataType,
|
|
||||||
v: *mut c_void,
|
|
||||||
components: c_int,
|
|
||||||
v_min: *const c_void,
|
|
||||||
v_max: *const c_void,
|
|
||||||
format: *const c_char,
|
|
||||||
power: c_float,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igVSliderFloat(
|
|
||||||
label: *const c_char,
|
|
||||||
size: ImVec2,
|
|
||||||
v: *mut c_float,
|
|
||||||
v_min: c_float,
|
|
||||||
v_max: c_float,
|
|
||||||
format: *const c_char,
|
|
||||||
power: c_float,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igVSliderInt(
|
|
||||||
label: *const c_char,
|
|
||||||
size: ImVec2,
|
|
||||||
v: *mut c_int,
|
|
||||||
v_min: c_int,
|
|
||||||
v_max: c_int,
|
|
||||||
format: *const c_char,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igVSliderScalar(
|
|
||||||
label: *const c_char,
|
|
||||||
size: ImVec2,
|
|
||||||
data_type: ImGuiDataType,
|
|
||||||
v: *mut c_void,
|
|
||||||
v_min: *const c_void,
|
|
||||||
v_max: *const c_void,
|
|
||||||
format: *const c_char,
|
|
||||||
power: c_float,
|
|
||||||
) -> bool;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Widgets: Input with Keyboard
|
|
||||||
extern "C" {
|
|
||||||
pub fn igInputText(
|
|
||||||
label: *const c_char,
|
|
||||||
buf: *mut c_char,
|
|
||||||
buf_size: usize,
|
|
||||||
flags: ImGuiInputTextFlags,
|
|
||||||
callback: ImGuiInputTextCallback,
|
|
||||||
user_data: *mut c_void,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igInputTextMultiline(
|
|
||||||
label: *const c_char,
|
|
||||||
buf: *mut c_char,
|
|
||||||
buf_size: usize,
|
|
||||||
size: ImVec2,
|
|
||||||
flags: ImGuiInputTextFlags,
|
|
||||||
callback: ImGuiInputTextCallback,
|
|
||||||
user_data: *mut c_void,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igInputFloat(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_float,
|
|
||||||
step: c_float,
|
|
||||||
step_fast: c_float,
|
|
||||||
format: *const c_char,
|
|
||||||
extra_flags: ImGuiInputTextFlags,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igInputFloat2(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_float,
|
|
||||||
format: *const c_char,
|
|
||||||
extra_flags: ImGuiInputTextFlags,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igInputFloat3(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_float,
|
|
||||||
format: *const c_char,
|
|
||||||
extra_flags: ImGuiInputTextFlags,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igInputFloat4(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_float,
|
|
||||||
format: *const c_char,
|
|
||||||
extra_flags: ImGuiInputTextFlags,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igInputInt(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_int,
|
|
||||||
step: c_int,
|
|
||||||
step_fast: c_int,
|
|
||||||
extra_flags: ImGuiInputTextFlags,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igInputInt2(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_int,
|
|
||||||
extra_flags: ImGuiInputTextFlags,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igInputInt3(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_int,
|
|
||||||
extra_flags: ImGuiInputTextFlags,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igInputInt4(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_int,
|
|
||||||
extra_flags: ImGuiInputTextFlags,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igInputDouble(
|
|
||||||
label: *const c_char,
|
|
||||||
v: *mut c_double,
|
|
||||||
step: c_double,
|
|
||||||
step_fast: c_double,
|
|
||||||
format: *const c_char,
|
|
||||||
extra_flags: ImGuiInputTextFlags,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igInputScalar(
|
|
||||||
label: *const c_char,
|
|
||||||
data_type: ImGuiDataType,
|
|
||||||
v: *mut c_void,
|
|
||||||
step: *const c_void,
|
|
||||||
step_fast: *const c_void,
|
|
||||||
format: *const c_char,
|
|
||||||
extra_flags: ImGuiInputTextFlags,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igInputScalarN(
|
|
||||||
label: *const c_char,
|
|
||||||
data_type: ImGuiDataType,
|
|
||||||
v: *mut c_void,
|
|
||||||
components: c_int,
|
|
||||||
step: *const c_void,
|
|
||||||
step_fast: *const c_void,
|
|
||||||
format: *const c_char,
|
|
||||||
extra_flags: ImGuiInputTextFlags,
|
|
||||||
) -> bool;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Widgets: Color Editor/Picker
|
|
||||||
extern "C" {
|
|
||||||
pub fn igColorEdit3(
|
|
||||||
label: *const c_char,
|
|
||||||
col: *mut c_float,
|
|
||||||
flags: ImGuiColorEditFlags,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igColorEdit4(
|
|
||||||
label: *const c_char,
|
|
||||||
col: *mut c_float,
|
|
||||||
flags: ImGuiColorEditFlags,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igColorPicker3(
|
|
||||||
label: *const c_char,
|
|
||||||
col: *mut c_float,
|
|
||||||
flags: ImGuiColorEditFlags,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igColorPicker4(
|
|
||||||
label: *const c_char,
|
|
||||||
col: *mut c_float,
|
|
||||||
flags: ImGuiColorEditFlags,
|
|
||||||
ref_col: *const c_float,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igColorButton(
|
|
||||||
desc_id: *const c_char,
|
|
||||||
col: ImVec4,
|
|
||||||
flags: ImGuiColorEditFlags,
|
|
||||||
size: ImVec2,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igSetColorEditOptions(flags: ImGuiColorEditFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Widgets: Trees
|
|
||||||
extern "C" {
|
|
||||||
pub fn igTreeNodeStr(label: *const c_char) -> bool;
|
|
||||||
pub fn igTreeNodeStrStr(str_id: *const c_char, fmt: *const c_char, ...) -> bool;
|
|
||||||
pub fn igTreeNodePtr(ptr_id: *const c_void, fmt: *const c_char, ...) -> bool;
|
|
||||||
pub fn igTreeNodeExStr(label: *const c_char, flags: ImGuiTreeNodeFlags) -> bool;
|
|
||||||
pub fn igTreeNodeExStrStr(
|
|
||||||
str_id: *const c_char,
|
|
||||||
flags: ImGuiTreeNodeFlags,
|
|
||||||
fmt: *const c_char,
|
|
||||||
...
|
|
||||||
) -> bool;
|
|
||||||
pub fn igTreeNodeExPtr(
|
|
||||||
ptr_id: *const c_void,
|
|
||||||
flags: ImGuiTreeNodeFlags,
|
|
||||||
fmt: *const c_char,
|
|
||||||
...
|
|
||||||
) -> bool;
|
|
||||||
pub fn igTreePushStr(str_id: *const c_char);
|
|
||||||
pub fn igTreePushPtr(ptr_id: *const c_void);
|
|
||||||
pub fn igTreePop();
|
|
||||||
pub fn igTreeAdvanceToLabelPos();
|
|
||||||
pub fn igGetTreeNodeToLabelSpacing() -> c_float;
|
|
||||||
pub fn igSetNextItemOpen(opened: bool, cond: ImGuiCond);
|
|
||||||
pub fn igCollapsingHeader(label: *const c_char, flags: ImGuiTreeNodeFlags) -> bool;
|
|
||||||
pub fn igCollapsingHeaderBoolPtr(
|
|
||||||
label: *const c_char,
|
|
||||||
open: *mut bool,
|
|
||||||
flags: ImGuiTreeNodeFlags,
|
|
||||||
) -> bool;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Widgets: Selectables
|
|
||||||
extern "C" {
|
|
||||||
pub fn igSelectable(
|
|
||||||
label: *const c_char,
|
|
||||||
selected: bool,
|
|
||||||
flags: ImGuiSelectableFlags,
|
|
||||||
size: ImVec2,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igSelectableBoolPtr(
|
|
||||||
label: *const c_char,
|
|
||||||
p_selected: *mut bool,
|
|
||||||
flags: ImGuiSelectableFlags,
|
|
||||||
size: ImVec2,
|
|
||||||
) -> bool;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Widgets: List Boxes
|
|
||||||
extern "C" {
|
|
||||||
pub fn igListBoxStr_arr(
|
|
||||||
label: *const c_char,
|
|
||||||
current_item: *mut c_int,
|
|
||||||
items: *const *const c_char,
|
|
||||||
items_count: c_int,
|
|
||||||
height_in_items: c_int,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igListBoxFnPtr(
|
|
||||||
label: *const c_char,
|
|
||||||
current_item: *mut c_int,
|
|
||||||
items_getter: extern "C" fn(
|
|
||||||
data: *mut c_void,
|
|
||||||
idx: c_int,
|
|
||||||
out_text: *mut *const c_char,
|
|
||||||
) -> bool,
|
|
||||||
data: *mut c_void,
|
|
||||||
items_count: c_int,
|
|
||||||
height_in_items: c_int,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igListBoxHeaderVec2(label: *const c_char, size: ImVec2) -> bool;
|
|
||||||
pub fn igListBoxHeaderInt(
|
|
||||||
label: *const c_char,
|
|
||||||
items_count: c_int,
|
|
||||||
height_in_items: c_int,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igListBoxFooter();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Widgets: Data Plotting
|
|
||||||
extern "C" {
|
|
||||||
pub fn igPlotLines(
|
|
||||||
label: *const c_char,
|
|
||||||
values: *const c_float,
|
|
||||||
values_count: c_int,
|
|
||||||
values_offset: c_int,
|
|
||||||
overlay_text: *const c_char,
|
|
||||||
scale_min: c_float,
|
|
||||||
scale_max: c_float,
|
|
||||||
graph_size: ImVec2,
|
|
||||||
stride: c_int,
|
|
||||||
);
|
|
||||||
pub fn igPlotLinesFnPtr(
|
|
||||||
label: *const c_char,
|
|
||||||
values_getter: extern "C" fn(data: *mut c_void, idx: c_int) -> c_float,
|
|
||||||
data: *mut c_void,
|
|
||||||
values_count: c_int,
|
|
||||||
values_offset: c_int,
|
|
||||||
overlay_text: *const c_char,
|
|
||||||
scale_min: c_float,
|
|
||||||
scale_max: c_float,
|
|
||||||
graph_size: ImVec2,
|
|
||||||
);
|
|
||||||
pub fn igPlotHistogramFloatPtr(
|
|
||||||
label: *const c_char,
|
|
||||||
values: *const c_float,
|
|
||||||
values_count: c_int,
|
|
||||||
values_offset: c_int,
|
|
||||||
overlay_text: *const c_char,
|
|
||||||
scale_min: c_float,
|
|
||||||
scale_max: c_float,
|
|
||||||
graph_size: ImVec2,
|
|
||||||
stride: c_int,
|
|
||||||
);
|
|
||||||
pub fn igPlotHistogramFnPtr(
|
|
||||||
label: *const c_char,
|
|
||||||
values_getter: extern "C" fn(data: *mut c_void, idx: c_int) -> c_float,
|
|
||||||
data: *mut c_void,
|
|
||||||
values_count: c_int,
|
|
||||||
values_offset: c_int,
|
|
||||||
overlay_text: *const c_char,
|
|
||||||
scale_min: c_float,
|
|
||||||
scale_max: c_float,
|
|
||||||
graph_size: ImVec2,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Widgets: Value() Helpers
|
|
||||||
extern "C" {
|
|
||||||
pub fn igValueBool(prefix: *const c_char, b: bool);
|
|
||||||
pub fn igValueInt(prefix: *const c_char, v: c_int);
|
|
||||||
pub fn igValueUInt(prefix: *const c_char, v: c_uint);
|
|
||||||
pub fn igValueFloat(prefix: *const c_char, v: c_float, float_format: *const c_char);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Widgets: Menus
|
|
||||||
extern "C" {
|
|
||||||
pub fn igBeginMainMenuBar() -> bool;
|
|
||||||
pub fn igEndMainMenuBar();
|
|
||||||
pub fn igBeginMenuBar() -> bool;
|
|
||||||
pub fn igEndMenuBar();
|
|
||||||
pub fn igBeginMenu(label: *const c_char, enabled: bool) -> bool;
|
|
||||||
pub fn igEndMenu();
|
|
||||||
pub fn igMenuItemBool(
|
|
||||||
label: *const c_char,
|
|
||||||
shortcut: *const c_char,
|
|
||||||
selected: bool,
|
|
||||||
enabled: bool,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igMenuItemBoolPtr(
|
|
||||||
label: *const c_char,
|
|
||||||
shortcut: *const c_char,
|
|
||||||
p_selected: *mut bool,
|
|
||||||
enabled: bool,
|
|
||||||
) -> bool;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tooltips
|
|
||||||
extern "C" {
|
|
||||||
pub fn igBeginTooltip();
|
|
||||||
pub fn igEndTooltip();
|
|
||||||
pub fn igSetTooltip(fmt: *const c_char, ...);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Popups
|
|
||||||
extern "C" {
|
|
||||||
pub fn igOpenPopup(str_id: *const c_char);
|
|
||||||
pub fn igBeginPopup(str_id: *const c_char, flags: ImGuiWindowFlags) -> bool;
|
|
||||||
pub fn igBeginPopupContextItem(str_id: *const c_char, mouse_button: c_int) -> bool;
|
|
||||||
pub fn igBeginPopupContextWindow(
|
|
||||||
str_id: *const c_char,
|
|
||||||
mouse_button: c_int,
|
|
||||||
also_over_items: bool,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igBeginPopupContextVoid(str_id: *const c_char, mouse_button: c_int) -> bool;
|
|
||||||
pub fn igBeginPopupModal(name: *const c_char, open: *mut bool, flags: ImGuiWindowFlags)
|
|
||||||
-> bool;
|
|
||||||
pub fn igEndPopup();
|
|
||||||
pub fn igOpenPopupOnItemClick(str_id: *const c_char, mouse_button: c_int) -> bool;
|
|
||||||
pub fn igIsPopupOpen(str_id: *const c_char) -> bool;
|
|
||||||
pub fn igCloseCurrentPopup();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Columns
|
|
||||||
extern "C" {
|
|
||||||
pub fn igColumns(count: c_int, id: *const c_char, border: bool);
|
|
||||||
pub fn igNextColumn();
|
|
||||||
pub fn igGetColumnIndex() -> c_int;
|
|
||||||
pub fn igGetColumnWidth(column_index: c_int) -> c_float;
|
|
||||||
pub fn igSetColumnWidth(column_index: c_int, width: c_float);
|
|
||||||
pub fn igGetColumnOffset(column_index: c_int) -> c_float;
|
|
||||||
pub fn igSetColumnOffset(column_index: c_int, offset_x: c_float);
|
|
||||||
pub fn igGetColumnsCount() -> c_int;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Logging/Capture
|
|
||||||
extern "C" {
|
|
||||||
pub fn igLogToTTY(max_depth: c_int);
|
|
||||||
pub fn igLogToFile(max_depth: c_int, filename: *const c_char);
|
|
||||||
pub fn igLogToClipboard(max_depth: c_int);
|
|
||||||
pub fn igLogFinish();
|
|
||||||
pub fn igLogButtons();
|
|
||||||
pub fn igLogText(fmt: *const c_char, ...);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Drag and Drop
|
|
||||||
extern "C" {
|
|
||||||
/// Call when current ID is active.
|
|
||||||
///
|
|
||||||
/// When this returns true you need to:
|
|
||||||
///
|
|
||||||
/// 1. call [`igSetDragDropPayload`] exactly once,
|
|
||||||
/// 2. you may render the payload visual/description,
|
|
||||||
/// 3. pcall [`igEndDragDropSource`]
|
|
||||||
pub fn igBeginDragDropSource(flags: ImGuiDragDropFlags) -> bool;
|
|
||||||
/// Use 'cond' to choose to submit payload on drag start or every frame
|
|
||||||
pub fn igSetDragDropPayload(
|
|
||||||
type_: *const c_char,
|
|
||||||
data: *const c_void,
|
|
||||||
size: size_t,
|
|
||||||
cond: ImGuiCond,
|
|
||||||
) -> bool;
|
|
||||||
pub fn igEndDragDropSource();
|
|
||||||
pub fn igBeginDragDropTarget() -> bool;
|
|
||||||
pub fn igAcceptDragDropPayload(
|
|
||||||
type_: *const c_char,
|
|
||||||
flags: ImGuiDragDropFlags,
|
|
||||||
) -> *const ImGuiPayload;
|
|
||||||
pub fn igEndDragDropTarget();
|
|
||||||
pub fn igGetDragDropPayload() -> *const ImGuiPayload;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clipping
|
|
||||||
extern "C" {
|
|
||||||
pub fn igPushClipRect(
|
|
||||||
clip_rect_min: ImVec2,
|
|
||||||
clip_rect_max: ImVec2,
|
|
||||||
intersect_with_current_clip_rect: bool,
|
|
||||||
);
|
|
||||||
pub fn igPopClipRect();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Focus
|
|
||||||
extern "C" {
|
|
||||||
pub fn igSetItemDefaultFocus();
|
|
||||||
pub fn igSetKeyboardFocusHere(offset: c_int);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Utilities
|
|
||||||
extern "C" {
|
|
||||||
pub fn igIsItemHovered(flags: ImGuiHoveredFlags) -> bool;
|
|
||||||
pub fn igIsItemActive() -> bool;
|
|
||||||
pub fn igIsItemFocused() -> bool;
|
|
||||||
pub fn igIsItemClicked(mouse_button: c_int) -> bool;
|
|
||||||
pub fn igIsItemVisible() -> bool;
|
|
||||||
pub fn igIsItemEdited() -> bool;
|
|
||||||
pub fn igIsItemDeactivated() -> bool;
|
|
||||||
pub fn igIsItemDeactivatedAfterEdit() -> bool;
|
|
||||||
pub fn igIsAnyItemHovered() -> bool;
|
|
||||||
pub fn igIsAnyItemActive() -> bool;
|
|
||||||
pub fn igIsAnyItemFocused() -> bool;
|
|
||||||
pub fn igGetItemRectMin_nonUDT2() -> ImVec2;
|
|
||||||
pub fn igGetItemRectMax_nonUDT2() -> ImVec2;
|
|
||||||
pub fn igGetItemRectSize_nonUDT2() -> ImVec2;
|
|
||||||
pub fn igSetItemAllowOverlap();
|
|
||||||
pub fn igIsRectVisible(size: ImVec2) -> bool;
|
|
||||||
pub fn igIsRectVisibleVec2(rect_min: ImVec2, rect_max: ImVec2) -> bool;
|
|
||||||
pub fn igGetTime() -> c_double;
|
|
||||||
pub fn igGetFrameCount() -> c_int;
|
|
||||||
pub fn igGetOverlayDrawList() -> *mut ImDrawList;
|
|
||||||
pub fn igGetDrawListSharedData() -> *mut ImDrawListSharedData;
|
|
||||||
pub fn igGetStyleColorName(idx: ImGuiCol) -> *const c_char;
|
|
||||||
pub fn igSetStateStorage(storage: *mut ImGuiStorage);
|
|
||||||
pub fn igGetStateStorage() -> *mut ImGuiStorage;
|
|
||||||
pub fn igCalcTextSize_nonUDT2(
|
|
||||||
text: *const c_char,
|
|
||||||
text_end: *const c_char,
|
|
||||||
hide_text_after_double_hash: bool,
|
|
||||||
wrap_width: c_float,
|
|
||||||
) -> ImVec2;
|
|
||||||
pub fn igCalcListClipping(
|
|
||||||
items_count: c_int,
|
|
||||||
items_height: c_float,
|
|
||||||
out_items_display_start: *mut c_int,
|
|
||||||
out_items_display_end: *mut c_int,
|
|
||||||
);
|
|
||||||
|
|
||||||
pub fn igBeginChildFrame(id: ImGuiID, size: ImVec2, flags: ImGuiWindowFlags) -> bool;
|
|
||||||
pub fn igEndChildFrame();
|
|
||||||
|
|
||||||
pub fn igColorConvertU32ToFloat4_nonUDT2(color: ImU32) -> ImVec4;
|
|
||||||
pub fn igColorConvertFloat4ToU32(color: ImVec4) -> ImU32;
|
|
||||||
pub fn igColorConvertRGBtoHSV(
|
|
||||||
r: c_float,
|
|
||||||
g: c_float,
|
|
||||||
b: c_float,
|
|
||||||
out_h: *mut c_float,
|
|
||||||
out_s: *mut c_float,
|
|
||||||
out_v: *mut c_float,
|
|
||||||
);
|
|
||||||
pub fn igColorConvertHSVtoRGB(
|
|
||||||
h: c_float,
|
|
||||||
s: c_float,
|
|
||||||
v: c_float,
|
|
||||||
out_r: *mut c_float,
|
|
||||||
out_g: *mut c_float,
|
|
||||||
out_b: *mut c_float,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Inputs
|
|
||||||
extern "C" {
|
|
||||||
pub fn igGetKeyIndex(imgui_key: ImGuiKey) -> c_int;
|
|
||||||
pub fn igIsKeyDown(user_key_index: c_int) -> bool;
|
|
||||||
pub fn igIsKeyPressed(user_key_index: c_int, repeat: bool) -> bool;
|
|
||||||
pub fn igIsKeyReleased(user_key_index: c_int) -> bool;
|
|
||||||
pub fn igGetKeyPressedAmount(key_index: c_int, repeat_delay: c_float, rate: c_float) -> c_int;
|
|
||||||
pub fn igIsMouseDown(button: c_int) -> bool;
|
|
||||||
pub fn igIsAnyMouseDown() -> bool;
|
|
||||||
pub fn igIsMouseClicked(button: c_int, repeat: bool) -> bool;
|
|
||||||
pub fn igIsMouseDoubleClicked(button: c_int) -> bool;
|
|
||||||
pub fn igIsMouseReleased(button: c_int) -> bool;
|
|
||||||
pub fn igIsMouseDragging(button: c_int, lock_threshold: c_float) -> bool;
|
|
||||||
pub fn igIsMouseHoveringRect(r_min: ImVec2, r_max: ImVec2, clip: bool) -> bool;
|
|
||||||
pub fn igIsMousePosValid(mouse_pos: *const ImVec2) -> bool;
|
|
||||||
pub fn igGetMousePos_nonUDT2() -> ImVec2;
|
|
||||||
pub fn igGetMousePosOnOpeningCurrentPopup_nonUDT2() -> ImVec2;
|
|
||||||
pub fn igGetMouseDragDelta_nonUDT2(button: c_int, lock_threshold: c_float) -> ImVec2;
|
|
||||||
pub fn igResetMouseDragDelta(button: c_int);
|
|
||||||
pub fn igGetMouseCursor() -> ImGuiMouseCursor;
|
|
||||||
pub fn igSetMouseCursor(cursor: ImGuiMouseCursor);
|
|
||||||
pub fn igCaptureKeyboardFromApp(capture: bool);
|
|
||||||
pub fn igCaptureMouseFromApp(capture: bool);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clipboard utilities
|
|
||||||
extern "C" {
|
|
||||||
pub fn igGetClipboardText() -> *const c_char;
|
|
||||||
pub fn igSetClipboardText(text: *const c_char);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Settings/.Ini Utilities
|
|
||||||
extern "C" {
|
|
||||||
pub fn igLoadIniSettingsFromDisk(ini_filename: *const c_char);
|
|
||||||
pub fn igLoadIniSettingsFromMemory(ini_data: *const c_char, ini_size: usize);
|
|
||||||
pub fn igSaveIniSettingsToDisk(ini_filename: *const c_char);
|
|
||||||
pub fn igSaveIniSettingsToMemory(out_ini_size: *const usize) -> *const c_char;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Memory Utilities
|
|
||||||
extern "C" {
|
|
||||||
pub fn igSetAllocatorFunctions(
|
|
||||||
alloc_func: Option<extern "C" fn(sz: usize, user_data: *mut c_void) -> *mut c_void>,
|
|
||||||
free_func: Option<extern "C" fn(ptr: *mut c_void, user_data: *mut c_void)>,
|
|
||||||
user_data: *mut c_void,
|
|
||||||
);
|
|
||||||
pub fn igMemAlloc(size: usize) -> *mut c_void;
|
|
||||||
pub fn igMemFree(ptr: *mut c_void);
|
|
||||||
}
|
|
||||||
@ -1,96 +1,6 @@
|
|||||||
#![allow(non_upper_case_globals)]
|
|
||||||
|
|
||||||
use std::convert::From;
|
|
||||||
|
|
||||||
pub use self::enums::*;
|
|
||||||
pub use self::flags::*;
|
|
||||||
|
|
||||||
mod bindings;
|
mod bindings;
|
||||||
mod enums;
|
|
||||||
mod flags;
|
|
||||||
mod legacy;
|
|
||||||
|
|
||||||
pub use bindings::{
|
pub use crate::bindings::*;
|
||||||
igGetIO, igPushStyleVarFloat, igPushStyleVarVec2, CustomRect, ImDrawCallback, ImDrawChannel,
|
|
||||||
ImDrawCmd, ImDrawData, ImDrawData_Clear, ImDrawData_DeIndexAllBuffers,
|
|
||||||
ImDrawData_ScaleClipRects, ImDrawIdx, ImDrawList, ImDrawListSharedData, ImDrawListSplitter,
|
|
||||||
ImDrawList_AddBezierCurve, ImDrawList_AddCallback, ImDrawList_AddCircle,
|
|
||||||
ImDrawList_AddCircleFilled, ImDrawList_AddConvexPolyFilled, ImDrawList_AddDrawCmd,
|
|
||||||
ImDrawList_AddImage, ImDrawList_AddImageQuad, ImDrawList_AddImageRounded, ImDrawList_AddLine,
|
|
||||||
ImDrawList_AddPolyline, ImDrawList_AddQuad, ImDrawList_AddQuadFilled, ImDrawList_AddRect,
|
|
||||||
ImDrawList_AddRectFilled, ImDrawList_AddRectFilledMultiColor, ImDrawList_AddText,
|
|
||||||
ImDrawList_AddTextFontPtr, ImDrawList_AddTriangle, ImDrawList_AddTriangleFilled,
|
|
||||||
ImDrawList_ChannelsMerge, ImDrawList_ChannelsSetCurrent, ImDrawList_ChannelsSplit,
|
|
||||||
ImDrawList_Clear, ImDrawList_ClearFreeMemory, ImDrawList_CloneOutput, ImDrawList_ImDrawList,
|
|
||||||
ImDrawList_PathArcTo, ImDrawList_PathArcToFast, ImDrawList_PathBezierCurveTo,
|
|
||||||
ImDrawList_PathClear, ImDrawList_PathFillConvex, ImDrawList_PathLineTo,
|
|
||||||
ImDrawList_PathLineToMergeDuplicate, ImDrawList_PathRect, ImDrawList_PathStroke,
|
|
||||||
ImDrawList_PopClipRect, ImDrawList_PopTextureID, ImDrawList_PrimQuadUV, ImDrawList_PrimRect,
|
|
||||||
ImDrawList_PrimRectUV, ImDrawList_PrimReserve, ImDrawList_PrimVtx, ImDrawList_PrimWriteIdx,
|
|
||||||
ImDrawList_PrimWriteVtx, ImDrawList_PushClipRect, ImDrawList_PushClipRectFullScreen,
|
|
||||||
ImDrawList_PushTextureID, ImDrawList_UpdateClipRect, ImDrawList_UpdateTextureID,
|
|
||||||
ImDrawList_destroy, ImDrawVert, ImFont, ImFontAtlas, ImFontAtlas_AddFont,
|
|
||||||
ImFontAtlas_AddFontDefault, ImFontAtlas_Clear, ImFontAtlas_GetGlyphRangesChineseFull,
|
|
||||||
ImFontAtlas_GetGlyphRangesChineseSimplifiedCommon, ImFontAtlas_GetGlyphRangesCyrillic,
|
|
||||||
ImFontAtlas_GetGlyphRangesDefault, ImFontAtlas_GetGlyphRangesJapanese,
|
|
||||||
ImFontAtlas_GetGlyphRangesKorean, ImFontAtlas_GetGlyphRangesThai,
|
|
||||||
ImFontAtlas_GetGlyphRangesVietnamese, ImFontAtlas_GetTexDataAsRGBA32, ImFontConfig,
|
|
||||||
ImFontGlyphRangesBuilder, ImGuiBackendFlags_, ImGuiBackendFlags_HasGamepad,
|
|
||||||
ImGuiBackendFlags_HasMouseCursors, ImGuiBackendFlags_HasSetMousePos, ImGuiBackendFlags_None,
|
|
||||||
ImGuiBackendFlags_RendererHasVtxOffset, ImGuiCol, ImGuiCol_, ImGuiCol_Border,
|
|
||||||
ImGuiCol_BorderShadow, ImGuiCol_Button, ImGuiCol_ButtonActive, ImGuiCol_ButtonHovered,
|
|
||||||
ImGuiCol_COUNT, ImGuiCol_CheckMark, ImGuiCol_ChildBg, ImGuiCol_DragDropTarget,
|
|
||||||
ImGuiCol_FrameBg, ImGuiCol_FrameBgActive, ImGuiCol_FrameBgHovered, ImGuiCol_Header,
|
|
||||||
ImGuiCol_HeaderActive, ImGuiCol_HeaderHovered, ImGuiCol_MenuBarBg, ImGuiCol_ModalWindowDimBg,
|
|
||||||
ImGuiCol_NavHighlight, ImGuiCol_NavWindowingDimBg, ImGuiCol_NavWindowingHighlight,
|
|
||||||
ImGuiCol_PlotHistogram, ImGuiCol_PlotHistogramHovered, ImGuiCol_PlotLines,
|
|
||||||
ImGuiCol_PlotLinesHovered, ImGuiCol_PopupBg, ImGuiCol_ResizeGrip, ImGuiCol_ResizeGripActive,
|
|
||||||
ImGuiCol_ResizeGripHovered, ImGuiCol_ScrollbarBg, ImGuiCol_ScrollbarGrab,
|
|
||||||
ImGuiCol_ScrollbarGrabActive, ImGuiCol_ScrollbarGrabHovered, ImGuiCol_Separator,
|
|
||||||
ImGuiCol_SeparatorActive, ImGuiCol_SeparatorHovered, ImGuiCol_SliderGrab,
|
|
||||||
ImGuiCol_SliderGrabActive, ImGuiCol_Tab, ImGuiCol_TabActive, ImGuiCol_TabHovered,
|
|
||||||
ImGuiCol_TabUnfocused, ImGuiCol_TabUnfocusedActive, ImGuiCol_Text, ImGuiCol_TextDisabled,
|
|
||||||
ImGuiCol_TextSelectedBg, ImGuiCol_TitleBg, ImGuiCol_TitleBgActive, ImGuiCol_TitleBgCollapsed,
|
|
||||||
ImGuiCol_WindowBg, ImGuiCond, ImGuiCond_, ImGuiCond_Always, ImGuiCond_Appearing,
|
|
||||||
ImGuiCond_FirstUseEver, ImGuiCond_Once, ImGuiConfigFlags_, ImGuiConfigFlags_IsSRGB,
|
|
||||||
ImGuiConfigFlags_IsTouchScreen, ImGuiConfigFlags_NavEnableGamepad,
|
|
||||||
ImGuiConfigFlags_NavEnableKeyboard, ImGuiConfigFlags_NavEnableSetMousePos,
|
|
||||||
ImGuiConfigFlags_NavNoCaptureKeyboard, ImGuiConfigFlags_NoMouse,
|
|
||||||
ImGuiConfigFlags_NoMouseCursorChange, ImGuiConfigFlags_None, ImGuiContext, ImGuiDir, ImGuiDir_,
|
|
||||||
ImGuiDir_COUNT, ImGuiDir_Down, ImGuiDir_Left, ImGuiDir_None, ImGuiDir_Right, ImGuiDir_Up,
|
|
||||||
ImGuiID, ImGuiIO, ImGuiIO_AddInputCharacter, ImGuiIO_AddInputCharactersUTF8,
|
|
||||||
ImGuiIO_ClearInputCharacters, ImGuiInputTextCallback, ImGuiInputTextCallbackData,
|
|
||||||
ImGuiInputTextCallbackData_DeleteChars, ImGuiInputTextCallbackData_HasSelection,
|
|
||||||
ImGuiInputTextCallbackData_ImGuiInputTextCallbackData, ImGuiInputTextCallbackData_InsertChars,
|
|
||||||
ImGuiInputTextCallbackData_destroy, ImGuiKey, ImGuiKey_, ImGuiKey_A, ImGuiKey_Backspace,
|
|
||||||
ImGuiKey_C, ImGuiKey_COUNT, ImGuiKey_Delete, ImGuiKey_DownArrow, ImGuiKey_End, ImGuiKey_Enter,
|
|
||||||
ImGuiKey_Escape, ImGuiKey_Home, ImGuiKey_Insert, ImGuiKey_LeftArrow, ImGuiKey_PageDown,
|
|
||||||
ImGuiKey_PageUp, ImGuiKey_RightArrow, ImGuiKey_Space, ImGuiKey_Tab, ImGuiKey_UpArrow,
|
|
||||||
ImGuiKey_V, ImGuiKey_X, ImGuiKey_Y, ImGuiKey_Z, ImGuiListClipper, ImGuiMouseCursor,
|
|
||||||
ImGuiMouseCursor_, ImGuiMouseCursor_Arrow, ImGuiMouseCursor_COUNT, ImGuiMouseCursor_Hand,
|
|
||||||
ImGuiMouseCursor_None, ImGuiMouseCursor_ResizeAll, ImGuiMouseCursor_ResizeEW,
|
|
||||||
ImGuiMouseCursor_ResizeNESW, ImGuiMouseCursor_ResizeNS, ImGuiMouseCursor_ResizeNWSE,
|
|
||||||
ImGuiMouseCursor_TextInput, ImGuiNavInput_, ImGuiNavInput_Activate, ImGuiNavInput_COUNT,
|
|
||||||
ImGuiNavInput_Cancel, ImGuiNavInput_DpadDown, ImGuiNavInput_DpadLeft, ImGuiNavInput_DpadRight,
|
|
||||||
ImGuiNavInput_DpadUp, ImGuiNavInput_FocusNext, ImGuiNavInput_FocusPrev, ImGuiNavInput_Input,
|
|
||||||
ImGuiNavInput_InternalStart_, ImGuiNavInput_KeyDown_, ImGuiNavInput_KeyLeft_,
|
|
||||||
ImGuiNavInput_KeyMenu_, ImGuiNavInput_KeyRight_, ImGuiNavInput_KeyTab_, ImGuiNavInput_KeyUp_,
|
|
||||||
ImGuiNavInput_LStickDown, ImGuiNavInput_LStickLeft, ImGuiNavInput_LStickRight,
|
|
||||||
ImGuiNavInput_LStickUp, ImGuiNavInput_Menu, ImGuiNavInput_TweakFast, ImGuiNavInput_TweakSlow,
|
|
||||||
ImGuiPayload, ImGuiSizeCallback, ImGuiStorage, ImGuiStyle, ImGuiStyleVar, ImGuiStyleVar_,
|
|
||||||
ImGuiStyleVar_Alpha, ImGuiStyleVar_ButtonTextAlign, ImGuiStyleVar_COUNT,
|
|
||||||
ImGuiStyleVar_ChildBorderSize, ImGuiStyleVar_ChildRounding, ImGuiStyleVar_FrameBorderSize,
|
|
||||||
ImGuiStyleVar_FramePadding, ImGuiStyleVar_FrameRounding, ImGuiStyleVar_GrabMinSize,
|
|
||||||
ImGuiStyleVar_GrabRounding, ImGuiStyleVar_IndentSpacing, ImGuiStyleVar_ItemInnerSpacing,
|
|
||||||
ImGuiStyleVar_ItemSpacing, ImGuiStyleVar_PopupBorderSize, ImGuiStyleVar_PopupRounding,
|
|
||||||
ImGuiStyleVar_ScrollbarRounding, ImGuiStyleVar_ScrollbarSize,
|
|
||||||
ImGuiStyleVar_SelectableTextAlign, ImGuiStyleVar_TabRounding, ImGuiStyleVar_WindowBorderSize,
|
|
||||||
ImGuiStyleVar_WindowMinSize, ImGuiStyleVar_WindowPadding, ImGuiStyleVar_WindowRounding,
|
|
||||||
ImGuiStyleVar_WindowTitleAlign, ImGuiStyle_ScaleAllSizes, ImGuiTextBuffer, ImGuiTextFilter,
|
|
||||||
ImTextureID, ImU32, ImVec2, ImVec2_Simple, ImVec4, ImVec4_Simple, ImVector_ImFontPtr,
|
|
||||||
ImVector_ImWchar, ImVector_char, ImWchar,
|
|
||||||
};
|
|
||||||
pub use legacy::*;
|
|
||||||
|
|
||||||
#[cfg(feature = "gfx")]
|
#[cfg(feature = "gfx")]
|
||||||
mod gfx_support;
|
mod gfx_support;
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use sys;
|
|
||||||
|
|
||||||
use super::{ImGuiWindowFlags, ImStr, ImVec2, Ui};
|
use crate::legacy::ImGuiWindowFlags;
|
||||||
|
use crate::sys;
|
||||||
|
use crate::{ImStr, ImVec2, Ui};
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub struct ChildFrame<'ui, 'p> {
|
pub struct ChildFrame<'ui, 'p> {
|
||||||
@ -97,8 +98,14 @@ impl<'ui, 'p> ChildFrame<'ui, 'p> {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
pub fn build<F: FnOnce()>(self, f: F) {
|
pub fn build<F: FnOnce()>(self, f: F) {
|
||||||
let render_child_frame =
|
let render_child_frame = unsafe {
|
||||||
unsafe { sys::igBeginChild(self.name.as_ptr(), self.size, self.border, self.flags) };
|
sys::igBeginChild(
|
||||||
|
self.name.as_ptr(),
|
||||||
|
self.size,
|
||||||
|
self.border,
|
||||||
|
self.flags.bits(),
|
||||||
|
)
|
||||||
|
};
|
||||||
if render_child_frame {
|
if render_child_frame {
|
||||||
f();
|
f();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
#![warn(missing_docs)]
|
#![warn(missing_docs)]
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use sys;
|
|
||||||
|
|
||||||
use crate::{ImGuiColorEditFlags, ImStr, ImVec2, ImVec4, Ui};
|
use crate::legacy::ImGuiColorEditFlags;
|
||||||
|
use crate::sys;
|
||||||
|
use crate::{ImStr, ImVec2, ImVec4, Ui};
|
||||||
|
|
||||||
/// Mutable reference to an editable color value.
|
/// Mutable reference to an editable color value.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@ -196,10 +197,10 @@ impl<'ui, 'p> ColorEdit<'ui, 'p> {
|
|||||||
pub fn build(self) -> bool {
|
pub fn build(self) -> bool {
|
||||||
match self.value {
|
match self.value {
|
||||||
EditableColor::Float3(value) => unsafe {
|
EditableColor::Float3(value) => unsafe {
|
||||||
sys::igColorEdit3(self.label.as_ptr(), value.as_mut_ptr(), self.flags)
|
sys::igColorEdit3(self.label.as_ptr(), value.as_mut_ptr(), self.flags.bits())
|
||||||
},
|
},
|
||||||
EditableColor::Float4(value) => unsafe {
|
EditableColor::Float4(value) => unsafe {
|
||||||
sys::igColorEdit4(self.label.as_ptr(), value.as_mut_ptr(), self.flags)
|
sys::igColorEdit4(self.label.as_ptr(), value.as_mut_ptr(), self.flags.bits())
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -344,7 +345,7 @@ impl<'ui, 'p> ColorPicker<'ui, 'p> {
|
|||||||
sys::igColorPicker4(
|
sys::igColorPicker4(
|
||||||
self.label.as_ptr(),
|
self.label.as_ptr(),
|
||||||
self.value.as_mut_ptr(),
|
self.value.as_mut_ptr(),
|
||||||
self.flags,
|
self.flags.bits(),
|
||||||
ref_color,
|
ref_color,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -413,6 +414,13 @@ impl<'ui, 'p> ColorButton<'ui, 'p> {
|
|||||||
}
|
}
|
||||||
/// Builds the color button.
|
/// Builds the color button.
|
||||||
pub fn build(self) -> bool {
|
pub fn build(self) -> bool {
|
||||||
unsafe { sys::igColorButton(self.desc_id.as_ptr(), self.color, self.flags, self.size) }
|
unsafe {
|
||||||
|
sys::igColorButton(
|
||||||
|
self.desc_id.as_ptr(),
|
||||||
|
self.color,
|
||||||
|
self.flags.bits(),
|
||||||
|
self.size,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::os::raw::{c_int, c_void};
|
use std::os::raw::{c_int, c_void};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use sys;
|
|
||||||
|
|
||||||
use super::{ImGuiInputTextFlags, ImStr, ImString, Ui};
|
use crate::legacy::ImGuiInputTextFlags;
|
||||||
|
use crate::sys;
|
||||||
|
use crate::{ImStr, ImString, Ui};
|
||||||
|
|
||||||
macro_rules! impl_text_flags {
|
macro_rules! impl_text_flags {
|
||||||
($InputType:ident) => {
|
($InputType:ident) => {
|
||||||
@ -192,7 +193,7 @@ impl<'ui, 'p> InputText<'ui, 'p> {
|
|||||||
self.label.as_ptr(),
|
self.label.as_ptr(),
|
||||||
ptr,
|
ptr,
|
||||||
capacity,
|
capacity,
|
||||||
self.flags,
|
self.flags.bits(),
|
||||||
callback,
|
callback,
|
||||||
data,
|
data,
|
||||||
);
|
);
|
||||||
@ -243,7 +244,7 @@ impl<'ui, 'p> InputTextMultiline<'ui, 'p> {
|
|||||||
ptr,
|
ptr,
|
||||||
capacity,
|
capacity,
|
||||||
self.size,
|
self.size,
|
||||||
self.flags,
|
self.flags.bits(),
|
||||||
callback,
|
callback,
|
||||||
data,
|
data,
|
||||||
);
|
);
|
||||||
@ -282,7 +283,7 @@ impl<'ui, 'p> InputInt<'ui, 'p> {
|
|||||||
self.value as *mut i32,
|
self.value as *mut i32,
|
||||||
self.step,
|
self.step,
|
||||||
self.step_fast,
|
self.step_fast,
|
||||||
self.flags,
|
self.flags.bits(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -321,7 +322,7 @@ impl<'ui, 'p> InputFloat<'ui, 'p> {
|
|||||||
self.step,
|
self.step,
|
||||||
self.step_fast,
|
self.step_fast,
|
||||||
b"%.3f\0".as_ptr() as *const _,
|
b"%.3f\0".as_ptr() as *const _,
|
||||||
self.flags,
|
self.flags.bits(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -356,7 +357,7 @@ macro_rules! impl_input_floatn {
|
|||||||
self.label.as_ptr(),
|
self.label.as_ptr(),
|
||||||
self.value.as_mut_ptr(),
|
self.value.as_mut_ptr(),
|
||||||
b"%.3f\0".as_ptr() as *const _,
|
b"%.3f\0".as_ptr() as *const _,
|
||||||
self.flags,
|
self.flags.bits(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -392,7 +393,11 @@ macro_rules! impl_input_intn {
|
|||||||
|
|
||||||
pub fn build(self) -> bool {
|
pub fn build(self) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
sys::$igInputIntN(self.label.as_ptr(), self.value.as_mut_ptr(), self.flags)
|
sys::$igInputIntN(
|
||||||
|
self.label.as_ptr(),
|
||||||
|
self.value.as_mut_ptr(),
|
||||||
|
self.flags.bits(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
#![allow(non_upper_case_globals)]
|
||||||
use bitflags::bitflags;
|
use bitflags::bitflags;
|
||||||
use std::os::raw::c_int;
|
use std::os::raw::c_int;
|
||||||
|
|
||||||
32
src/lib.rs
32
src/lib.rs
@ -29,6 +29,7 @@ pub use self::input_widget::{
|
|||||||
InputText, InputTextMultiline,
|
InputText, InputTextMultiline,
|
||||||
};
|
};
|
||||||
pub use self::io::*;
|
pub use self::io::*;
|
||||||
|
pub use self::legacy::*;
|
||||||
pub use self::menus::{Menu, MenuItem};
|
pub use self::menus::{Menu, MenuItem};
|
||||||
pub use self::plothistogram::PlotHistogram;
|
pub use self::plothistogram::PlotHistogram;
|
||||||
pub use self::plotlines::PlotLines;
|
pub use self::plotlines::PlotLines;
|
||||||
@ -41,8 +42,7 @@ pub use self::sliders::{
|
|||||||
pub use self::string::{ImStr, ImString};
|
pub use self::string::{ImStr, ImString};
|
||||||
pub use self::style::*;
|
pub use self::style::*;
|
||||||
pub use self::sys::{
|
pub use self::sys::{
|
||||||
ImDrawIdx, ImDrawVert, ImGuiColorEditFlags, ImGuiFocusedFlags, ImGuiHoveredFlags,
|
ImDrawIdx, ImDrawVert, ImVec2,
|
||||||
ImGuiInputTextFlags, ImGuiSelectableFlags, ImGuiTreeNodeFlags, ImGuiWindowFlags, ImVec2,
|
|
||||||
ImVec4,
|
ImVec4,
|
||||||
};
|
};
|
||||||
pub use self::trees::{CollapsingHeader, TreeNode};
|
pub use self::trees::{CollapsingHeader, TreeNode};
|
||||||
@ -60,6 +60,7 @@ mod input;
|
|||||||
mod input_widget;
|
mod input_widget;
|
||||||
mod internal;
|
mod internal;
|
||||||
mod io;
|
mod io;
|
||||||
|
mod legacy;
|
||||||
mod menus;
|
mod menus;
|
||||||
mod plothistogram;
|
mod plothistogram;
|
||||||
mod plotlines;
|
mod plotlines;
|
||||||
@ -980,7 +981,7 @@ impl<'ui> Ui<'ui> {
|
|||||||
/// use .options(false) in your widget builders.
|
/// use .options(false) in your widget builders.
|
||||||
pub fn set_color_edit_options(&self, flags: ImGuiColorEditFlags) {
|
pub fn set_color_edit_options(&self, flags: ImGuiColorEditFlags) {
|
||||||
unsafe {
|
unsafe {
|
||||||
sys::igSetColorEditOptions(flags);
|
sys::igSetColorEditOptions(flags.bits());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1004,7 +1005,7 @@ impl<'ui> Ui<'ui> {
|
|||||||
flags: ImGuiSelectableFlags,
|
flags: ImGuiSelectableFlags,
|
||||||
size: S,
|
size: S,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
unsafe { sys::igSelectable(label.as_ptr(), selected, flags, size.into()) }
|
unsafe { sys::igSelectable(label.as_ptr(), selected, flags.bits(), size.into()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1095,7 +1096,8 @@ impl<'ui> Ui<'ui> {
|
|||||||
where
|
where
|
||||||
F: FnOnce(),
|
F: FnOnce(),
|
||||||
{
|
{
|
||||||
let render = unsafe { sys::igBeginPopup(str_id.as_ptr(), ImGuiWindowFlags::empty()) };
|
let render =
|
||||||
|
unsafe { sys::igBeginPopup(str_id.as_ptr(), ImGuiWindowFlags::empty().bits()) };
|
||||||
if render {
|
if render {
|
||||||
f();
|
f();
|
||||||
unsafe { sys::igEndPopup() };
|
unsafe { sys::igEndPopup() };
|
||||||
@ -1267,14 +1269,16 @@ impl<'ui> Ui<'ui> {
|
|||||||
hide_text_after_double_hash: bool,
|
hide_text_after_double_hash: bool,
|
||||||
wrap_width: f32,
|
wrap_width: f32,
|
||||||
) -> ImVec2 {
|
) -> ImVec2 {
|
||||||
unsafe {
|
let result: [f32; 2] = unsafe {
|
||||||
sys::igCalcTextSize_nonUDT2(
|
sys::igCalcTextSize_nonUDT2(
|
||||||
text.as_ptr(),
|
text.as_ptr(),
|
||||||
std::ptr::null(),
|
std::ptr::null(),
|
||||||
hide_text_after_double_hash,
|
hide_text_after_double_hash,
|
||||||
wrap_width,
|
wrap_width,
|
||||||
)
|
)
|
||||||
}
|
.into()
|
||||||
|
};
|
||||||
|
result.into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1546,35 +1550,35 @@ impl<'ui> Ui<'ui> {
|
|||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn is_item_hovered(&self) -> bool {
|
pub fn is_item_hovered(&self) -> bool {
|
||||||
unsafe { sys::igIsItemHovered(ImGuiHoveredFlags::empty()) }
|
unsafe { sys::igIsItemHovered(ImGuiHoveredFlags::empty().bits()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_item_hovered_with_flags(&self, flags: ImGuiHoveredFlags) -> bool {
|
pub fn is_item_hovered_with_flags(&self, flags: ImGuiHoveredFlags) -> bool {
|
||||||
unsafe { sys::igIsItemHovered(flags) }
|
unsafe { sys::igIsItemHovered(flags.bits()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return `true` if the current window is being hovered by the mouse.
|
/// Return `true` if the current window is being hovered by the mouse.
|
||||||
pub fn is_window_hovered(&self) -> bool {
|
pub fn is_window_hovered(&self) -> bool {
|
||||||
unsafe { sys::igIsWindowHovered(ImGuiHoveredFlags::empty()) }
|
unsafe { sys::igIsWindowHovered(ImGuiHoveredFlags::empty().bits()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_window_hovered_with_flags(&self, flags: ImGuiHoveredFlags) -> bool {
|
pub fn is_window_hovered_with_flags(&self, flags: ImGuiHoveredFlags) -> bool {
|
||||||
unsafe { sys::igIsWindowHovered(flags) }
|
unsafe { sys::igIsWindowHovered(flags.bits()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return `true` if the current window is currently focused.
|
/// Return `true` if the current window is currently focused.
|
||||||
pub fn is_window_focused(&self) -> bool {
|
pub fn is_window_focused(&self) -> bool {
|
||||||
unsafe { sys::igIsWindowFocused(ImGuiFocusedFlags::RootAndChildWindows) }
|
unsafe { sys::igIsWindowFocused(ImGuiFocusedFlags::RootAndChildWindows.bits()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return `true` if the current root window is currently focused.
|
/// Return `true` if the current root window is currently focused.
|
||||||
pub fn is_root_window_focused(&self) -> bool {
|
pub fn is_root_window_focused(&self) -> bool {
|
||||||
unsafe { sys::igIsWindowFocused(ImGuiFocusedFlags::RootWindow) }
|
unsafe { sys::igIsWindowFocused(ImGuiFocusedFlags::RootWindow.bits()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return `true` if the current child window is currently focused.
|
/// Return `true` if the current child window is currently focused.
|
||||||
pub fn is_child_window_focused(&self) -> bool {
|
pub fn is_child_window_focused(&self) -> bool {
|
||||||
unsafe { sys::igIsWindowFocused(ImGuiFocusedFlags::ChildWindows) }
|
unsafe { sys::igIsWindowFocused(ImGuiFocusedFlags::ChildWindows.bits()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` if the last item is being active.
|
/// Returns `true` if the last item is being active.
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use super::{ImGuiWindowFlags, ImStr, Ui};
|
use crate::legacy::ImGuiWindowFlags;
|
||||||
|
use crate::sys;
|
||||||
use sys;
|
use crate::{ImStr, Ui};
|
||||||
|
|
||||||
/// Created by call to [`Ui::popup_modal`].
|
/// Created by call to [`Ui::popup_modal`].
|
||||||
#[must_use]
|
#[must_use]
|
||||||
@ -109,7 +109,7 @@ impl<'ui, 'p> PopupModal<'ui, 'p> {
|
|||||||
self.opened
|
self.opened
|
||||||
.map(|x| x as *mut bool)
|
.map(|x| x as *mut bool)
|
||||||
.unwrap_or(ptr::null_mut()),
|
.unwrap_or(ptr::null_mut()),
|
||||||
self.flags,
|
self.flags.bits(),
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
if render {
|
if render {
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use sys;
|
use sys;
|
||||||
|
|
||||||
use super::{Condition, ImGuiTreeNodeFlags, ImStr, Ui};
|
use super::{Condition, ImStr, Ui};
|
||||||
|
use crate::legacy::ImGuiTreeNodeFlags;
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub struct TreeNode<'ui, 'p> {
|
pub struct TreeNode<'ui, 'p> {
|
||||||
@ -102,7 +103,7 @@ impl<'ui, 'p> TreeNode<'ui, 'p> {
|
|||||||
}
|
}
|
||||||
sys::igTreeNodeExStrStr(
|
sys::igTreeNodeExStrStr(
|
||||||
self.id.as_ptr(),
|
self.id.as_ptr(),
|
||||||
self.flags,
|
self.flags.bits(),
|
||||||
super::fmt_ptr(),
|
super::fmt_ptr(),
|
||||||
self.label.unwrap_or(self.id).as_ptr(),
|
self.label.unwrap_or(self.id).as_ptr(),
|
||||||
)
|
)
|
||||||
@ -167,6 +168,6 @@ impl<'ui, 'p> CollapsingHeader<'ui, 'p> {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
pub fn build(self) -> bool {
|
pub fn build(self) -> bool {
|
||||||
unsafe { sys::igCollapsingHeader(self.label.as_ptr(), self.flags) }
|
unsafe { sys::igCollapsingHeader(self.label.as_ptr(), self.flags.bits()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,8 @@ use std::marker::PhantomData;
|
|||||||
use std::ptr;
|
use std::ptr;
|
||||||
use sys;
|
use sys;
|
||||||
|
|
||||||
use super::{Condition, ImGuiWindowFlags, ImStr, Ui};
|
use crate::legacy::ImGuiWindowFlags;
|
||||||
|
use crate::{Condition, ImStr, Ui};
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub struct Window<'ui, 'p> {
|
pub struct Window<'ui, 'p> {
|
||||||
@ -155,7 +156,7 @@ impl<'ui, 'p> Window<'ui, 'p> {
|
|||||||
self.opened
|
self.opened
|
||||||
.map(|x| x as *mut bool)
|
.map(|x| x as *mut bool)
|
||||||
.unwrap_or(ptr::null_mut()),
|
.unwrap_or(ptr::null_mut()),
|
||||||
self.flags,
|
self.flags.bits(),
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
if render {
|
if render {
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
use sys;
|
use sys;
|
||||||
use sys::{ImDrawCornerFlags, ImDrawList, ImU32};
|
use sys::{ImDrawList, ImU32};
|
||||||
|
|
||||||
use super::{ImVec2, ImVec4, Ui};
|
use super::{ImVec2, ImVec4, Ui};
|
||||||
|
use crate::legacy::ImDrawCornerFlags;
|
||||||
|
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user