Skip to content

Commit b68a14a

Browse files
committed
- Add pushItemFlag / popItemFlag
- Add setNextFrameWantCaptureMouse / setNextFrameWantCaptureKeyboard - Add addFontDefault
1 parent c5f1a77 commit b68a14a

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

src/gui.zig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ pub const FontConfig = extern struct {
206206
};
207207

208208
pub const io = struct {
209+
pub fn addFontDefault(config: ?FontConfig) Font {
210+
return zguiIoAddFontDefault(if (config) |c| &c else null);
211+
}
212+
extern fn zguiIoAddFontDefault(config: ?*const FontConfig) Font;
213+
209214
pub fn addFontFromFile(filename: [:0]const u8, size_pixels: f32) Font {
210215
return zguiIoAddFontFromFile(filename, size_pixels);
211216
}
@@ -1317,6 +1322,19 @@ pub fn popStyleVar(args: struct {
13171322
extern fn zguiPopStyleVar(count: c_int) void;
13181323

13191324
//--------------------------------------------------------------------------------------------------
1325+
pub const ItemFlag = enum(c_int) {
1326+
none = 0,
1327+
no_tab_stop = 1 << 0,
1328+
no_nav = 1 << 1,
1329+
no_nav_default_focus = 1 << 2,
1330+
button_repeat = 1 << 3,
1331+
auto_close_popups = 1 << 4,
1332+
allow_duplicate_id = 1 << 5,
1333+
};
1334+
/// `void pushItemFlag(item_flag: ItemFlag, enabled: bool) void`
1335+
pub const pushItemFlag = zguiPushItemFlag;
1336+
/// `void popItemFlag() void`
1337+
pub const popItemFlag = zguiPopItemFlag;
13201338
/// `void pushItemWidth(item_width: f32) void`
13211339
pub const pushItemWidth = zguiPushItemWidth;
13221340
/// `void popItemWidth() void`
@@ -1325,6 +1343,8 @@ pub const popItemWidth = zguiPopItemWidth;
13251343
pub const setNextItemWidth = zguiSetNextItemWidth;
13261344
/// `void setItemDefaultFocus() void`
13271345
pub const setItemDefaultFocus = zguiSetItemDefaultFocus;
1346+
extern fn zguiPushItemFlag(item_flag: ItemFlag, enabled: bool) void;
1347+
extern fn zguiPopItemFlag() void;
13281348
extern fn zguiPushItemWidth(item_width: f32) void;
13291349
extern fn zguiPopItemWidth() void;
13301350
extern fn zguiSetNextItemWidth(item_width: f32) void;

src/zgui.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ extern "C"
362362
ImGui::SetMouseCursor(cursor);
363363
}
364364

365-
ZGUI_API void zguiSetNextFrameWantCaptureMouse(bool want_capture_mouse)
365+
ZGUI_API void zguiSetNextFrameWantCaptureMouse(bool want_capture_mouse)
366366
{
367367
ImGui::SetNextFrameWantCaptureMouse(want_capture_mouse);
368368
}
@@ -1314,6 +1314,16 @@ extern "C"
13141314
ImGui::PopStyleVar(count);
13151315
}
13161316

1317+
ZGUI_API void zguiPushItemFlag(int item_flag, bool enabled)
1318+
{
1319+
ImGui::PushItemFlag(item_flag, enabled);
1320+
}
1321+
1322+
ZGUI_API void zguiPopItemFlag()
1323+
{
1324+
ImGui::PopItemFlag();
1325+
}
1326+
13171327
ZGUI_API void zguiPushItemWidth(float item_width)
13181328
{
13191329
ImGui::PushItemWidth(item_width);
@@ -1492,6 +1502,11 @@ extern "C"
14921502
return ImGui::GetClipboardText();
14931503
}
14941504

1505+
ZGUI_API ImFont *zguiIoAddFontDefault(const ImFontConfig *config)
1506+
{
1507+
return ImGui::GetIO().Fonts->AddFontDefault(config);
1508+
}
1509+
14951510
ZGUI_API ImFont *zguiIoAddFontFromFileWithConfig(
14961511
const char *filename,
14971512
float size_pixels,

0 commit comments

Comments
 (0)