From 64125fb1952da8fdbc7f3ad919437962f56ff21e Mon Sep 17 00:00:00 2001 From: St Z Date: Wed, 2 Sep 2020 22:34:31 +0800 Subject: [PATCH] finish popup (probably) --- .gitignore | 1 + src/Desktop.jl | 3 ++- src/Desktop/imgui_controls.jl | 4 ---- src/Desktop/popups.jl | 7 +++++++ test/poptart/desktop/controls.jl | 4 +--- 5 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 src/Desktop/popups.jl diff --git a/.gitignore b/.gitignore index f5e1d7f..b8800aa 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ docs/build *.jl.cov *.jl.*.cov *.jl.mem +Manifest.toml \ No newline at end of file diff --git a/src/Desktop.jl b/src/Desktop.jl index f7b6ab0..7e7e2c7 100644 --- a/src/Desktop.jl +++ b/src/Desktop.jl @@ -1,7 +1,7 @@ module Desktop # Poptart export Application, Window -export Button, InputText, Label, Slider, Checkbox, Popup, open_popup +export Button, InputText, Label, Slider, Checkbox, Popup, OpenPopup export Canvas export ScatterPlot, Spy, BarPlot, LinePlot, MultiLinePlot, Histogram export Separator, SameLine, NewLine, Spacing, Group @@ -40,6 +40,7 @@ include("Desktop/imgui_controls.jl") include("Desktop/imgui_drawings.jl") include("Desktop/menus.jl") include("Desktop/events.jl") +include("Desktop/popups.jl") env = Dict{Ptr{Cvoid},UIApplication}() include("Desktop/glfw.jl") # env exit_on_esc diff --git a/src/Desktop/imgui_controls.jl b/src/Desktop/imgui_controls.jl index a34bb79..08c680f 100644 --- a/src/Desktop/imgui_controls.jl +++ b/src/Desktop/imgui_controls.jl @@ -103,8 +103,4 @@ function imgui_control_item(imctx::Ptr, item::Popup) end end -function open_popup(popup::Popup) - CImGui.OpenPopup(popup.label) -end - # module Poptart.Desktop diff --git a/src/Desktop/popups.jl b/src/Desktop/popups.jl new file mode 100644 index 0000000..408c467 --- /dev/null +++ b/src/Desktop/popups.jl @@ -0,0 +1,7 @@ +# module Poptart.Desktop + +function OpenPopup(popup::Popup) + CImGui.OpenPopup(popup.label) +end + +# module Poptart.Desktop \ No newline at end of file diff --git a/test/poptart/desktop/controls.jl b/test/poptart/desktop/controls.jl index 0d9b957..3458345 100644 --- a/test/poptart/desktop/controls.jl +++ b/test/poptart/desktop/controls.jl @@ -31,10 +31,8 @@ popup1 = Popup(label="popup1", items = [Label("A popup")]) push!(window1.items, popup1) didClick(popup_button) do event - open_popup(popup1) + OpenPopup(popup1) end -# For now, you cannot use Mouse.leftClick to open a popup -# Mouse.leftClick(popup_button) pause(app)