-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnsw.nim
53 lines (34 loc) · 1.14 KB
/
nsw.nim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import nigui, packages/docutils/rstast, doc
app.init()
var rst = readFile("backends.rst")
var root = parse(rst)
#echo renderRstToJson(root)
var window = newWindow("NoScript Web")
window.width = 600
window.height = 400
# icon path executable file without extension + ".png"
var scrollContainer = newLayoutContainer(Layout_Vertical)
window.add(scrollContainer)
scrollContainer.widthMode = WidthMode_Expand
scrollContainer.heightMode = HeightMode_Expand
var control1 = newControl()
scrollContainer.add(control1)
control1.widthMode = WidthMode_Expand
control1.heightMode = HeightMode_Static
#control1.height = 700
#control1.width = 600
#control1.height = pageHeight
var initialized = false
control1.onDraw = proc (event: DrawEvent) =
if not initialized:
control1.canvas.textColor = rgb(0, 0, 0)
control1.canvas.fontSize = 20
control1.canvas.fontFamily = "Arial"
initialized = true
render(event.control.canvas, root, scrollContainer.yScrollPos())
if control1.height != pageHeight:
echo "fix height"
control1.height = pageHeight
window.show()
app.run()
# "app.quit()".