Skip to content

Commit 80b0675

Browse files
committed
Big update, but still work in progress: rework class system and generated documentation
1 parent 10e6b4c commit 80b0675

File tree

198 files changed

+9963
-1273
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+9963
-1273
lines changed

Diff for: .github/workflows/test.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
3838
- name: setup common
3939
run: |
40+
luarocks install lpath
4041
luarocks install oocairo
4142
luarocks --server=https://luarocks.org/dev install lpugl
4243
luarocks --server=https://luarocks.org/dev install lpugl_cairo
@@ -49,7 +50,9 @@ jobs:
4950
run: |
5051
set -e
5152
lua -v
53+
lua src/alltests.lua src/tests
5254
cd src
53-
lua alltests.lua
54-
lua doctest.lua ../doc/*md
55+
export LUA_PATH='./?.lua;./?/init.lua;'$LUA_PATH
56+
echo "LUA_PATH=$LUA_PATH"
57+
lua doctest.lua
5558

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
/.files
2+
*.trace
3+

Diff for: README.md

+6-46
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ of standard widgets. So far only very simple standard widgets are provided, e.g.
3232

3333
## First Example
3434

35-
* The first example demonstrates a simple dialog using the `lwtk.TextInput` widget.
35+
* The first example demonstrates a simple "Hello World" dialog.
3636
The appearance of the widgets is configured in [lwtk.DefaultStyle](src/lwtk/DefaultStyle.lua).
3737
The key bindings are configured in [lwtk.DefaultKeyBinding](src/lwtk/DefaultKeyBinding.lua).
3838

39-
![Screenshot example01](./example/screenshot01.png)
39+
![Screenshot example01](./example/screenshot00.png)
4040

4141
```lua
4242
local lwtk = require("lwtk")
@@ -45,67 +45,27 @@ of standard widgets. So far only very simple standard widgets are provided, e.g.
4545
local Column = lwtk.Column
4646
local Row = lwtk.Row
4747
local PushButton = lwtk.PushButton
48-
local TextInput = lwtk.TextInput
4948
local TitleText = lwtk.TitleText
5049
local Space = lwtk.Space
5150

52-
local app = Application("example01.lua")
51+
local app = Application("example")
5352

5453
local function quit()
5554
app:close()
5655
end
5756

5857
local win = app:newWindow {
59-
title = "example01",
58+
title = "example",
6059
Column {
61-
id = "c1",
62-
TitleText { text = "What's your name?" },
63-
TextInput { id = "i1", focus = true, style = { Columns = 40 } },
60+
TitleText { text = "Hello World!", style = { textSize = 35 } },
6461
Row {
6562
Space {},
66-
PushButton { id = "b1", text = "&OK", disabled = true,
67-
default = true },
68-
69-
PushButton { id = "b2", text = "&Quit", onClicked = quit },
63+
PushButton { text = "&OK", onClicked = quit },
7064
Space {}
7165
}
7266
},
73-
Column {
74-
id = "c2",
75-
visible = false,
76-
Space {},
77-
TitleText { id = "t2", style = { TextAlign = "center" } },
78-
Space {},
79-
Row {
80-
Space {},
81-
PushButton { id = "b3", text = "&Again" },
82-
83-
PushButton { id = "b4", text = "&Quit", default = true,
84-
onClicked = quit },
85-
Space {}
86-
}
87-
}
8867
}
89-
90-
win:childById("c1"):setOnInputChanged(function(widget, input)
91-
widget:childById("b1"):setDisabled(input.text == "")
92-
end)
93-
94-
win:childById("b1"):setOnClicked(function(widget)
95-
win:childById("t2"):setText("Hello "..win:childById("i1").text.."!")
96-
win:childById("c1"):setVisible(false)
97-
win:childById("c2"):setVisible(true)
98-
end)
99-
100-
win:childById("b3"):setOnClicked(function(widget)
101-
win:childById("i1"):setText("")
102-
win:childById("i1"):setFocus()
103-
win:childById("c1"):setVisible(true)
104-
win:childById("c2"):setVisible(false)
105-
end)
106-
10768
win:show()
108-
10969
app:runEventLoop()
11070
```
11171

Diff for: doc/Application.md

+6-43
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,16 @@
1-
# lwtk.Application
1+
# lwtk.Application Usage
22

3-
TODO
4-
5-
<!-- ---------------------------------------------------------------------------------------- -->
6-
## Contents
7-
<!-- ---------------------------------------------------------------------------------------- -->
8-
9-
* [Application Methods](#application-methods)
10-
* [Application:runEventLoop()](#Application_runEventLoop)
11-
* [Application:update()](#Application_update)
12-
13-
<!-- ---------------------------------------------------------------------------------------- -->
3+
[lwtk.Application] objects are needed to control lwtk event processing and window
4+
management for desktop applications.
145

6+
[lwtk.Application]: ./gen/lwtk/Application.md
157

168
<!-- ---------------------------------------------------------------------------------------- -->
17-
## Application Methods
18-
<!-- ---------------------------------------------------------------------------------------- -->
19-
20-
* <a id="Application_runEventLoop">**`Application:runEventLoop(timeout)
21-
`**</a>
22-
23-
Update by processing events from the window system.
24-
25-
* *timeout* - optional float, timeout in seconds
26-
27-
If *timeout* is given, this function will process events from the window system until
28-
the time period in seconds has elapsed or until all window objects have been closed.
29-
30-
If *timeout* is `nil` or not given, this function will process events from the window system
31-
until all window objects have been closed.
32-
9+
## Contents
3310
<!-- ---------------------------------------------------------------------------------------- -->
3411

35-
* <a id="Application_update">**`Application:update(timeout)
36-
`**</a>
12+
TODO
3713

38-
Update by processing events from the window system.
39-
40-
* *timeout* - optional float, timeout in seconds
41-
42-
If *timeout* is given, this function will wait for *timeout* seconds until
43-
events from the window system become available. If *timeout* is `nil` or not
44-
given, this function will block indefinitely until an event occurs.
45-
46-
As soon as events are available, all events in the queue are processed and this function
47-
returns `true`.
48-
49-
If *timeout* is given and there are no events available after *timeout*
50-
seconds, this function will return `false`.
5114

5215
<!-- ---------------------------------------------------------------------------------------- -->
5316

0 commit comments

Comments
 (0)