Skip to content

Commit fc8f0b0

Browse files
committed
Add ImGuiStyle helper methods to get ImVec2 values
1 parent f555f84 commit fc8f0b0

File tree

1 file changed

+160
-0
lines changed

1 file changed

+160
-0
lines changed

imgui-binding/src/main/java/imgui/ImGuiStyle.java

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,20 @@ public void destroy() {
7171
Jni::ImVec2Cpy(env, &IMGUI_STYLE->WindowPadding, dstImVec2);
7272
*/
7373

74+
/**
75+
* Padding within a window.
76+
*/
77+
public native float getWindowPaddingX(); /*
78+
return IMGUI_STYLE->WindowPadding.x;
79+
*/
80+
81+
/**
82+
* Padding within a window.
83+
*/
84+
public native float getWindowPaddingY(); /*
85+
return IMGUI_STYLE->WindowPadding.y;
86+
*/
87+
7488
/**
7589
* Padding within a window.
7690
*/
@@ -116,6 +130,20 @@ public void destroy() {
116130
Jni::ImVec2Cpy(env, &IMGUI_STYLE->WindowMinSize, dstImVec2);
117131
*/
118132

133+
/**
134+
* Minimum window size. This is a global setting. If you want to constraint individual windows, use SetNextWindowSizeConstraints().
135+
*/
136+
public native float getWindowMinSizeX(); /*
137+
return IMGUI_STYLE->WindowMinSize.x;
138+
*/
139+
140+
/**
141+
* Minimum window size. This is a global setting. If you want to constraint individual windows, use SetNextWindowSizeConstraints().
142+
*/
143+
public native float getWindowMinSizeY(); /*
144+
return IMGUI_STYLE->WindowMinSize.y;
145+
*/
146+
119147
/**
120148
* Minimum window size. This is a global setting. If you want to constraint individual windows, use SetNextWindowSizeConstraints().
121149
*/
@@ -131,6 +159,20 @@ public void destroy() {
131159
Jni::ImVec2Cpy(env, &IMGUI_STYLE->WindowTitleAlign, dstImVec2);
132160
*/
133161

162+
/**
163+
* Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered.
164+
*/
165+
public native float getWindowTitleAlignX(); /*
166+
return IMGUI_STYLE->WindowTitleAlign.x;
167+
*/
168+
169+
/**
170+
* Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered.
171+
*/
172+
public native float getWindowTitleAlignY(); /*
173+
return IMGUI_STYLE->WindowTitleAlign.y;
174+
*/
175+
134176
/**
135177
* Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered.
136178
*/
@@ -216,6 +258,20 @@ public void destroy() {
216258
Jni::ImVec2Cpy(env, &IMGUI_STYLE->FramePadding, dstImVec2);
217259
*/
218260

261+
/**
262+
* Padding within a framed rectangle (used by most widgets).
263+
*/
264+
public native float getFramePaddingX(); /*
265+
return IMGUI_STYLE->FramePadding.x;
266+
*/
267+
268+
/**
269+
* Padding within a framed rectangle (used by most widgets).
270+
*/
271+
public native float getFramePaddingY(); /*
272+
return IMGUI_STYLE->FramePadding.y;
273+
*/
274+
219275
/**
220276
* Padding within a framed rectangle (used by most widgets).
221277
*/
@@ -259,6 +315,20 @@ public void destroy() {
259315
Jni::ImVec2Cpy(env, &IMGUI_STYLE->ItemSpacing, dstImVec2);
260316
*/
261317

318+
/**
319+
* Horizontal and vertical spacing between widgets/lines.
320+
*/
321+
public native float getItemSpacingX(); /*
322+
return IMGUI_STYLE->ItemSpacing.x;
323+
*/
324+
325+
/**
326+
* Horizontal and vertical spacing between widgets/lines.
327+
*/
328+
public native float getItemSpacingY(); /*
329+
return IMGUI_STYLE->ItemSpacing.y;
330+
*/
331+
262332
/**
263333
* Horizontal and vertical spacing between widgets/lines.
264334
*/
@@ -274,6 +344,20 @@ public void destroy() {
274344
Jni::ImVec2Cpy(env, &IMGUI_STYLE->ItemInnerSpacing, dstImVec2);
275345
*/
276346

347+
/**
348+
* Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label).
349+
*/
350+
public native float getItemInnerSpacingX(); /*
351+
return IMGUI_STYLE->ItemInnerSpacing.x;
352+
*/
353+
354+
/**
355+
* Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label).
356+
*/
357+
public native float getItemInnerSpacingY(); /*
358+
return IMGUI_STYLE->ItemInnerSpacing.y;
359+
*/
360+
277361
/**
278362
* Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label).
279363
*/
@@ -290,6 +374,22 @@ public void destroy() {
290374
Jni::ImVec2Cpy(env, &IMGUI_STYLE->TouchExtraPadding, dstImVec2);
291375
*/
292376

377+
/**
378+
* Expand reactive bounding box for touch-based system where touch position is not accurate enough.
379+
* Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
380+
*/
381+
public native float getTouchExtraPaddingX(); /*
382+
return IMGUI_STYLE->TouchExtraPadding.x;
383+
*/
384+
385+
/**
386+
* Expand reactive bounding box for touch-based system where touch position is not accurate enough.
387+
* Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
388+
*/
389+
public native float getTouchExtraPaddingY(); /*
390+
return IMGUI_STYLE->TouchExtraPadding.y;
391+
*/
392+
293393
/**
294394
* Expand reactive bounding box for touch-based system where touch position is not accurate enough.
295395
* Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
@@ -448,6 +548,20 @@ public void destroy() {
448548
Jni::ImVec2Cpy(env, &IMGUI_STYLE->ButtonTextAlign, dstImVec2);
449549
*/
450550

551+
/**
552+
* Alignment of button text when button is larger than text. Defaults to (0.5f, 0.5f) (centered).
553+
*/
554+
public native float getButtonTextAlignX(); /*
555+
return IMGUI_STYLE->ButtonTextAlign.x;
556+
*/
557+
558+
/**
559+
* Alignment of button text when button is larger than text. Defaults to (0.5f, 0.5f) (centered).
560+
*/
561+
public native float getButtonTextAlignY(); /*
562+
return IMGUI_STYLE->ButtonTextAlign.y;
563+
*/
564+
451565
/**
452566
* Alignment of button text when button is larger than text. Defaults to (0.5f, 0.5f) (centered).
453567
*/
@@ -464,6 +578,22 @@ public void destroy() {
464578
Jni::ImVec2Cpy(env, &IMGUI_STYLE->SelectableTextAlign, dstImVec2);
465579
*/
466580

581+
/**
582+
* Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned).
583+
* It's generally important to keep this left-aligned if you want to lay multiple items on a same line.
584+
*/
585+
public native float getSelectableTextAlignX(); /*
586+
return IMGUI_STYLE->SelectableTextAlign.x;
587+
*/
588+
589+
/**
590+
* Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned).
591+
* It's generally important to keep this left-aligned if you want to lay multiple items on a same line.
592+
*/
593+
public native float getSelectableTextAlignY(); /*
594+
return IMGUI_STYLE->SelectableTextAlign.y;
595+
*/
596+
467597
/**
468598
* Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned).
469599
* It's generally important to keep this left-aligned if you want to lay multiple items on a same line.
@@ -480,6 +610,20 @@ public void destroy() {
480610
Jni::ImVec2Cpy(env, &IMGUI_STYLE->DisplayWindowPadding, dstImVec2);
481611
*/
482612

613+
/**
614+
* Window position are clamped to be visible within the display area by at least this amount. Only applies to regular windows.
615+
*/
616+
public native float getDisplayWindowPaddingX(); /*
617+
return IMGUI_STYLE->DisplayWindowPadding.x;
618+
*/
619+
620+
/**
621+
* Window position are clamped to be visible within the display area by at least this amount. Only applies to regular windows.
622+
*/
623+
public native float getDisplayWindowPaddingY(); /*
624+
return IMGUI_STYLE->DisplayWindowPadding.y;
625+
*/
626+
483627
/**
484628
* Window position are clamped to be visible within the display area by at least this amount. Only applies to regular windows.
485629
*/
@@ -496,6 +640,22 @@ public void destroy() {
496640
Jni::ImVec2Cpy(env, &IMGUI_STYLE->DisplaySafeAreaPadding, dstImVec2);
497641
*/
498642

643+
/**
644+
* If you cannot see the edges of your screen (e.g. on a TV) increase the safe area padding.
645+
* Apply to popups/tooltips as well regular windows. NB: Prefer configuring your TV sets correctly!
646+
*/
647+
public native float getDisplaySafeAreaPaddingX(); /*
648+
return IMGUI_STYLE->DisplaySafeAreaPadding.x;
649+
*/
650+
651+
/**
652+
* If you cannot see the edges of your screen (e.g. on a TV) increase the safe area padding.
653+
* Apply to popups/tooltips as well regular windows. NB: Prefer configuring your TV sets correctly!
654+
*/
655+
public native float getDisplaySafeAreaPaddingY(); /*
656+
return IMGUI_STYLE->DisplaySafeAreaPadding.y;
657+
*/
658+
499659
/**
500660
* If you cannot see the edges of your screen (e.g. on a TV) increase the safe area padding.
501661
* Apply to popups/tooltips as well regular windows. NB: Prefer configuring your TV sets correctly!

0 commit comments

Comments
 (0)