mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-14 15:08:36 +00:00
[Ui] Add with_text_wrap_pos
Wrap igPushTextWrapPos and igPopTextWrapPos.
This commit is contained in:
parent
77c79f4e61
commit
713d669783
@ -2,6 +2,10 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- `Ui::with_test_wrap_pos`
|
||||
|
||||
### Changed
|
||||
|
||||
- Upgrade to cimgui 1.65.2 / imgui 1.65. **This is a very big update, so there
|
||||
|
||||
13
src/lib.rs
13
src/lib.rs
@ -827,6 +827,19 @@ impl<'ui> Ui<'ui> {
|
||||
sys::igTextWrapped(fmt_ptr(), text.as_ptr());
|
||||
}
|
||||
}
|
||||
/// Set word-wrapping for `text_*()` commands.
|
||||
/// - `< 0.0`: no wrapping;
|
||||
/// - `= 0.0`: wrap to end of window (or column);
|
||||
/// - `> 0.0`: wrap at `wrap_pos_x` position in window local space
|
||||
pub fn with_text_wrap_pos<F: FnOnce()>(&self, wrap_pos_x: f32, f: F) {
|
||||
unsafe {
|
||||
sys::igPushTextWrapPos(wrap_pos_x);
|
||||
}
|
||||
f();
|
||||
unsafe {
|
||||
sys::igPopTextWrapPos();
|
||||
}
|
||||
}
|
||||
pub fn label_text<'p>(&self, label: &'p ImStr, text: &'p ImStr) {
|
||||
unsafe {
|
||||
sys::igLabelText(label.as_ptr(), fmt_ptr(), text.as_ptr());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user