Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

Commit

Permalink
Merge pull request #119 from fsomers/window-content-region
Browse files Browse the repository at this point in the history
Add support for WindowContentRegion{Min,Max,Width}
  • Loading branch information
dertseha authored Aug 30, 2020
2 parents 1f38586 + ea68240 commit f78f02f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Window.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,30 @@ func ContentRegionMax() Vec2 {
return out
}

// WindowContentRegionMin returns the content boundaries min (roughly (0,0)-Scroll), in window coordinates.
func WindowContentRegionMin() Vec2 {
out := Vec2{}
outArg, outFin := out.wrapped()
C.iggGetWindowContentRegionMin(outArg)
outFin()
return out
}

// WindowContentRegionMax returns the content boundaries max (roughly (0,0)+Size-Scroll) where Size can be overridden
// with SetNextWindowContentSize(), in window coordinates.
func WindowContentRegionMax() Vec2 {
out := Vec2{}
outArg, outFin := out.wrapped()
C.iggGetWindowContentRegionMax(outArg)
outFin()
return out
}

// WindowContentRegionWidth returns the width of the content boundary, in window coordinates.
func WindowContentRegionWidth() float32 {
return float32(C.iggGetWindowContentRegionWidth())
}

// SetNextWindowPosV sets next window position.
// Call before Begin(). Use pivot=(0.5,0.5) to center on given point, etc.
func SetNextWindowPosV(pos Vec2, cond Condition, pivot Vec2) {
Expand Down
17 changes: 17 additions & 0 deletions wrapper/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,23 @@ void iggGetContentRegionMax(IggVec2 *out)
exportValue(*out, im_out);
}

void iggGetWindowContentRegionMin(IggVec2 *out)
{
ImVec2 im_out = ImGui::GetWindowContentRegionMin();
exportValue(*out, im_out);
}

void iggGetWindowContentRegionMax(IggVec2 *out)
{
ImVec2 im_out = ImGui::GetWindowContentRegionMax();
exportValue(*out, im_out);
}

float iggGetWindowContentRegionWidth()
{
return ImGui::GetWindowContentRegionWidth();
}

void iggSetNextWindowPos(IggVec2 const *pos, int cond, IggVec2 const *pivot)
{
Vec2Wrapper posArg(pos);
Expand Down
3 changes: 3 additions & 0 deletions wrapper/Window.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ extern float iggWindowWidth(void);
extern float iggWindowHeight(void);
extern void iggContentRegionAvail(IggVec2 *size);
extern void iggGetContentRegionMax(IggVec2 *out);
extern void iggGetWindowContentRegionMin(IggVec2 *out);
extern void iggGetWindowContentRegionMax(IggVec2 *out);
extern float iggGetWindowContentRegionWidth();

extern void iggSetNextWindowPos(IggVec2 const *pos, int cond, IggVec2 const *pivot);
extern void iggSetNextWindowSize(IggVec2 const *size, int cond);
Expand Down

0 comments on commit f78f02f

Please sign in to comment.