Skip to content

Commit

Permalink
finish popup (probably)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eggiverse committed Sep 2, 2020
1 parent dee69bb commit 64125fb
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ docs/build
*.jl.cov
*.jl.*.cov
*.jl.mem
Manifest.toml
3 changes: 2 additions & 1 deletion src/Desktop.jl
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions src/Desktop/imgui_controls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions src/Desktop/popups.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# module Poptart.Desktop

function OpenPopup(popup::Popup)
CImGui.OpenPopup(popup.label)
end

# module Poptart.Desktop
4 changes: 1 addition & 3 deletions test/poptart/desktop/controls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 64125fb

Please sign in to comment.