Skip to content

Commit 08a8626

Browse files
authored
feat(api): expose some internal Table API (#318)
resolves #230
1 parent 24c86a3 commit 08a8626

File tree

2 files changed

+112
-0
lines changed

2 files changed

+112
-0
lines changed

imgui-binding/src/generated/java/imgui/internal/ImGui.java

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,86 @@ public static void dockBuilderFinish(final int nodeId) {
11161116
ImGui::DockBuilderFinish(nodeId);
11171117
*/
11181118

1119+
// Tables: Candidates for public API
1120+
1121+
public static void tableOpenContextMenu() {
1122+
nTableOpenContextMenu();
1123+
}
1124+
1125+
public static void tableOpenContextMenu(final int columnN) {
1126+
nTableOpenContextMenu(columnN);
1127+
}
1128+
1129+
private static native void nTableOpenContextMenu(); /*
1130+
ImGui::TableOpenContextMenu();
1131+
*/
1132+
1133+
private static native void nTableOpenContextMenu(int columnN); /*
1134+
ImGui::TableOpenContextMenu(columnN);
1135+
*/
1136+
1137+
public static void tableSetColumnWidth(final int columnN, final float width) {
1138+
nTableSetColumnWidth(columnN, width);
1139+
}
1140+
1141+
private static native void nTableSetColumnWidth(int columnN, float width); /*
1142+
ImGui::TableSetColumnWidth(columnN, width);
1143+
*/
1144+
1145+
public static void tableSetColumnSortDirection(final int columnN, final int sortDirection, final boolean appendToSortSpecs) {
1146+
nTableSetColumnSortDirection(columnN, sortDirection, appendToSortSpecs);
1147+
}
1148+
1149+
private static native void nTableSetColumnSortDirection(int columnN, int sortDirection, boolean appendToSortSpecs); /*
1150+
ImGui::TableSetColumnSortDirection(columnN, static_cast<ImGuiSortDirection>(sortDirection), appendToSortSpecs);
1151+
*/
1152+
1153+
/**
1154+
* May use {@code (TableGetColumnFlags() & ImGuiTableColumnFlags_IsHovered)} instead. Return hovered column.
1155+
* Return -1 when table is not hovered. return columns_count if the unused space at the right of visible columns is hovered.
1156+
*/
1157+
public static int tableGetHoveredColumn() {
1158+
return nTableGetHoveredColumn();
1159+
}
1160+
1161+
private static native int nTableGetHoveredColumn(); /*
1162+
return ImGui::TableGetHoveredColumn();
1163+
*/
1164+
1165+
/**
1166+
* Retrieve *PREVIOUS FRAME* hovered row. This difference with TableGetHoveredColumn() is the reason why this is not public yet.
1167+
*/
1168+
public static int tableGetHoveredRow() {
1169+
return nTableGetHoveredRow();
1170+
}
1171+
1172+
private static native int nTableGetHoveredRow(); /*
1173+
return ImGui::TableGetHoveredRow();
1174+
*/
1175+
1176+
public static float tableGetHeaderRowHeight() {
1177+
return nTableGetHeaderRowHeight();
1178+
}
1179+
1180+
private static native float nTableGetHeaderRowHeight(); /*
1181+
return ImGui::TableGetHeaderRowHeight();
1182+
*/
1183+
1184+
public static void tablePushBackgroundChannel() {
1185+
nTablePushBackgroundChannel();
1186+
}
1187+
1188+
private static native void nTablePushBackgroundChannel(); /*
1189+
ImGui::TablePushBackgroundChannel();
1190+
*/
1191+
1192+
public static void tablePopBackgroundChannel() {
1193+
nTablePopBackgroundChannel();
1194+
}
1195+
1196+
private static native void nTablePopBackgroundChannel(); /*
1197+
ImGui::TablePopBackgroundChannel();
1198+
*/
11191199

11201200
// Widgets
11211201

imgui-binding/src/main/java/imgui/internal/ImGui.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,38 @@ public static void init() {
334334
@BindingMethod
335335
public static native void DockBuilderFinish(int nodeId);
336336

337+
// Tables: Candidates for public API
338+
339+
@BindingMethod
340+
public static native void TableOpenContextMenu(@OptArg int columnN);
341+
342+
@BindingMethod
343+
public static native void TableSetColumnWidth(int columnN, float width);
344+
345+
@BindingMethod
346+
public static native void TableSetColumnSortDirection(int columnN, @ArgValue(staticCast = "ImGuiSortDirection") int sortDirection, boolean appendToSortSpecs);
347+
348+
/**
349+
* May use {@code (TableGetColumnFlags() & ImGuiTableColumnFlags_IsHovered)} instead. Return hovered column.
350+
* Return -1 when table is not hovered. return columns_count if the unused space at the right of visible columns is hovered.
351+
*/
352+
@BindingMethod
353+
public static native int TableGetHoveredColumn();
354+
355+
/**
356+
* Retrieve *PREVIOUS FRAME* hovered row. This difference with TableGetHoveredColumn() is the reason why this is not public yet.
357+
*/
358+
@BindingMethod
359+
public static native int TableGetHoveredRow();
360+
361+
@BindingMethod
362+
public static native float TableGetHeaderRowHeight();
363+
364+
@BindingMethod
365+
public static native void TablePushBackgroundChannel();
366+
367+
@BindingMethod
368+
public static native void TablePopBackgroundChannel();
337369

338370
// Widgets
339371

0 commit comments

Comments
 (0)