Skip to content

Commit

Permalink
Add docs for nested classes
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiashienzsch committed Oct 19, 2023
1 parent 8f3ea02 commit f7f2829
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 19 deletions.
121 changes: 121 additions & 0 deletions tool/jml-docgen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,16 @@
- [ArrowButton](#ArrowButton)
- [Button](#Button)
- [ComboBox](#ComboBox)
- [Component](#Component)
- [ComponentListener](#ComponentListener)
- [Grid](#Grid)
- [Grid.Fr](#Grid.Fr)
- [Grid.Px](#Grid.Px)
- [Grid.TrackInfo](#Grid.TrackInfo)
- [GridItem](#GridItem)
- [GridItem.Margin](#GridItem.Margin)
- [GridItem.Property](#GridItem.Property)
- [GridItem.Span](#GridItem.Span)
- [HyperlinkButton](#HyperlinkButton)
- [ImageComponent](#ImageComponent)
- [Label](#Label)
Expand Down Expand Up @@ -1179,6 +1187,24 @@ juce.ComboBox.showEditor(...)
juce.ComboBox.showPopup(...)
```

## Component

```lua
juce.Component.__eq(...)
juce.Component.mouseDoubleClick(...)
juce.Component.mouseDown(...)
juce.Component.mouseDrag(...)
juce.Component.mouseEnter(...)
juce.Component.mouseExit(...)
juce.Component.mouseMagnify(...)
juce.Component.mouseMove(...)
juce.Component.mouseUp(...)
juce.Component.mouseWheelMove(...)
juce.Component.new(...)
juce.Component.paint(...)
juce.Component.resized(...)
```

## ComponentListener

```lua
Expand Down Expand Up @@ -1218,6 +1244,101 @@ juce.Grid.templateColumns(...)
juce.Grid.templateRows(...)
```

## Grid.Fr

```lua
juce.Grid.Fr.__eq(...)
juce.Grid.Fr.fraction(...)
juce.Grid.Fr.new(...)
```

## Grid.Px

```lua
juce.Grid.Px.__eq(...)
juce.Grid.Px.new(...)
juce.Grid.Px.pixels(...)
```

## Grid.TrackInfo

```lua
juce.Grid.TrackInfo.__eq(...)
juce.Grid.TrackInfo.getEndLineName(...)
juce.Grid.TrackInfo.getSize(...)
juce.Grid.TrackInfo.getStartLineName(...)
juce.Grid.TrackInfo.isAuto(...)
juce.Grid.TrackInfo.isFractional(...)
juce.Grid.TrackInfo.isPixels(...)
juce.Grid.TrackInfo.new(...)
```

## GridItem

```lua
juce.GridItem.__eq(...)
juce.GridItem.alignSelf(...)
juce.GridItem.area(...)
juce.GridItem.associatedComponent(...)
juce.GridItem.column(...)
juce.GridItem.currentBounds(...)
juce.GridItem.height(...)
juce.GridItem.justifySelf(...)
juce.GridItem.margin(...)
juce.GridItem.maxHeight(...)
juce.GridItem.maxWidth(...)
juce.GridItem.minHeight(...)
juce.GridItem.minWidth(...)
juce.GridItem.new(...)
juce.GridItem.order(...)
juce.GridItem.row(...)
juce.GridItem.setArea(...)
juce.GridItem.width(...)
juce.GridItem.withAlignSelf(...)
juce.GridItem.withArea(...)
juce.GridItem.withColumn(...)
juce.GridItem.withHeight(...)
juce.GridItem.withJustifySelf(...)
juce.GridItem.withMargin(...)
juce.GridItem.withOrder(...)
juce.GridItem.withRow(...)
juce.GridItem.withSize(...)
juce.GridItem.withWidth(...)
```

## GridItem.Margin

```lua
juce.GridItem.Margin.__eq(...)
juce.GridItem.Margin.bottom(...)
juce.GridItem.Margin.left(...)
juce.GridItem.Margin.new(...)
juce.GridItem.Margin.right(...)
juce.GridItem.Margin.top(...)
```

## GridItem.Property

```lua
juce.GridItem.Property.__eq(...)
juce.GridItem.Property.getName(...)
juce.GridItem.Property.getNumber(...)
juce.GridItem.Property.hasAbsolute(...)
juce.GridItem.Property.hasAuto(...)
juce.GridItem.Property.hasName(...)
juce.GridItem.Property.hasSpan(...)
juce.GridItem.Property.new(...)
```

## GridItem.Span

```lua
juce.GridItem.Span.__eq(...)
juce.GridItem.Span.name(...)
juce.GridItem.Span.new(...)
juce.GridItem.Span.number(...)
```

## HyperlinkButton

```lua
Expand Down
26 changes: 10 additions & 16 deletions tool/jml-docgen/doxygen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ json = require("json")

local doxygen = {}

local function assert_file_exists(file)
if not file:existsAsFile() then
print(file:getFullPathName())
assert(false)
end
end

local function has_kind(e, expected_kind)
local tag = juce.String.new("kind")
local kind = e:getStringAttribute(juce.StringRef.new(tag))
Expand All @@ -10,6 +17,7 @@ end

local function select_xml_file(entity)
entity = entity:gsub('_', '__')
entity = entity:gsub('%.', '_1_1')
local juce_root = "~/Developer/tobiashienzsch/JUCE"
local xml = string.format("%s/docs/doxygen/xml", juce_root)

Expand Down Expand Up @@ -97,7 +105,8 @@ function doxygen.parse_xml(entity_name)

-- Xml file
local xml_file = select_xml_file(entity_name)
assert(xml_file:existsAsFile())
assert_file_exists(xml_file)

local xml_doc = juce.XmlDocument.parse(xml_file)
if xml_doc == nil then
print("error loading xml from " .. tostring(xml_file:getFullPathName()))
Expand Down Expand Up @@ -143,18 +152,3 @@ function doxygen.parse_xml(entity_name)
end

return doxygen

-- --- Describes the layout and colours that should be used to paint a colour gradient.
-- -- @classmod juce.ColourGradient
-- -- @usage
-- -- local gradient = juce.ColourGradient.vertical(1.0, 2.0)
-- -- gradient.isRadial = true
-- local ColourGradient = {}

-- ----
-- Public variables of the class
-- @table public
-- -- @field Point point1
-- -- @field Point point2
-- -- @field bool isRadial
-- -- @usage local p = gradient.point1
8 changes: 8 additions & 0 deletions tool/jml-docgen/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,17 @@ local classes = {
},
juce_gui_basics = {
juce.abstract.Button,
juce.Component.new(),
juce.ComponentListener.new(),
juce.ComboBox.new(juce.String.new("")),
juce.Grid.new(),
juce.Grid.Fr.new(1),
juce.Grid.Px.new(1),
juce.Grid.TrackInfo.new(),
juce.GridItem.new(juce.Component.new()),
juce.GridItem.Margin.new(),
juce.GridItem.Property.new(),
juce.GridItem.Span.new(1),
juce.Label.new(juce.String.new(""), juce.String.new("")),
juce.abstract.LookAndFeel,
juce.LookAndFeel_V4.new(),
Expand Down
18 changes: 15 additions & 3 deletions tool/jml-docgen/sol2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ local function parse_usertype(obj)

doc.name = doc.name:gsub("*", "")
doc.name = doc.name:gsub("&", "")
doc.name = doc.name:gsub("::", ".")
assert(doc.name ~= nil)

for key, value in pairs(meta) do
Expand Down Expand Up @@ -70,9 +71,20 @@ function sol2.parse_juce_types(modules)
end

local function test()
assert(parse_usertype(juce.String.new()).name == "String")
assert(parse_usertype(juce.abstract.Button).name == "Button")
assert(parse_usertype(juce.abstract.LookAndFeel).name == "LookAndFeel")
local assert_usertype_name = function(v, name)
local actual = parse_usertype(v).name
if actual ~= name then
local msg = "NAME MISMATCH: should be '%s', but is '%s'"
print(string.format(msg, name, actual))
assert(false)
end
end

assert_usertype_name(juce.String.new(), "String")
assert_usertype_name(juce.abstract.Button, "Button")
assert_usertype_name(juce.abstract.LookAndFeel, "LookAndFeel")
assert_usertype_name(juce.Grid.Px.new(1), "Grid.Px")
assert_usertype_name(juce.GridItem.Margin.new(), "GridItem.Margin")

local types = io.open("out/types.txt", "w")
for k, v in pairs(juce) do
Expand Down

0 comments on commit f7f2829

Please sign in to comment.