mirror of
				https://github.com/Drezil/dear-imgui.hs.git
				synced 2025-11-04 07:01:06 +01:00 
			
		
		
		
	Wrap ImGui::BeginChild and EndChild (#21)
This commit is contained in:
		
							
								
								
									
										4
									
								
								Main.hs
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								Main.hs
									
									
									
									
									
								
							@@ -78,11 +78,15 @@ loop w checked color slider = do
 | 
			
		||||
 | 
			
		||||
  progressBar 0.314 (Just "Pi")
 | 
			
		||||
 | 
			
		||||
  beginChild "Child"
 | 
			
		||||
 | 
			
		||||
  beginCombo "Label" "Preview" >>= whenTrue do
 | 
			
		||||
    selectable "Testing 1"
 | 
			
		||||
    selectable "Testing 2"
 | 
			
		||||
    endCombo
 | 
			
		||||
 | 
			
		||||
  endChild
 | 
			
		||||
 | 
			
		||||
  plotHistogram "A histogram" [ 10, 10, 20, 30, 90 ]
 | 
			
		||||
 | 
			
		||||
  colorPicker3 "Test" color
 | 
			
		||||
 
 | 
			
		||||
@@ -43,6 +43,10 @@ module DearImGui
 | 
			
		||||
  , begin
 | 
			
		||||
  , end
 | 
			
		||||
 | 
			
		||||
    -- * Child Windows
 | 
			
		||||
  , beginChild
 | 
			
		||||
  , endChild
 | 
			
		||||
 | 
			
		||||
    -- * Cursor/Layout
 | 
			
		||||
  , separator
 | 
			
		||||
  , sameLine
 | 
			
		||||
@@ -276,6 +280,19 @@ end = liftIO do
 | 
			
		||||
  [C.exp| void { ImGui::End(); } |]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
-- | Wraps @ImGui::BeginChild()@.
 | 
			
		||||
beginChild :: MonadIO m => String -> m Bool
 | 
			
		||||
beginChild name = liftIO do
 | 
			
		||||
  withCString name \namePtr ->
 | 
			
		||||
    (0 /=) <$> [C.exp| bool { ImGui::BeginChild($(char* namePtr)) } |]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
-- | Wraps @ImGui::EndChild()@.
 | 
			
		||||
endChild :: MonadIO m => m ()
 | 
			
		||||
endChild = liftIO do
 | 
			
		||||
  [C.exp| void { ImGui::EndChild(); } |]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
-- | Separator, generally horizontal. inside a menu bar or in horizontal layout
 | 
			
		||||
-- mode, this becomes a vertical separator.
 | 
			
		||||
--
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user