Skip to content

Commit 468cd59

Browse files
committed
docs
1 parent 135253e commit 468cd59

File tree

14 files changed

+251
-37
lines changed

14 files changed

+251
-37
lines changed

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Poptart.jl 🏂
22

3-
| **Build Status** |
4-
|:----------------------------------------------------------------:|
5-
| [![][travis-img]][travis-url] [![][codecov-img]][codecov-url] |
3+
| **Documentation** | **Build Status** |
4+
|:-----------------------------------------:|:----------------------------------------------------------------:|
5+
| [![][docs-latest-img]][docs-latest-url] | [![][travis-img]][travis-url] [![][codecov-img]][codecov-url] |
66

77

88
GUI programming in Julia based on [CImGui.jl](https://github.com/Gnimuc/CImGui.jl)
@@ -45,6 +45,8 @@ Desktop.exit_on_esc() = true
4545
Base.JLOptions().isinteractive==0 && wait(app.closenotify)
4646
```
4747

48+
![slider.png](https://wookay.github.io/docs/Poptart.jl/assets/poptart/slider.png)
49+
4850
* InputText
4951

5052
```julia
@@ -65,9 +67,14 @@ Desktop.exit_on_esc() = true
6567
Base.JLOptions().isinteractive==0 && wait(app.closenotify)
6668
```
6769

70+
![inputtext.png](https://wookay.github.io/docs/Poptart.jl/assets/poptart/inputtext.png)
71+
6872
* see more examples: [PoptartExamples.jl](https://github.com/wookay/PoptartExamples.jl/tree/master/examples)
6973

7074

75+
[docs-latest-img]: https://img.shields.io/badge/docs-latest-blue.svg
76+
[docs-latest-url]: https://wookay.github.io/docs/Poptart.jl/
77+
7178
[travis-img]: https://api.travis-ci.org/wookay/Poptart.jl.svg?branch=master
7279
[travis-url]: https://travis-ci.org/wookay/Poptart.jl
7380

docs/make.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using Poptart
2+
using Poptart.Desktop
3+
using .Desktop: UIApplication
4+
using Poptart.Drawings
5+
using Documenter
6+
7+
makedocs(
8+
build = joinpath(@__DIR__, "local" in ARGS ? "build_local" : "build"),
9+
modules = [Poptart],
10+
clean = false,
11+
format = Documenter.HTML(
12+
prettyurls = !("local" in ARGS),
13+
assets = ["assets/custom.css"],
14+
),
15+
sitename = "Poptart.jl 🏂",
16+
authors = "WooKyoung Noh",
17+
pages = Any[
18+
"Home" => "index.md",
19+
"Desktop" => "Desktop.md",
20+
"Drawings" => "Drawings.md",
21+
],
22+
)

docs/src/Desktop.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Poptart.Desktop
2+
3+
Desktop
4+
5+
### application and window
6+
```@docs
7+
Application
8+
resume(app::UIApplication)
9+
pause(::UIApplication)
10+
Window
11+
```
12+
13+
### controls
14+
```@docs
15+
Label
16+
Button
17+
Slider
18+
Canvas
19+
InputText
20+
```
21+
22+
### layouts
23+
```@docs
24+
Separator
25+
SameLine
26+
NewLine
27+
Spacing
28+
Group
29+
```
30+
31+
### plots
32+
```@docs
33+
ScatterPlot
34+
Spy
35+
BarPlot
36+
LinePlot
37+
MultiLinePlot
38+
Histogram
39+
```
40+
41+
### menus
42+
```@docs
43+
MenuBar
44+
Menu
45+
MenuItem
46+
```
47+
48+
### events
49+
```@docs
50+
Mouse.leftClick
51+
didClick
52+
```
53+
54+
### custom
55+
```@docs
56+
Desktop.exit_on_esc()
57+
Desktop.custom_fonts(::Application)
58+
```

docs/src/Drawings.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Poptart.Drawings
2+
3+
Drawings
4+
5+
### shapes
6+
```@docs
7+
Line
8+
Rect
9+
RectMultiColor
10+
Circle
11+
Quad
12+
Triangle
13+
Arc
14+
Pie
15+
Curve
16+
Polyline
17+
Polygon
18+
TextBox
19+
ImageBox
20+
```
21+
22+
### paints
23+
```@docs
24+
Drawings.stroke(element::Drawings.DrawingElement)
25+
Drawings.fill(element::Drawings.DrawingElement)
26+
```
27+
28+
`stroke ∘ fill`
29+
30+
### transforms
31+
```@docs
32+
translate
33+
scale
34+
translate!
35+
scale!
36+
```

docs/src/assets/custom.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
html article code {
2+
color: #222;
3+
}
4+
5+
html.theme--documenter-dark article code {
6+
color: #00cbf4;
7+
}
8+
222 KB
Loading

docs/src/assets/poptart/slider.png

231 KB
Loading

docs/src/index.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Poptart.jl 🏂
2+
3+
<https://github.com/wookay/Poptart.jl>
4+
5+
GUI programming in Julia based on [CImGui.jl](https://github.com/Gnimuc/CImGui.jl)
6+
7+
* ☕️ You can [make a donation](https://wookay.github.io/donate/) to support this project.
8+
9+
10+
### Poptart.Desktop
11+
12+
* Button, Slider
13+
14+
```julia
15+
using Poptart.Desktop # Application Window Button Label Slider didClick
16+
17+
window1 = Window(title="A", frame=(x=10,y=20,width=200,height=200))
18+
window2 = Window(title="B", frame=(x=220,y=20,width=200,height=200))
19+
app = Application(windows=[window1, window2], title="App", frame=(width=430, height=300))
20+
21+
button = Button(title="Hello")
22+
push!(window1.items, button)
23+
24+
label = Label(text="Range:")
25+
slider1 = Slider(label="slider1", range=1:10, value=5)
26+
slider2 = Slider(label="slider2", range=1.0:10.0, value=2.0)
27+
push!(window2.items, label, slider1, slider2)
28+
29+
didClick(button) do event
30+
@info :didClick event
31+
end
32+
33+
didClick(slider1) do event
34+
@info :didClick (event, slider1.value)
35+
end
36+
37+
didClick(slider2) do event
38+
@info :didClick (event, slider2.value)
39+
end
40+
41+
Desktop.exit_on_esc() = true
42+
Base.JLOptions().isinteractive==0 && wait(app.closenotify)
43+
```
44+
45+
![slider.png](https://wookay.github.io/docs/Poptart.jl/assets/poptart/slider.png)
46+
47+
* InputText
48+
49+
```julia
50+
using Poptart.Desktop # Application Window InputText Button didClick
51+
52+
window1 = Window()
53+
app = Application(windows = [window1])
54+
55+
input1 = InputText(label="Subject", buf="")
56+
button1 = Button(title = "submit")
57+
push!(window1.items, input1, button1)
58+
59+
didClick(button1) do event
60+
@info :didClick (event, input1.buf)
61+
end
62+
63+
Desktop.exit_on_esc() = true
64+
Base.JLOptions().isinteractive==0 && wait(app.closenotify)
65+
```
66+
67+
![inputtext.png](https://wookay.github.io/docs/Poptart.jl/assets/poptart/inputtext.png)
68+
69+
* see more examples: [PoptartExamples.jl](https://github.com/wookay/PoptartExamples.jl/tree/master/examples)

src/Desktop.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,20 @@ abstract type UIApplication end
2222
abstract type UIWindow end
2323
abstract type UIControl end
2424

25+
"""
26+
Desktop.exit_on_esc()
27+
"""
2528
exit_on_esc() = false
29+
30+
"""
31+
Desktop.custom_fonts(::Application)
32+
"""
2633
custom_fonts(::Any) = nothing
2734

2835
include("Desktop/controls.jl")
2936
include("Desktop/layouts.jl")
3037
include("Desktop/imgui_convert.jl")
3138
include("Desktop/plots.jl")
32-
include("Desktop/drawings.jl")
3339
include("Desktop/imgui_controls.jl")
3440
include("Desktop/imgui_drawings.jl")
3541
include("Desktop/menus.jl")

src/Desktop/application.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,20 @@ function setup_app(app::UIApplication)
6868
end
6969
end
7070

71+
"""
72+
resume(app::UIApplication)
73+
"""
7174
function resume(app::UIApplication)
7275
glwin = GLFW.GetCurrentContext()
7376
glwin.handle !== C_NULL && haskey(env, glwin.handle) && return nothing
7477
create_app(app)
7578
nothing
7679
end
7780

78-
function pause(app::UIApplication)
81+
"""
82+
pause(::UIApplication)
83+
"""
84+
function pause(::UIApplication)
7985
glwin = GLFW.GetCurrentContext()
8086
glwin.handle !== C_NULL && GLFW.SetWindowShouldClose(glwin, true)
8187
end

0 commit comments

Comments
 (0)