mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-11 13:38:35 +00:00
docking branch
This commit is contained in:
parent
57d155301c
commit
44b8621d20
@ -23,6 +23,7 @@ parking_lot = "0.12"
|
|||||||
cfg-if = "1"
|
cfg-if = "1"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
default = ["docking"]
|
||||||
wasm = ["imgui-sys/wasm"]
|
wasm = ["imgui-sys/wasm"]
|
||||||
freetype = ["imgui-sys/freetype"]
|
freetype = ["imgui-sys/freetype"]
|
||||||
docking = ["imgui-sys/docking"]
|
docking = ["imgui-sys/docking"]
|
||||||
|
|||||||
@ -9,7 +9,7 @@ use crate::clipboard::{ClipboardBackend, ClipboardContext};
|
|||||||
use crate::fonts::atlas::{FontAtlas, FontId, SharedFontAtlas};
|
use crate::fonts::atlas::{FontAtlas, FontId, SharedFontAtlas};
|
||||||
use crate::io::Io;
|
use crate::io::Io;
|
||||||
use crate::style::Style;
|
use crate::style::Style;
|
||||||
use crate::{sys, DrawData};
|
use crate::{docking_utils, sys, DrawData};
|
||||||
use crate::{MouseCursor, Ui};
|
use crate::{MouseCursor, Ui};
|
||||||
|
|
||||||
/// An imgui-rs context.
|
/// An imgui-rs context.
|
||||||
@ -449,9 +449,18 @@ fn test_shared_font_atlas() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_ini_load_save() {
|
fn test_ini_load_save() {
|
||||||
let (_guard, mut ctx) = crate::test::test_ctx();
|
let (_guard, mut ctx) = crate::test::test_ctx();
|
||||||
|
|
||||||
|
#[cfg(feature = "docking")]
|
||||||
|
let data = "[Window][Debug##Default]
|
||||||
|
Pos=60,60
|
||||||
|
Size=400,400
|
||||||
|
Collapsed=0";
|
||||||
|
|
||||||
|
#[cfg(not(feature = "docking"))]
|
||||||
let data = "[Window][Debug##Default]
|
let data = "[Window][Debug##Default]
|
||||||
Pos=60,60
|
Pos=60,60
|
||||||
Size=400,400";
|
Size=400,400";
|
||||||
|
|
||||||
ctx.load_ini_settings(data);
|
ctx.load_ini_settings(data);
|
||||||
let mut buf = String::new();
|
let mut buf = String::new();
|
||||||
ctx.save_ini_settings(&mut buf);
|
ctx.save_ini_settings(&mut buf);
|
||||||
@ -675,34 +684,34 @@ impl Context {
|
|||||||
io.backend_platform_user_data = ctx.get() as *mut _;
|
io.backend_platform_user_data = ctx.get() as *mut _;
|
||||||
|
|
||||||
let pio = self.platform_io_mut();
|
let pio = self.platform_io_mut();
|
||||||
pio.platform_create_window = Some(crate::platform_io::platform_create_window);
|
pio.platform_create_window = Some(docking_utils::platform_create_window);
|
||||||
pio.platform_destroy_window = Some(crate::platform_io::platform_destroy_window);
|
pio.platform_destroy_window = Some(docking_utils::platform_destroy_window);
|
||||||
pio.platform_show_window = Some(crate::platform_io::platform_show_window);
|
pio.platform_show_window = Some(docking_utils::platform_show_window);
|
||||||
pio.platform_set_window_pos = Some(crate::platform_io::platform_set_window_pos);
|
pio.platform_set_window_pos = Some(docking_utils::platform_set_window_pos);
|
||||||
// since pio.platform_get_window_pos is not a C compatible function, cimgui provides an extra function to set it.
|
// since pio.platform_get_window_pos is not a C compatible function, cimgui provides an extra function to set it.
|
||||||
unsafe {
|
unsafe {
|
||||||
crate::platform_io::ImGuiPlatformIO_Set_Platform_GetWindowPos(
|
docking_utils::ImGuiPlatformIO_Set_Platform_GetWindowPos(
|
||||||
pio,
|
pio,
|
||||||
crate::platform_io::platform_get_window_pos,
|
docking_utils::platform_get_window_pos,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
pio.platform_set_window_size = Some(crate::platform_io::platform_set_window_size);
|
pio.platform_set_window_size = Some(docking_utils::platform_set_window_size);
|
||||||
// since pio.platform_get_window_size is not a C compatible function, cimgui provides an extra function to set it.
|
// since pio.platform_get_window_size is not a C compatible function, cimgui provides an extra function to set it.
|
||||||
unsafe {
|
unsafe {
|
||||||
crate::platform_io::ImGuiPlatformIO_Set_Platform_GetWindowSize(
|
docking_utils::ImGuiPlatformIO_Set_Platform_GetWindowSize(
|
||||||
pio,
|
pio,
|
||||||
crate::platform_io::platform_get_window_size,
|
docking_utils::platform_get_window_size,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
pio.platform_set_window_focus = Some(crate::platform_io::platform_set_window_focus);
|
pio.platform_set_window_focus = Some(docking_utils::platform_set_window_focus);
|
||||||
pio.platform_get_window_focus = Some(crate::platform_io::platform_get_window_focus);
|
pio.platform_get_window_focus = Some(docking_utils::platform_get_window_focus);
|
||||||
pio.platform_get_window_minimized = Some(crate::platform_io::platform_get_window_minimized);
|
pio.platform_get_window_minimized = Some(docking_utils::platform_get_window_minimized);
|
||||||
pio.platform_set_window_title = Some(crate::platform_io::platform_set_window_title);
|
pio.platform_set_window_title = Some(docking_utils::platform_set_window_title);
|
||||||
pio.platform_set_window_alpha = Some(crate::platform_io::platform_set_window_alpha);
|
pio.platform_set_window_alpha = Some(docking_utils::platform_set_window_alpha);
|
||||||
pio.platform_update_window = Some(crate::platform_io::platform_update_window);
|
pio.platform_update_window = Some(docking_utils::platform_update_window);
|
||||||
pio.platform_render_window = Some(crate::platform_io::platform_render_window);
|
pio.platform_render_window = Some(docking_utils::platform_render_window);
|
||||||
pio.platform_swap_buffers = Some(crate::platform_io::platform_swap_buffers);
|
pio.platform_swap_buffers = Some(docking_utils::platform_swap_buffers);
|
||||||
pio.platform_create_vk_surface = Some(crate::platform_io::platform_create_vk_surface);
|
pio.platform_create_vk_surface = Some(docking_utils::platform_create_vk_surface);
|
||||||
|
|
||||||
self.platform_viewport_ctx = ctx;
|
self.platform_viewport_ctx = ctx;
|
||||||
}
|
}
|
||||||
@ -717,11 +726,11 @@ impl Context {
|
|||||||
io.backend_renderer_user_data = ctx.get() as *mut _;
|
io.backend_renderer_user_data = ctx.get() as *mut _;
|
||||||
|
|
||||||
let pio = self.platform_io_mut();
|
let pio = self.platform_io_mut();
|
||||||
pio.renderer_create_window = Some(crate::platform_io::renderer_create_window);
|
pio.renderer_create_window = Some(docking_utils::renderer_create_window);
|
||||||
pio.renderer_destroy_window = Some(crate::platform_io::renderer_destroy_window);
|
pio.renderer_destroy_window = Some(docking_utils::renderer_destroy_window);
|
||||||
pio.renderer_set_window_size = Some(crate::platform_io::renderer_set_window_size);
|
pio.renderer_set_window_size = Some(docking_utils::renderer_set_window_size);
|
||||||
pio.renderer_render_window = Some(crate::platform_io::renderer_render_window);
|
pio.renderer_render_window = Some(docking_utils::renderer_render_window);
|
||||||
pio.renderer_swap_buffers = Some(crate::platform_io::renderer_swap_buffers);
|
pio.renderer_swap_buffers = Some(docking_utils::renderer_swap_buffers);
|
||||||
|
|
||||||
self.renderer_viewport_ctx = ctx;
|
self.renderer_viewport_ctx = ctx;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ impl Ui {
|
|||||||
pub fn dockspace_over_main_viewport(&self) {
|
pub fn dockspace_over_main_viewport(&self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
sys::igDockSpaceOverViewport(
|
sys::igDockSpaceOverViewport(
|
||||||
|
0,
|
||||||
sys::igGetMainViewport(),
|
sys::igGetMainViewport(),
|
||||||
sys::ImGuiDockNodeFlags_PassthruCentralNode as i32,
|
sys::ImGuiDockNodeFlags_PassthruCentralNode as i32,
|
||||||
null(),
|
null(),
|
||||||
|
|||||||
@ -3,12 +3,7 @@ use std::{
|
|||||||
os::raw::{c_char, c_int},
|
os::raw::{c_char, c_int},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{Io, PlatformIo, Viewport};
|
||||||
internal::{ImVector, RawCast},
|
|
||||||
Io, ViewportFlags,
|
|
||||||
};
|
|
||||||
|
|
||||||
todo!("needs to be checked with docking feature...");
|
|
||||||
|
|
||||||
/// Trait holding functions needed when the platform integration supports viewports.
|
/// Trait holding functions needed when the platform integration supports viewports.
|
||||||
///
|
///
|
||||||
@ -353,6 +348,8 @@ pub struct PlatformMonitor {
|
|||||||
/// Set to `work_size` if not known.
|
/// Set to `work_size` if not known.
|
||||||
pub work_size: [f32; 2],
|
pub work_size: [f32; 2],
|
||||||
pub dpi_scale: f32,
|
pub dpi_scale: f32,
|
||||||
|
|
||||||
|
pub platform_handle: *mut c_void,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -382,6 +379,7 @@ fn test_platform_monitor_memory_layout() {
|
|||||||
assert_field_offset!(work_pos, WorkPos);
|
assert_field_offset!(work_pos, WorkPos);
|
||||||
assert_field_offset!(work_size, WorkSize);
|
assert_field_offset!(work_size, WorkSize);
|
||||||
assert_field_offset!(dpi_scale, DpiScale);
|
assert_field_offset!(dpi_scale, DpiScale);
|
||||||
|
assert_field_offset!(platform_handle, PlatformHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@ -140,7 +140,7 @@ impl<'ui> DrawListMut<'ui> {
|
|||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(feature = "docking")] {
|
if #[cfg(feature = "docking")] {
|
||||||
// Has extra overload in docking branch
|
// Has extra overload in docking branch
|
||||||
sys::igGetBackgroundDrawList_Nil()
|
sys::igGetBackgroundDrawList(std::ptr::null_mut())
|
||||||
} else {
|
} else {
|
||||||
sys::igGetBackgroundDrawList()
|
sys::igGetBackgroundDrawList()
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ impl<'ui> DrawListMut<'ui> {
|
|||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(feature = "docking")] {
|
if #[cfg(feature = "docking")] {
|
||||||
// Has extra overload in docking branch
|
// Has extra overload in docking branch
|
||||||
sys::igGetForegroundDrawList_Nil()
|
sys::igGetForegroundDrawList_ViewportPtr(std::ptr::null_mut())
|
||||||
} else {
|
} else {
|
||||||
sys::igGetForegroundDrawList()
|
sys::igGetForegroundDrawList()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,7 +82,7 @@ bitflags! {
|
|||||||
#[cfg(feature = "docking")]
|
#[cfg(feature = "docking")]
|
||||||
const TOP_MOST = sys::ImGuiViewportFlags_TopMost;
|
const TOP_MOST = sys::ImGuiViewportFlags_TopMost;
|
||||||
#[cfg(feature = "docking")]
|
#[cfg(feature = "docking")]
|
||||||
const MINIMIZED = sys::ImGuiViewportFlags_Minimized;
|
const IS_MINIMIZED = sys::ImGuiViewportFlags_IsMinimized;
|
||||||
#[cfg(feature = "docking")]
|
#[cfg(feature = "docking")]
|
||||||
const NO_AUTO_MERGE = sys::ImGuiViewportFlags_NoAutoMerge;
|
const NO_AUTO_MERGE = sys::ImGuiViewportFlags_NoAutoMerge;
|
||||||
#[cfg(feature = "docking")]
|
#[cfg(feature = "docking")]
|
||||||
@ -146,6 +146,23 @@ pub struct Io {
|
|||||||
/// framebuffer coordinates
|
/// framebuffer coordinates
|
||||||
pub display_framebuffer_scale: [f32; 2],
|
pub display_framebuffer_scale: [f32; 2],
|
||||||
|
|
||||||
|
#[cfg(feature = "docking")]
|
||||||
|
pub config_docking_no_split: bool,
|
||||||
|
#[cfg(feature = "docking")]
|
||||||
|
pub config_docking_with_shift: bool,
|
||||||
|
#[cfg(feature = "docking")]
|
||||||
|
pub config_docking_always_tab_bar: bool,
|
||||||
|
#[cfg(feature = "docking")]
|
||||||
|
pub config_docking_transparent_payload: bool,
|
||||||
|
#[cfg(feature = "docking")]
|
||||||
|
pub config_viewports_no_auto_merge: bool,
|
||||||
|
#[cfg(feature = "docking")]
|
||||||
|
pub config_viewports_no_task_bar_icon: bool,
|
||||||
|
#[cfg(feature = "docking")]
|
||||||
|
pub config_viewports_no_decoration: bool,
|
||||||
|
#[cfg(feature = "docking")]
|
||||||
|
pub config_viewports_no_default_parent: bool,
|
||||||
|
|
||||||
/// Request imgui-rs to draw a mouse cursor for you
|
/// Request imgui-rs to draw a mouse cursor for you
|
||||||
pub mouse_draw_cursor: bool,
|
pub mouse_draw_cursor: bool,
|
||||||
/// macOS-style input behavior.
|
/// macOS-style input behavior.
|
||||||
@ -287,6 +304,9 @@ pub struct Io {
|
|||||||
/// Notates the origin of the mouse input event.
|
/// Notates the origin of the mouse input event.
|
||||||
pub mouse_source: MouseSource,
|
pub mouse_source: MouseSource,
|
||||||
|
|
||||||
|
#[cfg(feature = "docking")]
|
||||||
|
mouse_hovered_viewport: sys::ImGuiID,
|
||||||
|
|
||||||
/// Keyboard modifier pressed: Control
|
/// Keyboard modifier pressed: Control
|
||||||
pub key_ctrl: bool,
|
pub key_ctrl: bool,
|
||||||
/// Keyboard modifier pressed: Shift
|
/// Keyboard modifier pressed: Shift
|
||||||
@ -336,38 +356,6 @@ pub struct Io {
|
|||||||
|
|
||||||
input_queue_surrogate: sys::ImWchar16,
|
input_queue_surrogate: sys::ImWchar16,
|
||||||
input_queue_characters: ImVector<sys::ImWchar>,
|
input_queue_characters: ImVector<sys::ImWchar>,
|
||||||
|
|
||||||
#[cfg(feature = "docking")]
|
|
||||||
mouse_hovered_viewport: sys::ImGuiID,
|
|
||||||
|
|
||||||
#[cfg(feature = "docking")]
|
|
||||||
pub config_docking_no_split: bool,
|
|
||||||
#[cfg(feature = "docking")]
|
|
||||||
pub config_docking_with_shift: bool,
|
|
||||||
#[cfg(feature = "docking")]
|
|
||||||
pub config_docking_always_tab_bar: bool,
|
|
||||||
#[cfg(feature = "docking")]
|
|
||||||
pub config_docking_transparent_payload: bool,
|
|
||||||
#[cfg(feature = "docking")]
|
|
||||||
pub config_viewports_no_auto_merge: bool,
|
|
||||||
#[cfg(feature = "docking")]
|
|
||||||
pub config_viewports_no_task_bar_icon: bool,
|
|
||||||
#[cfg(feature = "docking")]
|
|
||||||
pub config_viewports_no_decoration: bool,
|
|
||||||
#[cfg(feature = "docking")]
|
|
||||||
pub config_viewports_no_default_parent: bool,
|
|
||||||
// pub(crate) get_clipboard_text_fn:
|
|
||||||
// Option<unsafe extern "C" fn(user_data: *mut c_void) -> *const c_char>,
|
|
||||||
// pub(crate) set_clipboard_text_fn:
|
|
||||||
// Option<unsafe extern "C" fn(user_data: *mut c_void, text: *const c_char)>,
|
|
||||||
// pub(crate) clipboard_user_data: *mut c_void,
|
|
||||||
// pub set_platform_ime_data_fn: Option<
|
|
||||||
// unsafe extern "C" fn(
|
|
||||||
// viewport: *mut sys::ImGuiViewport,
|
|
||||||
// data: *mut sys::ImGuiPlatformImeData,
|
|
||||||
// ),
|
|
||||||
// >,
|
|
||||||
// unused_padding: *mut c_void,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl RawCast<sys::ImGuiIO> for Io {}
|
unsafe impl RawCast<sys::ImGuiIO> for Io {}
|
||||||
@ -498,6 +486,14 @@ fn test_io_memory_layout() {
|
|||||||
assert_field_offset!(font_allow_user_scaling, FontAllowUserScaling);
|
assert_field_offset!(font_allow_user_scaling, FontAllowUserScaling);
|
||||||
assert_field_offset!(font_default, FontDefault);
|
assert_field_offset!(font_default, FontDefault);
|
||||||
assert_field_offset!(display_framebuffer_scale, DisplayFramebufferScale);
|
assert_field_offset!(display_framebuffer_scale, DisplayFramebufferScale);
|
||||||
|
assert_field_offset!(config_docking_no_split, ConfigDockingNoSplit);
|
||||||
|
assert_field_offset!(config_docking_with_shift, ConfigDockingWithShift);
|
||||||
|
assert_field_offset!(config_docking_always_tab_bar, ConfigDockingAlwaysTabBar);
|
||||||
|
assert_field_offset!(config_docking_transparent_payload, ConfigDockingTransparentPayload);
|
||||||
|
assert_field_offset!(config_viewports_no_auto_merge, ConfigViewportsNoAutoMerge);
|
||||||
|
assert_field_offset!(config_viewports_no_task_bar_icon, ConfigViewportsNoTaskBarIcon);
|
||||||
|
assert_field_offset!(config_viewports_no_decoration, ConfigViewportsNoDecoration);
|
||||||
|
assert_field_offset!(config_viewports_no_default_parent, ConfigViewportsNoDefaultParent);
|
||||||
assert_field_offset!(mouse_draw_cursor, MouseDrawCursor);
|
assert_field_offset!(mouse_draw_cursor, MouseDrawCursor);
|
||||||
assert_field_offset!(config_mac_os_behaviors, ConfigMacOSXBehaviors);
|
assert_field_offset!(config_mac_os_behaviors, ConfigMacOSXBehaviors);
|
||||||
assert_field_offset!(
|
assert_field_offset!(
|
||||||
@ -539,6 +535,8 @@ fn test_io_memory_layout() {
|
|||||||
assert_field_offset!(mouse_down, MouseDown);
|
assert_field_offset!(mouse_down, MouseDown);
|
||||||
assert_field_offset!(mouse_wheel, MouseWheel);
|
assert_field_offset!(mouse_wheel, MouseWheel);
|
||||||
assert_field_offset!(mouse_wheel_h, MouseWheelH);
|
assert_field_offset!(mouse_wheel_h, MouseWheelH);
|
||||||
|
assert_field_offset!(mouse_source, MouseSource);
|
||||||
|
assert_field_offset!(mouse_hovered_viewport, MouseHoveredViewport);
|
||||||
assert_field_offset!(key_ctrl, KeyCtrl);
|
assert_field_offset!(key_ctrl, KeyCtrl);
|
||||||
assert_field_offset!(key_shift, KeyShift);
|
assert_field_offset!(key_shift, KeyShift);
|
||||||
assert_field_offset!(key_alt, KeyAlt);
|
assert_field_offset!(key_alt, KeyAlt);
|
||||||
|
|||||||
@ -93,6 +93,8 @@ use std::os::raw::c_char;
|
|||||||
pub use self::clipboard::*;
|
pub use self::clipboard::*;
|
||||||
pub use self::color::ImColor32;
|
pub use self::color::ImColor32;
|
||||||
pub use self::context::*;
|
pub use self::context::*;
|
||||||
|
#[cfg(feature = "docking")]
|
||||||
|
pub use self::docking_utils::*;
|
||||||
pub use self::drag_drop::{DragDropFlags, DragDropSource, DragDropTarget};
|
pub use self::drag_drop::{DragDropFlags, DragDropSource, DragDropTarget};
|
||||||
pub use self::draw_list::{ChannelsSplit, DrawListMut};
|
pub use self::draw_list::{ChannelsSplit, DrawListMut};
|
||||||
pub use self::fonts::atlas::*;
|
pub use self::fonts::atlas::*;
|
||||||
@ -150,6 +152,7 @@ mod context;
|
|||||||
mod dock_space;
|
mod dock_space;
|
||||||
#[cfg(feature = "docking")]
|
#[cfg(feature = "docking")]
|
||||||
mod docking_utils;
|
mod docking_utils;
|
||||||
|
|
||||||
pub mod drag_drop;
|
pub mod drag_drop;
|
||||||
pub mod draw_list;
|
pub mod draw_list;
|
||||||
mod fonts;
|
mod fonts;
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
use std::ffi::{c_char, c_void};
|
use std::ffi::{c_char, c_void};
|
||||||
|
|
||||||
use crate::{internal::RawCast, ViewportFlags};
|
use crate::{
|
||||||
|
internal::{ImVector, RawCast},
|
||||||
|
PlatformMonitor, ViewportFlags,
|
||||||
|
};
|
||||||
|
|
||||||
/// Holds the information needed to enable multiple viewports.
|
/// Holds the information needed to enable multiple viewports.
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
@ -61,9 +64,15 @@ pub struct PlatformIo {
|
|||||||
pub(crate) platform_get_window_dpi_scale: Option<unsafe extern "C" fn(*mut Viewport) -> f32>,
|
pub(crate) platform_get_window_dpi_scale: Option<unsafe extern "C" fn(*mut Viewport) -> f32>,
|
||||||
#[cfg(feature = "docking")]
|
#[cfg(feature = "docking")]
|
||||||
pub(crate) platform_on_changed_viewport: Option<unsafe extern "C" fn(*mut Viewport)>,
|
pub(crate) platform_on_changed_viewport: Option<unsafe extern "C" fn(*mut Viewport)>,
|
||||||
|
|
||||||
#[cfg(feature = "docking")]
|
#[cfg(feature = "docking")]
|
||||||
pub(crate) platform_create_vk_surface:
|
pub(crate) platform_get_window_work_area_inserts:
|
||||||
Option<unsafe extern "C" fn(*mut Viewport, u64, *const c_void, *mut u64) -> c_int>,
|
Option<unsafe extern "C" fn(vp: *mut Viewport) -> sys::ImVec4>,
|
||||||
|
|
||||||
|
#[cfg(feature = "docking")]
|
||||||
|
pub(crate) platform_create_vk_surface: Option<
|
||||||
|
unsafe extern "C" fn(*mut Viewport, u64, *const c_void, *mut u64) -> std::ffi::c_int,
|
||||||
|
>,
|
||||||
|
|
||||||
#[cfg(feature = "docking")]
|
#[cfg(feature = "docking")]
|
||||||
pub(crate) renderer_create_window: Option<unsafe extern "C" fn(*mut Viewport)>,
|
pub(crate) renderer_create_window: Option<unsafe extern "C" fn(*mut Viewport)>,
|
||||||
@ -77,7 +86,7 @@ pub struct PlatformIo {
|
|||||||
pub(crate) renderer_swap_buffers: Option<unsafe extern "C" fn(*mut Viewport, *mut c_void)>,
|
pub(crate) renderer_swap_buffers: Option<unsafe extern "C" fn(*mut Viewport, *mut c_void)>,
|
||||||
|
|
||||||
/// Holds information about the available monitors.
|
/// Holds information about the available monitors.
|
||||||
/// Should be initialized and updated by the [`PlatformViewportBackend`].
|
/// Should be initialized and updated by the [`PlatformViewportBackend`](crate::PlatformViewportBackend).
|
||||||
#[cfg(feature = "docking")]
|
#[cfg(feature = "docking")]
|
||||||
pub monitors: ImVector<PlatformMonitor>,
|
pub monitors: ImVector<PlatformMonitor>,
|
||||||
|
|
||||||
@ -161,11 +170,9 @@ pub struct Viewport {
|
|||||||
pub size: [f32; 2],
|
pub size: [f32; 2],
|
||||||
pub work_pos: [f32; 2],
|
pub work_pos: [f32; 2],
|
||||||
pub work_size: [f32; 2],
|
pub work_size: [f32; 2],
|
||||||
pub platform_handle: *mut c_void,
|
|
||||||
pub platform_handle_raw: *mut c_void,
|
|
||||||
|
|
||||||
#[cfg(feature = "docking")]
|
#[cfg(feature = "docking")]
|
||||||
pub dpi_scale: f32,
|
pub dpi_scale: f32,
|
||||||
|
|
||||||
#[cfg(feature = "docking")]
|
#[cfg(feature = "docking")]
|
||||||
pub(crate) parent_viewport_id: crate::Id,
|
pub(crate) parent_viewport_id: crate::Id,
|
||||||
#[cfg(feature = "docking")]
|
#[cfg(feature = "docking")]
|
||||||
@ -175,6 +182,10 @@ pub struct Viewport {
|
|||||||
pub renderer_user_data: *mut c_void,
|
pub renderer_user_data: *mut c_void,
|
||||||
#[cfg(feature = "docking")]
|
#[cfg(feature = "docking")]
|
||||||
pub platform_user_data: *mut c_void,
|
pub platform_user_data: *mut c_void,
|
||||||
|
|
||||||
|
pub platform_handle: *mut c_void,
|
||||||
|
pub platform_handle_raw: *mut c_void,
|
||||||
|
|
||||||
#[cfg(feature = "docking")]
|
#[cfg(feature = "docking")]
|
||||||
pub platform_window_created: bool,
|
pub platform_window_created: bool,
|
||||||
#[cfg(feature = "docking")]
|
#[cfg(feature = "docking")]
|
||||||
|
|||||||
@ -143,6 +143,11 @@ pub struct Style {
|
|||||||
///
|
///
|
||||||
/// Also applies to popups/tooltips in addition to regular windows.
|
/// Also applies to popups/tooltips in addition to regular windows.
|
||||||
pub display_safe_area_padding: [f32; 2],
|
pub display_safe_area_padding: [f32; 2],
|
||||||
|
|
||||||
|
/// Thickness of resizing border between docked windows
|
||||||
|
#[cfg(feature = "docking")]
|
||||||
|
pub docking_separator_size: f32,
|
||||||
|
|
||||||
/// Scale software-rendered mouse cursor.
|
/// Scale software-rendered mouse cursor.
|
||||||
///
|
///
|
||||||
/// May be removed later.
|
/// May be removed later.
|
||||||
@ -712,6 +717,7 @@ fn test_style_memory_layout() {
|
|||||||
assert_field_offset!(selectable_text_align, SelectableTextAlign);
|
assert_field_offset!(selectable_text_align, SelectableTextAlign);
|
||||||
assert_field_offset!(display_window_padding, DisplayWindowPadding);
|
assert_field_offset!(display_window_padding, DisplayWindowPadding);
|
||||||
assert_field_offset!(display_safe_area_padding, DisplaySafeAreaPadding);
|
assert_field_offset!(display_safe_area_padding, DisplaySafeAreaPadding);
|
||||||
|
assert_field_offset!(docking_separator_size, DockingSeparatorSize);
|
||||||
assert_field_offset!(mouse_cursor_scale, MouseCursorScale);
|
assert_field_offset!(mouse_cursor_scale, MouseCursorScale);
|
||||||
assert_field_offset!(anti_aliased_lines, AntiAliasedLines);
|
assert_field_offset!(anti_aliased_lines, AntiAliasedLines);
|
||||||
assert_field_offset!(anti_aliased_lines_use_tex, AntiAliasedLinesUseTex);
|
assert_field_offset!(anti_aliased_lines_use_tex, AntiAliasedLinesUseTex);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user