@@ -67,6 +67,15 @@ module DearImGui
67
67
-- ** Selectables
68
68
, selectable
69
69
70
+ -- ** Menus
71
+ , beginMenuBar
72
+ , endMenuBar
73
+ , beginMainMenuBar
74
+ , endMainMenuBar
75
+ , beginMenu
76
+ , endMenu
77
+ , menuItem
78
+
70
79
-- * Types
71
80
, ImGuiDir
72
81
, pattern ImGuiDirLeft
@@ -393,6 +402,66 @@ selectable label = liftIO do
393
402
(1 == ) <$> [C. exp | bool { Selectable($(char* labelPtr)) } |]
394
403
395
404
405
+ -- | Append to menu-bar of current window (requires 'ImGuiWindowFlagsMenuBar'
406
+ -- flag set on parent window).
407
+ --
408
+ -- Wraps @ImGui::BeginMenuBar()@.
409
+ beginMenuBar :: MonadIO m => m Bool
410
+ beginMenuBar = liftIO do
411
+ (1 == ) <$> [C. exp | bool { BeginMenuBar() } |]
412
+
413
+
414
+ -- | Only call 'endMenuBar' if 'beginMenuBar' returns true!
415
+ --
416
+ -- Wraps @ImGui::EndMenuBar()@.
417
+ endMenuBar :: MonadIO m => m ()
418
+ endMenuBar = liftIO do
419
+ [C. exp | void { EndMenuBar(); } |]
420
+
421
+
422
+ -- | Create and append to a full screen menu-bar.
423
+ --
424
+ -- Wraps @ImGui::BeginMainMenuBar()@.
425
+ beginMainMenuBar :: MonadIO m => m Bool
426
+ beginMainMenuBar = liftIO do
427
+ (1 == ) <$> [C. exp | bool { BeginMainMenuBar() } |]
428
+
429
+
430
+ -- | Only call 'endMainMenuBar' if 'beginMainMenuBar' returns true!
431
+ --
432
+ -- Wraps @ImGui::EndMainMenuBar()@.
433
+ endMainMenuBar :: MonadIO m => m ()
434
+ endMainMenuBar = liftIO do
435
+ [C. exp | void { EndMainMenuBar(); } |]
436
+
437
+
438
+ -- | Create a sub-menu entry.
439
+ --
440
+ -- Wraps @ImGui::BeginMenu()@.
441
+ beginMenu :: MonadIO m => String -> m Bool
442
+ beginMenu label = liftIO do
443
+ withCString label \ labelPtr ->
444
+ (1 == ) <$> [C. exp | bool { BeginMenu($(char* labelPtr)) } |]
445
+
446
+
447
+ -- | Only call 'endMenu' if 'beginMenu' returns true!
448
+ --
449
+ -- Wraps @ImGui::EndMenu()@.
450
+ endMenu :: MonadIO m => m ()
451
+ endMenu = liftIO do
452
+ [C. exp | void { EndMenu(); } |]
453
+
454
+
455
+ -- Return true when activated. Shortcuts are displayed for convenience but not
456
+ -- processed by ImGui at the moment
457
+ --
458
+ -- Wraps @ImGui::MenuItem()@
459
+ menuItem :: MonadIO m => String -> m Bool
460
+ menuItem label = liftIO do
461
+ withCString label \ labelPtr ->
462
+ (1 == ) <$> [C. exp | bool { MenuItem($(char* labelPtr)) } |]
463
+
464
+
396
465
-- | A cardinal direction.
397
466
newtype ImGuiDir = ImGuiDir CInt
398
467
0 commit comments