forked from AllenDang/imgui-go
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathListClipper.cpp
57 lines (50 loc) · 1.81 KB
/
ListClipper.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "imguiWrappedHeader.h"
#include "ListClipper.h"
#include "WrapperConverter.h"
static void importValue(ImGuiListClipper &out, IggListClipper const &in);
static void exportValue(IggListClipper &out, ImGuiListClipper const &in);
typedef TypeWrapper<ImGuiListClipper, IggListClipper> ListClipperWrapper;
IggBool iggListClipperStep(IggListClipper *clipper)
{
ImGuiListClipper imguiClipper;
importValue(imguiClipper, *clipper);
IggBool returnValue = imguiClipper.Step() ? 1 : 0;
exportValue(*clipper, imguiClipper);
// needs to be done to prevent assert fail, we don't call end because the cursor will move.
imguiClipper.ItemsCount = -1;
return returnValue;
}
void iggListClipperBegin(IggListClipper *clipper, int items_count, float items_height)
{
ImGuiListClipper imguiClipper;
importValue(imguiClipper, *clipper);
imguiClipper.Begin(items_count, items_height);
exportValue(*clipper, imguiClipper);
// needs to be done to prevent assert fail, we don't call end because the cursor will move.
imguiClipper.ItemsCount = -1;
}
void iggListClipperEnd(IggListClipper *clipper)
{
ImGuiListClipper imguiClipper;
importValue(imguiClipper, *clipper);
imguiClipper.End();
exportValue(*clipper, imguiClipper);
}
static void importValue(ImGuiListClipper &out, IggListClipper const &in)
{
out.StartPosY = in.StartPosY;
out.ItemsHeight = in.ItemsHeight;
out.ItemsCount = in.ItemsCount;
out.StepNo = in.StepNo;
out.DisplayStart = in.DisplayStart;
out.DisplayEnd = in.DisplayEnd;
}
static void exportValue(IggListClipper &out, ImGuiListClipper const &in)
{
out.StartPosY = in.StartPosY;
out.ItemsHeight = in.ItemsHeight;
out.ItemsCount = in.ItemsCount;
out.StepNo = in.StepNo;
out.DisplayStart = in.DisplayStart;
out.DisplayEnd = in.DisplayEnd;
}