mirror of
https://github.com/Drezil/dear-imgui.hs.git
synced 2025-07-06 04:58:48 +02:00
Implement ImGuiListClipper (#100)
* Added DearImGui.Raw.ImGuiListClipper * Added the DearImGui.withListClipper bracket * Added dependency for `vector` * Added the test in the Main.hs
This commit is contained in:
16
Main.hs
16
Main.hs
@ -7,6 +7,7 @@ module Main (main) where
|
||||
|
||||
import Control.Monad
|
||||
import Data.IORef
|
||||
import qualified Data.Vector as Vector
|
||||
import DearImGui
|
||||
import DearImGui.OpenGL3
|
||||
import DearImGui.SDL
|
||||
@ -131,6 +132,21 @@ loop window checked color slider r pos size' selected tab1Ref tab2Ref = do
|
||||
|
||||
endChild
|
||||
|
||||
text "ListClipper"
|
||||
withChildOpen "##fixed" (ImVec2 0 200) True ImGuiWindowFlags_None do
|
||||
let lotsOfItems = Vector.generate 50 (mappend "Item " . show)
|
||||
withListClipper Nothing lotsOfItems text
|
||||
|
||||
text "ListClipper, Haskell-powered"
|
||||
withChildOpen "##infinite" (ImVec2 0 200) True ImGuiWindowFlags_None do
|
||||
let infiniteItems = map (mappend "Item " . show) [0 :: Int ..]
|
||||
withListClipper Nothing infiniteItems text
|
||||
|
||||
text "Ethereal ListClipper"
|
||||
withChildOpen "##ethereal" (ImVec2 0 200) True ImGuiWindowFlags_None do
|
||||
withListClipper Nothing (ClipRange (0 :: Int) 1000) $
|
||||
text . mappend "Item " . show
|
||||
|
||||
plotHistogram "A histogram" [ 10, 10, 20, 30, 90 ]
|
||||
|
||||
colorPicker3 "Test" color
|
||||
|
Reference in New Issue
Block a user